<?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: Reg : performance in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139195#M989694</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do this way&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
if not itab_mseg1[] is initial..
SELECT  matnr zzinvtp zzlstnr zzlblcd zzinvsz
FROM mara
into it_mara
for all entries of itab_mseg1
WHERE matnr = itab_mseg1-matnr.
if sy-subrc = 0.
endif.
endif.

LOOP at itab_mseg1.
read table it_mara with key matnr = itab_mseg1-matnr into wa_mara. 
IF sy-subrc = 0.
CONCATENATE wa_mara-zzinvtp wa_mara-zzlstnr
wa_mara-zzlblcd wa_mara-zzinvsz
INTO itab_output-z1633code.
ENDIF.
CLEAR wa_mara.
endloop. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jul 2008 10:36:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-23T10:36:35Z</dc:date>
    <item>
      <title>Reg : performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139191#M989690</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;I am facing performance issue as i am using select statement inside a loop .I need to move select statement  out of the loop .thanx in advance .what all changes need to be made in the code .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP at itab_mseg1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- To get 1633 Code for Material from MARA Table&lt;/P&gt;&lt;P&gt;    SELECT SINGLE zzinvtp zzlstnr zzlblcd zzinvsz&lt;/P&gt;&lt;P&gt;      FROM mara&lt;/P&gt;&lt;P&gt;      INTO CORRESPONDING FIELDS OF wa_mara&lt;/P&gt;&lt;P&gt;     WHERE matnr = itab_mseg1-matnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      CONCATENATE wa_mara-zzinvtp wa_mara-zzlstnr&lt;/P&gt;&lt;P&gt;                  wa_mara-zzlblcd wa_mara-zzinvsz&lt;/P&gt;&lt;P&gt;      INTO itab_output-z1633code.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    CLEAR wa_mara.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 10:32:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139191#M989690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T10:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139192#M989691</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;Use for all entries inplace of select inside loop.&lt;/P&gt;&lt;P&gt;Assumption: ITAB_MSEG1 should have unique MATNR. if not delete the duplicate entries of MATNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF NOT ITAB_MSEG1[] IS INITIAL.
SELECT zzinvtp zzlstnr zzlblcd zzinvsz
FROM mara
INTO CORRESPONDING FIELDS OF TABLE IT_MARA
FOR ALL ENTRIES IN ITAB_MSEG1
WHERE matnr = itab_mseg1-matnr.
IF sy-subrc = 0.
LOOP AT IT_MARA.
---&amp;gt;  do the processing here
ENDLOOP.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;madhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 10:33:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139192#M989691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T10:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139193#M989692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change your select from MARA to use a FOR ALL ENTRIES based on your ITAB_MSEG1 table.  Be careful to check the number of entries in this table though as you could still have performance issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Search for more info and read the F1 help if you don't know how to use FOR ALL ENTRIES - there are thousands of posts on here explaining it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 10:34:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139193#M989692</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T10:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139194#M989693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use FOR ALL ENTRIES IN.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT zzinvtp zzlstnr zzlblcd zzinvsz
  FROM mara
  INTO CORRESPONDING FIELDS OF TABLE IT_MARA
   FOR ALL ENTRIES IN ITAB_MSEG1
 WHERE matnr = itab_mseg1-matnr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Adil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 10:35:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139194#M989693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T10:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139195#M989694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do this way&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
if not itab_mseg1[] is initial..
SELECT  matnr zzinvtp zzlstnr zzlblcd zzinvsz
FROM mara
into it_mara
for all entries of itab_mseg1
WHERE matnr = itab_mseg1-matnr.
if sy-subrc = 0.
endif.
endif.

LOOP at itab_mseg1.
read table it_mara with key matnr = itab_mseg1-matnr into wa_mara. 
IF sy-subrc = 0.
CONCATENATE wa_mara-zzinvtp wa_mara-zzlstnr
wa_mara-zzlblcd wa_mara-zzinvsz
INTO itab_output-z1633code.
ENDIF.
CLEAR wa_mara.
endloop. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 10:36:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139195#M989694</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T10:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139196#M989695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My Proposal would be NOT to use for all entries.&lt;/P&gt;&lt;P&gt;I would do a full mara array-fetch into an internal table BEFORE your loop, and then inside the loop just use read-table statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at least it´s worth a try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 10:38:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139196#M989695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T10:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139197#M989696</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;Try this way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;clear wa_mara.

SELECT SINGLE zzinvtp 
             zzlstnr 
             zzlblcd 
             zzinvsz
INTO CORRESPONDING FIELDS OF wa_mara
FROM mara
FOR ALL ENTRIES IN TABLE ITAB_MSEG1
WHERE matnr = itab_mseg1-matnr.
IF sy-subrc = 0.
CONCATENATE wa_mara-zzinvtp wa_mara-zzlstnr
wa_mara-zzlblcd wa_mara-zzinvsz
INTO itab_output-z1633code.
ENDIF.

clear wa_mara.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on no of times you need to change the logic....  if you want to use the above one time then go as stated above or else put all the details in to internal table T_MARA instead of WA_MARA and then Loop your table with which the value has to be compared and read the table T_MARA with key of that compared internal table and concatenate to the your destination internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this would help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Narin Nandivada.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 10:38:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-performance/m-p/4139197#M989696</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T10:38:09Z</dc:date>
    </item>
  </channel>
</rss>

