Application Development 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: 

Default values in select options

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

Hi All,

Any clues...

Regards

Ram

uppu_narayan
Active Participant
0 Kudos

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

former_member282823
Active Participant
0 Kudos

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.

0 Kudos

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

0 Kudos

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.

mayur_priyan
Active Participant
0 Kudos

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.

pankaj_sandanshi
Explorer
0 Kudos

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.