cancel
Showing results for 
Search instead for 
Did you mean: 

activating tabstrip when triggering an event in WDA application

Former Member
0 Kudos

Hi friends,

I have created a wda application where i have 3 tabstrips and in each tabstrip displayng a tableview.When the user clicked on button in the tab1 it should navigate to tab2 and display the data accordingly. This is what my requirement should be.

But am unable to activate tab2 in the action method.I have written the following code in button event of tab1.

<b>Method onnext.

<b>CONTROLS tab TYPE TABSTRIP.

tab-activetab = 'TAB2'.</b>

-

--

endmethod.</b>

But its throwing an error which is "CONTROLS can only be defined globally".

Please guide where should i define this tab(CONTROLS) or if this way of doing is wrong please guide how to activate a tab when triggering an event.

Regards

Sireesha.

Accepted Solutions (1)

Accepted Solutions (1)

mohammed_anzys
Contributor
0 Kudos

Hi Sireesha,

You could use CL_WD_TABSTRIP SET_SELECTED_TAB for setting the selected tab , not CONTROLS

Thanks

Anzy

mohammed_anzys
Contributor
0 Kudos

Hi Sireesha,

You can following steps.

Step 1. Create an attribute in your context ,with name TABSEL of type string and give the default value as the DEFAULT tab you want to select.

Step 2. In your action code, Check which tab you want to select and bind that value to the TABSEL attribute in your context.

Step 3. In your WDDOMODIFY , write the following code ,where you will be fetching the default TABSEL and will be making that default dynamically.

I am sure , these steps will solve your problem

Tahnks

Anzy

Data:lo_tab type CL_WD_TABSTRIP,

TABSSEL type string.

CALL METHOD WD_CONTEXT->GET_ATTRIBUTE

EXPORTING

  • INDEX = USE_LEAD_SELECTION

NAME = 'TABSEL'

  • IMPORTING

  • VALUE = TABSSEL

.

lo_tab ?= view->get_element( 'TABSTRP' ).

lo_tab->SET_SELECTED_TAB( value = TABSSEL ).

mohammed_anzys
Contributor
0 Kudos

Hi Sireesha,

Does it solve your problem?..Please post if you need anymore clarifications.

Thanks

Anzy

Former Member
0 Kudos

Hi Mohammed,

Thank you for ur quick reply and am sorry for the delay as was on leave.

I have tried the way which u have guided me. But could u please tell me

whats wrong in the below step.

<b> lo_tab ?= view->get_element( 'TABSTRP' ).</b>

As per my understanding we will get tab name in lo_tab for the above step. Am i correct?

But am getting error at the above step as "view is unknown"...

I have tried by replacing view with the view name , say for ex, if my view name is "tabstrip_view" then the above step will be as below.

<b>lo_tab ?= tabstrip_view->get_element( 'TABSTRP' ).</b>

Please guide me what would be the mistake in the above line.

Thanks & regards

Sireesha.

Former Member
0 Kudos

Hi ,

Could anybody please guide me how to navigate to second when triggering an event.Please help me. its urgent..

Regards

Sireesha.

Former Member
0 Kudos

If you are getting the error 'view is unknown', then your code is not in the modifyview method. You should put the code given by Anzy in the wddomodify method.

Regards

Nithya

Former Member
0 Kudos

Hi nithya,

I have tried the way which anzy has given. But in tab1 when am clicking on button its not going to tab2.It still staying in tab1 itself. Here am posting the code. Could you or anybody please check if anything wrong.

I have 2 tabs called HEADER and ITEM.In the HEADER tab i have a button called NEXT. So when i clickn on NEXT it should go to tab ITEM where it should display the data from the first tab.

I have created a view context TABSEL where the default values is tab : HEADER.

method for ONACTIONITEMNEXT (which is for HEADER button NEXT )

-


DATA:

ELEM_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENt,

STRU_CONTEXT TYPE WD_THIS->ELEMENT_CONTEXT ,

ITEM_TABSEL LIKE STRU_CONTEXT-TABSEL.

  • get element via lead selection

ELEM_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).

  • get single attribute

ELEM_CONTEXT->GET_ATTRIBUTE(

EXPORTING

NAME = `TABSEL`

IMPORTING

VALUE = ITEM_TABSEL ).

ITEM_TABSEL = 'ITEM'.

-


and the code in the modifyview is same as anzy has given....

Please guide where its wrong...

Help me out..

Regrads

sireesha.

Former Member
0 Kudos

If you are using a context attribute TABSEL, then you can have this code in the event handler of the 'Next' button itself. Only if you are using the view->get_element( ) it needs to be coded in the modifyview method.

