cancel
Showing results for 
Search instead for 
Did you mean: 

TabStrip - set a Tab dynamically in an Action

thomas_gaberthel
Explorer
0 Kudos

Hi Experts,

I'm building an application for flat file Uploads into alv. The view contains one TabStrip with two Tabs, one with the Content of flat file in an  ALV grid, the other tab with Messages. Depending on Content of flat file, I like to show tab with messages (in case of errors), or tab with flat file Content (successful load).

Has anyone an idea regarding coding?

Best regards, Thomas

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Thomas,

You can achieve your requirement as below

Create an attribute GV_CURRENT_TAB_ID of type string ... in attributes tab of view.

Set the tab id in your action as below

wd_this->gv_current_tab_id = 'TAB_ID1'.

Write the code in method WDDOMODIFYVIEW( )


data: lo_tabstrip type ref to cl_wd_tabstrip.

lo_tabstrip ?= view->get_element( 'MY_TABSTRIP' ). "replace by tab strip id

now you have the reference and you can call set_selected_Tab method

lo_tabstrip->set_selected_Tab(  WD_THIS->GV_CURRENT_TAB_ID ). " pass the TAB id to be shown

Hope this helps you.

Regards,

Rama

thomas_gaberthel
Explorer
0 Kudos

I get the Syntax error: Field "VIEW" is unknown. .....

ramakrishnappa
Active Contributor
0 Kudos

Hi Thomas,

VIEW object is available in WDDOMODIFYVIEW( ) method... Hope you are not writing the above code in wddomodifyview( ) method

Regards,

Rama

thomas_gaberthel
Explorer
0 Kudos

Hi Rama,

no I don't use this code in wddomodifyview method . It is an action started behind a button.

But how can I "define" the method WDDOMODIFYVIEW( ) in my Action?

ramakrishnappa
Active Contributor
0 Kudos

Hi Thomas,

WDDOMODIFYVIEW( ) method executes after every action and you need not to define this method it is standard method available in your view.

Let me know, if you are still having issues... I will suggest you other approach

Regards,

rama

thomas_gaberthel
Explorer
0 Kudos

see my screenshot

ramakrishnappa
Active Contributor
0 Kudos

Hi Thomas,

view reference is not available in your event handler method 'Do_upload'.

you need to get the view reference and then use that as below


data lo_view TYPE REF TO if_wd_view.
data: lo_tabstrip type ref to cl_wd_tabstrip.

"get view reference
lo_view ?= wd_this->wd_get_api( ).


lo_tabstrip ?= lo_view->get_element( 'TS_01' ). "replace by tab strip id

lo_tabstrip->set_selected_Tab('TAB_3'). " pass the TAB id to be shown

Regards,

Rama

thomas_gaberthel
Explorer
0 Kudos

Rama,

I can activate the application now. When I test the application, I get following dump:

ramakrishnappa
Active Contributor
0 Kudos

Hi Thomas,

lo_view ?= wd_this->wd_get_api( ).


That statement works for nw7.3 and above. Hope your system is not meeting that requirement.


Any way ...  please follow the below steps


  • Go to attributes tab of your view and create an attribute GO_VIEW .. type ref to IF_WD_VIEW
  • Now go to wddomodify ( ) method and save view reference into global Attribute GO_VIEW  as below

      

       If first_time = abap_true.

          Wd_this-> GO_VIEW = view.

        Endif.

  • In your action do_upload replace lo_view by wd_this->GO_VIEW

Hope this should work for u.

Regards,

Rama

thomas_gaberthel
Explorer
0 Kudos

Hi Rama,

YOU ARE THE BEST !!

It's running now. Many thanks and have a nice Weekend.

Best Regards,

Thomas

ramakrishnappa
Active Contributor
0 Kudos

Hi Thomas,

Its good to hear that your issue is resolved

Thank you and you too have a great weekend.

Regards,

Rama

Answers (0)