<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362273#M179696</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai Bermard&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following Document &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT NEW f. &lt;/P&gt;&lt;P&gt;Variant 2&lt;/P&gt;&lt;P&gt;AT END OF f. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;f is a sub-field of an internal table processed with LOOP . The sequence of statements which follow it is executed if the sub-field f or a sub-field in the current LOOP line defined (on the left) before f has a differnt value than in the preceding ( AT NEW ) or subsequent ( AT END OF ) table line. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF COMPANIES OCCURS 20,&lt;/P&gt;&lt;P&gt;        NAME(30),&lt;/P&gt;&lt;P&gt;        PRODUCT(20),&lt;/P&gt;&lt;P&gt;        SALES TYPE I,&lt;/P&gt;&lt;P&gt;      END   OF COMPANIES.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;LOOP AT COMPANIES.&lt;/P&gt;&lt;P&gt;  AT NEW NAME.&lt;/P&gt;&lt;P&gt;    NEW-PAGE.&lt;/P&gt;&lt;P&gt;    WRITE / COMPANIES-NAME.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  WRITE: / COMPANIES-PRODUCT, COMPANIES-SALES.&lt;/P&gt;&lt;P&gt;  AT END OF NAME.&lt;/P&gt;&lt;P&gt;    SUM.&lt;/P&gt;&lt;P&gt;    WRITE: / COMPANIES-NAME, COMPANIES-SALES.&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;The AT statements refer to the field COMPANIES-NAME . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes&lt;/P&gt;&lt;P&gt;If a control break criterion is not known until runtime, you can use AT NEW (name) or AT END OF (name) to specify it dynamically as the contents of the field name . If name is blank at runtime, the control break criterion is ignored and the sequence of statements is not executed. If name contains an invalid component name, a runtime error occurs. &lt;/P&gt;&lt;P&gt;By defining an offset and/or length, you can further restrict control break criteria - regardless of whether they are specified statically or dynamically. &lt;/P&gt;&lt;P&gt;A field symbol pointing to the LOOP output area can also be used as a dynamic control break criterion. If the field symbol does not point to the LOOP output area, a runtime error occurs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Sreenivasulu P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 May 2006 06:27:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-05-11T06:27:57Z</dc:date>
    <item>
      <title>AT NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362271#M179694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to move/append a line from 1 internal table (DTAB_ISSUE) for every 1st occurance of a new material number (MATNR). Based on my logic below, it did manage move the first line correctly to my target internal table (DTAB) but for some reason, the first field which is DTAB-MATNR contains the material number, but the other fields all get asterisks (*)...why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I declared my tables as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: BEGIN OF DTAB OCCURS 0,
        MATNR LIKE AUFM-MATNR,      "Material Number
        MBLNR LIKE AUFM-MBLNR,      "Number of Material Document
        BUDAT LIKE AUFM-BUDAT,      "Posting Date in the Document
        BWART LIKE AUFM-BWART,      "Movement Type
        CHARG LIKE AUFM-CHARG,      "Batch Number
        WERKS LIKE AUFM-WERKS,      "Plant
      END OF DTAB.

DATA: BEGIN OF DTAB_ISSUE OCCURS 0,
        MATNR LIKE AUFM-MATNR,      "Material Number
        MBLNR LIKE AUFM-MBLNR,      "Number of Material Document
        BUDAT LIKE AUFM-BUDAT,      "Posting Date in the Document
        BWART LIKE AUFM-BWART,      "Movement Type
        CHARG LIKE AUFM-CHARG,      "Batch Number
        WERKS LIKE AUFM-WERKS,      "Plant
      END OF DTAB_ISSUE.

*--&amp;gt; Select statement to fill up DTAB_ISSUE

SORT DTAB_ISSUE BY MATNR MBLNR DESCENDING.