What you are doing is getting the attribute from the context and changing it locally. What is missing is binding it to the context again. Add the following code after your existing code:

Elem_context->set_attribute(

exporting

name = 'TABSEL'

value = item_tabsel

).

Make sure the <b>selectedTab</b> property of the tabstrip is bound to the tabsel attribute.

Regards

Nithya

Former Member
0 Kudos

Hi nithya,

Could you please tell me how to call set->attribute method ?

i have tried the way how you will normally read the contect thru code wizard. But am not getting set attribute method. Could you please tell me how to call this?

Regards

Sireesha.

Former Member
0 Kudos

You will not get set_attribute method through the wizard. Copy the call to get_attribute and change it to set_attribute. Instead of one exporting and one importing parameter, set_attribute will have both exporting parameters, name and value.

Regards

Nithya

Former Member
0 Kudos

Nithya,

I have added the code after get_attribute method in the action.

my tabstrip property selectedtab is set to ITEM( to which tab from HEADER tab navigates).

still what else i need to make changes.

Could you please look into the issue where am missing.....

I should finish it up soon but unable to fix it...

help me out.

regards

sireesha

Former Member
0 Kudos

Nithya,

After adding the code to set attribute to context still its not going to seocnd tab ITEM. Where else i need to make chnages. Plesse guide me..

Regards

Sireesha.

Former Member
0 Kudos

The selectedTab property should not be statically specified as ITEM. It should be bound to the context attribute tabsel. To do this, click on the button next to the selectedTab property, there will be a popup. Select the attribute TABSEL in the popup. So depending on what value to specify in TABSEL, the corresponding tab will be selected. If you set_attribute as HEADER, the first tab will be selected. If you specify ITEM, second tab and so on.

Regards

Nithya

Former Member
0 Kudos

Nithya,

I have made the changes as what you have said above.But its not working.Here am giving action and modifyview code. Please check is it correct or anything missing.

ONACTIONITEMNEXT

-


DATA:

ELEM_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENt,

STRU_CONTEXT TYPE WD_THIS->ELEMENT_CONTEXT ,

ITEM_TABSEL LIKE STRU_CONTEXT-TABSEL.

  • get element via lead selection

ELEM_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).

  • get single attribute

ELEM_CONTEXT->GET_ATTRIBUTE(

EXPORTING

NAME = `TABSEL`

IMPORTING

VALUE = ITEM_TABSEL ).

ITEM_TABSEL = 'ITEM'.

ELEM_CONTEXT->SET_ATTRIBUTE(

EXPORTING

NAME = `TABSEL`

VALUE = ITEM_TABSEL ).

endmethod.

-


WDDOMODIFYVIEW

-


Data:lo_tab type ref to CL_WD_TABSTRIP,

TABSSEL type string.

DATA:

ELEM_CONTEXT TYPE REF TO

IF_WD_CONTEXT_ELEMENt,

STRU_CONTEXT TYPE WD_THIS->ELEMENT_CONTEXT ,

ITEM_TABSEL LIKE STRU_CONTEXT-TABSEL.

  • get element via lead selection

ELEM_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).

  • get single attribute

ELEM_CONTEXT->GET_ATTRIBUTE(

EXPORTING

NAME = `TABSEL`

IMPORTING

VALUE = ITEM_TABSEL ).

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

lo_tab->SET_SELECTED_TAB( value = TABSSEL ).

-


Please guide me if anything am missing .....

Regards

sireesha.

Former Member
0 Kudos

Hi Sireesha,

You dont need both event handler and code in the modify view. Any one will do, both achieve the same functionality. I would suggest to comment out the code in the modifyview method. Just use the event handler. The most important thing is the binding of the selectedTab property. Do that and it should work.

Regards

Nithya

Former Member
0 Kudos

Nithya,

Thank you so much for your patience in replying me.

Now everything is working fine. But by default its displaying second tab ITEM instead of first tab HEADER. nowhere i didnt set the default tab as ITEM. iam consfusing from where its displaying second tab ITEM as default.

Is there any way where can i change the default tab property...

Regards

Sireesha

Former Member
0 Kudos

In the wddoinit of your view, do a set_attribute of TABSEL to 'HEADER', so that will be selected when you load the application initially. Then as you change the selection it will get changed.

Ideal thing would be to do the coding to change the tab in the on tab selection change event. Please award points and close the thread if your problem is solved.

Regards

Nithya

Former Member
0 Kudos

Nithya,

Thanks for ur reply.

Its working fine now.

Am assigining the points to you.

Once again thank u for ur reply.

Catch u in the next thread.

Regards

sireesha.

Answers (0)