How can we increse this coding Part

Hi there
I came across some coding to improve .while looking the progam it is unique .some say it is correct as per the Sap point of view .but some dosent.
Please verify is this the correct way for coding .
       IF NOT skont IS INITIAL.
    IF NOT aksaldo IS INITIAL.
      IF NOT summen IS INITIAL.
        LOOP AT organ.
          CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.
          SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM mbew
                 INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)
                 WHERE bwkey EQ organ-bwkey
                 AND   matnr IN matnr
                 AND   bklas IN ibklas
                 AND   bwtar IN bwtar
                 GROUP BY bwkey bklas bwtty bwtar.
            CHECK NOT sum IS INITIAL.
            MOVE f_bwkey TO xmbew-bwkey.
            MOVE f_bklas TO xmbew-bklas.
            MOVE f_bwtty TO xmbew-bwtty.
            MOVE f_bwtar TO xmbew-bwtar.
            MOVE sum     TO xmbew-salk3.
            COLLECT xmbew.
          ENDSELECT.
          CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.
          SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM ebew
                 INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)
                 WHERE bwkey EQ organ-bwkey
                 AND   matnr IN matnr
                 AND   bklas IN ibklas
                 AND   bwtar IN bwtar
                 GROUP BY bwkey bklas bwtty bwtar.
            CHECK NOT sum IS INITIAL.
            MOVE f_bwkey TO xmbew-bwkey.
            MOVE f_bklas TO xmbew-bklas.
            MOVE f_bwtty TO xmbew-bwtty.
            MOVE f_bwtar TO xmbew-bwtar.
            MOVE sum     TO xmbew-salk3.
            COLLECT xmbew.
          ENDSELECT.
          CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.
          SELECT bwkey bklas bwtty bwtar SUM( salk3 ) FROM qbew
                 INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)
                 WHERE bwkey EQ organ-bwkey
                 AND   matnr IN matnr
                 AND   bklas IN ibklas
                 AND   bwtar IN bwtar
                 GROUP BY bwkey bklas bwtty bwtar.
            CHECK NOT sum IS INITIAL.
            MOVE f_bwkey TO xmbew-bwkey.
            MOVE f_bklas TO xmbew-bklas.
            MOVE f_bwtty TO xmbew-bwtty.
            MOVE f_bwtar TO xmbew-bwtar.
            MOVE sum     TO xmbew-salk3.
            COLLECT xmbew.
          ENDSELECT.
        consider valuated subcontractor stocks from OBEW  "n497391
          CLEAR: f_bwkey, f_bklas, f_bwtty, f_bwtar, sum.   "n497391
          SELECT bwkey bklas bwtty bwtar SUM( salk3 )       "n497391
                 FROM obew                                  "n497391
            INTO (f_bwkey, f_bklas, f_bwtty, f_bwtar, sum)  "n497391
                 WHERE bwkey EQ organ-bwkey                 "n497391
                 AND   matnr IN matnr                       "n497391
                 AND   bklas IN ibklas                      "n497391
                 AND   bwtar IN bwtar                       "n497391
                 GROUP BY bwkey bklas bwtty bwtar.          "n497391
            CHECK NOT sum IS INITIAL.                       "n497391
            MOVE f_bwkey TO xmbew-bwkey.                    "n497391
            MOVE f_bklas TO xmbew-bklas.                    "n497391
            MOVE f_bwtty TO xmbew-bwtty.                    "n497391
            MOVE f_bwtar TO xmbew-bwtar.                    "n497391
            MOVE sum     TO xmbew-salk3.                    "n497391
            COLLECT xmbew.                                  "n497391
          ENDSELECT.                                        "n497391
        ENDLOOP.
      ELSEIF summen IS INITIAL.
        CLEAR xmbew.                                        "388498
        SELECT mandt matnr bwkey bwtar lvorm lbkum salk3
               vprsv verpr stprs peinh bklas salkv lfgja lfmon
               bwtty pstat vksal eklas qklas
               FROM mbew INTO CORRESPONDING FIELDS OF xmbew
               FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey
                                        AND   matnr IN matnr
                                        AND   bklas IN ibklas
                                        AND   bwtar IN bwtar.
          APPEND xmbew.
        ENDSELECT.
Begin of Optima  APP 037
        IF NOT xmbew IS INITIAL.
      Start of Insert E_FIR.018 PRADHSA1
          SELECT matnr werks prctr
            FROM marc
            INTO TABLE i_marc
             FOR ALL ENTRIES IN xmbew
           WHERE matnr = xmbew-matnr
             AND werks = xmbew-bwkey.
      End of Insert E_FIR.018 PRADHSA1
        ENDIF.
