SAP® Documentation

Single view

ABAPLOAD-OF-PROGRAM - LOAD-OF-PROGRAM

Fill RESBD Structure from EBP Component Structure   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

LOAD-OF-PROGRAM

Short Reference



Syntax

LOAD-OF-PROGRAM.

Effect

This event keyword defines the program constructor of an executable program, a module pool, a function group, or a subroutine pool. The program constructor is an event block whose event is raised by the ABAP runtime environment when one of the executable programs mentioned above is loaded into the internal session.

When a program is called using SUBMIT or using a transaction code, a new internal session is opened in every call and the event block is executed once in every call. You can initialize global data objects of the program here. The event block must be fully executed, otherwise a runtime error occurs. This means that statements can be specified that exit the event block without returning to it.

The first time an external procedure (subroutine or function module) or a subscreen is called, the master program of the called procedure is loaded into the internal session of the caller, thus raising the event LOAD-OF-PROGRAM. The event block is executed before the called procedure. Each time a procedure of the same master program is called again by a caller of the same internal session, the event LOAD-OF-PROGRAM is not raised.

Notes

  • The event LOAD-OF-PROGRAM should mainly be used to initialize global data when calling external procedures or transactions. If executable programs are called using SUBMIT, it is recommended that the event INITIALIZATION is used, since the start values for parameter and selection criteria are set after LOAD-OF-PROGRAM (see program flow after SUBMIT).

  • If a program is only loaded because declarations are required from it, such as when using absolute type names, the LOAD-OF-PROGRAM event is not raised. The program constructor is only executed if an executable unit of the program is called afterwards.

  • Class pools do not have a program constructor, since the static constructor from the global class defined in the class pool can be used instead.

Example

Sets a global data object for the language as specified by the system field sy-langu in the event LOAD-OF-PROGRAM.

DATA g_langu TYPE sy-langu.

LOAD-OF-PROGRAM.
  g_langu = COND #( WHEN sy-langu = 'D' THEN 'D' ELSE 'E' ).






Fill RESBD Structure from EBP Component Structure   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 4338 Date: 20200127 Time: 230956     sap01-206 ( 15 ms )

Our Service

Looking for Support? Questions?

The

Consolut

Callback-Service

Leave us your contact details and we will call you back. Panels marked with * are mandatory.