cancel
Showing results for 
Search instead for 
Did you mean: 

How to set value for dynamically created attribute

former_member199125
Active Contributor
0 Kudos

    Guys,

how can we set value to dynamically created attribute.

Regards

Srinivas        

Accepted Solutions (0)

Answers (1)

Answers (1)

amy_king
Active Contributor
0 Kudos

Hi Srinivas,

Interface IF_WD_CONTEXT_NODE_INFO has method ADD_ATTRIBUTE which allows you to dynamically create an attribute and assign various properties like NAME and DEFAULT_VALUE at the time of creation.

If you have already created the attribute, you can later assign it a value by calling the method IF_WD_CONTEXT_ELEMENT->SET_ATTRIBUTE. e.g,

  lo_context_element->set_attribute(
    name =  `ATTRIBUTE_NAME`
    value = some_value 
  ).

Can you give more information on the scenario in which you are setting its value?

Cheers,

Amy

former_member199125
Active Contributor
0 Kudos

Here the scenario is  i have created an attribute dynamically in some method say wddoint method.

later, in some button action i want to assign the value to dynamically created attribute... here we cannot directly refer the attribute name because attribute will created during run time, so if we use pass attribute name in set_attribute method it will throw error.

hope you understand the scenario.

Regards

Srinivas sana    

amy_king
Active Contributor
0 Kudos

The following blog posts by Thomas Szücs might help.

Dynamic Programming in Web Dynpro ABAP: