You are on page 1of 2

Control Break Events

*******************Events which are used inside a loop*********************

1.AT-FIRST - Statements are executed before any processing started and is executed
only once

2. AT-LAST - statements are executed after all processing is finished.

3. AT-NEW-FIELDNAME- statements are executed at the begining of a group of records


containing the same values.

For Eg: so in item details if there are multiple records of vbeln = 002 so it will
group all 002.

4.AT-END OF FIELD NAME- Statements are executed at the end of the group after
matching values are grouped.

*******************************************************************************

Report zcontrol_break_events

Types:begin of lty_data,
vbeln type vbeln_va,
netwr type netwr_ap
end of lty_data.

DATA: lt_data type table of lty_data,


ls_data type lty_data.

***************************************************************************
Selection-Screen
***************************************************************************

selection-screen: begin of block with frame text-001.

select-option: s_vbeln for vbak-vbeln.

selection-screen:end-of-block b1.

****************************************************************************

select vbeln netwr


from vbap
into table lt_data
where vbeln in s_vbeln.

loop at lt_data into ls_data.

AT FIRST. ********

Write:/ 'Sum of all the sales doc is printed below'. " '/' gives us the output in
different line.

ENDAT.**********

AT LAST. *********
Write:/ 'sum of sales order number'.

ENDAT.***********

AT NEW VBELN.**********

Write:/ ls_data-vbeln.

ENDAT.***************

AT END OF VBELN.

sum. "its a stament to sum the write staement


write:/ ls_data-netwr.

ENDAT.

ENDLOOP.

You might also like