<?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: help in looping in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280484#M152645</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Silviya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pl try the following code..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data w_bukrs type bukrs.
loop at struct1 where tcode = 'FS00' 
                   or tcode = 'FSP0' .
w_KTOPL = struct1-objectid(4).
select bukrs up to 1 rows from t001 into w_bukrs
where KTOPL eq w_KTOPL.
endselect.
check sy-subrc eq 0.
struct1-bukrs = itab_t001-w_bukrs.
modify struct1 index sy-tabix transporting bukrs.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Mar 2006 03:57:41 GMT</pubDate>
    <dc:creator>suresh_datti</dc:creator>
    <dc:date>2006-03-07T03:57:41Z</dc:date>
    <item>
      <title>help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280476#M152637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;   I am not getting output properly. it should write struct1 value whenever Tcode not equal to FS00 and FSp0. it should write itab_t001 value whenever Tcode equal to FS00 and FSp0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    1.Its working fine whenevr tcode not equal to FS00 and FSp0. &lt;/P&gt;&lt;P&gt;    2.also its working fine whenever tcode  equal to FS00 and FSp0.  first looping (itab_t001) time its writing itab_t001 value when  Tcode eq FS00 .then second time looping its writting so many values when tcode eq FS00 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     3.I think the problem may be here&lt;/P&gt;&lt;P&gt;"append lines of it_t001 to itab_t001."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    can anyone help me to get exact result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;loop at struct1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     if struct1-tcode = 'FS00' Or struct1-tcode = 'FSP0' .&lt;/P&gt;&lt;P&gt;        w_KTOPL = struct1-objectid(4).&lt;/P&gt;&lt;P&gt;     select bukrs KTOPL from t001 into table it_t001&lt;/P&gt;&lt;P&gt;                     where KTOPL eq w_KTOPL.&lt;/P&gt;&lt;P&gt;          check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if struct1-TCODE eq 'FS00'.&lt;/P&gt;&lt;P&gt;        append lines of it_t001 to itab_t001.&lt;/P&gt;&lt;P&gt;        clear it_t001.&lt;/P&gt;&lt;P&gt;           &lt;/P&gt;&lt;P&gt;       loop at itab_t001 where KTOPL eq w_KTOPL..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        struct1-bukrs = itab_t001-w_bukrs.&lt;/P&gt;&lt;P&gt;        append struct1.&lt;/P&gt;&lt;P&gt;        clear struct1.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;P&gt;                endif.&lt;/P&gt;&lt;P&gt;                  endif.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 02:44:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280476#M152637</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T02:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280477#M152638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI silviya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;correct this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at struct1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if struct1-tcode = 'FS00' Or struct1-tcode = 'FSP0' .&lt;/P&gt;&lt;P&gt;w_KTOPL = struct1-objectid(4).&lt;/P&gt;&lt;P&gt;select bukrs KTOPL from t001 into table it_t001&lt;/P&gt;&lt;P&gt;where KTOPL eq w_KTOPL.&lt;/P&gt;&lt;P&gt;check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append lines of it_t001 to itab_t001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;loop at itab_t001 where KTOPL eq w_KTOPL..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;struct1-bukrs = itab_t001-w_bukrs.&lt;/P&gt;&lt;P&gt;append struct1.&lt;/P&gt;&lt;P&gt;clear struct1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kishore&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 02:55:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280477#M152638</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T02:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280478#M152639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. it is giving so many values means what?&lt;/P&gt;&lt;P&gt;what is so many?&lt;/P&gt;&lt;P&gt;exactly what values u want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at struct1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if struct1-tcode = 'FS00' Or struct1-tcode = 'FSP0' .&lt;/P&gt;&lt;P&gt;w_KTOPL = struct1-objectid(4).&lt;/P&gt;&lt;P&gt;select bukrs KTOPL from t001 into table it_t001&lt;/P&gt;&lt;P&gt;where KTOPL eq w_KTOPL.&lt;/P&gt;&lt;P&gt;check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if struct1-TCODE eq 'FS00'.&lt;/P&gt;&lt;P&gt;append lines of it_t001 to itab_t001.&lt;/P&gt;&lt;P&gt;clear it_t001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab_t001 where KTOPL eq w_KTOPL..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;struct1-bukrs = itab_t001-w_bukrs.&lt;/P&gt;&lt;P&gt;append struct1.&lt;/P&gt;&lt;P&gt;clear struct1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM THE ABOVE, i understood,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. u r looping at stuct1 and when tcode is either FS00 OR FSP0, U ARE SELECTING DATA FROM T001 TO TABLE IT_T001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.IF TCODE = FS00, U R APPENDING TABLE ITAB_T001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HERE EXACTLY WHAT IS UR PURPOSE?&lt;/P&gt;&lt;P&gt;IF U WANT TO MOVE THE CONTENTS TO ITAB_T001, U CAN USE&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING right!!&lt;/P&gt;&lt;P&gt;then y r u using itab_t001??&lt;/P&gt;&lt;P&gt;is already some data there in itab_t001 and u want to append this data to it? then what u did is right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. U R LOOPING INSIDE STRUCT1 and again u r appending STRUCT1??? Y LIKE THIS?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THIS IS NOT GOOD FOR PERFORMANNCE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 03:03:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280478#M152639</guid>
      <dc:creator>hymavathi_oruganti</dc:creator>
      <dc:date>2006-03-07T03:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280479#M152640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hymavathi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  1.I am looping at stuct1 and when tcode is either FS00 OR FSP0 &amp;amp;  i am SELECTING DATA FROM T001 TO TABLE IT_T001.&lt;/P&gt;&lt;P&gt;  2.I have to add it_t001 (companycode) value in the last field of strcut1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 03:12:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280479#M152640</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T03:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280480#M152641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Silviya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; have to add it_t001 (companycode) value in the last field of strcut1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that casem you should use MODIFY strcut1 INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Append will keep on adding records to struct1 with each loop pass &amp;amp; the table will grow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Oruganti already cautioned, it will lead to performance issues too..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 03:16:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280480#M152641</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2006-03-07T03:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280481#M152642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suresh,&lt;/P&gt;&lt;P&gt;   1.Requirement: it should write struct1 value whenever Tcode not equal to FS00 and FSp0. it should write it_t001 value (company code) in last field of struct1 value whenever Tcode equal to FS00 and FSp0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   2. problem: Its only displying struct1 value whenever tcode eq FS00 or FSP0.i coded like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at struct1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     if struct1-tcode = 'FS00' Or struct1-tcode = 'FSP0' .&lt;/P&gt;&lt;P&gt;        w_KTOPL = struct1-objectid(4).&lt;/P&gt;&lt;P&gt;     select bukrs KTOPL from t001 into table it_t001&lt;/P&gt;&lt;P&gt;                     where KTOPL eq w_KTOPL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   loop at it_t001.&lt;/P&gt;&lt;P&gt;        struct1-bukrs = it_t001-w_bukrs.&lt;/P&gt;&lt;P&gt;        MODIFY struct1 INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt;                endif.&lt;/P&gt;&lt;P&gt;                  endif.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 03:41:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280481#M152642</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T03:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280482#M152643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Silviya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT struct1.
  IF struct1-tcode = 'FS00' Or struct1-tcode = 'FSP0' .
    w_KTOPL = struct1-objectid(4).
  SELECT bukrs ktopl FROM t001 INTO TABLE it_t001
    WHERE ktopl EQ w_ktopl.

  CHECK sy-subrc EQ 0.

  LOOP AT it_t001.
    struct1-bukrs = it_t001-w_bukrs.
    &amp;lt;b&amp;gt;MODIFY struct1 TRANSPORTING bukrs.&amp;lt;/b&amp;gt;
  ENDLOOP.
  ELSE.
    WRITE : struct1-bukrs.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 03:44:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280482#M152643</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T03:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280483#M152644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if we knew the format of struct1 it might be easier to give a better loop... and the tables too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in the short term you will probably get the results you want by putting this at the end:&lt;/P&gt;&lt;P&gt;sort struct1.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM struct1. &lt;/P&gt;&lt;P&gt;sort itab_t001.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM itab_t001.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 03:47:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280483#M152644</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2006-03-07T03:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280484#M152645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Silviya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pl try the following code..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data w_bukrs type bukrs.
