<?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 Loop Statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187294#M759100</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;LOOP AT idoc_data FROM tab_index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here idoc_data is a structure and not a table and tab_index holds a numeric value.&lt;/P&gt;&lt;P&gt;How does this statement work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Anindya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        anindya mukhopadhyay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Dec 2007 08:49:52 GMT</pubDate>
    <dc:creator>Anindya</dc:creator>
    <dc:date>2007-12-07T08:49:52Z</dc:date>
    <item>
      <title>Loop Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187294#M759100</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;LOOP AT idoc_data FROM tab_index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here idoc_data is a structure and not a table and tab_index holds a numeric value.&lt;/P&gt;&lt;P&gt;How does this statement work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Anindya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        anindya mukhopadhyay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 08:49:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187294#M759100</guid>
      <dc:creator>Anindya</dc:creator>
      <dc:date>2007-12-07T08:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187295#M759101</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;It means the system'll start to loop the table from record number &amp;lt;b&amp;gt;tab_index&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example the table ITAB has 100 records, but I need to read the data only from 75th record:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB FROM 75&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These code is similar to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TAB_INDEX = 75.
DO.
  READ TABLE ITAB INDEX TAB_INDEX.
  IF SY-SUBRC &amp;lt;&amp;gt; 0. EXIT. ENDIF.
  TAB_INDEX = TABX_INDEX + 1.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I wants to read the record from 75th to 90th&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB FROM 75
               TO 90.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These code is similar to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AB_INDEX = 75.
DO.
  READ TABLE ITAB INDEX TAB_INDEX.
  IF SY-SUBRC &amp;lt;&amp;gt; 0. EXIT. ENDIF.
  TAB_INDEX = TABX_INDEX + 1.
  
  if TAB_INDEX &amp;gt; 90. EXIT. ENDIF.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you should check how the index TAB_INDEX is calculated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 08:55:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187295#M759101</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T08:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187296#M759102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loop at itab from index l_index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will start from the i_index th record and process further u can also use TO option to limit the looping.&lt;/P&gt;&lt;P&gt;But this will have no effect on a structure . it s used only along with itab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 09:00:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187296#M759102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T09:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187297#M759103</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;I got some valuable insights from the answers that has been posted and Thanks to you guys for your answers.&lt;/P&gt;&lt;P&gt;But the fundamantal Question remains why a strusture has been used here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 10:02:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187297#M759103</guid>
      <dc:creator>Anindya</dc:creator>
      <dc:date>2007-12-07T10:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187298#M759104</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;The data IDOC_DATA has to be an internal table otherwise the stament &amp;lt;b&amp;gt;LOOP AT idoc_data FROM tab_index&amp;lt;/b&amp;gt; wouldn't make a sense and the system'd generate a syntax error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can't know how the data IDOC_DATA is defined and why it's used: you should past the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can only suppose it needs to read the data of idoc segments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 10:43:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187298#M759104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T10:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Loop Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187299#M759105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If structure IDOC_DATA your are talking about it's the same that it's defined in DDIC, then this is a table type with a line type of structure EDIDD.&lt;/P&gt;&lt;P&gt;So the LOOP statement makes sense here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, the only structure where you can put a LOOP on is the special structure SCREEN, and that's not this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I declare this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA struc TYPE idoc_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then struc become a table and not a structured field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Roby.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 10:48:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-statement/m-p/3187299#M759105</guid>
      <dc:creator>former_member199581</dc:creator>
      <dc:date>2007-12-07T10:48:30Z</dc:date>
    </item>
  </channel>
</rss>

