Try to solve this

Hello Friends
There is an error showing for the below code
and also the maktx, lgort,labst data is not coming
i thought that the code was correct but the data is not showing. And also i want the grand total of the stock at the end of the plant & also subtotal of the stock for each storage location.
reply soon urgent.
*& Report  ZSTOCKDETAILS                                               *
REPORT  zstockdetails          NO STANDARD PAGE HEADING
                               LINE-SIZE 250
                               LINE-COUNT 22(3).
              tables declaration                 *
TABLES : mara,        "general material data
         marc,        "plant data for material
         mard,        "storage location data for material
         makt.        "material description
             internal table declaration             *
TYPES : BEGIN OF ty_mara,
        matnr TYPE matnr,
        END OF ty_mara.
TYPES : BEGIN OF ty_marc,
        matnr TYPE matnr,
        werks TYPE werks,
        END OF ty_marc.
TYPES : BEGIN OF ty_mard,
        matnr TYPE matnr,
        lgort TYPE lgort,
        labst TYPE labst,
        END OF ty_mard.
TYPES : BEGIN OF ty_makt,
        matnr TYPE matnr,
        maktx TYPE maktx,
        END OF ty_makt.
DATA:t_mara TYPE TABLE OF ty_mara WITH HEADER LINE,
     t_marc TYPE TABLE OF ty_marc WITH HEADER LINE,
     t_mard TYPE TABLE OF ty_mard WITH HEADER LINE,
     t_makt TYPE TABLE OF ty_makt WITH HEADER LINE.
                final internal table                    *
TYPES : BEGIN OF ty_out,
        matnr TYPE matnr,
        werks TYPE werks,
        lgort TYPE lgort,
        labst TYPE labst,
        maktx TYPE maktx,
        END OF ty_out.
DATA:t_out TYPE TABLE OF ty_out WITH HEADER LINE.
              selection screen                                 *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR mara-matnr OBLIGATORY,
                 s_werks FOR marc-werks.
SELECTION-SCREEN END OF BLOCK b1.
             start-of-selection                                 *
START-OF-SELECTION.
  SELECT matnr
              FROM mara
                INTO TABLE t_mara
                 WHERE matnr IN s_matnr.
      if sy-subrc = 0.
   if not t_mara[] is initial.
  SELECT matnr werks
              FROM marc
                INTO TABLE t_marc
                 FOR ALL ENTRIES IN t_mara
                  WHERE matnr = t_mara-matnr
                  AND werks in s_werks.
       endif.
      endif.
    if sy-subrc = 0.
   if not t_marc[] is initial.
  SELECT matnr maktx
              FROM makt
                INTO TABLE t_makt
                 FOR ALL ENTRIES IN t_mara
                 WHERE matnr = t_mara-matnr.
   endif.
endif.
  SELECT matnr lgort labst
              FROM mard
                INTO TABLE t_mard
                 FOR ALL ENTRIES IN t_mara
                  WHERE matnr = t_mara-matnr.
  SORT : t_mara BY matnr,
         t_marc BY matnr,
         t_mard BY matnr,
         t_makt BY matnr.
  LOOP AT t_mara.
    READ TABLE t_marc WITH KEY matnr = t_mara-matnr BINARY SEARCH.
    READ TABLE t_mard WITH KEY matnr = t_mard-matnr BINARY SEARCH.
    READ TABLE t_makt WITH KEY matnr = t_makt-matnr BINARY SEARCH.
    MOVE : t_mara-matnr TO t_out-matnr,
           t_marc-werks TO t_out-werks,
           t_mard-lgort TO t_out-lgort,
           t_mard-labst TO t_out-labst,
           t_makt-maktx TO t_out-maktx.
    APPEND t_out.
    CLEAR t_out.
  ENDLOOP.
                   end-of-selection                             *
