<?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: 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/2533594#M574749</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is the effect of end on statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jul 2007 12:57:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-19T12:57:04Z</dc:date>
    <item>
      <title>Control break statements.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533587#M574742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please give me the explanation for the following statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At first.&lt;/P&gt;&lt;P&gt;At new&lt;/P&gt;&lt;P&gt;At end of&lt;/P&gt;&lt;P&gt;sum&lt;/P&gt;&lt;P&gt;On change of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;P&gt;Basavaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 07:14:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533587#M574742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T07:14:20Z</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/2533588#M574743</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;The field position is important for the fields that are using in the control break statements..Also SORT internal table is required..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;MATNR TYPE MATNR,&lt;/P&gt;&lt;P&gt;WERKS TYPE WERKS_D,&lt;/P&gt;&lt;P&gt;VALUE TYPE NETPR,&lt;/P&gt;&lt;P&gt;END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-MATNR = 'ABC'.&lt;/P&gt;&lt;P&gt;ITAB-WERKS = '0100'.&lt;/P&gt;&lt;P&gt;ITAB-VALUE = '10.00'.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-MATNR = '1ABC'.&lt;/P&gt;&lt;P&gt;ITAB-WERKS = '0100'.&lt;/P&gt;&lt;P&gt;ITAB-VALUE = '10.00'.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY MATNR WERKS.&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 MATNR.&lt;/P&gt;&lt;P&gt;SUM.&lt;/P&gt;&lt;P&gt;WRITE: / ITAB-MATNR, 'MATERIAL TOTAL - ', ITAB-VALUE.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT END OF WERKS.&lt;/P&gt;&lt;P&gt;SUM.&lt;/P&gt;&lt;P&gt;WRITE: / ITAB-WERKS, 'PLANT TOTAL - ', ITAB-VALUE.&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;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Abhay Singh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Rewards point for useful answer.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 07:17:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533588#M574743</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T07:17:07Z</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/2533589#M574744</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;control break statements are&lt;/P&gt;&lt;P&gt;at new(every new record follows)&lt;/P&gt;&lt;P&gt;at first (at the top of the list i.e,first statement like headers)&lt;/P&gt;&lt;P&gt;at end of (every record ends it get triggered)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at last ( it is useful in summation of records) these r used in loop statements only&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to execute some statements for certain records of the dataset only, use the control statements AT and ENDAT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system processes the statement blocks between the control statements for the different options of AT as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT FIRST&lt;/P&gt;&lt;P&gt;The system executes the statement block once for the first record of the dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT LAST&lt;/P&gt;&lt;P&gt;The system executes the statement block once for the last record of the dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also use the AT and ENDAT statements for control level processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic form&lt;/P&gt;&lt;P&gt;SUM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;When processing an internal table in a block starting with LOOP and concluded by ENDLOOP , SUM calculates the control totals of all fields of type I , F and P (see also ABAP/4 number types ) and places them in the LOOP output area (header line of the internal table or an explicitly specified work area). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the SUM statement both at the end and the beginning of a control group (see also AT FIRST/LAST ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On Change of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect: &lt;/P&gt;&lt;P&gt;The statements ON CHANGE OF and ENDON, which are forbidden in classes, define a control structure that can contain a statement block statement_block. After ON CHANGE OF, any number of data objects dobj1, dobj2... of any data type can be added..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: &lt;/P&gt;&lt;P&gt;In a SELECT loop, a statement block should only be executed if the content of the column CARRID has changed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA spfli_wa TYPE spfli. &lt;/P&gt;&lt;P&gt;SELECT * &lt;/P&gt;&lt;P&gt;FROM spfli &lt;/P&gt;&lt;P&gt;INTO spfli_wa &lt;/P&gt;&lt;P&gt;ORDER BY carrid. &lt;/P&gt;&lt;P&gt;... &lt;/P&gt;&lt;P&gt;ON CHANGE OF spfli_wa-carrid. &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;ENDSELECT.&lt;/P&gt;&lt;P&gt;&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;Priyanka.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 07:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533589#M574744</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T07:18:59Z</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/2533590#M574745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Basavraj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Check these links for information regarding different Events in SAP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9a1435c111d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9a1435c111d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_46c/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_46c/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="182681"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONTROL STATEMENTS.&lt;/P&gt;&lt;P&gt;Control Break Statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Control break statements are used to create statement blocks which process only specific table lines the LOOP &amp;#150; ENDLOOP block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You open such a statement block with the control level statement AT and close it with the control level statement ENDAT. The syntax is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table should be sorted when you use control-break statements&lt;/P&gt;&lt;P&gt;You can break the sequential access of internal tables by using these statements.&lt;/P&gt;&lt;P&gt;Syntax:&lt;/P&gt;&lt;P&gt;At first.&lt;/P&gt;&lt;P&gt;&amp;lt;Statement block&amp;gt;&lt;/P&gt;&lt;P&gt;Endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the first statement to get executed inside the loop (remember control break statements are applicable only inside the loop)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in this block you can write or process those statements which you want to get executed when the loop starts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At New carrid.&lt;/P&gt;&lt;P&gt;Write:/ carrid.&lt;/P&gt;&lt;P&gt;Endat.&lt;/P&gt;&lt;P&gt;In this case whenever the new carrid is reached, carrid will be written.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At End of carrid.&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;In this case whenever the end of carrid is reached, a line will be drawn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At Last.&lt;/P&gt;&lt;P&gt;Write:/ &amp;#145;Last Record is reached&amp;#146;.&lt;/P&gt;&lt;P&gt;Endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Processing of statements within this block is done when entire processing of entire internal table is over. Usually used to display grand totals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use either all or one of the above control break statements with in the loop for processing internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At end of carrid.&lt;/P&gt;&lt;P&gt;Sum.&lt;/P&gt;&lt;P&gt;Endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In above case the statement SUM (applicable only within AT-ENDAT) will sum up all the numeric fields in internal table and result is stored in same internal table variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap.mis.cmich.edu/sap-abap/abap03/sld001.htm" target="test_blank"&gt;http://sap.mis.cmich.edu/sap-abap/abap03/sld001.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;pls go through this&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&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
