Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

report programming

Former Member
0 Likes
895

Hi all,

i am a beginner in ABAP,plz explain me clearly about the events in report programming.

thanks,

jetti.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
857

Hi jetti,

These are the events that the report programming is comprised of.

INITIALIZATION

Point before the selection screen is displayed. When you start a program in which a selection screen is defined (either in the program itself or in the linked logical database program), the system normally processes this selection screen first. If you want to execute a processing block before the selection screen is processed, you can assign it to the event keyword INITIALIZATION. Mostly global variables, classes, internal tables declarations are made here.

AT SELECTION-SCREEN

Point after processing user input on the selection screen while the selection screen is active. It provides you with several possibilities to carry out processing blocks while the system is processing the selection screen.

START-OF-SELECTION

Point after processing the selection screen. It gives you the possibility of creating a processing block after processing the selection screen and before accessing database tables using a logical database. You can use this processing block, for example, to set the values of internal fields or to write informational statements onto the output screen. At the START-OF-SELECTION event, also all statements are processed that are not attached to an event keyword except those that are written behind FORM-ENDFORM block.

You can do select database tables data processing here. REPORT statement always execute a START-OF-SELECTION implicitly. Consequently all processing logic between the REPORT statement and the next event keyword is automatically processed in the START-OF-SELECTION event.

*GET *

After the logical database has read an entry from the node . The most important event for report programs with an attached logical database is the moment at which the logical database program has read a line from a database table. When many programmers learn how to write an ABAP program, they confuse about logical database concept and this GET events. At first glance GET looks like a normal statement, but it is event keyword. If you look at the source of the logical database program code, it is easier to understand the GET keyword, even when you see the opposite keyword PUT inside the logical database program.

GET LATE

After the logical database has read an entry from the node . The event is triggered when all of the records for a node of the logical database have been read. If you want to write, for example, a sub total for a field, you can use this event.

END-OF-SELECTION

To define a processing block after the system has read processed all selections. It is triggered in type 1 programs (reports). This is the last of the events called by the runtime environment occur. It is triggered after all of the data has been read from the logical database, and before the list processor started. You can use the corresponding event block to process and format the data that the program has stored in internal tables or extracts during the various GET events.

The following events occur during the processing of the output list of a report program:

TOP-OF-PAGE

In list processing when a new page starts.

END-OF-PAGE

In list processing when a page ends.

AT LINE-SELECTION

When the user triggers the predefined function code PICK.

AT PF

When the user triggers the predefined function code PF.

AT USER-COMMAND

When the user triggers a function code defined in the program.

The last three events are used when an interactive report program has been written.

please reward if helpful,

thanks and regards,

srikanth

8 REPLIES 8
Read only

Former Member
0 Likes
857

Hi,

Below are events :

load-of-program.

initialization.

at selection-screen output.

at selection-screen.

start-of-selection.

get <Node> If you are using LDB

get late<Node>If you are using LDB.

end-of-selection.

top-of-page."Trtiggered for every page

end-of-page "Trigerred for everypage.

Interactive.

At line seletion.

at pf status.

Thanks,

Sriram Ponna.

Read only

0 Likes
857

load-of-program.

initialization.

at selection-screen output.

at selection-screen on field

at selection-screen on help request

at selection-screen on value request

at selection-screen.

start-of-selection.

get <Node> If you are using LDB

get late<Node>If you are using LDB.

end-of-selection.

top-of-page."Trtiggered for every page

end-of-page "Trigerred for everypage.

Interactive.

At line seletion.

at pf status.

Read only

Former Member
0 Likes
857

Hi,

Events in Classical Reports

Initialization.

At selection-screen.

At selection-screen on <field>.

Start-of-selection.

Top-of-page.

End-of-page.

End-of-selection.

Initialization.

We can initialize the selection-screen with calculated default values under this event.

Initialization.

s_date-high = sy-datum.

s_date-low = sy-datum - 15.

Append s_date.

At selection-screen.

We can validate all the inputs on selection screen fields under this event.

At selection-screen.

If s_carrid-low is initial or s_connid-low is initial or s_date is initial.

< ... code for validation... >.

Endif.

At selection-screen on <field>.

We can validate a particular field input on selection screen under this event.

At selection-screen on s_carrid.

If s_carrid-low ‘LH’.

<… code for validation…>

Endif.

Start-of-selection.

By default the program is under this event.

If any of the other event comes before

‘Select…Endselect.’ statements, then to break

that event, we require this S-O-S event.

Start-of-selection.

Select * from ……

…………

Endselect.

Top-of-page.

If we need some portion of the output (like

column headings) to appear in all the pages,

then we use this event.

