cancel
Showing results for 
Search instead for 
Did you mean: 

Caption element at runtime

Former Member
0 Kudos

Hi,

How do I change the text og af Caption element at runtime.

Thanks,

Morten

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Morten,

You can bind the text property of the UI element to the attribute in the context.

Based on the value settings u make to the attribute that value will be shwon.

The attribute type shuld be string.

Hope it helps.

Regards,

Shashikanth. D

Answers (2)

Answers (2)

pranav_nagpal2
Contributor
0 Kudos

Hi Morten,

You have to create a context attribute of type string and you have to bind the text property of this caption with this attribute..... now at run time when you want to give the text to this caption write this code...

data: lo_nd_cn_pernr        type ref to if_wd_context_node,
        lo_el_cn_pernr        type ref to if_wd_context_element,
       lv_ca_pernr type String.
  lo_nd_cn_pernr = wd_context->get_child_node( name =
                                             wd_this->wdctx_cn_pernr ).

*get element via lead selection

  lo_el_cn_pernr = lo_nd_cn_pernr->get_element(  ).

*set single attribute
lv_ca_pernr = 'Hello'
  lo_el_cn_pernr->set_attribute(
    exporting
      name =  `CA_PERNR`
      value = lv_ca_pernr ).

regards

Pranav

Former Member
0 Kudos

Found out myself