cancel
Showing results for 
Search instead for 
Did you mean: 

Select options default value

Former Member
0 Kudos

Hi,

Kindly assist me on how to set a default value for dynamically created Select options.

I am coding the below code snippet for default value and it's working but when I remove the default value for the select option on portal screen ...I encounter a dump stating line type does not match with internal table.

wd_this->m_wd_select_options = wd_this->wd_cpifc_wdr_select_options_e( ).

        • init the select screen

wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).

**

lt_range_table = wd_this->m_handler->create_range_table( i_typename = 'STRING' ).

assign lt_range_table->* to <range_table>.

insert initial line into table <range_table> assigning <range_table_line>.

assign component 'SIGN' of structure <range_table_line> to <sign>.

assign component 'OPTION' of structure <range_table_line> to <option>.

assign component 'LOW' of structure <range_table_line> to <low>.

assign component 'HIGH' of structure <range_table_line> to <high>.

<sign> = 'I'.

<option> = 'EQ'.

<low> = 'ZA'.

clear <high>.

wd_this->m_handler->set_range_table_of_sel_field(

i_id = 'DY_PARVW'

it_range_table = lt_range_table ).

Points will be rewarded!!!!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi.

I use the following code (snippet) to add default values:


lt_range = lr_selop->create_range_table(
                                    i_typename = 'VKORG' ).

  lr_selop->add_selection_field(
                     i_id = 'VKORG'
                     i_within_block = lv_id_gdata
                     i_no_intervals = abap_true
                     i_no_extension = abap_true
                     i_obligatory = abap_true
                     i_read_only = abap_true
                     it_result = lt_range
                     i_value_help_type = if_wd_value_help_handler=>co_prefix_none ).

DATA:
        lr_user        TYPE REF TO zcl_user,
        lr_param       TYPE REF TO data,
        lr_headerline  TYPE REF TO data.

  DATA:
        ls_tmprange    TYPE rsparams.

  FIELD-SYMBOLS:
                 <fs_param>      TYPE ANY,
                 <fs_range>      TYPE ANY,
                 <fs_rangetable> TYPE table.


  lr_user = zcl_user=>get_instance( ).
  lr_param  = lr_user->get_usermaster_param(
     param_name = param_name
  ).

  ASSIGN lr_param->* TO <fs_param>.
  MOVE <fs_param> TO ls_tmprange-low.
  IF ls_tmprange-low IS NOT INITIAL.
    ls_tmprange-sign = zcl_salsa_assistance=>userparam_sign_default.
    ls_tmprange-option = zcl_salsa_assistance=>userparam_option_default.

    ASSIGN lr_range->* TO <fs_rangetable>.
    CREATE DATA lr_headerline LIKE LINE OF  <fs_rangetable>.
    ASSIGN lr_headerline->* TO <fs_range>.
    MOVE-CORRESPONDING  ls_tmprange TO <fs_range>.
    APPEND <fs_range> TO <fs_rangetable>.
  ENDIF.

lr_user->get_usermaster_param( param_name = param_name ) just returns a data reference to a parameter value.

After assigning this value to the range table i do not have to call set_range_table_of_sel_field cause lr_range is already a reference to the range table.

This works well and I can remove the default value without getting dumps.

Cheers,

Sascha

Former Member
0 Kudos

Thanks Sascha for your reply..but I have a query

You have mentioned add_selection_screen method but don't we use it if we are going to add a new fields on selection screen.

In my case the select option is already created dynamically.

Also can you please explain what is zcl_user.

Please clarify.

Former Member
0 Kudos

I mentioned set_range_table_of_sel_field must not be used.

zcl_user is one of my classes. Do not care this class, as it has nothing to do with

the problem solved here.

I dynamically create the select options too .. and as soon as I received the range table i just add the default value to it (in wddoinit while creating the select options)

Cheers,

Sascha

Former Member
0 Kudos

Hi Sascha,

I too had a similar scenario, but unfortunately, things doesnt seem to work with or without SET_RANGE_TABLE_OF_SEL_FIELD method.

Actually I have created a Selection screen and on change of variant, I would have to like to reload the values in the selection screen. I tried this, and everything looks fine as long as I debug too. But when the actual screen is displayed, the old values are still on the screen. I cannot really populate the new values.

Please check my recent thread.

Let us know if you have some clue.

Regards

<i><b>Raja Sekhar</b></i>