<?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 control break statements in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678942#M619100</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;       pls explain , what is the use of control break statements( at first, at last, at new, at end of, on change of ) ? and practical difference applying at new and on change. &lt;/P&gt;&lt;P&gt;Pls send me material or links related to control break statements.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;SR K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Aug 2007 07:38:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-14T07:38:55Z</dc:date>
    <item>
      <title>control break statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678942#M619100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;       pls explain , what is the use of control break statements( at first, at last, at new, at end of, on change of ) ? and practical difference applying at new and on change. &lt;/P&gt;&lt;P&gt;Pls send me material or links related to control break statements.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;SR K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 07:38:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678942#M619100</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T07:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: control break statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678943#M619101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;All this AT NEW, AT FIRST, AT END OF and AT LAST are called control break statements of Internal tables and are used to calculate the TOTALS based on sertain key fields in that internal table&lt;/P&gt;&lt;P&gt;FIrst to use these statements the ITAB has to be sorted by the key fields on whcih you need the SUM of the fields.&lt;/P&gt;&lt;P&gt;Some time you will get * when mopving data from this int table to other table using these commands&lt;/P&gt;&lt;P&gt;so you have to use&lt;/P&gt;&lt;P&gt;READ TABLE ITAB INDEX SY-TABIX in AT..ENDAT..if you are using other fields between them&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: sflight_tab TYPE SORTED TABLE OF sflight &lt;/P&gt;&lt;P&gt;                  WITH UNIQUE KEY carrid connid fldate, &lt;/P&gt;&lt;P&gt;      sflight_wa  LIKE LINE OF sflight_tab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * &lt;/P&gt;&lt;P&gt;       FROM sflight &lt;/P&gt;&lt;P&gt;       INTO TABLE sflight_tab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT sflight_tab INTO sflight_wa. &lt;/P&gt;&lt;P&gt;  AT NEW connid. &lt;/P&gt;&lt;P&gt;    WRITE: / sflight_wa-carrid, &lt;/P&gt;&lt;P&gt;             sflight_wa-connid. &lt;/P&gt;&lt;P&gt;    ULINE. &lt;/P&gt;&lt;P&gt;  ENDAT. &lt;/P&gt;&lt;P&gt;  WRITE: / sflight_wa-fldate, &lt;/P&gt;&lt;P&gt;           sflight_wa-seatsocc. &lt;/P&gt;&lt;P&gt;  AT END OF connid. &lt;/P&gt;&lt;P&gt;    SUM. &lt;/P&gt;&lt;P&gt;    ULINE. &lt;/P&gt;&lt;P&gt;    WRITE: / 'Sum', &lt;/P&gt;&lt;P&gt;              sflight_wa-seatsocc UNDER sflight_wa-seatsocc. &lt;/P&gt;&lt;P&gt;    SKIP. &lt;/P&gt;&lt;P&gt;  ENDAT. &lt;/P&gt;&lt;P&gt;  AT END OF carrid. &lt;/P&gt;&lt;P&gt;    SUM. &lt;/P&gt;&lt;P&gt;    ULINE. &lt;/P&gt;&lt;P&gt;    WRITE: / 'Carrier Sum', &lt;/P&gt;&lt;P&gt;              sflight_wa-seatsocc UNDER sflight_wa-seatsocc. &lt;/P&gt;&lt;P&gt;    NEW-PAGE. &lt;/P&gt;&lt;P&gt;  ENDAT. &lt;/P&gt;&lt;P&gt;  AT LAST. &lt;/P&gt;&lt;P&gt;    SUM. &lt;/P&gt;&lt;P&gt;    WRITE: / 'Overall Sum', &lt;/P&gt;&lt;P&gt;              sflight_wa-seatsocc UNDER sflight_wa-seatsocc. &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;&amp;lt;b&amp;gt;Reward points for useful Answers&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 07:41:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678943#M619101</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T07:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: control break statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678944#M619102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SR K,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Control Break Statements are mainly used when you want to track changes of values in any particular column of your internal table, based on which you would proceed with further logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Example would be to calculate SUM, Sub-Totals of your internal table records....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At New - This event is triggered when it encounters the first record of your internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On Change of - This event is triggered only when the value changes for the first time in that column that you have specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points for helpful answers.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 07:43:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678944#M619102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T07:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: control break statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678945#M619103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SR K,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just go through the following documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT - Control breaks with extracts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              Variants:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              1. AT NEW f.&lt;/P&gt;&lt;P&gt;              2. AT END OF f.&lt;/P&gt;&lt;P&gt;              3. AT FIRST.&lt;/P&gt;&lt;P&gt;              4. AT LAST.&lt;/P&gt;&lt;P&gt;              5. AT fg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect        In a LOOP which processes a dataset created with EXTRACT, you&lt;/P&gt;&lt;P&gt;              can use special control structures for control break&lt;/P&gt;&lt;P&gt;              processing. All these structures begin with AT and end with&lt;/P&gt;&lt;P&gt;              ENDAT. The sequence of statements which lies between is&lt;/P&gt;&lt;P&gt;              executed whenever a control break occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              You can use these key words for control break processing with&lt;/P&gt;&lt;P&gt;              extract datasets only if the active LOOP statement is&lt;/P&gt;&lt;P&gt;              processing an extract dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              The control level structure with extract datasets is dynamic.&lt;/P&gt;&lt;P&gt;              It corresponds exactly to the sort key of the extract dataset,&lt;/P&gt;&lt;P&gt;              i.e. to the order of fields in the field group HEADER by which&lt;/P&gt;&lt;P&gt;              the extract dataset was sorted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              At the end of a control group (AT END OF, AT LAST), there are&lt;/P&gt;&lt;P&gt;              two types of control level information between AT and ENDAT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              -  If the sort key of the extract dataset contains a&lt;/P&gt;&lt;P&gt;                 non-numeric field h (particularly in the field group&lt;/P&gt;&lt;P&gt;                 HEADER), the field CNT(h) contains the number of control&lt;/P&gt;&lt;P&gt;                 breaks in the (subordinate) control level h.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              -  For extracted number fields g (see also ABAP Number Types),&lt;/P&gt;&lt;P&gt;                 the fields SUM(g) contain the relevant control totals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes         1. The fields CNT(h) and SUM(g) can only be addressed after&lt;/P&gt;&lt;P&gt;                 they have been sorted. Otherwise, a runtime error may&lt;/P&gt;&lt;P&gt;                 occur.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              2. The fields CNT(h) and SUM(g) are filled with the relevant&lt;/P&gt;&lt;P&gt;                 values for a control level at the end of each control group&lt;/P&gt;&lt;P&gt;                 (AT END OF, AT LAST), not at the beginning (AT FIRST, AT&lt;/P&gt;&lt;P&gt;                 NEW).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              3. When calculating totals with SUM(g), the system&lt;/P&gt;&lt;P&gt;                 automatically chooses the maximum field sizes so that an&lt;/P&gt;&lt;P&gt;                 overflow occurs only if the absolute value area limits are&lt;/P&gt;&lt;P&gt;                 exceeded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              4. You can also use special control break control structures&lt;/P&gt;&lt;P&gt;                 with LOOPs on internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variant 1     AT NEW f.&lt;/P&gt;&lt;P&gt;Variant 2     AT END OF f.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect        f is a field from the field group HEADER. The enclosed&lt;/P&gt;&lt;P&gt;              sequence of statements is executed if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              -  the field f occurs in the sort key of the extract dataset&lt;/P&gt;&lt;P&gt;                 (and thus also in the field group HEADER) and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              -  the field f or a superior sort criterion has a different&lt;/P&gt;&lt;P&gt;                 value in the current LOOP line than in the preceding (AT&lt;/P&gt;&lt;P&gt;                 NEW) or subsequent (AT END OF) record of the extract&lt;/P&gt;&lt;P&gt;                 dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              If f is not an assigned field symbol, the control break&lt;/P&gt;&lt;P&gt;              criterion is ignored, and the subsequent sequence of&lt;/P&gt;&lt;P&gt;              statements is not executed. If a field symbol is assigned, but&lt;/P&gt;&lt;P&gt;              does not point to the HEADER field group, the system triggers&lt;/P&gt;&lt;P&gt;              a runtime error.&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;              DATA: NAME(30),&lt;/P&gt;&lt;P&gt;                    SALES TYPE I.&lt;/P&gt;&lt;P&gt;              FIELD-GROUPS: HEADER, INFOS.&lt;/P&gt;&lt;P&gt;              INSERT: NAME  INTO HEADER,&lt;/P&gt;&lt;P&gt;                      SALES INTO INFOS.&lt;/P&gt;&lt;P&gt;              ...&lt;/P&gt;&lt;P&gt;              LOOP.&lt;/P&gt;&lt;P&gt;                AT NEW NAME.&lt;/P&gt;&lt;P&gt;                  NEW-PAGE.&lt;/P&gt;&lt;P&gt;                ENDAT.&lt;/P&gt;&lt;P&gt;                ...&lt;/P&gt;&lt;P&gt;                AT END OF NAME.&lt;/P&gt;&lt;P&gt;                  WRITE: / NAME, SUM(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;Notes         1. If the extract dataset is not sorted before processing with&lt;/P&gt;&lt;P&gt;                 LOOP, no control level structure is defined and the&lt;/P&gt;&lt;P&gt;                 statements following AT NEW or AT END OF are not executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              2. Fields which stand at hex zero are ignored by the control&lt;/P&gt;&lt;P&gt;                 break check with AT NEW or AT END OF. This corresponds to&lt;/P&gt;&lt;P&gt;                 the behavior of the SORT statement, which always places&lt;/P&gt;&lt;P&gt;                 unoccupied fields (i.e. fields which stand at hex zero)&lt;/P&gt;&lt;P&gt;                 before all occupied fields when sorting extract datasets,&lt;/P&gt;&lt;P&gt;                 regardless of whether the sort sequence is in ascending or&lt;/P&gt;&lt;P&gt;                 descending order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variant 3     AT FIRST.&lt;/P&gt;&lt;P&gt;Variant 4     AT LAST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect        Executes the relevant series of statements just once - either&lt;/P&gt;&lt;P&gt;              on the first loop pass (with AT FIRST) or on the last loop&lt;/P&gt;&lt;P&gt;               pass (with AT LAST).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Variant 5     AT fg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               Addition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               ... WITH fg1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Effect        This statement makes single record processing dependent on the&lt;/P&gt;&lt;P&gt;               type of extracted record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               The sequence of statements following AT fg are executed&lt;/P&gt;&lt;P&gt;               whenever the current LOOP record is created with EXTRACT fg&lt;/P&gt;&lt;P&gt;               (in other words: when the current record is a fg record).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Addition      ... WITH fg1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Effect        Executes the sequence of statements belonging to AT fg WITH&lt;/P&gt;&lt;P&gt;               fg1 only if the record of the field group fg in the dataset is&lt;/P&gt;&lt;P&gt;               immediately followed by a record of the field group fg1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward If Helpful&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;Sasidhar Reddy Matli.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 07:48:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678945#M619103</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T07:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: control break statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678946#M619104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try this example and look at the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES: VBAP.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;DATA: ITAB TYPE TABLE OF VBAP WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;SELECT * FROM VBAP INTO TABLE ITAB UP TO 100 ROWS.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;  WRITE: / 'without any', ITAB-VBELN.&lt;/P&gt;&lt;P&gt;  AT FIRST.&lt;/P&gt;&lt;P&gt;    WRITE: / 'at first', ITAB-VBELN.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  ON CHANGE OF ITAB-VBELN.&lt;/P&gt;&lt;P&gt;    WRITE: / 'on change of', ITAB-VBELN.&lt;/P&gt;&lt;P&gt;  ENDON.&lt;/P&gt;&lt;P&gt;  AT NEW VBELN.&lt;/P&gt;&lt;P&gt;    WRITE: / 'at new', ITAB-VBELN.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  AT END OF VBELN.&lt;/P&gt;&lt;P&gt;    WRITE: / 'at end of', ITAB-VBELN.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  AT LAST.&lt;/P&gt;&lt;P&gt;    WRITE: / 'at last', ITAB-VBELN.&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;Regards, Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 07:53:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678946#M619104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T07:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: control break statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678947#M619105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;solved?!?!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 12:01:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2678947#M619105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T12:01:39Z</dc:date>
    </item>
  </channel>
</rss>