END-OF-SELECTION.
  LOOP AT t_out.
    WRITE :/ t_out-werks,
             t_out-lgort,
             t_out-matnr,
             t_out-maktx,
             t_out-labst.
  ENDLOOP.

Hi....
   While reading a table you need to specify all the keys required.
You have not included the Key fields required to get the unique records.
   for MARC table both MATNR and WERKS need to provided to get the unique records
   Similarly for the table MARD the key fields MATNR, WERKS and LGORT need to be provided to get the unique record.
Now in your case you are fetching the records based on material ...you will get multiple values of WERKS and LGORT for one MATNR... in that read statement will not be sufficient.
Check the below logic..
    LOOP AT t_mara.
       MOVE : t_mara-matnr TO t_out-matnr.
       LOOP AT T_MARC WHERE MATNR = T_MARA-MATNR.
         MOVE t_marc-werks TO t_out-werks.
         LOOP AT T_MARD WHERE MATNR = T_MARA-MATNR
                          AND WERKS = T_MARC-WERKS
         MOVE : t_mard-lgort TO t_out-lgort,
                t_mard-labst TO t_out-labst,
         ENDLOOP.
       ENDLOOP.
        READ TABLE t_makt WITH KEY matnr = t_makt-matnr 
               BINARY SEARCH.
        IF SY-SUBRC = 0.
          t_makt-maktx TO t_out-maktx.
        ENDIF.
   APPEND t_out.
   CLEAR t_out.
ENDLOOP.
Now the above logic should work fine. INcase you want to avoid nested loop, use inner joins to fetch records.
Regards,
Vara

