04-18-2013 7:53 PM
Hi All,
I had select options in my screen as follows:
select-options:s_f_curr for tcurr-fcurr,
s_t_curr for tcurr-fcurr.
I wrote in the INITILIZATION event for populating default values.
INITILIZATION.
Perform def_values.
form def_values.
s_f_curr-sign = 'I'.
s_f_curr-option = 'EQ'.
s_f_curr-low = 'EUR'.
append s_f_curr.
s_f_curr-sign = 'I'.
s_f_curr-option = 'EQ'.
s_f_curr-low = 'BRL'.
append s_f_curr.
endform.
But the problem is when i check the extended syntax check these statement comes under the obsolete statements.
How can we rectify this one.
I tried declared like below
data:ty_f_curr type range of tcurr-fcurr.
But how will write into the perform statement.
I need like subroutine like shown below.
perform def_values changing s_f_curr
s_t_curr.
form def_values rv_f_curr
rv_t_curr.
Inside what i need to write to populate default values
endform.
Can any one help me on this.
Regards
Ram
04-19-2013 4:47 AM
04-19-2013 6:18 AM
Hi Ram,
The reason it is shown obsolete is because of this statement append s_f_curr. you should append to table with workarea.......i have modified your code accordingly........and one more thing range table is obsolete dont use it.........goodbye
DATA ls_wa TYPE tcurr.
select-options: s_f_curr for ls_wa-fcurr,
s_t_curr for ls_wa-fcurr.
INITIALIZATION.
s_f_curr-sign = 'I'.
s_f_curr-option = 'EQ'.
s_f_curr-low = 'EUR'.
append s_f_curr to s_t_curr.
s_f_curr-sign = 'I'.
s_f_curr-option = 'EQ'.
s_f_curr-low = 'BRL'.
append s_f_curr to s_t_curr.
thanks and regards,
narayan
04-19-2013 6:22 AM
Hi Ram,
you can write the default values in the select-options itself by adding default addition to it.
For ex:
SELECT-OPTIONS: P_werks for lv_werks DEFAULT 1000 to 2000.
Regards,
Ramesh.
04-19-2013 6:46 AM
Hi Ramesh,
Does the above statement help us when we want to have more than one line initialized for select options? In the question, the user wants to have EUR and BRL in the input as default values. I am not really sure if we can achieve that. Do let us know if you could get it done.
~Athreya
04-19-2013 7:27 AM
Hi Ram,
In that case it won't work, only incase if it wants in one line we can use default, else the way you have done is correct, just take the work area and append it to the select-option.
DATA ls_wa TYPE tcurr.
data: ls_selopt type selopt.
select-options: s_f_curr for ls_wa-fcurr,
s_t_curr for ls_wa-fcurr.
INITIALIZATION.
ls_selopt -sign = 'I'.
ls_selopt -option = 'EQ'.
ls_selopt -low = 'EUR'.
append ls_selopt to s_t_curr.
clear ls_selopt.
ls_selopt -sign = 'I'.
ls_selopt -option = 'EQ'.
ls_selopt -low = 'BRL'.
append ls_selopt to s_t_curr.
Regards,
Ramesh.
04-19-2013 6:56 AM
Hi Ram,
The Obsolete statement was occuring because while appending the values you were doing it directly without using a work area,
as in append s_f_curr.
Just create a structure of type SELOPT and pass the values into this structure.
Then APPEND this structure into the corresponding SELECT-OPTIONS.
Ex: DATA: wa_sel TYPE selopt.
INITIALIZATION.
s_f_curr-sign = 'I'.
s_f_curr-option = 'EQ'.
s_f_curr-low = 'EUR'.
append wa_sel to s_t_curr.
04-19-2013 1:08 PM
You can use standard keyword DEFAULT as follows:
select-options:s_f_curr for tcurr-fcurr DEFAULT xyz,
s_t_curr for tcurr-fcurr DEFAULT xyz.