LOOP AT DTAB_ISSUE.
  AT NEW MATNR.
    WRITE DTAB_ISSUE TO DTAB.
    APPEND DTAB.
  ENDAT.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to make the values for the fields after DTAB-MATNR to appear as it suppose to?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2006 06:23:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362271#M179694</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-11T06:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: AT NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362272#M179695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi bernard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. U are right.&lt;/P&gt;&lt;P&gt;2. We get **** in other fields.&lt;/P&gt;&lt;P&gt;3. So instead of AT NEW&lt;/P&gt;&lt;P&gt;4. &amp;lt;b&amp;gt;use ON CHANGE event.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;5. In this case, u will not get ****&lt;/P&gt;&lt;P&gt;   but u will get the other fields of that particular row&lt;/P&gt;&lt;P&gt;   on which the event fires.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2006 06:25:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362272#M179695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-11T06:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: AT NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362273#M179696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai Bermard&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following Document &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT NEW f. &lt;/P&gt;&lt;P&gt;Variant 2&lt;/P&gt;&lt;P&gt;AT END OF f. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;f is a sub-field of an internal table processed with LOOP . The sequence of statements which follow it is executed if the sub-field f or a sub-field in the current LOOP line defined (on the left) before f has a differnt value than in the preceding ( AT NEW ) or subsequent ( AT END OF ) table line. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF COMPANIES OCCURS 20,&lt;/P&gt;&lt;P&gt;        NAME(30),&lt;/P&gt;&lt;P&gt;        PRODUCT(20),&lt;/P&gt;&lt;P&gt;        SALES TYPE I,&lt;/P&gt;&lt;P&gt;      END   OF COMPANIES.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;LOOP AT COMPANIES.&lt;/P&gt;&lt;P&gt;  AT NEW NAME.&lt;/P&gt;&lt;P&gt;    NEW-PAGE.&lt;/P&gt;&lt;P&gt;    WRITE / COMPANIES-NAME.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  WRITE: / COMPANIES-PRODUCT, COMPANIES-SALES.&lt;/P&gt;&lt;P&gt;  AT END OF NAME.&lt;/P&gt;&lt;P&gt;    SUM.&lt;/P&gt;&lt;P&gt;    WRITE: / COMPANIES-NAME, COMPANIES-SALES.&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;The AT statements refer to the field COMPANIES-NAME . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes&lt;/P&gt;&lt;P&gt;If a control break criterion is not known until runtime, you can use AT NEW (name) or AT END OF (name) to specify it dynamically as the contents of the field name . If name is blank at runtime, the control break criterion is ignored and the sequence of statements is not executed. If name contains an invalid component name, a runtime error occurs. &lt;/P&gt;&lt;P&gt;By defining an offset and/or length, you can further restrict control break criteria - regardless of whether they are specified statically or dynamically. &lt;/P&gt;&lt;P&gt;A field symbol pointing to the LOOP output area can also be used as a dynamic control break criterion. If the field symbol does not point to the LOOP output area, a runtime error occurs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Sreenivasulu P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2006 06:27:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362273#M179696</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-11T06:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: AT NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362274#M179697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bernard,&lt;/P&gt;&lt;P&gt;At new statement renders all the char fields unusable..&lt;/P&gt;&lt;P&gt; u can try this instead..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : var like mara-matnr.&lt;/P&gt;&lt;P&gt;clear var.&lt;/P&gt;&lt;P&gt; loop at itab.&lt;/P&gt;&lt;P&gt; if var &amp;lt;&amp;gt; itab-matnr.&lt;/P&gt;&lt;P&gt; var = itab-matnr.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt; this space now acts as AT NEW..&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2006 06:43:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362274#M179697</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-11T06:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: AT NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362275#M179698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bernard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An easy way, use a structure :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*--&amp;gt; Select statement to fill up DTAB_ISSUE
 
Data : begin of s_dtab_issue,
include structure dtab.
data : end of s_dtab_issue.


SORT DTAB_ISSUE BY MATNR MBLNR DESCENDING.
 
LOOP AT DTAB_ISSUE.
&amp;lt;b&amp;gt;clear S_DATB_ISSUE.&amp;lt;/b&amp;gt;
move DTAB_ISSUE to &amp;lt;b&amp;gt;S_DTAB_ISSUE&amp;lt;/b&amp;gt;
  AT NEW MATNR.
    WRITE &amp;lt;b&amp;gt;S_DTAB_ISSUE&amp;lt;/b&amp;gt; TO DTAB.
    APPEND DTAB.
  ENDAT.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erwan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2006 06:44:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362275#M179698</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-11T06:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: AT NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362276#M179699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;U can use &lt;/P&gt;&lt;P&gt;on change of DTAB_ISSUE-MATNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create a stucture of type DTAB_ISSUE as&lt;/P&gt;&lt;P&gt;itab like DTAB_ISSUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT DTAB_ISSUE.  &lt;/P&gt;&lt;P&gt;  itab = DTAB_ISSUE.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;  AT NEW MATNR.    &lt;/P&gt;&lt;P&gt;      WRITE itab TO DTAB.    &lt;/P&gt;&lt;P&gt;      APPEND DTAB.  &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;Bye.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2006 07:18:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362276#M179699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-11T07:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: AT NEW statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362277#M179700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This condition arises because u are not using read statement again... check this sample code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever we use at new always we need to read table again to avoid *** for the fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT T_VBRK_VBRP.
    V_SYTAB = SY-TABIX.
    AT NEW VBELN.
      READ TABLE T_VBRK_VBRP INDEX V_SYTAB.
      READ TABLE IT_VBRK WITH KEY VBELN = T_VBRK_VBRP-VBELN.
      IF SY-SUBRC = 0.
        T_VBRK_VBRP-FKDAT = IT_VBRK-FKDAT.
        MODIFY T_VBRK_VBRP  TRANSPORTING FKDAT
                  WHERE VBELN = IT_VBRK-VBELN.
      ENDIF.
    ENDAT.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Award points if found helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2006 07:32:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/at-new-statement/m-p/1362277#M179700</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-05-11T07:32:23Z</dc:date>
    </item>
  </channel>
</rss>

