‎2007 Jul 17 8:42 AM
usually what are control statements that are used in our programs in general
‎2007 Jul 17 8:48 AM
Hi,
Check these links for information regarding different Events in SAP
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9a1435c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm
CONTROL STATEMENTS.
Control Break Statements
Control break statements are used to create statement blocks which process only specific table lines the LOOP ENDLOOP block.
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:
Table should be sorted when you use control-break statements
You can break the sequential access of internal tables by using these statements.
Syntax:
At first.
<Statement block>
Endat.
This is the first statement to get executed inside the loop (remember control break statements are applicable only inside the loop)
So in this block you can write or process those statements which you want to get executed when the loop starts.
At New carrid.
Write:/ carrid.
Endat.
In this case whenever the new carrid is reached, carrid will be written.
At End of carrid.
Uline.
Endat.
In this case whenever the end of carrid is reached, a line will be drawn.
At Last.
Write:/ Last Record is reached.
Endat.
Processing of statements within this block is done when entire processing of entire internal table is over. Usually used to display grand totals.
You can use either all or one of the above control break statements with in the loop for processing internal table.
At end of carrid.
Sum.
Endat.
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.
http://sap.mis.cmich.edu/sap-abap/abap03/sld001.htm
pls go through this
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/content.htm
Regards,
Priyanka.
‎2007 Jul 17 8:43 AM
Hi
IF ELSE
WHILE
DO
LOOP ENDLOOP
etc.
These are the most common control statements used in abap.
refer to abap help for more statements
regards
ravish garg
Reward if useful
‎2007 Jul 17 8:48 AM
Hi,
Check this,
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/content.htm
Reward if useful!
‎2007 Jul 17 8:48 AM
Hi,
Check these links for information regarding different Events in SAP
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9a1435c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm
CONTROL STATEMENTS.
Control Break Statements
Control break statements are used to create statement blocks which process only specific table lines the LOOP ENDLOOP block.
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:
Table should be sorted when you use control-break statements
You can break the sequential access of internal tables by using these statements.
Syntax:
At first.
<Statement block>
Endat.
This is the first statement to get executed inside the loop (remember control break statements are applicable only inside the loop)
So in this block you can write or process those statements which you want to get executed when the loop starts.
At New carrid.
Write:/ carrid.
Endat.
In this case whenever the new carrid is reached, carrid will be written.
At End of carrid.
Uline.
Endat.
In this case whenever the end of carrid is reached, a line will be drawn.
At Last.
Write:/ Last Record is reached.
Endat.
Processing of statements within this block is done when entire processing of entire internal table is over. Usually used to display grand totals.
You can use either all or one of the above control break statements with in the loop for processing internal table.
At end of carrid.
Sum.
Endat.
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.
http://sap.mis.cmich.edu/sap-abap/abap03/sld001.htm
pls go through this
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9f1f35c111d1829f0000e829fbfe/content.htm
Regards,
Priyanka.
‎2007 Jul 17 8:49 AM
Hi
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.
<b>Reward points for useful Answers</b>
Regards
Anji
‎2007 Jul 17 9:00 AM
HI,
CONTROL STATEMENTS :
1.if <condition>
<statements>
else.
<statements>
endif
2. do
<statements>
while<condition>.
3.do <condition>
<statements>
enddo.
4. loop
<statements>
endloop.
5 skip
reward with points if helpful.
Message was edited by:
Vinutha YV