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

INITIALIZATION and IN PARAMETERS

Former Member
2,717

hi friends,

we can set default values at INITIALIZATION and IN PARAMETERS .than what is the difference between them?what is the use of INITIALIZATION?

6 REPLIES 6
Read only

Former Member
0 Likes
1,729

hi,

It is true that we Can Set values in IN PARAMETERS and In INITIALIZATION.

But there is difference in the two.

While using the In PARAMETER we can define the initial value of the variable which can be changed.

IF one of our parameter initial value is based on some calculation then we perform this calculation in the INITIALIZATION.

Regards

Sumit AGarwal

Read only

Former Member
0 Likes
1,729

The default value you set in parameters statement is not dynamic.

where as you can set the initial value dynamically using variables in Initialization.

Regards,

Ravi Kanth Talagana

Read only

Former Member
0 Likes
1,729

Hi Vinod,

In INITIALIZATION Event we can make some calculations and we can display them on the Selection screen.

Like to display the last date of the previous month in the date field.

Best regards,

raam

Read only

Former Member
1,729

hii!

Yes you can set default values in both the cases.

But in case of default you can just mention the default value.

While in case of INITIALIZATION, you can perform some operation on default values.

Just have a look at this sample code.


PARAMETERS:
  p_dat TYPE sy-datum DEFAULT sy-datum.


INITIALIZATION.

  p_dat = sy-datum + 7.


START-OF-SELECTION.

  WRITE: p_dat.

Regards

Abhijeet

Edited by: Abhijeet Kulshreshtha on Jul 9, 2008 5:33 AM

Edited by: Abhijeet Kulshreshtha on Jul 9, 2008 6:17 AM

Read only

Former Member
0 Likes
1,729

Hi,

The difference lies in the business application requirment.

In case of Default value of PARAMETERS we set set fixed value which remains same whenever you execute the code.

e.g.

PARAMETERS: 
         P_VAR type i default 12.

Here P_VAR will always take initial value 12.

but, in real business senario, sometime we face some requirment like 'the date field to be set to 1st day of the month of the daya of execution of code.'. here the initial value varies based on the day of excution and we need to calculate it.

This kind of initialization is based on calculation and we do it in INITIALIZATION Event.

e.g.

PARAMETERS:
   p_date like sy-datum.

INITIALIZATION.
    p_date = sy-datum.
    p_date+6(2) = '01'.

Here lies the difference.

Anirban Bhattacharjee