cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine view element from context node

russell_day2
Participant
0 Kudos

I have been asked to position the cursor to the first element with an error after validation. I can get a list of error messages from IF_WD_MESSAGE_MANAGER, and from that I can get the element and attribute in the context node. However, to set the focus, I have to refer to a view element. Is there a neat way of doing this?

Thanks for your help

Accepted Solutions (0)

Answers (1)

Answers (1)

russell_day2
Participant
0 Kudos

OK, I will do the George thing and answer my own question.

The solution comes from an unlikely source - WDR_TEST_FOCUS - who would have thought?

This allows me to set the focus knowing the context element rather than the view element.

In this particular example, the focus is set to a table cell.

l_node = wd_context->get_child_node( 'SPFLI' ).

l_element = l_node->get_element( index = l_index ).

if l_element is bound.

. l_api = wd_this->wd_get_api( ).

. l_api->request_focus( context_element = l_element

. attribute = l_attribute ).

endif.