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 initialization and default

Former Member
0 Likes
1,352

hi guru

when ever we r using

parameters : p(30) type c default 'sapabap'.

and

prameters : p(30) type c.

initialization.

p = 'srinivas'.

difference...

and select-options and initialization

4 REPLIES 4
Read only

Former Member
0 Likes
887

Hi,

Initialization is the section where the initialization of internal tables, variables, select-option fields, parameters etc takes place.

True, that you can default the values too for parameters/select-option fields in selection-screen.

This event is invoked directly after LOAD-OF-PROGRAM and before the selection screen processing of any existing standard selection screen.

This gives you the one-time opportunity to initialize the input fields of the selection screen, including those defined in the logical database linked with the program.

When run in background, values initialized in initialization event are considered.

For eg: if you want to initialize like this:

carrid-sign = 'I'.

carrid-option = 'EQ'.

carrid-low = 'AA'.

carrid-high = 'LH'.

APPEND carrid TO carrid.

You cannot achieve this by giving 'default' or 'value' at selection-screen.

<b>Default keyword</b> is used for assigning default values to varaiables, parameters

Refer to these related threads

Thanks.

Read only

JozsefSzikszai
Active Contributor
0 Likes
887

hi srinivas,

default will be the same always and for everyone but in initialization you can apply some more logic, something like:

initialization.

if sy-uname = 'srinivas'.

p = 'srinivas'.

else.

p = 'not srinivas'.

endif.

hope this helps

ec

Read only

Former Member
0 Likes
887

Hi,

parameters : p(30) type c default 'sapabap'.

In the above statement the value sapabap will be displayed in the selection screen and if you want to change the value you can change value in the selection screen.

parameters : p(30) type c.

initialization.

p = 'srinivas'.

In the above mentioned code the value in initialized at the run time. You cannot change the value in runtime.

Thanks,

Sriram Ponna.

Message was edited by:

Sriram Ponna

Read only

Former Member
0 Likes
887

hi,

initialization will intialize the variables

data : var(10) type c.

default value is

data : var(10) type c default 'ABC'.

reward with points if helpful.