Top-of-page.

Write:/ ‘Carrier’,10 ‘Connection’ 20 ‘Date’.

If there is no external output statement before

‘Top-of-page’ event, then this event will not

work.

End-of-page.

Once the cursor reaches the last line of the

page, automatically this event will be triggered.

Report Zxxx line-count 25(3).

In this case line numbers 23, 24 and 25 are

reserved for footer.

Once the cursor reaches 23rd line, this event

will be triggered.

End-of-page.

Write:/ sy-uline(75).

Write:/ ‘This is end of page:’,sy-pagno.

Write:/ sy-uline(75).

End-of-selection.

This event is used for concluding part of List.

End-of-selection.

Write:/ ‘This is end of the Report’.

Additional events in interactive reports

The following additional events are applicable to secondary lists.

Top-of-page during line-selection.

At line-selection.

At user-command.

Regards,

Satish

Read only

Former Member
0 Likes
857

Hi Jetti

hope this wil help you.

Events in Dialog Program

PBO - Process Before Output

PAI - Process After Input

POH - Process on Help Request

POV - Process on Value Request.

Events in ABAP Programming

Classical Reporting:

INITIALIZATION

AT SELECTION-SCREEN OUTPUT

AT SELECTION-SCREEN

START-OF–SELECTION.

TOP-OF-PAGE

END-OF-PAGE

END-OF-SELECTION.

Events in Interactive Report

TOP-OF-PAGE DURING LINE-SELECTION

AT USER-COMMAND.

AT LINE-SELECTION

AT PF-FUNCTION KEY

Control Break events related to Internal Tables:

AT NEW FIELD

AT END OF FIELD

AT FIRST

AT LAST

Triggering and Handling Events

In ABAP Objects, triggering and handling an event means that certain methods act as triggers and trigger events, to which other methods - the handlers - react. This means that the handler methods are executed when the event occurs.

This section contains explains how to work with events in ABAP Objects. For precise details of the relevant ABAP statements, refer to the corresponding keyword documentation in the ABAP Editor.

Triggering Events

To trigger an event, a class must

· Declare the event in its declaration part

· Trigger the event in one of its methods

Declaring Events

You declare events in the declaration part of a class or in an interface. To declare instance events, use the following statement:

EVENTS ) TYPE type ..

To declare static events, use the following statement:

CLASS-EVENTS in the EXPORTING addition. The self-reference ME is automatically passed to the implicit parameter SENDER.

reward pts if help.

Read only

Former Member
0 Likes
858

Hi jetti,

These are the events that the report programming is comprised of.

INITIALIZATION

Point before the selection screen is displayed. When you start a program in which a selection screen is defined (either in the program itself or in the linked logical database program), the system normally processes this selection screen first. If you want to execute a processing block before the selection screen is processed, you can assign it to the event keyword INITIALIZATION. Mostly global variables, classes, internal tables declarations are made here.

AT SELECTION-SCREEN

Point after processing user input on the selection screen while the selection screen is active. It provides you with several possibilities to carry out processing blocks while the system is processing the selection screen.

START-OF-SELECTION

Point after processing the selection screen. It gives you the possibility of creating a processing block after processing the selection screen and before accessing database tables using a logical database. You can use this processing block, for example, to set the values of internal fields or to write informational statements onto the output screen. At the START-OF-SELECTION event, also all statements are processed that are not attached to an event keyword except those that are written behind FORM-ENDFORM block.

You can do select database tables data processing here. REPORT statement always execute a START-OF-SELECTION implicitly. Consequently all processing logic between the REPORT statement and the next event keyword is automatically processed in the START-OF-SELECTION event.

*GET *

After the logical database has read an entry from the node . The most important event for report programs with an attached logical database is the moment at which the logical database program has read a line from a database table. When many programmers learn how to write an ABAP program, they confuse about logical database concept and this GET events. At first glance GET looks like a normal statement, but it is event keyword. If you look at the source of the logical database program code, it is easier to understand the GET keyword, even when you see the opposite keyword PUT inside the logical database program.

GET LATE

After the logical database has read an entry from the node . The event is triggered when all of the records for a node of the logical database have been read. If you want to write, for example, a sub total for a field, you can use this event.

END-OF-SELECTION

To define a processing block after the system has read processed all selections. It is triggered in type 1 programs (reports). This is the last of the events called by the runtime environment occur. It is triggered after all of the data has been read from the logical database, and before the list processor started. You can use the corresponding event block to process and format the data that the program has stored in internal tables or extracts during the various GET events.

The following events occur during the processing of the output list of a report program:

TOP-OF-PAGE

In list processing when a new page starts.

END-OF-PAGE