Similar Messages

  • I have a iPhone 5.  In usage, it says i have 2.1 gigs used because of photos and camera.  I have deleted all my photos via iPhoto and now reset the phone back to factory settings in order to try to solve this problem, to no avail. Help!

    I have a iPhone 5.  In usage, it says i have 2.1 gigs used because of photos and camera.  I have deleted all my photos via iPhoto and now reset the phone back to factory settings in order to try to solve this problem, to no avail.   Both iTunes  and the phone say that 2.1 gigs are being used, even though the phone now has nothing on it.  What is going on?

    Yeah it works fine over wifi the problem is when I try to use it over my 3G. It's really stressing me out now.

  • Out of Sync, try to solve this one!!!

    Here's a mystery for you to solve.
    I have a SD DVD project made in Encore CS3.
    When playing the footage on one DVD player in my house. (The nicest one I have I might add, a high-end Sony), the Audio is out of sync with the video.
    When I play it on other DVD players such as computers, XBOX, Playstation, LG DVD player, they all play in sync with no problems.
    Now this Sony DVD player I have is my favorite player, it's nice, it's always played everything perfect, even now it plays everything from Star Wars to Cheech and Chong completely in synch.
    I've tried every setting imaginable, importing, exporting, you name it.
    So what is going on with this player?
    Why does it play everything else in sync, but not the DVD's I burn with encore?
    Do you have any suggestions?
    I've even exported to ISO's and folder, still same problem.
    Here are my settings:
    DVD+R 4.7G
    All encoding settings set to default. (I've tried many others)
    Project length: 5min.
    Thanks for your help.

    Yes, strange.
    This is a problem with DVD+R DL? Or DVD+R in general? Have you tried DVD-R? Or tried a different brand of DVD+R? Also, 6 & 7 MBps isn't a wide range of transcoding bit rates. How does 3 MBps work on this player using the same media? Try lower values and see if one "clicks".
    Recordable DVD compatibility is inexact, at best. You may have to juggle some of the many variables to find the best compatibility. Even then, there may be other players that won't play it.
    Best compatibility is replicated DVD, which all players are designed to play. Recordable DVD, as you have found, is a bit more of gamble.

  • My home button doesnt work at all and its not broken and it didnt fall. What should I do to solve this issue?

    This is an iPad replacement because the ne that I had before rejected my sim card so Apple sent me a new ne for free. I received it last Wednesday and the home button didnt work correctly. And today, a week later, it just stopped working completely, whenever I press it, it doesnt work. What should I do? Are there any steps that I can take to try to solve this button issue?

    hmm.
    it literally does nothing?
    If the engraving is important to you, then you may wish to get it repaired.
    I would recommend calling iphone repair www.iphonerepair.com
    or iresq www.iresq.com
    but first try this:
    https://discussions.apple.com/message/15143496#15143496
    --Sam

  • Now I am tired of this Let's see anyone can solve this

    Hi all,
    I am having some serious trouble with JSP session. And i posted the problem but didn't find any solution.
    Now i am posting my code.
    The SITUATION IS: i am couple of JSP pages and THEY ARE NOT ALL LINKED TOGETHER. meaning that two of them is linked with sending data to another but the rest of them are just in one application but not connected. BUT in every page there is a separate link for all other pages AND this is not HTML FORM.
    Select_Database.JSP
    <!--Setting sessions-->
           <%
               String uname=request.getParameter("uname");
                String pass=request.getParameter("passw");
                session.setAttribute("user",uname);
            %>
    <!--Setting sessions-->Update_Para.JSP
    para_id=Integer.parseInt(category);
                         String username="";
                         username=(String)session.getAttribute("user");
                         //my new code
                     //File afile = new File(path);
                         BufferedWriter one = new BufferedWriter(new FileWriter(para_path));
                         one.write(para_data);
                         one.close();
                       out.println("<ul class='bullet'>");
                     out.println("<li><b>Successful Update</b></li><br>");
                     out.println("<br>");
                     out.println("</ul>");LogOff.JSP
    <% session.invalidate(); %>
    Here are three JSP pages pardon me i got rid of all the webdesign HTML codes for easy understanding.
    Now on the select _database.JSP file i am getting the user name and setting in sessions.
    Just reminding you all the pages got
    <%@page language="java" session="true" %>this on top.
    Now after i set the login name as a session value there is no connection between this page and any other page except the HREF links i mentioned above.
    On the Update_Para.JSP page as you can see i used that session variable. when they click LOGOFF HREF they are taken to the logoff.JSP and they are the session is killed.
    Now on the logoff.jsp page after loggin of if they click login again then they are taken to the login page and they login with a different id and when they goto Update_Para to update paragraph the user stored in JSP as the user logged in when the session was created two weeks ago meaning that that session is still alive after two weeks.
    Now i described the problem clearly here, Can anyone please tell me what is the problem. Thanks

    This may be caching on the user's browser. The user's browser may hold onto older web pages to make display quicker. This is usually only done for pages that are visited with normal links, rather than forms. The browser will look to see if the page has an expiration data, and then re-query the server if that expiration date has passed. Otherwise it will hold the same page in a cache on your hard-disk and display it from there when requested.
    You can try to solve this by forcing your page to expire as soon as it is created. See the following link:
    http://www.jguru.com/faq/view.jsp?EID=377

  • I Try to open an Indesign document. The message: it is made in a newer version. Go tot CC: Help/Give your Adobe id/Start Indesign again and try to open the document. This doesn't work. How to solve this problem?

    I Try to open an Indesign document. The message: it is made in a newer version. Go tot CC: Help/Give your Adobe id/Start Indesign again and try to open the document. This doesn’t work. How to solve this problem?

    What version are you running?
    What version was it made with?

  • I want to disable or remove Game center from my iphone. It's always pop up during i play hay day game. So i can not solve this problem. Any way i try to log in game center my several Apple id account but it does' not work. I am still stuck in log in page

    I want to disable or remove Game center from my iphone. It's always pop up during i play hay day game. So i can not solve this problem. Any way i try to log in game center my several Apple id account but it does' not work. I am still stuck in log in page

    The Game Center app is pre installed and cannot be removed from the device.
    Best thing to do is move it to the last available screen.
    Hold down the Game Center app until all the apps jiggle then sliide the Game Center app to the right from one screen to the next. This requires a bit of finesse, but it's doable.
    Press the Home button one time to stop the apps from jiggling.
    For the Apple ID issue, try resetting.
    Tap Settings > General > Reset > Reset All Settings
    Then try your Apple ID and password for the Game Center app.

  • I have set up iCloud on my iPad as instructed. When I try to login to iCloud from safari on my iPad I get redirected to set up iCloud on this iPad. How do I solve this? iPad 2, iOS 5.0.1

    I have set up iCloud on my iPad as instructed. When I try to login to iCloud from safari on my iPad I get redirected to set up iCloud on this iPad.
    How do I solve this?
    iPad 2, iOS 5.0.1

    If you upload a document from your computer to your iCloud account, the document automatically appears in the app on the iPad - If the app works with iCloud.
    You can't log into iCloud and transfer just any and all documents from your computer to the iPad. That's now how iCloud works. You have to upload all of the compatible files into iCloud before you get to the office and then the files will be accessible on your iPad.
    There are really only a few apps that even work with iCloud in this manner right now, the Apple iWorks apps work with iCloud, so once again - at this point in time - given the way that iCloud works - there is no reason to log into your iCloud account on the iPad. You have to understand what iCloud does and how it works and I think then it makes sense as to why you don't need to log into iCloud on the iPad.

  • When ı update firefox 7 to 8 I can not enter the facebook site, when I try it, it says Uyumsuz bir internet tarayıcısı kullanıyorsun. ( it means in english : you are using an unsuportted web browser) how I can solve this problem?

    when ı update firefox 7 to 8 I can not enter the facebook site, when I try it, it says Uyumsuz bir internet tarayıcısı kullanıyorsun. ( it means in english : you are using an unsuportted web browser) how I can solve this problem?

    Step by step, how did you arrive at seeing this agreement?

  • I guess the problem come from me or I really need those contacts before he calls me for it. I'll try some method that I got from some responders on your support website. Do you have or can you recommand any software that can solve this problem?

    I guess the problem come from me but I really need those contacts before he calls me for it. I'll try some method that I got from some responders on your support website. Do you have or can you recommand any software that can solve this problem?
    One more thing. I just update my iphone that my boss gave to me but it seems to be like it giving me some trouble. My iphone was updated not too long and was successful. I try to lock into it and it telling me emergency call. I plug it to my itune and it telling me that the sim card is not valid or supported. So I inserted my sim card that I usually use to call and it still saying the same. Please help me get into it.

    And as far as paying for phone support, here are a few tips:
    If you call your carrier first and then they route you to Apple, you usually don't have to pay for phone support.
    If you are talking to Apple and they ask you to pay a support fee, ask if you can get an exception this time.  That usually works once, but they keep track of the times you've been granted such an exception.
    If you still end up paying the support fee, that fee only applies if it's not a hardware related issue.  In other words, if it can be fixed by just talking over the phone and following Apple's instructions, then the fee applies.  But if your device is deemed to have a hardware failure that caused the issue, then the fee should not apply, and you can ask for it to be waived after the fact.
    This forum is free, and almost all of the technical support articles the Apple tech advisors use are available on this website.  Literally 99% of what they can do over the phone is just walking you through the publicly available support articles.  In other words, you're paying the fee to have them do your research for you.  It's like hiring a research consultant to go look stuff up in the public library so you don't have to.  You're capable of doing it; you'd just rather pay someone to do it for you.
    It's like Starbucks.  You know how to make coffee.  Everyone knows how to make coffee.  And Starbucks coffee isn't any better than what you could make at home for far less.  But you want the convenience.  So you're really paying a convenience fee.  Milk is more expensive at 7-Eleven than it is at the grocery store... because it's a convenience store.

  • I have verified my apple Id but when I try to log on the app store its says it is not verified. How do I solve this?

    I have verified my Apple Id. It even shows verified when I log in to My apple Id. But when I try to log in through the app store it says its not verified. How do I solve this?

    Go to settings
    App Store
    Click on Apple ID
    Sign out
    Sign in with new updated ID

  • When starting a rental movie, I get the message: "An error occured loading this content, please try again later". Any ideas how to solve this issue?

    When starting a rental movie, I get the message: "An error occured loading this content, please try again later". Any ideas how to solve this issue?

    Firstly, I should have typed speedtest.net previously.
    Now that's an interesting comment you make, out of interest do you have any purchased HD movies in your iTunes collection, if so, do they play on the Apple TV with your new tv.

  • Hi there, I made the monthly payment for the Adobe apps, i managed to download Illustrator and Photoshop but can't seem to download Indesign. It says that "file seems to be corrupted... try later". How do I solve this problem?

    Hi there, I made the monthly payment for the Adobe apps, i managed to download Illustrator and Photoshop but can't seem to download Indesign. It says that "file seems to be corrupted... try later". How do I solve this problem?

    Hi shuster9,
    It seems the downloaded setup for InDesign has got corrupt.
    Could you please clear the TEMP from your computer and then retry.
    Thanks,
    Manish Sharma

  • My MacKeeper says iPhoto is out of date.  When I try to update the App Store says I need IOS 10.9 or later.  I have 10.7.5 and when I check for updates my Mac says the software is up to date.  How do I solve this problem??

    My MacKeeper says iPhoto is out of date.  When I try to update it, the App Store says I need IOS 10.9 or later.  I have 10.7.5 and when I check for updates my Mac says the OS software is up to date.  How do I solve this problem??

    1. First step to solving the Problem: Trash MacKeeper. It's a pile of trash that does far more harm to your computer than good.
    https://discussions.apple.com/docs/DOC-3691
    2. What version of iPhoto do you have? (iPhoto Menu -> About iPhoto)

  • When I try to activate my home sharing on iTune I get this error message."home sharing could not be activated because an error occurred(-2146762487)"  .How can I solve this problem?

    When I try to activate my home sharing on iTune I get this error message."home sharing could not be activated because an error occurred(-2146762487)"  .How can I solve this problem?

    I have a brand new iMac with all the newest updates etc etc, Safari logs me in without any problem but iTunes etc is just not working.. and I have the same message...Any ideas how to resolve this?
    "Home Sharing could not be activated because an error occurred (5506)."

Maybe you are looking for

  • Imac wont wake up from sleep, runs hot in games

    I have a brand new Imac and when i put in sleep mode i can click the mouse and hit the keys all i want it just wont come back on .. i have to totally reboot my Imac. also i have the best Graphics card available right now from apple and when i play Co

  • Empty iPod, unable to snyc

    i've had my iPod for 7 months, a few weeks ago i updated it, only to find that there was no music on it at all. i then tried to update it again, with the same to happen again. i then went on to the apple help site, which told me to manually sncy my i

  • Can't open a thing! Why does CS4 suddenly started crashing upon starting?

    Opening either the program (and I've tried it with Illustrator, Photoshop, InDesign and Acrobat), or the file itself (if I'm lucky enough to have the CS4 program open fine with startup but then when I click to open a file it closes unexpectedly), jus

  • [Help] Span or mirror? 15" 1GHz

    Hi gurus, I've roughly gone thru related threads on my question but can't really find an answer. I have an 1GHz iMac G4. And I've recently gotten a 32" lcd tv (samsung LA32R81B) with pc in. (VGA). I plan to connect my mac to it for viewing of dvds. S

  • Acrobat toolbar disappeared after update

    I'm in the midst of reinstalling everything on a reformatted computer (don't we all just LOVE computer crashes?). When I first installed MS Office 2007, I had the Acrobat toolbar in both Word and Outlook.  But then I did an update to Acrobat 7.0 stan