cancel
Showing results for 
Search instead for 
Did you mean: 

active tab in tab_strip

Former Member
0 Kudos

Hi,

I have a tebstrip with 4 tabs and a button in my view

if i click the button the tab 1 should be selected in the tabstrip.

please let me know how to do this in codeing.

Regards,

Kumar K

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Say suppose I have a context node by name NODE & an attribute by name SELECTEDTAB of type STRING under this node. I bind the selectedTab property of my TabStrip to this context attribute. (i.e., MAIN.NODE.SELECTEDTAB ) Now I place a button and create an action handler for this SET_FOCUS_ONTAB1. Below is the coding for my buttons action handler:

METHOD onactionset_focus_ontab1 .
  DATA: wd_node TYPE REF TO if_wd_context_node.
  wd_node = wd_context->get_child_node( name = 'NODE' ).
  wd_node->set_attribute( EXPORTING name  = 'SELECTEDTAB'
                                    value = 'TAB1' ).
ENDMETHOD.

Regards,

Uday

Former Member
0 Kudos

Uday,

actually i know that. but i want do it with out node and attribute.

if i start createting node and attributes for each properties it will reach nearly thousand for

single view.

I think we can code without node or attribute is pretty good.

But i dont know which is best ..

please let me know shall wether i create Node attributes for each properties like tab_strip.

or can i do the same without node and attribute.

Regards,

Kumar K

uday_gubbala2
Active Contributor
0 Kudos

Hi Kumar,

This is the approach suggested by SAP. Whenever you want to modify any particular property of an ui element we need to have it bound to some context attribute & we modify the value of this context attribute. We can even do it using dynamic programming but this way we would end up changing the ui elements properties in a method other than the WDDOMODIFYVIEW which is strongly not suggested. However am just giving you the methodology & code for the dynamic programming approach code just for your understanding:

1) Fetch the reference of your tabstrip by passing its ID within your WDDOMODIFYVIEW

2) Save the reference obtained in a view level attribute

3) Now within your action handler method just use this reference to set the desired tab as selected

Regards,

Uday

method WDDOMODIFYVIEW .
  check first_time = abap_true.
" Fetching the reference of the tabstrip. My tabstrip id is TABSTRIP
    wd_this->gv_tabstrip ?= view->get_element( id = 'TABSTRIP' ).
endmethod.

METHOD onactionset_focus_ontab1 .
" Use the earlier obtained reference to set the first tab as selected
" My first tab's id is TAB1
  wd_this->gv_tabstrip->set_selected_tab( value = 'TAB1' ).
ENDMETHOD.

Former Member
0 Kudos

Thanks uday,

Now i am useing the context attribute for set the selected tab.

and your code for dynami codeing also use ful.

Thanks & Regards,

Kumar K

Answers (1)

Answers (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Kumar,

This is easy. Just create a context attribute of type STRING & bind it to the selectedTab property of your TabStrip. Now when the user presses on the button just set the value of this context attribute to the ID of your first tab.

Regards,

Uday