cancel
Showing results for 
Search instead for 
Did you mean: 

Manual Selection Change Behaviour for TabStrips

preston_freeland
Explorer
0 Kudos

I have a web dynpro for abap application that contains a tab strip. This tabstrip contains multiple tabs with ALV grids imbedded where users can enter information. I am using the data check method to catch and validate entries upon enter or action. If the user changes a cell and changes tabs without pressing enter or some other function, the changes are not validated. I know you can use the onSelect event to validate this data and then manually call the selected tab, I'm just not sure how to implement it. Any help would be greatly appreciated.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can have a context attribute that holds the name of the currently selected tab. In the OnSelect method, read the context of your ALV (which will already have the changed values bound), and depending on that, set the context attribute selected_tab to whichever tab you wish to navigate. In the modifyview method, get the reference of your tabstrip and set the selected tab manually.

Your code in the On Select will be to read context, validate and set the selected tab attribute to the name (ID) of the tab you have specified in the design time.

In the modify view, do this:

data: lr_tabstrip type ref to cl_wd_tabstrip,

lr_context type ref to cl_wd_context_element,

lv_seltab type string.

lr_tabstrip ?= view->get_element( 'TABSTRIP' ).

lr_context = wd_context->get_element( ).

lr_context->get_attribute(

exporting

name = 'SELECTED_TAB'

importing

value = lv_seltab ).

lr_tabstrip->set_selected_tab( lv_seltab ).

Hope this helps.

Regards,

Nithya

preston_freeland
Explorer
0 Kudos

Thanks for you help.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Preston,

In the action handler method of TabStrip, you can get the new tab id using the importing parameter io_wdevent as follows

io_wdevent->get_string('TAB') ---> returns the new tab that is selcted.

io_wdevent->get_string('OLD_TAB') ---> returns previous tab from which new tab is selected.

depending on the old tab, you can do the validation logic as you want.

One more information is, what about writing the validation logic in the WDDOBEFOREACTION method, if it works for you then it would be the best option to have the validation logic.

Hope this will help you.

Thanks,

Prashanth