‎2008 Jul 08 4:10 PM
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?
‎2008 Jul 08 4:12 PM
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
‎2008 Jul 08 4:12 PM
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
‎2008 Jul 08 4:13 PM
‎2008 Jul 08 4:17 PM
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
‎2008 Jul 08 4:17 PM
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
‎2008 Jul 09 4:37 AM
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