<?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 problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975273#M70706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mara has secondary indices, but I don't think you can use any of them. The other tables have secondary indices as well (MARC-WERKS for example, although this one probably wouldn't be selective enough to help). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you need to change the join around so that you are selecting from one of the other tables using a secondary index and then joining to the other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But be careful that you get all of the results you expect.&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, 23 Sep 2005 14:47:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-09-23T14:47:43Z</dc:date>
    <item>
      <title>performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975267#M70700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Iam reading data from 5 tables mara,marc,mbew,mlgn,mlgt&lt;/P&gt;&lt;P&gt;using inner joins and left outer join.It taking alot of time to process.&lt;/P&gt;&lt;P&gt;So, I request you that is there any fm to retrive data &lt;/P&gt;&lt;P&gt;from these tables instead of select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;chandu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 13:51:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975267#M70700</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T13:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975268#M70701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use logical database .MM have one logical database&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 13:56:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975268#M70701</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T13:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975269#M70702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;also it can deoend on how you use your select statements. Can you post the code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 13:59:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975269#M70702</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T13:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975270#M70703</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;This is my code please check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select fields FROM mara  JOIN  marc ON mara&lt;SUB&gt;matnr = marc&lt;/SUB&gt;matnr JOIN makt ON makt&lt;SUB&gt;matnr = marc&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;           JOIN mbew ON mbew&lt;SUB&gt;matnr = marc&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;                    AND mbew&lt;SUB&gt;bwkey = marc&lt;/SUB&gt;werks&lt;/P&gt;&lt;P&gt;            JOIN mlgn ON mlgn&lt;SUB&gt;matnr = mbew&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;        LEFT OUTER JOIN mlgt ON mlgt&lt;SUB&gt;matnr = mlgn&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;                            AND mlgt&lt;SUB&gt;lgnum = mlgn&lt;/SUB&gt;lgnum&lt;/P&gt;&lt;P&gt;                            AND mlgt~lgtyp = s_lgtyp&lt;/P&gt;&lt;P&gt;                            AND mlgt~lgpla = s_lgpla&lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE  gt_data1&lt;/P&gt;&lt;P&gt;                                                  WHERE&lt;/P&gt;&lt;P&gt;                                   mara~matnr IN s_matnr&lt;/P&gt;&lt;P&gt;                              AND marc~werks IN s_werks&lt;/P&gt;&lt;P&gt;                              AND mbew~bwkey IN s_bwkey&lt;/P&gt;&lt;P&gt;                              AND mbew~bklas IN s_bklas&lt;/P&gt;&lt;P&gt;                              AND marc~dismm IN s_dismm&lt;/P&gt;&lt;P&gt;                              AND marc~dispo IN s_dispo&lt;/P&gt;&lt;P&gt;                              AND makt~spras IN s_spras&lt;/P&gt;&lt;P&gt;                              AND mlgn~lgnum IN s_lgnum&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 14:02:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975270#M70703</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T14:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975271#M70704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code looks OK. Since the primary key for all of these tables is the material number, what does the contents of the select option s_matnr look like? Are there "NE"? Is it empty? If it is empty, that's likely your problem.&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, 23 Sep 2005 14:24:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975271#M70704</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T14:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975272#M70705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;You are correct my s_matnr is empty.&lt;/P&gt;&lt;P&gt;So is there any tip for that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;chandu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 14:29:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975272#M70705</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T14:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975273#M70706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mara has secondary indices, but I don't think you can use any of them. The other tables have secondary indices as well (MARC-WERKS for example, although this one probably wouldn't be selective enough to help). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you need to change the join around so that you are selecting from one of the other tables using a secondary index and then joining to the other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But be careful that you get all of the results you expect.&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, 23 Sep 2005 14:47:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975273#M70706</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T14:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975274#M70707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't try to do this in one select.  I would join mara, marc, makt, mbew in one select, and then read mlgn and mlgt in a second select, using the results of the first select as the key.  Then you combine the two tables in ABAP, rather than relying on the database to do it for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Working with internal tables is very fast.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT fields&lt;/P&gt;&lt;P&gt;         FROM mara&lt;/P&gt;&lt;P&gt;         JOIN marc&lt;/P&gt;&lt;P&gt;           ON mara&lt;SUB&gt;matnr = marc&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;         JOIN makt&lt;/P&gt;&lt;P&gt;           ON makt&lt;SUB&gt;matnr = marc&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;         JOIN mbew&lt;/P&gt;&lt;P&gt;           ON mbew&lt;SUB&gt;matnr = marc&lt;/SUB&gt;matnr AND&lt;/P&gt;&lt;P&gt;              mbew&lt;SUB&gt;bwkey = marc&lt;/SUB&gt;werks&lt;/P&gt;&lt;P&gt;         INTO I_MARA_DATA&lt;/P&gt;&lt;P&gt;         WHERE mara~matnr IN s_matnr&lt;/P&gt;&lt;P&gt;           AND marc~werks IN s_werks&lt;/P&gt;&lt;P&gt;           AND mbew~bwkey IN s_bwkey&lt;/P&gt;&lt;P&gt;           AND mbew~bklas IN s_bklas&lt;/P&gt;&lt;P&gt;           AND marc~dismm IN s_dismm&lt;/P&gt;&lt;P&gt;           AND marc~dispo IN s_dispo&lt;/P&gt;&lt;P&gt;           AND makt~spras IN s_spras&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT fields FROM mlgn as mlgn&lt;/P&gt;&lt;P&gt;         JOIN mlgt as mlgt&lt;/P&gt;&lt;P&gt;           ON mlgt&lt;SUB&gt;matnr = mlgn&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;              mlgt&lt;SUB&gt;lgnum = mlgn&lt;/SUB&gt;lgnum&lt;/P&gt;&lt;P&gt;        INTO CORRESPONDING FIELDS OF TABLE i_mlgt_data&lt;/P&gt;&lt;P&gt;        FOR ALL ENTRIES IN i_mara_data&lt;/P&gt;&lt;P&gt;        WHERE mlgt~matnr = i_mara_data-matnr&lt;/P&gt;&lt;P&gt;          and mlgt~lgtyp = s_lgtyp    &lt;/P&gt;&lt;P&gt;          and mlgt~lgpla = s_lgpla.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives you two internal tables that can be logically 'joined' using MATNR as the common key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know what you're program is trying to do, but you can either create an itab with all of the combined data in it, OR, you can loop one of the itabs, and do a lookup on the other one. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;sort i_gt_data1 by matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_gt_data2 into st_gt_data2.&lt;/P&gt;&lt;P&gt;  read table i_gt_data1 into st_gt_data1&lt;/P&gt;&lt;P&gt;       with key matnr = st_gt_data2-matnr&lt;/P&gt;&lt;P&gt;       binary search.&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    clear st_gt_data2.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;At this point, you have one logical row of data that &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;you would have had using one select&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this makes sense.  The basic premise is that you could have one itab for EACH table, and then just do a table lookup when necessary.  This is SUBSTANTIALLY faster than most other techniques.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: John Welch&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 15:03:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975274#M70707</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T15:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975275#M70708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chandu - look at the following select:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT marc~matnr
  FROM marc JOIN mara
            ON mara~matnr = marc~matnr JOIN
       makt ON makt~matnr = marc~matnr JOIN
       mbew ON mbew~matnr = marc~matnr AND
               mbew~bwkey = marc~werks JOIN
       mlgn ON mlgn~matnr = marc~matnr LEFT OUTER JOIN
       mlgt ON mlgt~matnr = mlgn~matnr AND
               mlgt~lgnum = mlgn~lgnum
    INTO CORRESPONDING FIELDS OF TABLE gt_data1
    WHERE marc~dispo IN s_dispo
      AND marc~werks IN s_werks
      AND mara~matnr IN s_matnr
      AND mbew~bwkey IN s_bwkey
      AND mbew~bklas IN s_bklas
      AND marc~dismm IN s_dismm
      AND makt~spras IN s_spras
      AND mlgn~lgnum IN s_lgnum.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The primary table is MARC and it has an index on DISPO and WERKS, so if these select options are not empty, it should run a more quickly. I'm not sure the select will return what you want, so please check it out very carefully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that I took out&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
AND mlgt~lgtyp = s_lgtyp
AND mlgt~lgpla = s_lgpla
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; from the join condition. I don't think it worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rob Burbank&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 15:38:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975275#M70708</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T15:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975276#M70709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John - this may speed up the select somewhat, but I think that the main problem is that the s_matnr select-option is empty.&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, 23 Sep 2005 15:42:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975276#M70709</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T15:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975277#M70710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you specify which fields you select in "Select Fields... ".&lt;/P&gt;&lt;P&gt;Join the tables only if you require data from all of them. Else if table is to just restrict entry of input on selection screen you can use sub query .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this will depend on what fields you want to select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 15:51:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975277#M70710</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T15:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975278#M70711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks alot for your replies.&lt;/P&gt;&lt;P&gt;I will check all the proposed solutions on monday&lt;/P&gt;&lt;P&gt;and i will let you know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;chandu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2005 16:09:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem/m-p/975278#M70711</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-23T16:09:36Z</dc:date>
    </item>
  </channel>
</rss>