Begin of Optima  APP 037
        CLEAR xmbew.                                        "388498
        SELECT mandt matnr bwkey bwtar lbkum salk3
               vprsv verpr stprs peinh bklas salkv lfgja lfmon
               bwtty vksal sobkz vbeln posnr
               FROM ebew INTO CORRESPONDING FIELDS OF xmbew
               FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey
                                        AND   matnr IN matnr
                                        AND   bklas IN ibklas
                                        AND   bwtar IN bwtar.
          xmbew-no_sum = 'X'.
          APPEND xmbew.
        ENDSELECT.
        CLEAR xmbew.                                        "388498
        SELECT mandt matnr bwkey bwtar lbkum salk3
               vprsv verpr stprs peinh bklas salkv lfgja lfmon
               bwtty vksal sobkz pspnr
               FROM qbew INTO CORRESPONDING FIELDS OF xmbew
               FOR ALL ENTRIES IN organ WHERE bwkey EQ organ-bwkey
                                        AND   matnr IN matnr
                                        AND   bklas IN ibklas
                                        AND   bwtar IN bwtar.
          xmbew-no_sum = 'X'.
          APPEND xmbew.
        ENDSELECT.
      consider valuated subcontractor stocks from OBEW    "n497391
        CLEAR                xmbew.                         "n497391
        SELECT mandt matnr bwkey bwtar lbkum salk3          "n497391
               vprsv verpr stprs peinh bklas salkv          "n497391
               lfgja lfmon bwtty vksal sobkz lifnr          "n497391
               FROM obew INTO CORRESPONDING FIELDS OF xmbew "n497391
               FOR ALL ENTRIES IN organ                     "n497391
               WHERE  bwkey EQ organ-bwkey                  "n497391
                 AND  matnr IN matnr                        "n497391
                 AND  bklas IN ibklas                       "n497391
                 AND  bwtar IN bwtar.                       "n497391
          xmbew-no_sum = 'X'.                               "n497391
          APPEND xmbew.                                     "n497391
        ENDSELECT.                                          "n497391
      ENDIF.
Thanks in advance
Raja

Hi Raj,
1) Avoid select statements inside a loop which will effect the performance of your program
2) First get all the required data from tables mbew, ebew, qbew, obew, qbew, obew in to separate internal tables using for all entries from internal table organ instead of using select----endselect in a loop
3) use nested loops instead of select------endselect but use parallel cursor method in nested loop to improve performance.
The below example shows how to improve performance if we use nested loop using parallel cursor method
Nested Loop using Parallel Cursor:
REPORT  zparallel_cursor2.
TABLES:
  likp,
  lips.
DATA:
  t_likp  TYPE TABLE OF likp,
  t_lips  TYPE TABLE OF lips.
DATA:
  w_runtime1 TYPE i,
  w_runtime2 TYPE i,
  w_index LIKE sy-index.
START-OF-SELECTION.
  SELECT *
    FROM likp
    INTO TABLE t_likp.
  SELECT *
    FROM lips
    INTO TABLE t_lips.
  GET RUN TIME FIELD w_runtime1.
  SORT t_likp BY vbeln.
  SORT t_lips BY vbeln.
  LOOP AT t_likp INTO likp.
    LOOP AT t_lips INTO lips FROM w_index.
      IF likp-vbeln NE lips-vbeln.
        w_index = sy-tabix.
        EXIT.
      ENDIF.
    ENDLOOP.
  ENDLOOP.
  GET RUN TIME FIELD w_runtime2.
  w_runtime2 = w_runtime2 - w_runtime1.
  WRITE w_runtime2.
Thanks,
Naveen Kumar.