In list processing when a page ends.

AT LINE-SELECTION

When the user triggers the predefined function code PICK.

AT PF

When the user triggers the predefined function code PF.

AT USER-COMMAND

When the user triggers a function code defined in the program.

The last three events are used when an interactive report program has been written.

please reward if helpful,

thanks and regards,

srikanth

Read only

Former Member
0 Likes
857

Hi jetti,

First of all, welcome to ABAP.

Anyway, your question is quite vague.

It would be easier to focus on one aspect of report programming.

What did you have in mind, specifically?

I agree with the replies.

It would be beneficial if you got to know the differences in the events.

Thanks.

~ ric

Edited by: ric on Jan 8, 2008 8:21 PM

Read only

Former Member
0 Likes
857

List Events in an ABAP Program

After a user interaction on a list, the ABAP runtime environment checks whether it should process the function code itself (for example, %EX or %PC), or whether it should trigger the relevant event. Unlike normal screens, in which the PAI event is triggered, the runtime environment triggers three special events when list events occur. You can use the corresponding event blocks in your ABAP program to react to the user action. From within the program, you can use the SY-UCOMM system field to access the function code. There is no OK_CODE field that is filled.

Event Blocks for Function Codes PF<nn> (Obsolete)

When the user chooses a function code PF<nn> (<nn> can be between 01 and 24), the system always triggers the AT PF<nn> event. In the standard list status, the function keys F<nn> that are not reserved for predefined system functions all have the function code PF<nn> as long as a corresponding event block is defined in the program.

AT PF<nn>.

<statements>.

These event blocks are executed when the user chooses the corresponding function key. The position of the cursor in the list is irrelevant.

If you use these event blocks at all, it should only be for temporary test versions. In production programs, you should only use AT USER-COMMAND with a dialog status of your own to assign function codes to function keys. When you use your own interfaces, the system displays a function text explaining what the function does. This does not happen when you use AT PF<nn> event blocks.

Event Block for Function Code PICK

When the user triggers the function code PICK, AT LINE-SELECTION is always triggered if the cursor is positioned on a list line. The function code PICK is, by default, always linked with function key F2 and hence with the mouse double-click. Consequently, if you have a simple program that does not react to any further user actions, you only need to write this event block.

AT LINE-SELECTION.

<statements>.

As described in the section Dialog Status for Lists, the function code PICK is always added to the standard list status when you have an AT LINE-SELECTION event in your program.

If you assign PICK to other function keys or menu entries, AT LINE-SELECTION is also triggered when the user chooses then. You should avoid this for the sake of the semantics.

Conversely, if you have a more extensive program that does not react to line selection, you should not use the function code PICK. Instead you should assign a different function code to F2 , to ensure that as many events as possible trigger the AT USER-COMMAND event.

Event Block for User-Defined Function Codes

If the user chooses a function code during list processing that is neither processed by the system, or PICK or PF<nn>, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:

AT USER-COMMAND.

<statements>.

In this event block, you can use an IF or CASE structure to tell the function codes apart. They are available in the system field SY-UCOMM. There are further system fields that are filled in list events, such as SY-LSIND and SY-PFKEY, that allow you to make further case distinctions.

Triggering a List Event from the Program

You can trigger a list event from the program as follows:

SET USER-COMMAND <fc>.

This statement takes effect after the current list is completed. Before the list is displayed, the event assigned to function code <fc> is triggered, regardless of the dialog status you are using.

The effect is the same as when the user chooses the function. In other words, predefined list function codes are trapped and processed by the runtime environment, the function codes PICK and PF<nn> trigger the AT LINE-SELECTION and AT PF<nn> events, and user-defined function codes trigger the AT USER-COMMAND event block.

Function code PICK triggers an event only if the cursor is located on a list line.

Using this statement in conjunction with the function codes reserved for system functions, you can call the system functions from the program. For example, you can use SET USER-COMMAND '%SC' to call the Find dialog box directly, or to position the list correctly before it is displayed.

If you use several SET USER-COMMAND statements while creating a list, the system executes only the last one.

Examples

Example for AT LINE-SELECTION.

REPORT demo_list_at_line_selection.

START-OF-SELECTION.

WRITE 'Basic List'.

AT LINE-SELECTION.

WRITE: 'Secondary List by Line-Selection',

/ 'SY-UCOMM =', sy-ucomm.

When you run the program, the basic list appears with the standard list status. The detail list shows that SY-UCOMM has the value PICK.

Example for AT PF<nn>.

REPORT demo_list_at_pf.

START-OF-SELECTION.

WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.

AT pf5.

PERFORM out.

AT pf6.

PERFORM out.

