<?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 level Staements in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125762#M446246</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are control level statements ? what is the use of this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can any one give sample examples for control level statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points for sure...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vijaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Apr 2007 07:36:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-18T07:36:45Z</dc:date>
    <item>
      <title>Control level Staements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125762#M446246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are control level statements ? what is the use of this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can any one give sample examples for control level statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points for sure...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vijaya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2007 07:36:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125762#M446246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-18T07:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: Control level Staements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125763#M446247</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;Control levels :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT NEW..&lt;/P&gt;&lt;P&gt;AT END OF..&lt;/P&gt;&lt;P&gt;AT FIRST ...&lt;/P&gt;&lt;P&gt;AT LAST....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To print data in the required format on the list.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&lt;/P&gt;&lt;P&gt;  a.&lt;/P&gt;&lt;P&gt;  b.&lt;/P&gt;&lt;P&gt;2.&lt;/P&gt;&lt;P&gt;3.&lt;/P&gt;&lt;P&gt;  c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;Reward all helpful answers.....&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;V.Raghavender.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2007 07:40:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125763#M446247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-18T07:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Control level Staements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125764#M446248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;AT - Control break with internal tables , these are used to calculate the SUMS of the Amount and Quantity fields based on certain key fields in an internal table&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;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;In a LOOP which processes a dataset created with EXTRACT , you can use special control structures for control break processing. All these structures begin with AT and end with ENDAT . The sequence of statements which lies between them is then executed if 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 extract datasets only if the active LOOP statement is proceesing an extract dataset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The control level structure with extract datasets is dynamic. It corresponds exactly to the sort key of the extract dataset, i.e. to the order of fields in the field group HEADER by which the extract dataset was sorted . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the start of a new control level (i.e. immediately after AT ), the following occurs in the output area of the current LOOP statement: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All default key fields (on the right) are filled with "*" after the current control level key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All other fields (on the right) are set to their initial values after the current control level key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Between AT and ENDAT , you can use SUM to insert the appropriate control totals in the number fields (see also ABAP/4 number types ) of the LOOP output area (on the right) after the current control level key. Summing is supported both at the beginning of a control level ( AT FIRST , AT NEW f ) and also the end of a control level ( AT END OF f , AT LAST ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the end of the control level processing (i.e. after ENDAT ), the old contents of the LOOP output area are restored. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes&lt;/P&gt;&lt;P&gt;When calculating totals, you must ensure that the totals are inserted into the same sub-fields of the LOOP output area as those where the single values otherwise occur. If there is an overflow, processing terminates with a runtime error. &lt;/P&gt;&lt;P&gt;If an internal table is processed only in a restricted form (using the additions FROM , TO and/or WHERE with the LOOP statement), you should not use the control structures for control level processing because the interaction of a restricted LOOP with the AT statement is currenly not properly defined. &lt;/P&gt;&lt;P&gt;With LOOP s on extracts, there are also special control break control structures you can use. &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;reward if useful&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>Wed, 18 Apr 2007 07:40:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125764#M446248</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-18T07:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Control level Staements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125765#M446249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Vijaya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out the code below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Processing Control Levels &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you sort an extract dataset, control levels are defined in it. For general information about control levels, refer to Processing Internal Tables in Loops The control level hierarchy of an extract dataset corresponds to the sequence of the fields in the HEADER field group. After sorting, you can use the AT statement within a loop to program statement blocks that the system processes only at a control break, that is, when the control level changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT NEW &amp;lt;f&amp;gt; | AT END OF &amp;lt;f&amp;gt;.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A control break occurs 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). Field &amp;lt;f&amp;gt; must be part of the HEADER field group. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the extract dataset is not sorted, the AT... ENDAT block is never executed. Furthermore, all extract records with the value HEX 00 in the field &amp;lt;f&amp;gt; are ignored when the control breaks are determined. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The AT... ENDAT blocks in a loop are processed in the order in which they occur. This sequence should be the same as the sort sequence. This sequence must not necessarily be the sequence of the fields in the HEADER field group, but can also be the one determined in the SORT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have sorted an extract dataset by the fields &amp;lt;f1&amp;gt;, &amp;lt;f2&amp;gt;, ..., the processing of the control levels should be written between the other control statements as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP.&lt;/P&gt;&lt;P&gt;  AT FIRST.... ENDAT.&lt;/P&gt;&lt;P&gt;    AT NEW &amp;lt;f1&amp;gt;....... ENDAT. &lt;/P&gt;&lt;P&gt;      AT NEW &amp;lt;f2&amp;gt;....... ENDAT. &lt;/P&gt;&lt;P&gt;     ...&lt;/P&gt;&lt;P&gt;          AT &amp;lt;fgi&amp;gt;..... ENDAT. &lt;/P&gt;&lt;P&gt;          &amp;lt;single line processing without control statement&amp;gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;      AT END OF &amp;lt;f2&amp;gt;.... ENDAT. &lt;/P&gt;&lt;P&gt;    AT END OF &amp;lt;f1&amp;gt;.... ENDAT. &lt;/P&gt;&lt;P&gt;  AT LAST..... ENDAT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You do not have to use all of the statement blocks listed here, but only the ones you require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT DEMO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T1(4), T2 TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-GROUPS: HEADER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT T2 T1 INTO HEADER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T1 ='AABB'. T2 = 1. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='BBCC'. T2 = 2. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='AAAA'. T2 = 2. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='AABB'. T2 = 1. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='BBBB'. T2 = 2. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='BBCC'. T2 = 2. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='AAAA'. T2 = 1. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='BBBB'. T2 = 1. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='AAAA'. T2 = 3. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;T1 ='AABB'. T2 = 1. EXTRACT HEADER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT BY T1 T2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AT FIRST.&lt;/P&gt;&lt;P&gt;    WRITE 'Start of LOOP'.&lt;/P&gt;&lt;P&gt;    ULINE.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AT NEW T1.&lt;/P&gt;&lt;P&gt;    WRITE / '   New T1:'.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AT NEW T2.&lt;/P&gt;&lt;P&gt;    WRITE / '   New T2:'.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE: /14 T1, T2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AT END OF T2.&lt;/P&gt;&lt;P&gt;    WRITE / 'End of T2'.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AT END OF T1.&lt;/P&gt;&lt;P&gt;    WRITE / 'End of T1'.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AT LAST.&lt;/P&gt;&lt;P&gt;    ULINE.&lt;/P&gt;&lt;P&gt;  ENDAT.&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;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Rewards points if helpful.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sachin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2007 07:47:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125765#M446249</guid>
      <dc:creator>sonu_p2</dc:creator>
      <dc:date>2007-04-18T07:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Control level Staements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125766#M446250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reddy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the difference between AT NEW &amp;amp; AT END OF..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2007 08:56:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125766#M446250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-18T08:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Control level Staements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125767#M446251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;AT NEW gets triggered when there is a new record and AT END OF gets triggered after the records are completed.&lt;/P&gt;&lt;P&gt;e.g. If an internal table hasthe following structure and data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VBELN VBTYP MENGE&lt;/P&gt;&lt;P&gt;A           X         10&lt;/P&gt;&lt;P&gt;A          Y          15&lt;/P&gt;&lt;P&gt;B          Z           25&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I write AT NEW VBELN, then this will be triggered as soon as the record A X 10 comes.&lt;/P&gt;&lt;P&gt;But AT END OF VBELN will be triggered after the processing for A Y 15 because the records with VBELN = 'A' are over.&lt;/P&gt;&lt;P&gt;For the use of these statements, it is a mandat that the internal table shud be sorted.&lt;/P&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;Regards,&lt;/P&gt;&lt;P&gt;Himanshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2007 09:00:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-staements/m-p/2125767#M446251</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-18T09:00:19Z</dc:date>
    </item>
  </channel>
</rss>

