<?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: loop with Flag in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683151#M1291742</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gayatri,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
v_index TYPE i.

LOOP AT itab INTO wa1.
  v_index = sy-tabix - 1.

  IF v_index GT 0.
    READ TABLE itab INTO wa2 INDEX v_index.
    IF sy-subrc = 0.
*   Compare WA1 &amp;amp; WA2
    ENDIF.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&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;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2009 12:56:02 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2009-06-10T12:56:02Z</dc:date>
    <item>
      <title>loop with Flag</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683148#M1291739</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 want to compare the a field with its previous value in a internal table &lt;/P&gt;&lt;P&gt;i am using the following logic&lt;/P&gt;&lt;P&gt;flag = 0.&lt;/P&gt;&lt;P&gt;loop at it where x_field = s_field.&lt;/P&gt;&lt;P&gt;if not of flag is intial.&lt;/P&gt;&lt;P&gt;if it_field2 = v_field2.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------------" /&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;move it_field2  to v_field.&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;i dont want to use flag in this case can any one help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 12:40:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683148#M1291739</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T12:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: loop with Flag</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683149#M1291740</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;PRE&gt;&lt;CODE&gt;data: tabix type sy-tabix.
loop at itab into wa1.
 read table itab into wa2 index tabix.
 if sy-subrc = 0.
  wa2-f1 is previous value of this field.
  compare wa1-f1 and wa2-f1. 
endif.  
  tabix = sy-tabix.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naveen Inuganti.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 12:48:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683149#M1291740</guid>
      <dc:creator>naveen_inuganti2</dc:creator>
      <dc:date>2009-06-10T12:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: loop with Flag</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683150#M1291741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If you are not using the where clause in the LOOP then use AT-NEW inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 12:51:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683150#M1291741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T12:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: loop with Flag</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683151#M1291742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gayatri,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
v_index TYPE i.

LOOP AT itab INTO wa1.
  v_index = sy-tabix - 1.

  IF v_index GT 0.
    READ TABLE itab INTO wa2 INDEX v_index.
    IF sy-subrc = 0.
*   Compare WA1 &amp;amp; WA2
    ENDIF.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&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;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 12:56:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683151#M1291742</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2009-06-10T12:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: loop with Flag</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683152#M1291743</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;PRE&gt;&lt;CODE&gt;Clear v_field2
loop at it where x_field = s_field.
if it_field2 = v_field2.
  " The previous value is same with the present value
endif.
move it_field2 to v_field.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 12:59:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683152#M1291743</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T12:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: loop with Flag</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683153#M1291744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;clear w_previousvalue.&lt;/P&gt;&lt;P&gt;loop at it where x_field = s_field.&lt;/P&gt;&lt;P&gt;if it-field1 = w_previousvalue AND&lt;/P&gt;&lt;P&gt;  NOT w_previousvalue IS INITIAL.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do required processing&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do required processing.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;w_previousvalue = it-field1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 13:15:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-flag/m-p/5683153#M1291744</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T13:15:52Z</dc:date>
    </item>
  </channel>
</rss>

