Event in ABAP report

Source: Internet
Author: User

Event in ABAP report determine process flow of a program. The events are triggered depended on the way the output is generated. They begin after event keyword and end when the next event reached.

Event Keyword:
Initialization.
Occurs when report initialized.
We can use it to check user authorization or prepare output for selection screen.

At selection-screen output:
Occurs each time selection screen about to generated.
We can use it to modify selection screen, for example hide/unhide parameter.

At selection-screen.
Occurs each user command in selection screen. We can use it to perform checking on user input.

Start-of-selection
Occurs after the standard selection screen has been processed .,
Data is read in this event.

End-of-selection
Occurs after start-of-selection.

Top-of-page
Occurs when a new page starts.
Use it for write report header.

End-of-page
Occurs when a page ends.
Use it for write report footer.

At line-selection
Occurs when the user double-click on report.

At user-command
Occurs when the user push toolbar button.

This is program to demonstrate how to use event properly.

Report zaalgal0008
Line-count 10 (1 ).

* Http://abap-gallery.blogspot.com

Tables: sflight.

Data: Begin of t_report occurs 3,
Carrid like sflight-carrid,
Connid like sflight-connid,
End of t_report.

* Begin selection screen
Parameters p_datum like sy-datum.
Parameters p_check as checkbox.
* End selection screen

Initialization.
* Begin initialization
Move sy-datum to p_datum.
* End Initialization

At selection-screen.
* Begin at selection-Screen
Message i888 (sabapdocu) with 'at selection-screen '.
If p_check = 'x '.
Message e888 (sabapdocu) with 'clear checkbox '.
Endif.
* End at selection-Screen

At selection-screen output.
* Begin at selection-screen output
Message i888 (sabapdocu) with 'at selection-screen output '.
* End at selection-screen output

Start-of-selection.
* Begin start-of-selection.
Message i888 (sabapdocu) with 'start-of-selection '.
Select * From sflight.
Move sflight-carrid to t_report-carrid.
Move sflight-connid to t_report-connid.
Append t_report.
Endselect.
* End start-of-selection.

End-of-selection.
* Begin end-of-selection.
Message i888 (sabapdocu) with 'end-of-selection '.
Format color col_normal.
Do 30 times.
Loop at t_report.
Write/t_report-carrid.
Write t_report-connid.
Endloop.
Enddo.
* End-of-selection.

Top-of-page.
Format color col_heading.
Write 'this is header '.

End-of-page.
Format color col_total.
Write 'this is footer '.

At line-selection.
Write:/'cursor row: ', Sy-curow.
Write:/'cursor Col: ', Sy-cucol.

 

Original http://abap-gallery.blogspot.com/2007/08/event-in-abap-report.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.