control break statements in ABAP?
Answers were Sorted based on User's Feedback
Answer / prasad1983
at first ... endat.
at new ... endat.
at end of ... endat.
on change of ... endon.
at last ... andat.
| Is This Answer Correct ? | 37 Yes | 4 No |
Answer / prabhakararao
hi all
This is Prabhakararao
Control break statememnts are:
AT FIRST
AT LAST
AT NEW
AT END OF
all the above are used for different purposed
| Is This Answer Correct ? | 32 Yes | 5 No |
Answer / niranjan
The Control Break Statements are used to print headings,subheadings,totals and subtotal.
We must use this statements inside the loop.
1.AT FIRST...........ENDAT:It is useful to print headings.
-->it will triggered before starting a first record in a loop.
2.AT LAST............ENDAT:It is useful to print TOTALS.
-->it will triggered after the last record in a loop.
3.AT NEW ON..........ENDAT:It is useful to print subheadings.
-->it will triggered before starting a new value for that particular field.
4.AT END OF..........ENDAT:It is useful to display sub-totals.
-->it will triggered after heading the old value.
5.ON CHANGE OF.......ENDAT:It is same as 'AT FIRST' but the only difference is we can use 'ON CHANGE OF' in any kind of loop statements like loop.....endloop,select.....endselect,do.....enddo,while.....endwhile.
-->it will triggered before starting a new value.
| Is This Answer Correct ? | 16 Yes | 1 No |
Answer / g.sivaramakrishnamohan
hi this is
G.sivaramakrishnamohan
Control break statememnts are:
1)At first.....endat
2)At last......endat
3)At new <field name>....endat
4)At end of <field name>........endat
5)change of <field name>........endon
| Is This Answer Correct ? | 10 Yes | 4 No |
Answer / deepti pattnaik
at first ... endat.
at new ... endat.
at end of ... endat.
on change of ... endon.
at last ... andat.
| Is This Answer Correct ? | 8 Yes | 2 No |
Answer / arasu
Control Break Statement is different from Control statement,
the BREAK, EXIT, CONTINUE are used to break and come out of
the current loop where it occurs, where as AT NEW, AT END,
AT LAST, AT FIRST is used to check for a table field value
(internal table). When u asked for control statements alone,
u need to answer as BREAK, EXIT, CONTINUE, CHECK because it
controls the program flow.
| Is This Answer Correct ? | 9 Yes | 5 No |
Control break statements:
Control break statements are like events inside the loop. There are 5 control break statements in ABAP. These are used within loop.(Except ON CHANGE OF which can be used outside the loop as well)
• AT FIRST - ENDAT
• AT NEW - ENDAT
• AT END OF - ENDAT
• AT LAST - ENDAT
• ON CHANGE OF
Explanation:
AT FIRST : Will trigger at the first run of the loop.
AT LAST: Will trigger at the last run of the loop.
The below 3 events are normally used when the table is sorted.
AT END OF : When we use At end for a field, it will trigger whenever there is any change in any of the fields from the left to that of the particular field. The trigger point will be the at the last occurrence of the same value for the field.
AT NEW: When we use At new for a field, it will trigger whenever there is any change in any of the fields from the left to that of the particular field.The trigger point will be the at the first occurrence of the new value for the field.
ON CHANGE OF: On change of it triggers only when there is any change in the particular field.
On change of can be used outside the loop too
Example Program:
Here is an example program which gives you the practical understanding of all control break statements.
Example Program for Control Break Statements
NOTE: It is important to note that we need a temporary work-area apart from the work-area used in loop for the last 3 control break statements. If we directly use the work-area of the loop, then we will get **** value and not the output we are expecting.
*&---------------------------------------------------------------------*
*& Report ZAU_CONTROLBREAK
*&
*&---------------------------------------------------------------------*
*& NEW TO SAP CONTROL BREAK EXAMPLE
*& http://www.newtosap.info
*&
*&---------------------------------------------------------------------*
REPORTzau_controlbreak.
TYPES: BEGIN OFty_marc,
matnr TYPE marc-matnr,
werks TYPE marc-werks,
END OFty_marc.
DATA: it_marc TYPE STANDARD TABLE OFty_marc,
wa_marc TYPEty_marc,
wa_temp TYPEty_marc.
SELECTmatnrwerks FROM marc INTO TABLEit_marc UP TO 10 ROWS WHEREmatnrge40.
SORTit_marc BY matnr.
FIELD-SYMBOLS :<matnr> typematnr.
WRITE:/'FULL TABLE'.
LOOP ATit_marc INTOwa_marc.
wa_temp = wa_marc.
WRITE: / sy-tabix ,wa_temp-matnr, wa_temp-werks.
ENDLOOP.
WRITE:/'AT FIRST AND LAST'.
LOOP ATit_marc INTOwa_marc.
wa_temp = wa_marc.
AT FIRST.
WRITE:/'First Entry'.
WRITE:/wa_temp-matnr, wa_temp-werks.
ENDAT.
AT LAST.
WRITE:/'Last Entry'.
WRITE:/wa_temp-matnr, wa_temp-werks.
ENDAT.
ENDLOOP.
WRITE:/'AT END OF'.
LOOP ATit_marc INTOwa_marc.
wa_temp = wa_marc.
AT END OFmatnr.
WRITE: / sy-tabix ,wa_temp-matnr, wa_temp-werks.
ENDAT.
ENDLOOP.
WRITE:/'AT NEW'.
LOOP ATit_marc INTOwa_marc.
wa_temp = wa_marc.
AT NEW matnr.
WRITE: / sy-tabix ,wa_temp-matnr, wa_temp-werks.
ENDAT.
ENDLOOP.
WRITE:/'ON CHANGE OF'.
LOOP ATit_marc INTOwa_marc.
wa_temp = wa_marc.
ASSIGNwa_marc-matnr TO<matnr>.
ON CHANGE OFwa_marc-matnr.
WRITE: / sy-tabix ,wa_temp-matnr, wa_temp-werks.
ENDON.
ENDLOOP.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / rv karthikeyan
Hi this is karthikeyan
control break statement: It is used to control the data flow inside the loop,for example if we need to add some functionality at run time for example subtotal for every new value triggered or sub heading,we use control break statement,now we see the types of control break statement.
at first: when the loop start first this at first will trigger,that when the loop starts the control goes to the at first statement and executed all the function inside it.
at new: when the first occurrence of the new value found this at new will trigger,used for the sub heading or page break purpose.
at end: when the last occurrence of the new value found this at end will trigger,used mainly for sub total purpose.
at last: when the last record in the loop over this at last will trigger used for grand total purpose.
Hope u got idea...
Regards
RV Karthikeyan.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / lakku sreenivasulu
The Control Break Statements are
AT FIRST
AT LAST
AT NEW
AT END OF
all the above are used for different purposed
| Is This Answer Correct ? | 3 Yes | 5 No |
AT NEW, AT FIRST, ... ARE ALL CONTROL LEVEL STATEMENTS.
THE CONTROL BREAK STATEMENTS ARE EXIT, CONTINUE, STOP.
| Is This Answer Correct ? | 10 Yes | 21 No |
What is ole?
What is pretty printer?
What is PNP-SW-FOUND
give example of sap memory and abap memory
What are the advantages and disadvantages of different types of bdc's?
we can write the select query or any code after the end of selection
If A is the super class of B. And both the classes have constructor. We create an object of class B. Then which constructor will be called? If both then in which order?
what is a workflow?
difference between enhancement and modifying
Can you create an internal table dynamically?(at run time)
How can an internal table with header line and one without header line be distinguished when passed to a subroutine? : abap modularization
What is report category and for what purpose do we use report category
SAP Basis (1262)
SAP ABAP (3939)
SAPScript (236)
SAP SD (Sales & Distribution) (2717)
SAP MM (Material Management) (912)
SAP QM (Quality Management) (99)
SAP PP (Production Planning) (523)
SAP PM (Plant Maintenance) (252)
SAP PS (Project Systems) (138)
SAP FI-CO (Financial Accounting & Controlling) (2766)
SAP HR (Human Resource Management) (1180)
SAP CRM (Customer Relationship Management) (432)
SAP SRM (Supplier Relationship Management) (132)
SAP APO (Advanced Planner Optimizer) (92)
SAP BW (Business Warehouse) (896)
SAP Business Workflow (72)
SAP Security (597)
SAP Interfaces (74)
SAP Netweaver (282)
SAP ALE IDocs (163)
SAP Business One (110)
SAP BO BOBJ (Business Objects) (388)
SAP CPS (Central Process Scheduling) (14)
SAP GTS (Global Trade Services) (21)
SAP Hybris (132)
SAP HANA (700)
SAP PI (Process Integration) (113)
SAP PO (Process Orchestration) (25)
SAP BI (Business Intelligence) (174)
SAP BPC (Business Planning and Consolidation) (38)
SAP BODS (Business Objects Data Services) (49)
SAP BODI (Business Objects Data Integrator) (26)
SAP Ariba (9)
SAP Fiori (45)
SAP EWM (Extended Warehouse Management) (58)
Sap R/3 (150)
SAP FSCM Financial Supply Chain Management (101)
SAP WM (Warehouse Management) (31)
SAP GRC (Governance Risk and Compliance) (64)
SAP MDM (Master Data Management) (0)
SAP MRS (Multi Resource Scheduling) (0)
SAP ESS MSS (Employee Manager Self Service) (13)
SAP CS (Customer Service) (0)
SAP TRM (Treasury and Risk Management) (0)
SAP Web Dynpro ABAP (198)
SAP IBP (Integrated Business Planning) (0)
SAP OO-ABAP (Object Oriented ABAP) (70)
SAP S/4 HANA Finance (Simple Finance) (143)
SAP FS-CD (Collections and Disbursements) (0)
SAP PLM (Product Lifecycle Management) (0)
SAP SuccessFactors (33)
SAP Vistex (0)
SAP ISR (IS Retail) (28)
SAP IdM (Identity Management) (0)
SAP IM (Investment Management) (0)
SAP UI5 (59)
SAP SCM (Supply Chain Management) (51)
SAP XI (Exchange Infrastructure) (49)
SAP Cloud Platform (34)
SAP Testing (89)
SAP SolMan (Solution Manager) (63)
SAP MaxDB (116)
SAP GUI (15)
SAP AllOther (329)