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

Why to use INITIALIZATION event in report ?

Former Member
0 Likes
10,168

It is defined that initialization event is used to set the default values before execution of report. However it can be done by direct giving initial value (e.g. a = b). Then why do we use INITIALIZATION event?

8 REPLIES 8
Read only

Former Member
0 Likes
4,678

it is not mendatory depend upon u ...

Initialisation -> This event is used when ever you initialize any variable or a field in your program.

this indicates the start of program .It is similar to Load of program .

this is the first event executed as the program is executed .

Read only

Former Member
0 Likes
4,678

Hi

This is the event which fires first, even before your selection screen pops up...

So any variables/ranges etc which need to be initialized should be populated in <b>Initialization </b>section... its a good programming practice to initialize all variables, workareas etc in Initialization section, and use them wherever required in the program flow.

Regards,

Raj

Read only

Former Member
0 Likes
4,678

Think that you have to select some data from any table like mara for the current date.In initialization event you can select that data from table and you can enter that data on the selection screen on execution.

Read only

Former Member
0 Likes
4,678

Hi Dinesh Singh,

If u r giving any value in Initialization , then it will execute when the event gets triggered, But when u give any value (e.g a = b) it will come defaultly.no execution required.

Reward me if it helps,

BALU.

Read only

Former Member
0 Likes
4,678

Hi,

With INITIALIZATION, we not only give the initial values but we can give the values to the screen fields, gui elements based on any conditions as per the requirement.

regards

Rakesh

Read only

Former Member
0 Likes
4,678

The event which gets triggered is INITIALAIZATION even before your selection screen pops up. So, if U need any variables to be initialized on selection screen as soon as it is shown, the variables are declared in the initialization part. It is very much useful as such.

Say, if u have a date field u can initialize as sy-datum.

for Orders u can give a range of values and initialize them for the selection screen.

As such initialization is very much useful in programming.

Read only

Former Member
0 Likes
4,678

Good ideas made me to get the answered for this dount in my mind...

Read only

0 Likes
4,678

ex-

REPORT ...
PARAMETERS: pa_date LIKE sy-datum DEFAULT sy-datum.
INITIALIZATION. " Default values for selection screen
pa_date = pa_date - 7.
START-OF-SELECTION. " Start of data processing
WRITE pa_date.

INITIALIZATION is an event that you can use if you need to set a large number of default values. This

event block allows you to set default values that can only be determined at runtime. In the above

example, the date 'A week ago' is calculated and placed in data object pa_date. The ABAP runtime

system then sends a selection screen to the presentation server containing the calculated value as a

default. The value can, of course, still be changed.