<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Performance Impovement for Join in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953665#M696613</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi P_V,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you give us a listing of all the indexes in tables VBAK, VBAP and VBEP in your system. Hopefully we could find a Z index that you can exploit. To give you a code with the for all entries option I would need to start with the table whose index we can use.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Oct 2007 15:20:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-19T15:20:32Z</dc:date>
    <item>
      <title>Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953660#M696608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following join statement. I have 220,000 records ... when I run this program, it times out. Can any one suggest performance impovement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT vbap&lt;SUB&gt;vbeln  vbap&lt;/SUB&gt;posnr  vbap&lt;SUB&gt;kwmeng  vbap&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;         vbap&lt;SUB&gt;werks  vbap&lt;/SUB&gt;kdmat  vbap&lt;SUB&gt;posex   vbak&lt;/SUB&gt;auart&lt;/P&gt;&lt;P&gt;         vbak&lt;SUB&gt;kunnr  vbak&lt;/SUB&gt;vdatu  vbep&lt;SUB&gt;edatu   lips&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;         lips&lt;SUB&gt;posnr  lips&lt;/SUB&gt;lfimg  marc&lt;SUB&gt;dispo   marc&lt;/SUB&gt;beskz "--&amp;gt; PV&lt;/P&gt;&lt;P&gt;         makt&lt;SUB&gt;maktx  mara&lt;/SUB&gt;meins  vbkd&lt;SUB&gt;ihrez   vbkd&lt;/SUB&gt;empst&lt;/P&gt;&lt;P&gt;         vbkd&lt;SUB&gt;bstkd  vbkd&lt;/SUB&gt;bstkd_e vbpa~ablad&lt;/P&gt;&lt;P&gt;  INTO TABLE lt_orders_t&lt;/P&gt;&lt;P&gt;  FROM vbak INNER JOIN vbap&lt;/P&gt;&lt;P&gt;              ON ( vbak&lt;SUB&gt;vbeln = vbap&lt;/SUB&gt;vbeln )&lt;/P&gt;&lt;P&gt;            INNER JOIN vbep&lt;/P&gt;&lt;P&gt;              ON ( vbap&lt;SUB&gt;posnr = vbep&lt;/SUB&gt;posnr AND vbap&lt;SUB&gt;vbeln = vbep&lt;/SUB&gt;vbeln )&lt;/P&gt;&lt;P&gt;            LEFT OUTER JOIN lips&lt;/P&gt;&lt;P&gt;              ON ( vbap&lt;SUB&gt;vbeln = lips&lt;/SUB&gt;vgbel AND vbap&lt;SUB&gt;posnr = lips&lt;/SUB&gt;vgpos )&lt;/P&gt;&lt;P&gt;            LEFT OUTER JOIN marc&lt;/P&gt;&lt;P&gt;              ON ( vbap&lt;SUB&gt;matnr = marc&lt;/SUB&gt;matnr AND vbap&lt;SUB&gt;werks = marc&lt;/SUB&gt;werks )&lt;/P&gt;&lt;P&gt;            LEFT OUTER JOIN makt&lt;/P&gt;&lt;P&gt;              ON ( vbap&lt;SUB&gt;matnr = makt&lt;/SUB&gt;matnr AND makt~spras = 'E'        )&lt;/P&gt;&lt;P&gt;            LEFT OUTER JOIN mara&lt;/P&gt;&lt;P&gt;              ON ( vbap&lt;SUB&gt;matnr = mara&lt;/SUB&gt;matnr )&lt;/P&gt;&lt;P&gt;            LEFT OUTER JOIN vbkd&lt;/P&gt;&lt;P&gt;              ON ( vbap&lt;SUB&gt;vbeln = vbkd&lt;/SUB&gt;vbeln AND vbap&lt;SUB&gt;posnr = vbkd&lt;/SUB&gt;posnr )&lt;/P&gt;&lt;P&gt;            LEFT OUTER JOIN vbpa&lt;/P&gt;&lt;P&gt;              ON ( vbap&lt;SUB&gt;vbeln = vbpa&lt;/SUB&gt;vbeln AND vbpa~posnr = '000010' AND&lt;/P&gt;&lt;P&gt;                   vbpa~parvw = 'WE'       )&lt;/P&gt;&lt;P&gt;  WHERE vbak~vbeln IN s_vbeln AND&lt;/P&gt;&lt;P&gt;        vbep~etenr = '0001'   AND&lt;/P&gt;&lt;P&gt;        vbap~posnr IN s_posnr AND&lt;/P&gt;&lt;P&gt;        vbap~werks IN s_werks AND&lt;/P&gt;&lt;P&gt;        vbak~auart IN s_auart AND&lt;/P&gt;&lt;P&gt;        vbak~kunnr IN s_kunnr AND&lt;/P&gt;&lt;P&gt;        vbak~vbtyp IN s_vbtyp AND&lt;/P&gt;&lt;P&gt;        vbap~matnr IN s_matnr AND&lt;/P&gt;&lt;P&gt;        vbep~ettyp IN s_ettyp AND&lt;/P&gt;&lt;P&gt;        vbep~edatu IN s_edatu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2007 23:35:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953660#M696608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-18T23:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953661#M696609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should use JOIN only if you want to join 3-5 tables. Here you are joining many tables that too with OUTER JOIN.&lt;/P&gt;&lt;P&gt;Try to break up your SELECT into 2 3 SELECT statements using FOR ALL ENTRIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Atish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2007 23:48:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953661#M696609</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-18T23:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953662#M696610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Split the join statement into 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Modify your join . Use inner join for VBAK VBAP VBEP VBKD VBPA. Use always VBELN and POSNR as join condition. Make sure you join VBELN first and then POSNR. Here try to restrict no of records selected. If the user is allowed to run without any selection parameter make some fields mandatory on sel-screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. In the second join statement link LIPS MARA MAKT. When joining VPAP and LIPS use VBFA inbetween, find VBELN and POSNR for LIPS from VBFA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Use inner join when joining LIPS and MARC and left outer join for MAKT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Avoid left outer join unless necessary, this will fetch empty records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. After combining JOIN 1 internal table and JOIN2 internal table, remember to refresh both these internal tables and you can also use FREE:  itab1 itab2 after refresh. This will improve the performance when you have fetched many records&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally dont forget to award points&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 06:39:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953662#M696610</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T06:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953663#M696611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before you do the SELECT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CHECK NOT s_vbeln[] IS INITIAL,&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 13:24:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953663#M696611</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T13:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953664#M696612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CHECK NOT s_vbeln[] IS INITIAL,&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob, your kidding right? Which SD functional consultant would agree to this? I agree that the cause of his problem is that there doesn't seem to be any index that his select can use. As tempting as it may be, asking the user to enter the sales order number does not give him any flexibility.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 15:16:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953664#M696612</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T15:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953665#M696613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi P_V,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you give us a listing of all the indexes in tables VBAK, VBAP and VBEP in your system. Hopefully we could find a Z index that you can exploit. To give you a code with the for all entries option I would need to start with the table whose index we can use.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 15:20:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953665#M696613</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T15:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953666#M696614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope - not kidding. This is an ABAP technical forum. If the programmer wants to speed up the SELECT that's how to do it. The functional consultants will have to live with either that restriction or a slow program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having said that, there may be other solutions. The most promising might be to force the user to enter something that could be used in and index. The material number would be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 15:25:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953666#M696614</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T15:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953667#M696615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me try to explain a little better. This sort of question has been asked many many times before in this forum. Forcing the user to enter a document or range of documents may not be reasonable, but I wanted to point out that was where the problem lay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ultimately, responsibility for identifying the problem and fixing it rests with the original poster of the thread. I'm willing to help, but I'm not going to try to give a detailed response based on a short code snippet and not knowing the requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I think the programmer will have to ensure that some combination of entries is made in the SELECT-OPTIONS. Based on what is entered, he or she may want to construct an entirely different SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, if nothing is entered but a material number, SELECT against VAPMA instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 16:12:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953667#M696615</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T16:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953668#M696616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mark, &lt;/P&gt;&lt;P&gt;How to find z index? &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Phani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Oct 2007 02:59:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953668#M696616</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-20T02:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Impovement for Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953669#M696617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PV,&lt;/P&gt;&lt;P&gt;As others have mentioned you really need to break the statement down. 3 joins is usually pushing it (depending on the tables). By the way, you can go to SE12 and look up each table. On the main screen you will see a pushbutton saying Indexes I think. Click on it and it will show you the secondary indexes for that table. There may be some or none defined. They may be SAP defined or customer defined (Z). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep your inner joins on vbak, vbap and vbep. The resulting table will be used as your driver for the other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create another inner join of mara, marc and makt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use your driver table as For All Entries for the other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you keep your driver table to be as shown, create another table with the first 5 fields.( vbeln, posnr, kwmeng, matnr, werks). The reason for this is so you can load the table with: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It_newtab[] = It_orders_t[]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All you want from the new table is matnr werks. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort it_newtab by matnr werks.&lt;/P&gt;&lt;P&gt;Delete adjacent duplicates from i_newtab comparing matnr werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can use it_newtab as your driver for marc-mara-makt join. The reason is that if you have 220,000 records, when you narrow down the material/plant combinations you will probably have only a few hundred materials. So your For All entries will be a table of a few hundred instead of 200 thousand.&lt;/P&gt;&lt;P&gt;The result will be in a new table it_materials. When you read this table, don't forget to sort it by matnr and plant first. And READ with Binary Search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have all your other smaller tables created. As with it_materials, SORT and READ with BINARY SEARCH, as you loop through your driver table and populate the missing data from the smaller tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you will end up with 5 Select statements. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indexes are important. Once you have split out the Select statements, if the code is still running unacceptably slow, you can use ST05 to see what indexes are being used and see if new indexes need to be created to help your cause. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll probably have to involve the Basis team to help you with your new indexes and they can help with the analysis of your ST05 results as well. Indexes must be created correctly in the proper order, or they may not be effective.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Oct 2007 05:07:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-impovement-for-join/m-p/2953669#M696617</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-20T05:07:50Z</dc:date>
    </item>
  </channel>
</rss>