loop at struct1 where tcode = 'FS00' 
                   or tcode = 'FSP0' .
w_KTOPL = struct1-objectid(4).
select bukrs up to 1 rows from t001 into w_bukrs
where KTOPL eq w_KTOPL.
endselect.
check sy-subrc eq 0.
struct1-bukrs = itab_t001-w_bukrs.
modify struct1 index sy-tabix transporting bukrs.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 03:57:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280484#M152645</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2006-03-07T03:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280485#M152646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wenceslaus,&lt;/P&gt;&lt;P&gt;    its working fine. it_t001 contains 7 records.But its 7th (last ) record only added to struct1.&lt;/P&gt;&lt;P&gt;   I want to add 7 (all) records in struct1.Please check the coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at struct1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     if struct1-tcode = 'FS00' Or struct1-tcode = 'FSP0' .&lt;/P&gt;&lt;P&gt;        w_KTOPL = struct1-objectid(4).&lt;/P&gt;&lt;P&gt;     select bukrs KTOPL from t001 into table it_t001&lt;/P&gt;&lt;P&gt;                     where KTOPL eq w_KTOPL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if struct1-TCODE eq 'FS00'.&lt;/P&gt;&lt;P&gt;  loop at it_t001.&lt;/P&gt;&lt;P&gt;        struct1-bukrs = it_t001-w_bukrs.&lt;/P&gt;&lt;P&gt;        MODIFY struct1 TRANSPORTING bukrs.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;                endif.&lt;/P&gt;&lt;P&gt;                  endif.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 03:59:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280485#M152646</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T03:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280486#M152647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Silviya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA cnt TYPE i. 
LOOP AT struct1.
  IF struct1-tcode = 'FS00' Or struct1-tcode = 'FSP0'.
    w_KTOPL = struct1-objectid(4).
  cnt = 0.
  SELECT bukrs ktopl FROM t001 INTO TABLE it_t001
    WHERE ktopl EQ w_ktopl.
 
  CHECK sy-subrc EQ 0.
 
  LOOP AT it_t001.
   IF cnt NE 0.
&amp;lt;b&amp;gt;    MOVE-CORRESPONDING it_t001 TO struct1.
    APPEND struct1.&amp;lt;/b&amp;gt;
   ELSE.
&amp;lt;b&amp;gt;    struct1-bukrs = it_t001-w_bukrs.
    MODIFY struct1 TRANSPORTING bukrs.&amp;lt;/b&amp;gt;
    cnt = 1.
   ENDIF.
  ENDLOOP.
  ELSE.
    WRITE : struct1-bukrs.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 04:02:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280486#M152647</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T04:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: help in looping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280487#M152648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sure the other answers are good. In addition, you should move the select of T001 outside of the loop. You can simply select all entries into an internal table and sort it in company code sequence. Then in the loop, you can do a binary read of that table to get the company code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 04:21:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-looping/m-p/1280487#M152648</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T04:21:14Z</dc:date>
    </item>
  </channel>
</rss>

