<?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: How to do comparison with loop in internal table? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498521#M1421368</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Control break events (At First,At Last,At New, At End of) are events where if you call a field inside these events, the value is replaced by '*' for all fields which are on the right of the field on which the event is triggered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before entering the AT .... ENDAT assign the contents of itab into a temporary variable and assign the value of that temporary variable to the new internal table gtab. Also the value of grmenge is to be assigned to a variable and then you can use it to add to total.&lt;/P&gt;&lt;P&gt;For example if wa is a variable with a structure similar to itab and temp is a variable of type grmenge then before AT First&lt;/P&gt;&lt;P&gt;move itab-grmenge to temp&lt;/P&gt;&lt;P&gt;move itab to wa.&lt;/P&gt;&lt;P&gt;Now inside the AT....ENDAT&lt;/P&gt;&lt;P&gt;replace the itab-grmenge with temp and itab with wa. wa contains the actual vaues which will be passed to gtab rather than '*'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps in solvibg your issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds,&lt;/P&gt;&lt;P&gt;Sachin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jan 2010 03:58:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-01-19T03:58:09Z</dc:date>
    <item>
      <title>How to do comparison with loop in internal table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498518#M1421365</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;Thanks for spending the time reading my thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to do a data comparison in an internal table, comparing the 1st row to the 2nd row, 2nd row to the 3rd subsequently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code i have came out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**&lt;/P&gt;&lt;P&gt;SORT ITAB ASCENDING BY ebeln ASCENDING.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At first.&lt;/P&gt;&lt;P&gt;move itab-grmenge to total.&lt;/P&gt;&lt;P&gt;move-corresponding itab to gtab.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if gtab-ebeln = itab-ebeln and gtab-ebelp = itab-ebelp.&lt;/P&gt;&lt;P&gt;total = itab-grmenge + total.&lt;/P&gt;&lt;P&gt;move-corresponding itab to gtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move total to gtab-grmenge.&lt;/P&gt;&lt;P&gt;append gtab.&lt;/P&gt;&lt;P&gt;clear total.&lt;/P&gt;&lt;P&gt;move itab-grmenge to total.&lt;/P&gt;&lt;P&gt;move-corresponding itab to gtab.&lt;/P&gt;&lt;P&gt;&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;I encounter a problem at the "at first" command.&lt;/P&gt;&lt;P&gt;When i test the code in steps, i noticed when it reached "at first", the itab becomes a wild card.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My intention is to copy the 1st row of data to my 2nd table(gtab), &lt;/P&gt;&lt;P&gt;go back the loop and compare the 1st row of data in 2nd table(gtab) with the 2nd row of data in 1st table(itab).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advise me how should i approach it, thanks alot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2010 03:34:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498518#M1421365</guid>
      <dc:creator>danny_loo</dc:creator>
      <dc:date>2010-01-19T03:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to do comparison with loop in internal table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498519#M1421366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;YOU have a SY-TABIX system variable by which you will get the the current index of itab in a loop you can catch it and then use &lt;/P&gt;&lt;P&gt;READ STATMENT WITH INDEX SY-TABIX + 1 , SY-TABIX +2 SO ON and so...on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Anup Deshmukh on Jan 19, 2010 4:45 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2010 03:45:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498519#M1421366</guid>
      <dc:creator>anup_deshmukh4</dc:creator>
      <dc:date>2010-01-19T03:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to do comparison with loop in internal table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498520#M1421367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    With your logic, just check if a particular EBELN has more than one EBELP values, how does it work. By your logic the total of the first record will be added alway, is that you wanted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the wildcard values, you can just simply move the workarea to another work area after LOOP statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_itab = itab.      " wa_itab is same as itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&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;Regards&lt;/P&gt;&lt;P&gt;Bala Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2010 03:49:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498520#M1421367</guid>
      <dc:creator>former_member585060</dc:creator>
      <dc:date>2010-01-19T03:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to do comparison with loop in internal table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498521#M1421368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Control break events (At First,At Last,At New, At End of) are events where if you call a field inside these events, the value is replaced by '*' for all fields which are on the right of the field on which the event is triggered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before entering the AT .... ENDAT assign the contents of itab into a temporary variable and assign the value of that temporary variable to the new internal table gtab. Also the value of grmenge is to be assigned to a variable and then you can use it to add to total.&lt;/P&gt;&lt;P&gt;For example if wa is a variable with a structure similar to itab and temp is a variable of type grmenge then before AT First&lt;/P&gt;&lt;P&gt;move itab-grmenge to temp&lt;/P&gt;&lt;P&gt;move itab to wa.&lt;/P&gt;&lt;P&gt;Now inside the AT....ENDAT&lt;/P&gt;&lt;P&gt;replace the itab-grmenge with temp and itab with wa. wa contains the actual vaues which will be passed to gtab rather than '*'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps in solvibg your issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds,&lt;/P&gt;&lt;P&gt;Sachin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2010 03:58:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498521#M1421368</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-19T03:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to do comparison with loop in internal table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498522#M1421369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anup, Bala and Sachin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the swift replies.&lt;/P&gt;&lt;P&gt;Let me try on the methods to see if it works out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: calibertto on Jan 19, 2010 5:05 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: calibertto on Jan 19, 2010 5:05 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2010 04:04:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498522#M1421369</guid>
      <dc:creator>danny_loo</dc:creator>
      <dc:date>2010-01-19T04:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to do comparison with loop in internal table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498523#M1421370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've managed to solve the problem by adding the "read table index sy-tabix" in the AT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for all your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 02:33:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-comparison-with-loop-in-internal-table/m-p/6498523#M1421370</guid>
      <dc:creator>danny_loo</dc:creator>
      <dc:date>2010-01-21T02:33:47Z</dc:date>
    </item>
  </channel>
</rss>

