cancel
Showing results for 
Search instead for 
Did you mean: 

change tab text

former_member305388
Active Contributor
0 Kudos

Hi Experts,

I have a standard webdynpro screen which has a Tabstrip having different tabs. For one of the tabs in the Tab Strip I want to change the Tab text on certain condition during runtime.

When I check the Tab property, the propery Caption is holding the Text for the Tab. Is it possible to change the text during runtime?

I would need to create and assign an OTR text to make enable the text in other login, so I is it possible to create another caption and bind it during runtime? or anyother option?

Accepted Solutions (1)

Accepted Solutions (1)

ChandraMahajan
Active Contributor
0 Kudos

Is it possible to change the text during runtime?

> I would need to create and assign an OTR text to make enable the text in other login, so I is it possible to create another caption and bind it during runtime? or anyother option?

As the text property of the caption of the Tab is bindable, Yes you can bind it at runtime. As you mentioed it is standard component, you need to use enhancment concepts to do this.

you can create OTR and then use below code,

 

  data: lw_alias   TYPE sotr_alias,
        lw_otr         TYPE string.

 data: l_otr type ref to cl_sotr.
  IF NOT l_otr IS BOUND.
    CREATE OBJECT l_otr.
  ENDIF.

       lw_alias = 'Z_OTR_TAB_TEXT'.
*    Get OTR text
        CALL METHOD l_otr->get_text_by_alias
          EXPORTING
            i_alias = lw_alias
          IMPORTING
            e_text  = lw_otr.


*     set single attribute
  lo_el_tab_text->set_attribute(
    EXPORTING
      name =  `TAB_TEXT`    "TAB_TEXT is attribute having type string
      value = lw_otr. ).

Thanks,

Chandra

former_member305388
Active Contributor
0 Kudos

Hi Chandrashekhar ,

I was checking the tab class CL_WD_TAB but could not find any binding method for adding a new caption. Can you tell me what method can be used?

ChandraMahajan
Active Contributor
0 Kudos

Hi,

I mentioned that you have Tabstrip UI element which consists of different Tabs. Inside this Tab UI element, the Tab description is displayed by Caption UI element. I am saying to create an attribute of type String and then bind it to the Text property of Caption UI element.

Now as it is standard WD component, you need to use concepts of enhancing WD component. refer http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/700317da-bd79-2c10-368e-8f18bf5d8... and http://help.sap.com/saphelp_nw04s/helpdata/en/3a/f6ba42a950da11e10000000a155106/frameset.htm

Thanks,

Chandra

Answers (0)