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

Difference between Load - of - program & Initialization ?

Former Member
0 Likes
4,087

Hi Friends,

What is the "Difference between Load - of - program & Initialization "

Cheers

R.Kripa.

9 REPLIES 9
Read only

Former Member
0 Likes
2,087

The corresponding event is triggered in an internal session immediately after a program with type 1, M, F, or S is loaded. The corresponding processing block is processed once per program and internal session.

The processing block LOAD-OF-PROGRAM has approximately the same function in an ABAP program with type 1, M, F, or S as the constructor method of a class in ABAP Objects.

Programs wiht type 1, M, F, or S can be loaded into an internal session in two ways:

Program calls

Whenever you call a program using SUBMIT or a transaction code, a new internal session is opened. The LOAD-OF-PROGRAM event is therefore called in each program call.

External procedure calls

The first time you call an external procedure (subroutine or function module), the main program of the procedure that you called is loaded into the internal session of the calling program. The eventLOAD-OF-PROGRAM is triggered and the corresponding processing block is executed before the procedure that you called. However, subsequent calls from the same calling program to a procedure in the same subroutine pool or function group do not trigger the LOAD-OF-PROGRAM event.

so it's before the program is loaded in the memory for execution.

Initialization:

(For executable programs of type 1), the associated event is executed before the selection screen is displayed.

The parameters (PARAMETERS) and selection criteria (SELECT-OPTIONS) defined in the program already contain default values (if specified). You can assign different values here and also change the database-specific selections.

Example

Define the last day of the previous month as the key date:

PARAMETERS QUAL_DAY TYPE D DEFAULT SY-DATUM.

INITIALIZATION.

QUAL_DAY+6(2) = '01'.

QUAL_DAY = QUAL_DAY - 1.

Here, the default value of QUAL_DAY is the current date, e.g. 05.04.88 (QUAL_DAY = '19880405'). Two subseqent statements set the date first to the beginning of the month, e.g. 01.04.88 (QUAL_DAY = '19880401') and then, by subtracting one day, to the last day of the previous month, e.g. 31.03.88 (QUAL_DAY = '19880331').

so load-of-program before program is loaded in the main memory is excuted and initialization is done before selection screen of the program is displayed..

reward points if it helps

regds

gunjan

Read only

Former Member
0 Likes
2,087

Hi Gunjan Kumar,

Thanks anyway .... but what will be the coding inside the event ????

Cheers

R.Kripa.

Read only

0 Likes
2,087

hi

load-of-program is used internally from SAP to load the program in the main meory for execution and it's internal processing...there's a separate subroutine and system level program involved ..to get the program loaded taking into account all the OS level details....

reward points if it helps

regards

gunjan

Read only

Former Member
0 Likes
2,087

hey Gunjan Kumar,

so do we not code "LOAD-OF-PROGRAM" while writing a program??

is it automatically called / executed ???

Cheers

R.Kripa.

Read only

0 Likes
2,087

i dont think u have to enter anything in this event..just go about coding and it'll be called at run time on it's own..

Reward points if it helps

Regards

Gunjan

Read only

0 Likes
2,087

Hi,

Yes you don't have to code 'LOAD-OF-PROGRAM' in program it is automatically called by system to load program memory area for variables.

But you can write it in your program if you want to do some thing before the 'INITIALIZATION' event because 'LOAD-OF-PROGRAM' is called before the 'INITIALIZATION' event'..

initialization.

write:/ '2'.

load-of-program.

write:/ '1'.

output will be

1

2

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
2,087

Hi,

<b>LOAD-OF-PROGRAM:</b>

The system always <b>automatically</b> processes this event when a program of type 1 (online report), type M (module pool), type F (function group) or S (subroutine pool) is loaded into an internal mode.

<b>INITIALIZATION:</b>

Before the selection screen the event will be triggered. We can this event only in Executable programs. i.e Report programs. This event is optional. whether we can use or not.

- Selvapandian Arunachalam

Read only

gbanik_in
Explorer
0 Likes
2,087

LOAD-OF-PROGRAM

First event to be called before any of the other ABAP code is processed.

INITIALIZATION

Called after the abap selection screen code has been processed (i.e. parameters, select-options etc) but before these are displayed to the user. So you can use it to initialize input fields of the selection screen or change the default values of these before the user gets to enter data into them.

Read only

0 Likes
2,087

Hi Gourab,

please see this is a thread of 2006, so please do not reply .