‎2007 Oct 15 1:32 PM
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
‎2007 Oct 15 1:33 PM
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.
‎2007 Oct 15 1:34 PM
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
‎2007 Oct 15 1:38 PM
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
‎2007 Oct 15 1:44 PM
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.