cancel
Showing results for 
Search instead for 
Did you mean: 

How to validate obligatory select-options

AlexGiguere
Contributor
0 Kudos

Is there an automatic way to validate obligatory select-options or parameters created with the reusable component WDR_SELECT_OPTIONS?

I know that for standard field, we can used the method

cl_wd_dynamic_tool=>check_mandatory_attr_on_view( lr_view_ctr ).

in the event method WDDOBEFOREACTION and it works fine

Alex

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Alexandre,

if you want to display your own messages for mandatory fields you can try like this

data lr-value type ref to data.

lr_value = wd_this->l_handler->get_value_of_parameter_field( i_id = ' '). '' l_handler is an attribute of IF_WD_SELECT_OPTIONS

if lr_value is initial.

use code wizard to call message manager to show the exception

endif.

Thanks

Bala Duvvuri

Former Member
0 Kudos
*Add a Selection Screen Field
  lr_helper->add_selection_field( i_id = 'S_CARR_ID'
  it_result = lt_range
  i_obligatory = 'X'   <<======
  i_description = 'description' ).

Define your code according to above, then this mandatory field check will be automatic.

AlexGiguere
Contributor
0 Kudos

I know that, this is how I added my select options on my view. No, it's not automatic, you can call an outbound plug for navigation and if your obligatory select options are empty, the framework will let you to go further in your processing.

Alex