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

what is difference between DEFAULT and INITIALIZATION

sudhakar196
Participant
0 Likes
953

what is difference between DEFAULT and INITIALIZATION?

give simple example

4 REPLIES 4
Read only

Former Member
0 Likes
855

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.

Regards,

Ferry Lianto

Read only

abdul_hakim
Active Contributor
0 Likes
855

hi

DEFAULT is used to set default values for the screen fields.

But INITIALIZATION is used to initialize the selection screen apart from setting default values

to the input fields..Confused?? Well,Suppose You want to display current date - 7 in the

selection screen input field..You cannot do so direcly using default alone..You need to do the

validation on the INITIALIZATION event.

something like sy-datum = sy-datum - 7

Cheers,

Hakim

Read only

Former Member
0 Likes
855

Hi,

Using default u can set the default value without any Conditions. But if u want to have default value based upon some conditions then u can use INITIALIZATION event. There is one more way of having default values and that is using SAP MEMORY

Read only

Former Member
0 Likes
855

hi,

This event is triggered when you execute your program for the first time i.e., before selection screen is displayed.

eg : 1

initialization.

if p_date is initial.

p_date = sy-datum + 7.

endif.

select-option : fldate1 for sflight-fldate.

eg2 : INITIALIZATION.

Data : date1 like sy-datum.

date1 = sy-datum - 30.

fldate1-low = date1.

fldate1-high = sy-datum.

append fldate1.

Default :

If you want to display DEFAULT VALUES for the selection criteria before your screen is displayed

eg : select-option : s_matnr for mara-matnr defaut '000098' to '76809067'.

hope this helps you.

sri