Similar Messages

  • I have messages in mail that are color-coded as if by a rule, but I have no rules set. How can I correct this?

    The only rule that I ever had in Mail was the default one that color coded messages from Apple blue. I notice that some messages are color-coded brown and I have no rules set at al (hence no rule to turn off.)  Some of the messages are related to viewing online magazine, but not all.  How can I stop this?

    Hi. Thanks for your message.
    Well, I understand what you are trying to say but I thought it was easier to categorize in Apple Mail.
    On Entourage I just click twice on a sender address, record it on Address book and give it a colour that I previously defined as "Work", "Personal", "Customers", "Suppliers", "Friends" or whatever.
    As Apple Mail don't have Address Book as part of it but an outside feature it's very annoying. Of course I am used to use a software and I don't expect now Apple Mail do everything as Entourage but... as someone said it seems Apple Mail stopped in time. The recent version seems the first one ever issued. I hate the way Mail.app handles attachments by placing big chunky previews right in my email. I prefer them to be named attachments listed somewhere else, out of the content of my email. I don't if I can change this via terminal commands? Can you tell me if that is possible?
    I don't understand why Apple Mail have lots of plugins instead of a great improvment from the backstage.
    I use Apple computers since ever and I love this machines but sometimes I don't understand this lake of improvments.
    Take a look at this link:
    http://scottworldblog.wordpress.com/2009/10/12/microsoft-entourage-vs-apple-mail /
    Of course I don't agree 100% with him but some things are true...

  • When saving my illustrator file to a pdf it doesnt show all the artwork ie boxes are hidden in the pdf or only showing part of them. How can I fix this?

    when saving my illustrator file to a pdf it doesnt show all the artwork ie boxes are hidden in the pdf or only showing part of them. Even some text is hidden. I have flattened the artwork so everything is in one layer. How can I fix this?

    Hi John
    I have indicated on the attached jpeg where the problem is, basically a line of text is missing at the top and part of the feeding diagram is missing. I created the artwork in different layer and then flattened. All text has been converted to outlines, however the areas being affected have no transparency, I have used solid fills or no fills. I get the same result when I export the file as a jpeg. Hope you can help.

  • Hi, I have problem with importing MOV files from SJCAM 4000. MOV files are in supported formats for Adobe Premiere Elements 11. But if I'm importing MOV file, only audio part is imported, video part is not imported. How can I solve this problem?

    Hi, I have problem with importing MOV files from SJCAM 4000. MOV files are in supported formats for Adobe Premiere Elements 11. But if I'm importing MOV file, only audio part is imported, video part is not imported. How can I solve this problem?

    haben
    From looking at the specifications of your camera (SJCam 4000), we know already what video compression your camera is using. It is H.264.
    A H.264.mov file should be supported by Premiere Elements 11. On what computer operating system is your Premiere Elements 11 running?
    Do you have the latest version of QuickTime installed on your computer? And, are you running QuickTime and Premiere Elements 11 from a
    User Account with administrative privileges? Please go to Premiere Elements 11 Publish+Share/Computer/QuickTime to confirm that you find
    presets there for the QuickTime choice there.
    What are the properties of these H.264.mov files - is it 1080p30 (1920 x 1080p30)  or something else? Do you know if this camera is recording with a variable or
    a constant frame rate?
    Please review and consider and then we will decide what next.
    Thank you.
    ATR

  • After I downloaded the new version of iTunes 11.0.1 and i try to open it it says: ''There is no application set to open the document ''iTunes 11.0.1.dmg.part''. How can i install this without paying for an app to do it?

    After I downloaded the new version of iTunes 11.0.1 and i try to open it it says: ''There is no application set to open the document ''iTunes 11.0.1.dmg.part''. How can i install this without paying for an app to do it? What apps can i download to do this type of work.

    .dmg.part is not a complete file..  It usually indicates that the entire file has not been downloaded yet.  Are you sure you downloaded the entire file?   (i recommend updating itunes through  > Software Update
    Alternatively, you can download it from here: http://support.apple.com/kb/DL1614

  • HT201272 I have part of a song on my iphone, and the other part of the same song in my itunes purchased history, how can I fix this?

    I have the first part of a song on my iphone, the second part of the same song shows up in my "purchased" list in itunes store. It used to play the whole song on my phone, what happened and how can I fix this? thanks.

    Not if you sync your contact to itunes using the program provide i.e outlook..etc

  • I am making a complex vector pattern for laser-cutting. No part may be more than 7mm wide at any point. How can I define this in order to get a warning when a shape is too wide? can this be automated?

    I am making a complex vector pattern for laser-cutting. No part may be more than 7mm wide at any point. How can I define this in order to get a warning when a shape is too wide?
    can this be automated?

    Not in Illustrator. You will need a CAD program or similar where you can dial in such manufacturing criteria.
    Mylenium

  • I have adobe illustrator CS5. When I save a document as a pdf and open it again later to edit Adobe reader can't read the whole document because it only shows part of the document. It is very frustrating. How can I fix this?

    I have adobe illustrator CS5. When I save a document as a pdf and open it again later to edit Adobe reader can't read the whole document because it only shows part of the document. It is very frustrating. How can I fix this?

    keokipineapples schrieb:
    I do have all of my files I am working on located on an external drive. I plan to transfer them directly to the hard drive
    Transfer them to your harddisk immediately.
    External drives are not offiially supported and the source of errors of all kinds including complete loss of files.
    Illustrator support for networks and removable media

  • I am making a complex vector pattern for laser-cutting. No part may be more than 7mm wide at any point. How can I define this in order to get a warning when a shape is too wide?

    I am making a complex vector pattern for laser-cutting. No part may be more than 7mm wide at any point. How can I define this in order to get a warning when a shape is too wide?
    can this be automated?

    do you mean Anchor Point to Anchor Point should be less than 7mm? A Script could check segment lengths, on demand, not automatically as you draw.

  • My code panel has an entirely black background and i can not see the coding how can i correct this?

    my code panel has an entirely black background and i can not see the coding how can i correct this?

    cs5 , windows, i don't even know how it changed? and yes all files but after 3 hrs burned here at work i figured it out:
    Before:
    click the format source code button
    Preferance panel will show up>code coloring>Default Background
    Correct:
    Thank you for your reply
    Message was edited by: Graphixqueen1

  • HT201304 I have forgottten the code to my restrictions, I have 9 failed passcode attempts, how can I unlock this part of my iPhone4

    I have forgotten the code to my restrictions, I have 9 failed passcode attempts, how can I unlock this part of my iPhone4? Help please!!

    Is the camera function restricted in Settings/General/Restrictions?
    What happens when you double click the home button, with your phone showing  the lock screen?

  • I changed my mailto: to yahoo mail but now when I click an email link it has the mailto: and the subject both in the To: part of the email. I have to delete the incorrect data out. How can I fix this?

    I changed my mailto: to yahoo mail but now when I click an email link it has the mailto: and the subject both in the To: part of the email. I have to delete the incorrect data out. How can I fix this?

    Firefox sent an email to me to confirm that I had asked the above question. The email had a link to click. When I clicked it from Firefox, nothing happened. Then I opened IE, signed into Comcast, opened the email, clicked the link, and it brought me here.

  • System Preferences quits suddenly. I have lost the dock, including the trash and ability to change desktop image. How can I replace this part of System Preferences? Where can I find Trash?

    System Preferences quits suddenly. I have lost the dock, including the trash and ability to change desktop image. How can I replace this part of System Preferences? Where can I find Trash? All other aspects of System Preferences work.

    just that that is one method, and lacks provision for working boot image and for an emergency - Lion gives a small minimal emergency boot environment but may lack all the utilities you need to use and run, even some drivers that your mac requires for add on PCIe.
    Just grab and look through Help in Carbon Copy and SuperDuper, both excellent and each has their use - together - for cloning.
    And do you have two TM backup sets? ought to consider that also, rotate daily or make a weekly set. Otherwise you are putting all your eggs in the proverbial one basket.

  • I installed newer Firefox, now parts of Norton and Words do not function. How can I fix this? Go back to previous Firefox? Thanks.

    I installed the latest version of Firefox when I was prompted. It was not until after the process was complete was I informed that certain aspects of my Norton and Words programs would not function, and that currently there is no fix available. How can you resolve this? Can I go back to the previous version?
    Thanks
    Mark

    Symantec need to update their Firefox add-ons so that they are compatible with Firefox 4. They have released an update for Norton 360 to make it compatible with Firefox 4, for details see http://us.norton.com/support/kb/web_view.jsp?wv_type=public_web&docurl=20100720113635EN&ln=en_US
    I do not know about other Norton products, but if you run Norton LiveUpdate it should inform you if there are updates available. If no updates are available, you can downgrade to Firefox 3.6 if you want to use the Norton add-ons.
    To downgrade to Firefox 3.6 first uninstall Firefox 4, but do not select the option to "Remove my Firefox personal data". If you select that option it will delete your bookmarks, passwords and other user data.
    You can then install the latest version of Firefox 3.6 available from http://www.mozilla.com/en-US/firefox/all-older.html - it will automatically use your current bookmarks, passwords etc.
    To avoid possible problems with downgrading, I recommend going to your profile folder and deleting the following files if they exist - extensions.cache, extensions.rdf, extensions.ini, extensions.sqlite and localstore.rdf. Deleting these files will force Firefox to rebuild the list of installed extensions, checking their compatibility, and reset toolbar customizations.
    For details of how to find your profile folder see https://support.mozilla.com/kb/Profiles

  • After restoring my ipod itunes crashes when veryfing restore with apple how can i skip this part?

    Trying to restore my ipod touch 4th gen and after it extracts software itunes crashes when it trys to verify restoration with apple how can i cancel this last part

    Try deleing the download file and try again. It is located here:
    IPSW file location for Mac and Windows
    I would also disable the computer's antivirus and firewall during the download and update/restore.

Maybe you are looking for