<?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: What does AT END OF do in a loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144001#M115561</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sabarina,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please sortn your internal table by matner plant batch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matnr plant batch value1 value2&lt;/P&gt;&lt;P&gt;1 p1 x 10 12&lt;/P&gt;&lt;P&gt;1 p2 x 12 25&lt;/P&gt;&lt;P&gt;2 p1 x 24 34&lt;/P&gt;&lt;P&gt;2 p2 x 03 02&lt;/P&gt;&lt;P&gt;3 p2 y 02 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by matnr plant batch.&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;at end of batch.&lt;/P&gt;&lt;P&gt;sum.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your example:&lt;/P&gt;&lt;P&gt;sort XTAB4 by matnr werks lgort charg.&lt;/P&gt;&lt;P&gt;Loop at XTAB4.&lt;/P&gt;&lt;P&gt;At end of Charg.&lt;/P&gt;&lt;P&gt;sum.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will work for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jan 2006 19:08:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-01-19T19:08:18Z</dc:date>
    <item>
      <title>What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143994#M115554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, can you please tell me what is the meaning of AT END of in this loop.  I know it is calculating summation  of a values in the structure XTAB4, but I am not able to understand why is CHARG specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT XTAB4.&lt;/P&gt;&lt;P&gt;          TEMP_MATNR = XTAB4-MATNR.&lt;/P&gt;&lt;P&gt;          TEMP_WERKS = XTAB4-WERKS.&lt;/P&gt;&lt;P&gt;          TEMP_LGORT = XTAB4-LGORT.&lt;/P&gt;&lt;P&gt;          TEMP_CHARG = XTAB4-CHARG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          AT END OF CHARG.&lt;/P&gt;&lt;P&gt;            SUM.&lt;/P&gt;&lt;P&gt;            SCHD_STOCK = XTAB4-VBMNJ.&lt;/P&gt;&lt;P&gt;            READ TABLE MCHB_INVT_BAL&lt;/P&gt;&lt;P&gt;                  WITH KEY MATNR =  XTAB4-MATNR&lt;/P&gt;&lt;P&gt;                           WERKS =  XTAB4-WERKS&lt;/P&gt;&lt;P&gt;                           LGORT =  XTAB4-LGORT&lt;/P&gt;&lt;P&gt;                           CHARG =  XTAB4-CHARG.&lt;/P&gt;&lt;P&gt;            IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;              MCHB_INVT_BAL-SDLVY = SCHD_STOCK.&lt;/P&gt;&lt;P&gt;              MODIFY MCHB_INVT_BAL INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt;              CLEAR MCHB_INVT_BAL.&lt;/P&gt;&lt;P&gt;            ENDIF.&lt;/P&gt;&lt;P&gt;          ENDAT.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the structure of &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA :  BEGIN OF XTAB4 OCCURS 0,&lt;/P&gt;&lt;P&gt;         MATNR LIKE VBBE-MATNR,&lt;/P&gt;&lt;P&gt;         WERKS LIKE VBBE-WERKS,&lt;/P&gt;&lt;P&gt;         LGORT LIKE VBBE-LGORT,&lt;/P&gt;&lt;P&gt;         CHARG LIKE VBBE-CHARG,&lt;/P&gt;&lt;P&gt;         VBMNA LIKE VBBE-OMENG,  &lt;/P&gt;&lt;P&gt;         VBMNB LIKE VBBE-OMENG,  &lt;/P&gt;&lt;P&gt;         VBMNC LIKE VBBE-OMENG,   &lt;/P&gt;&lt;P&gt;         VBMNE LIKE VBBE-OMENG,  &lt;/P&gt;&lt;P&gt;         VBMNG LIKE VBBE-OMENG,  &lt;/P&gt;&lt;P&gt;         VBMNI LIKE VBBE-OMENG,  &lt;/P&gt;&lt;P&gt;         VBMNJ LIKE VBBE-OMENG,  &lt;/P&gt;&lt;P&gt;         VRKME LIKE VBEP-VRKME,  &lt;/P&gt;&lt;P&gt;         WMENG LIKE VBEP-WMENG,  &lt;/P&gt;&lt;P&gt;       END OF XTAB4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Sabrina.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 17:45:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143994#M115554</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T17:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143995#M115555</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;At end of &amp;lt;f&amp;gt; (F: Field in you internal table) between loop and end loop means :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End of a group of lines with the same contents in the field &amp;lt;f&amp;gt; and in the fields left of &amp;lt;f&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 17:49:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143995#M115555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T17:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143996#M115556</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;YOu can specify any field in the statement at end.AT end will just add up all numerical fields in the internal table and stores them in the same internal table with the same name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 17:51:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143996#M115556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T17:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143997#M115557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks murthy for getting back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example if i have the following internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matnr plant batch value1 value2&lt;/P&gt;&lt;P&gt;1         p1    x      10     12&lt;/P&gt;&lt;P&gt;1         p2    x      12     25&lt;/P&gt;&lt;P&gt;2         p1    x      24     34&lt;/P&gt;&lt;P&gt;2         p2    x      03     02&lt;/P&gt;&lt;P&gt;3         p2    y      02     10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the above example is it that &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT END of batch&lt;/P&gt;&lt;P&gt;sum&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;calculates value1= 49 and not 51 because batch is y in the last line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;same with value2 too....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please let me know..&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Sabrina.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 17:57:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143997#M115557</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T17:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143998#M115558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sabrina, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Charg field is specified here to trigger the moment of summing values. So this summation wil take place at the last record with charg number xxxx. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michel Jonker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 18:00:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143998#M115558</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T18:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143999#M115559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sabrina ,&lt;/P&gt;&lt;P&gt;  You are correct.But make sure you sort the table first.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 18:53:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1143999#M115559</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T18:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144000#M115560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sabrina,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Taking your example consider the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will have to respect the values before CHARG to SUM: &lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) VBMNA(01)&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) VBMNA(02)&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) VBMNA(03)&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(y) VBMNA(04)&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(y) VBMNA(05)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM at this point by the field CHARG will be:&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) = 06&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(y) = 09&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now consider this:&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) VBMNA(01)&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) VBMNA(02)&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) &lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;LGORT(p2)&lt;/P&gt; CHARG(x) VBMNA(03)&lt;BR /&gt;MATNR (1) WERKS (1000) &lt;B&gt;&lt;P&gt;LGORT(p2)&lt;/P&gt;&lt;/B&gt; CHARG(y) VBMNA(04)&lt;BR /&gt;MATNR (1) WERKS (1000) &lt;B&gt;&lt;P&gt;LGORT(p2)&lt;/P&gt;&lt;/B&gt; CHARG(y) VBMNA(05)&lt;BR /&gt;&lt;BR /&gt;SUM at this point by the field CHARG will be:&lt;BR /&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) = 03&lt;BR /&gt;MATNR (1) WERKS (1000) LGORT(p2) CHARG(x) = 03&lt;BR /&gt;MATNR (1) WERKS (1000) LGORT(p2) CHARG(y) = 09&lt;BR /&gt;&lt;BR /&gt;And finaly ... changing also Material:&lt;BR /&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) VBMNA(01)&lt;BR /&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) VBMNA(02)&lt;BR /&gt;MATNR (1) WERKS (1000) LGORT(p2) CHARG(x) VBMNA(03)&lt;BR /&gt;MATNR (1) WERKS (1000) LGORT(p2) CHARG(y) VBMNA(04)&lt;BR /&gt;&lt;B&gt;&lt;P&gt;MATNR (2)&lt;/P&gt;&lt;/B&gt; WERKS (1000) LGORT(p2) CHARG(y) VBMNA(05)&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM at this point by the field CHARG will be:&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p1) CHARG(x) = 03&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p2) CHARG(x) = 03&lt;/P&gt;&lt;P&gt;MATNR (1) WERKS (1000) LGORT(p2) CHARG(y) = 04&lt;/P&gt;&lt;P&gt;MATNR (2) WERKS (1000) LGORT(p2) CHARG(y) = 05&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The way you do the SORT of your table by the fields until field CHARG will change your final output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mário&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 18:54:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144000#M115560</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T18:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144001#M115561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sabarina,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please sortn your internal table by matner plant batch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matnr plant batch value1 value2&lt;/P&gt;&lt;P&gt;1 p1 x 10 12&lt;/P&gt;&lt;P&gt;1 p2 x 12 25&lt;/P&gt;&lt;P&gt;2 p1 x 24 34&lt;/P&gt;&lt;P&gt;2 p2 x 03 02&lt;/P&gt;&lt;P&gt;3 p2 y 02 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by matnr plant batch.&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;at end of batch.&lt;/P&gt;&lt;P&gt;sum.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your example:&lt;/P&gt;&lt;P&gt;sort XTAB4 by matnr werks lgort charg.&lt;/P&gt;&lt;P&gt;Loop at XTAB4.&lt;/P&gt;&lt;P&gt;At end of Charg.&lt;/P&gt;&lt;P&gt;sum.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will work for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 19:08:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144001#M115561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T19:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144002#M115562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks all.  I got it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 20:43:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144002#M115562</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T20:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: What does AT END OF do in a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144003#M115563</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;everything is fine, but AT END OF works a little special in ABAP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Processing of Control Levels with AT NEW &amp;lt;f&amp;gt; or AT END OF &amp;lt;f&amp;gt; is done when a control break occurs. This is the case when the value of the field &amp;lt;f&amp;gt; or a superior field in the current record has a different value from the previous record (AT NEW) or the subsequent record (AT END).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the sample table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matnr plant batch value1 value2&lt;/P&gt;&lt;P&gt;1 p1 x 10 12&lt;/P&gt;&lt;P&gt;1 p2 x 12 25&lt;/P&gt;&lt;P&gt;2 p1 x 24 34&lt;/P&gt;&lt;P&gt;2 p2 x 03 02&lt;/P&gt;&lt;P&gt;3 p2 y 02 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it means, that AT END OF batch is processed for line 1, because the superior field plant (P1) is different from plant p2 in subsequent record 2.&lt;/P&gt;&lt;P&gt;Also processed for line 2 for the change of plant in record 3. &lt;/P&gt;&lt;P&gt;Processed again for line 3 for the plant change of line 4.&lt;/P&gt;&lt;P&gt;Also for record 4 due to change of batch (and material!) in record 5. &lt;/P&gt;&lt;P&gt;Processed in record 5, because it's at end of anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See a good description at&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In our sample, the characteristics of material batches in plants would be determined. As we do have all different combinations of material, plant and batch, in this case the use of at end of and sum is useless.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ABAP approach to control level looks strange at first but as soon as you got the concept can be extremely useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 23:39:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-does-at-end-of-do-in-a-loop/m-p/1144003#M115563</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2006-01-19T23:39:14Z</dc:date>
    </item>
  </channel>
</rss>

