cancel
Showing results for 
Search instead for 
Did you mean: 

Select-Option Fields and report_attribute_t100_message( )

MichiFr
Participant
0 Kudos

Hi,

I've built a web dynpro with an embedded select-options view using component WDR_SELECT_OPTIONS.

One of those select options is a parameter, added using method add_parameter_field( ).

The parameters are properly displayed in the browser and I wanted to validate the user input and give an error message.

Currently I'm using that coding:

    
    l_element       TYPE REF TO if_wd_context_element,
    l_node_sel_opt  TYPE REF TO if_wd_context_node
    .
  l_node_sel_opt = wd_context->get_child_node(
   name = wd_this->wdctx_select_options
   ).
  l_element = l_node_sel_opt->get_element( )
[..]
wd_comp_controller->g_message_controller->report_attribute_t100_message(
        msg                       = l_symsg
        element                   = l_element
        attribute_name            = 'CHECKBOX_PERSKAUF' 

This coding works fine, the message is available on top of the page, however, I cannot navigate to the appropriate element. I guess I cannot do this with the coding I'm currently using because there is no relation between the select-options fields and the context element/attribute. Am I correct?

If yes, is this possible at all - build my own select-options and let the user navigate to the validated field via a error message click?

Accepted Solutions (1)

Accepted Solutions (1)

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

When you use select options component you automatically get the button CHECK.

so you can call the event ON_CHECK of select options i.e of WD comp WDR_SELECT_OPTIONS and do the validations accordingly and throw an error message.

Priya

MichiFr
Participant
0 Kudos

{rant on}

Has anybody actually read the problem I've got??

The answers here in the forum really do lack some quality! It seems that some guys here are just hunting for forum points instead of reading the postings from top to bottom and give comprehensive answers accordingly.

Please don't post any answer if you did not understand the problems at all. I appreciate if you try to be helpful, but if you don't actually get the intention behind the postings then please don't answer at all.

{/rant off}

So, I will try to repeat my message with different words in case somebody did not understand:

1) I've set up some select-options/parameters on a web-dynpro, using component WDR_SELECT_OPTIONS

2) the user clicks button check

3) the action on_check is fired which calls my method oncheck().

4) inside this method I'm doing some checks after fetching the values from the web-dynpro

5) if some validation errors occur, the method displays some error message in the message area on top of he page

6) the user cannot click on the error message to immediately focus the field where the validation failed.

That's the current coding.

What I want to get as a result, is that the error message from 5) should be click-able to let the user jump to the appropriate select-option parameter/field where the validation error was found.

That's all - nothing more. If somebody has actually done this before, please post some sample coding - thanks

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

you can get access to the context of component WDR_SELECT_OPTIONS

and select the corresponding element.

Regards,

Christian

Example for an error message on a Select-Option with ID "CUSTOMER"

name of comp_usage: SELECT_OPTIONS_SEARCH

METHOD check_selection .

DATA cmp_usage TYPE REF TO if_wd_component_usage.

DATA cmp_control TYPE REF TO iwci_wdr_select_options.

DATA contr_selop TYPE REF TO if_wd_controller.

DATA context_selop TYPE REF TO if_wd_context.

DATA root_node TYPE REF TO if_wd_context_node.

DATA node TYPE REF TO if_wd_context_node.

DATA element TYPE REF TO if_wd_context_element.

  • get reference of component usage

cmp_usage = wd_this->wd_cpuse_select_options_search( ).

IF cmp_usage->has_active_component( ) IS INITIAL.

cmp_usage->create_component( ).

ENDIF.

  • get reference of component controller ( WDR_SELECT_OPTIONS )

cmp_control = wd_this->wd_cpifc_select_options_search( ).

  • get reference of context

contr_selop = cmp_control->wd_get_api( ).

context_selop = contr_selop->get_context( ).

root_node = context_selop->root_node.

  • get node of select-option "CUSTOMER"

CALL METHOD root_node->get_child_node

EXPORTING

name = 'CUSTOMER'

RECEIVING

child_node = node.

  • get element

element = node->get_element( ).

  • fire message for select-option field "low"

CALL METHOD wd_this->go_mm->report_attribute_error_message

EXPORTING

message_text = 'TEXT'

element = element

attribute_name = 'LOW'.

ENDMETHOD.

Former Member
0 Kudos

Hi,

Thanks For sharing the information.

Regards,

Lekha.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

You are right.

Interface of select options component should provide a way out.

Abhi

MichiFr
Participant
0 Kudos

Interface of select options component should provide a way out.

Hi,

could you please explain a bit more? Is it possible to link a select option parameter/field and a message or not? Saying 'link' I mean the message in the message area should be clickable and the appropriate field should be highlighted and focused.

If yes, how should I change my coding to get this running?

Thanks!

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Interface Controller of WDR_SELECT_OPTIONS should have some way( methods ) to throw Attribute exceptions/error messages, however i don't see any such method available in the component.

I don't think it is possible with select options

Abhi

abhimanyu_lagishetti7
Active Contributor
0 Kudos

You are right.

Interface of select options component should provide a way out.

Abhi