Flow of executable Program / ABAP Program Events


Flow of executable Program / ABAP Program Events

ABAP program events trigger depending on the program objects.
LOAD-OF-PROGRAM.
Global data, parameters, select options are declared here. Default values are also passed to parameters.
Load-of-Program event triggers whenever ABAP program is executed.

INITIALIZATION.
Event is used for initialization of data.
Initialization event triggers after load-of-program event.

AT SELECTION-SCREEN OUTPUT.
 
  at selection-screen output event triggers if selection screen is defined.


AT SELECTION-SCREEN.
  at selection-screen  event triggers if selection screen is defined.


START-OF-SELECTION.
Start-of-selection event triggers with every executable ABAP Program.

Different Get event. Associated with the logical database.

END-OF-SELECTION.
End-of-selection event  triggers with every executable ABAP Program.

Example:
Without Selection Screen.

REPORT yua_demo_program_event.

LOAD-OF-PROGRAM.
  TYPESBEGIN OF ty_event,
           event TYPE string"
         END OF ty_event.
  DATA gt_event TYPE STANDARD TABLE OF ty_event.
  DATA s_event LIKE LINE OF gt_event.

  s_event VALUE #event 'LOAD-OF-PROGRAM.' ).
  APPEND s_event TO gt_event.

AT SELECTION-SCREEN.
  s_event VALUE #event 'AT SELECTION-SCREEN. ' ).
  APPEND s_event TO gt_event.

AT SELECTION-SCREEN OUTPUT.
  s_event VALUE #event 'AT SELECTION-SCREEN OUTPUT. ' ).
  APPEND s_event TO gt_event.

INITIALIZATION.
  s_event VALUE #event 'INITIALIZATION. ' ).
  APPEND s_event TO gt_event.

START-OF-SELECTION.
*  Different Get event can also be called associated with logical database
  s_event VALUE #event 'START-OF-SELECTION. ' ).
  APPEND s_event TO gt_event.

END-OF-SELECTION.
  s_event VALUE #event 'END-OF-SELECTION. ' ).
  APPEND s_event TO gt_event.

  cl_demo_output=>displaygt_event ).

Output:



With Selection Screen:

REPORT yua_demo_program_event.

LOAD-OF-PROGRAM.

  PARAMETERS p_test TYPE AS CHECKBOX.
  TYPESBEGIN OF ty_event,
           event TYPE string"
         END OF ty_event.
  DATA gt_event TYPE STANDARD TABLE OF ty_event.
  DATA s_event LIKE LINE OF gt_event.

  s_event VALUE #event 'LOAD-OF-PROGRAM.' ).
  APPEND s_event TO gt_event.

AT SELECTION-SCREEN.
  s_event VALUE #event 'AT SELECTION-SCREEN. ' ).
  APPEND s_event TO gt_event.

AT SELECTION-SCREEN OUTPUT.
  s_event VALUE #event 'AT SELECTION-SCREEN OUTPUT. ' ).
  APPEND s_event TO gt_event.

INITIALIZATION.
  s_event VALUE #event 'INITIALIZATION. ' ).
  APPEND s_event TO gt_event.

START-OF-SELECTION.
*  Different Get event can also be called associated with logical database
  s_event VALUE #event 'START-OF-SELECTION. ' ).
  APPEND s_event TO gt_event.

END-OF-SELECTION.
  s_event VALUE #event 'END-OF-SELECTION. ' ).
  APPEND s_event TO gt_event.

  cl_demo_output=>displaygt_event ).

Output:




 
 
 
 

No comments:

Post a Comment

Code Inspector

The Code Inspector tests single objects or object sets (programs, function groups, classes, interfaces, Dictionary objects) for performanc...