FIrst to use these statements the ITAB has to be sorted by the key fields on whcih you need the SUM of the fields.
Some time you will get * when mopving data from this int table to other table using these commands
so you have to use
READ TABLE ITAB INDEX SY-TABIX in AT..ENDAT..if you are using other fields between them


DATA: sflight_tab TYPE SORTED TABLE OF sflight 
WITH UNIQUE KEY carrid connid fldate, 
sflight_wa LIKE LINE OF sflight_tab. 

SELECT * 
FROM sflight 
INTO TABLE sflight_tab. 

LOOP AT sflight_tab INTO sflight_wa. 
AT NEW connid. 
WRITE: / sflight_wa-carrid, 
sflight_wa-connid. 
ULINE. 
ENDAT. 
WRITE: / sflight_wa-fldate, 
sflight_wa-seatsocc. 
AT END OF connid. 
SUM. 
ULINE. 
WRITE: / 'Sum', 
sflight_wa-seatsocc UNDER sflight_wa-seatsocc. 
SKIP. 
ENDAT. 
AT END OF carrid. 
SUM. 
ULINE. 
WRITE: / 'Carrier Sum', 
sflight_wa-seatsocc UNDER sflight_wa-seatsocc. 
NEW-PAGE. 
ENDAT. 
AT LAST. 
SUM. 
WRITE: / 'Overall Sum', 
sflight_wa-seatsocc UNDER sflight_wa-seatsocc. 
ENDAT. 
ENDLOOP. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward pts if found usefull:)&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sathish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 07:20:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533590#M574745</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T07:20:58Z</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/2533591#M574746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Control break stmt should be always in the LOOP ... ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT END OF f.&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;Effect &lt;/P&gt;&lt;P&gt;f is a sub-field of an internal table or extract dataset (EXTRACT) which is being processed with LOOP, i.e. the variants 1 and 2 only make sense within a LOOP. &lt;/P&gt;&lt;P&gt;Both "AT NEW f." and "AT END OF f. " introduce processing blocks which are concluded by " ENDAT.". &lt;/P&gt;&lt;P&gt;These processing blocks are processed whenever the contents of a field f or a sub-field defined before f change as a result of processing with LOOP. "AT NEW f." begins a new group of (table) lines with the same contents as the field f while "AT END OF f." concludes such a group. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Within the AT ... ENDAT processing of internal tables, all argument fields following f are filled with "*". &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Examples &lt;/P&gt;&lt;P&gt;1. AT for sub-fields of an internal table &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &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;&amp;lt;b&amp;gt;rewards point for useful answer.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 07:23:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533591#M574746</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T07:23:18Z</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/2533592#M574747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;control break stmts are used twhile displaying o/ps either to calc totals or to group the fields and count the rows rtc.&lt;/P&gt;&lt;P&gt;so u shud use it in the loop used to write the o/p.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the simple ex prog using control breaks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;A1(10) TYPE C,&lt;/P&gt;&lt;P&gt;A3(10) TYPE C,&lt;/P&gt;&lt;P&gt;A2 TYPE I,&lt;/P&gt;&lt;P&gt;END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:TOT TYPE I,count TYPE I,i type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-A1 = 'char1'.&lt;/P&gt;&lt;P&gt;ITAB-A3 = 'abc'.&lt;/P&gt;&lt;P&gt;ITAB-A2 = '10'.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-A1 = 'char1'.&lt;/P&gt;&lt;P&gt;ITAB-A3 = 'def'.&lt;/P&gt;&lt;P&gt;ITAB-A2 = '20'.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-A1 = 'char1'.&lt;/P&gt;&lt;P&gt;ITAB-A3 = 'abc'.&lt;/P&gt;&lt;P&gt;ITAB-A2 = '30'.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-A1 = 'char2'.&lt;/P&gt;&lt;P&gt;ITAB-A3 = 'abc'.&lt;/P&gt;&lt;P&gt;ITAB-A2 = '10'.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-A1 = 'char2'.&lt;/P&gt;&lt;P&gt;ITAB-A3 = 'abc'.&lt;/P&gt;&lt;P&gt;ITAB-A2 = '20'.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY A1 a3.&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 new a1.&lt;/P&gt;&lt;P&gt;write:/ itab-a1.&lt;/P&gt;&lt;P&gt;clear i.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at new a3.&lt;/P&gt;&lt;P&gt;if i &amp;gt; 0.&lt;/P&gt;&lt;P&gt;write:/10 itab-a3.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write:10 itab-a3.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;clear count.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count = count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i = i + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of a3.&lt;/P&gt;&lt;P&gt;write:20 count.&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;o/p :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;char1 abc 2 &lt;/P&gt;&lt;P&gt;def 1 &lt;/P&gt;&lt;P&gt;char2 abc 2 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: don't forget to sort the table before using control breaks.&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;&amp;lt;b&amp;gt;*reward points for all helpful answers&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 07:23:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533592#M574747</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T07:23:45Z</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/2533593#M574748</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;&amp;lt;b&amp;gt;At first&amp;lt;/b&amp;gt;. used inside loop endloop.&lt;/P&gt;&lt;P&gt; it triggers for the first time in the loop.&lt;/P&gt;&lt;P&gt;you can use it for heading&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;At new&amp;lt;/b&amp;gt; used inside loop endloop.&lt;/P&gt;&lt;P&gt; at new triggers for every change of the value of the field given .&lt;/P&gt;&lt;P&gt;. at new kunnr .. triggers when ever the value of kunnr is new..&lt;/P&gt;&lt;P&gt;It even triggers when values prior to the kunnr fields changes.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;At end of&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;at end of kunnr : triggers at when all the values of kunnr are over loped.&lt;/P&gt;&lt;P&gt;use inside loop endloop.. used for totals&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;sum&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;it add all the numeric data types inside loop endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;On change of&amp;lt;/b&amp;gt; can be used in loop. endloop.&lt;/P&gt;&lt;P&gt;                                                   select endselet and other loops  &lt;/P&gt;&lt;P&gt;if triggers when the valus alone for field given changes..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rewards if useful,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;nazeer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 07:24:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533593#M574748</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T07:24:22Z</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/2533594#M574749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is the effect of end on statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 12:57:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533594#M574749</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T12:57:04Z</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/2533595#M574750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;whart is the effect of end on statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 13:01:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-break-statements/m-p/2533595#M574750</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T13:01:57Z</dc:date>
    </item>
  </channel>
</rss>

