<?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: At New statement problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802526#M654503</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Navneeth..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code works perfectly..&lt;/P&gt;&lt;P&gt;Only when the MATNR is the First field in your internal Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Sep 2007 11:37:48 GMT</pubDate>
    <dc:creator>varma_narayana</dc:creator>
    <dc:date>2007-09-07T11:37:48Z</dc:date>
    <item>
      <title>At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802522#M654499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently having a problem with my At New statement. It is treating every field of the itab as a new record even though it is the same. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, &lt;/P&gt;&lt;P&gt;      on the first loop the field matnr has a value of mat-A then the at new will trigger.&lt;/P&gt;&lt;P&gt;     then on the second loop matnr has a value of mat-B then again, At New will trigger.that is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    But on the third loop, the field matnr will have a value again of mat-B or Mat-A- the same as that of the second or first loop. So it must not trigger the At New statement but it does. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;           Any solutions? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   MY CODING.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SORT IT_FINAL BY MATNR.&lt;/P&gt;&lt;P&gt;LOOP AT IT_FINAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; wa_final = it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   at new matnr.&lt;/P&gt;&lt;P&gt;         it_final1-matnr = wa_final-matnr.&lt;/P&gt;&lt;P&gt;          it_final1-maktx = wa_final-maktx.&lt;/P&gt;&lt;P&gt;          it_final1-bdmng = VAL1.&lt;/P&gt;&lt;P&gt;          APPEND it_final1.&lt;/P&gt;&lt;P&gt;          clear : it_final, it_final1, wa_final.&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;                                      Thanks! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS,&lt;/P&gt;&lt;P&gt;NAVANEETH.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:31:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802522#M654499</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802523#M654500</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;&lt;/P&gt;&lt;P&gt;write the clear statement  clear : it_final, it_final1, wa_final. after ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;remove the line  wa_final = it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now check...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;vivekanand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:34:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802523#M654500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802524#M654501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make MATNR as the first field of your internal table structure &lt;/P&gt;&lt;P&gt;Code is absolutely correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:34:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802524#M654501</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802525#M654502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  I have used the matnr as first field only in the internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Navaneeth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:37:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802525#M654502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802526#M654503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Navneeth..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code works perfectly..&lt;/P&gt;&lt;P&gt;Only when the MATNR is the First field in your internal Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:37:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802526#M654503</guid>
      <dc:creator>varma_narayana</dc:creator>
      <dc:date>2007-09-07T11:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802527#M654504</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;fields which u give in AT NEW statement should be first fields to avoid unnecessary actions. so give all fields which u use in at new as starting fields and also clear the internal table after end at statement .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;Suresh Aluri.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:39:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802527#M654504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802528#M654505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;RERESH : IT_FINAL1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use this statement before the LOOP AT IT_FINAL. statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:40:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802528#M654505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802529#M654506</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 new matnr.&lt;/P&gt;&lt;P&gt;it_final1-matnr = wa_final-matnr.&lt;/P&gt;&lt;P&gt;it_final1-maktx = wa_final-maktx.&lt;/P&gt;&lt;P&gt;it_final1-bdmng = VAL1.&lt;/P&gt;&lt;P&gt;APPEND it_final1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above case , IF Matnr is the first field,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assigning the fields right hind side to the matnr (first field) will go for waste.&lt;/P&gt;&lt;P&gt;as &amp;lt;b&amp;gt;the * s only u could see&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So try to read the fields into another work area and assign them here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:43:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802529#M654506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802530#M654507</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;see this program you can understand each and every thing &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Using AT FIRST , AT NEW, AT THE END OF , AT LAST.

DATA: BEGIN OF ITAB OCCURS 0,
      F1 TYPE I,
      F2(6) TYPE C,
      F3(10) TYPE N,
      F4(16) TYPE P DECIMALS  2,

      END OF ITAB.


DATA: SUB_TOT(10) TYPE P DECIMALS 3.

**--1

ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.

APPEND ITAB.
CLEAR ITAB.

ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.


APPEND ITAB.
CLEAR ITAB.


ITAB-F1 = 1.
ITAB-F2 = 'ONE'.
ITAB-F3 = 30.
ITAB-F4 = '3000.00'.


APPEND ITAB.
CLEAR ITAB.

*--2

ITAB-F1 = 2.
ITAB-F2 = 'TWO'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.

APPEND ITAB.
CLEAR ITAB.


ITAB-F1 = 2.
ITAB-F2 = 'TWO'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.


APPEND ITAB.
CLEAR ITAB.

*-- 3

ITAB-F1 = 3.
ITAB-F2 = 'THREE'.
ITAB-F3 = 10.
ITAB-F4 = '1000.00'.


APPEND ITAB.
CLEAR ITAB.



ITAB-F1 = 3.
ITAB-F2 = 'THREE'.
ITAB-F3 = 20.
ITAB-F4 = '2000.00'.

APPEND ITAB.
CLEAR ITAB.


SORT ITAB BY F1.

LOOP AT ITAB.

AT FIRST.
WRITE: /35 ' MATERIAL DETAILS:'.
ULINE.
ENDAT.

AT NEW F1.
WRITE: / 'DETAILS OF MATERIAL:' COLOR 7  , ITAB-F1.
ULINE.
ENDAT.

WRITE: / ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.

SUB_TOT = SUB_TOT + ITAB-F4.

AT END OF F1.
ULINE.
WRITE: / 'SUB TOTAL :'  COLOR 3 INVERSE ON, SUB_TOT COLOR 3 INVERSE ON.
CLEAR SUB_TOT.
ENDAT.

AT LAST.
SUM.
ULINE.
WRITE: 'SUM:', ITAB-F4.
ULINE.
ENDAT.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:46:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802530#M654507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802531#M654508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi navaneethan krishnan ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are points yyou need to handle when you use AT NEW(Contril statements).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Sort the itab which you r looping at&lt;/P&gt;&lt;P&gt;2. The order of fields makes effect&lt;/P&gt;&lt;P&gt;3.suppose if there are F1,F2,...F10 Fields, and If you put AT NEW F5.&lt;/P&gt;&lt;P&gt; Then At new will trigger if any of field value before F5 changed &lt;/P&gt;&lt;P&gt;4.Proper End AT is used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope These ponts will definitely help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rama chary.Pammi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 11:59:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802531#M654508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T11:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: At New statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802532#M654509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi navaneethan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is important to understand SAP's concept of Control Level Processing using statements AT NEW f and AT END OF f.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Originally this was defined for the obsolete technique of extracts and that is where the documentation can be found.&lt;/P&gt;&lt;P&gt;[&amp;lt;a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/content.htm"&amp;gt;Control Level Processing&amp;lt;/a&amp;gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The documentation for extract datasets applies exactly to internal tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table mus be sorted to get control levels defined. A control break occurs when the value of the field f or a superior field in the current record has a different value from the previous record (AT NEW) or the subsequent record (AT END). Field f must be part of the header field group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the internal table is not sorted, the AT - ENDAT block is never executed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please have a look at the graphical demonstration of Control level processing in this document: &amp;lt;a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb381a358411d1829f0000e829fbfe/content.htm"&amp;gt;Processing Table Entries in Loops&amp;lt;/a&amp;gt;&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;BTW: Too bad we have anonymous MOD&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 22:59:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement-problem/m-p/2802532#M654509</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2007-09-07T22:59:30Z</dc:date>
    </item>
  </channel>
</rss>