AT pf7.

PERFORM out.

AT pf8.

PERFORM out.

FORM out.

WRITE: 'Secondary List by PF-Key Selection',

/ 'SY-LSIND =', sy-lsind,

/ 'SY-UCOMM =', sy-ucomm.

ENDFORM.

After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:

Secondary List by PF-Key Selection

SY-LSIND = 14

SY-UCOMM = PF06

Example for AT USER-COMMAND.

REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.

START-OF-SELECTION.

WRITE: 'Basic List',

/ 'SY-LSIND:', sy-lsind.

TOP-OF-PAGE.

WRITE 'Top-of-Page'.

ULINE.

TOP-OF-PAGE DURING LINE-SELECTION.

CASE sy-pfkey.

WHEN 'TEST'.

WRITE 'Self-defined GUI for Function Codes'.

ULINE.

ENDCASE.

AT LINE-SELECTION.

SET PF-STATUS 'TEST' EXCLUDING 'PICK'.

PERFORM out.

sy-lsind = sy-lsind - 1.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'FC1'.

PERFORM out.

WRITE / 'Button FUN 1 was pressed'.

WHEN 'FC2'.

PERFORM out.

WRITE / 'Button FUN 2 was pressed'.

WHEN 'FC3'.

PERFORM out.

WRITE / 'Button FUN 3 was pressed'.

WHEN 'FC4'.

PERFORM out.

WRITE / 'Button FUN 4 was pressed'.

WHEN 'FC5'.

PERFORM out.

WRITE / 'Button FUN 5 was pressed'.

ENDCASE.

sy-lsind = sy-lsind - 1.

FORM out.

WRITE: 'Secondary List',

/ 'SY-LSIND:', sy-lsind,

/ 'SY-PFKEY:', sy-pfkey.

ENDFORM.

When you run the program, the system displays the following basic list with a the page header defined in the program:

You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.

Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.

For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.

Example for SET USER-COMMAND.

REPORT demo_list_set_user_command NO STANDARD PAGE HEADING.

START-OF-SELECTION.

SET USER-COMMAND 'MYCO'.

WRITE 'Basic List'.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'MYCO'.

WRITE 'Secondary List from USER-COMMAND,'.

WRITE: 'SY-LSIND', sy-lsind.

SET USER-COMMAND 'PF05'.

ENDCASE.

AT pf05.

WRITE 'Secondary List from PF05,'.

WRITE: 'SY-LSIND', sy-lsind.

SET CURSOR LINE 1.

SET USER-COMMAND 'PICK'.

AT LINE-SELECTION.

WRITE 'Secondary List from LINE-SELECTION,'.

WRITE: 'SY-LSIND', sy-lsind.

SET USER-COMMAND '%SC'.

This program creates one basic list and three detail lists. When the program starts, the third detail list is displayed immediately, along with a dialog box for searching in the list. The dialog box is displayed by setting the predefined function code %SC. To view the other lists, the user chooses Back.

Note that in the event AT PF05, the SET CURSOR statement is used to position the cursor on a list line in order to support the function code PICK.

Read only

Former Member
0 Likes
857

Hi,

Events in Basic list :

Initialization

At selection-screen

Start of selection

End of selection

Top of page

End of page.

INITIALIZATION - is ment for initializing the values of variables before selection screen.

At selection-screen - events :

At selection-screen -> For validating the total selection screen like radio button,checkboxes,etc.

At selection-screen on radio button ->Validation check for one group of radio button.

At selection-screen on field -> Validation check for one field

At selection-screen on block ->Validation check for group of fields inside the block.

At selection-screen on help reuest -> For F1-Help Documentation.

At selection-screen on value request -> For F4 Help - list of possible values.

At selection-screen output-> PBO. For modifying the selection screen before displaying output & after displaying the selection screen.

Start of selection -> For selecting data from database.Its a default event.

End of selection -> Its not a default event.

Top of page -> Before triggerin the 1st write statement in start of selection , the write statement in top of page event triggers 1st.

End of page -> Before triggerin the 1st write statement in End of selection , the write statement in Endof page event triggers 1st.

EVENTS IN INTERACTIVE LIST:

AT lINE SELECTION

AT USER COMMAND

AT PF KEY

TOP OF PAGE DURING LINE SELECTION

AT lINE SELECTION -> Here we use :

READ,HIDE,GET CURSOR.

READ : SYNTAX is READ LINE SY-LILLI LINE VALUE INTO V_LINE.

AT PF KEY : Whatever the code we write under this ,that corresponding code will be triggered if we press that key.

TOP OF PAGE DURING LINE SELECTION : For handling headings in secondary lists we use this event.

bye.