cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set a context root attribute?

Former Member
0 Kudos

Hi,

I have created an attribute (type: string) called "ACTION" directly under the context root node which I want to set dynamically. But all my tries failed and now I don't know if it is possible at all.

My current solution is

lo_el_context = wd_context->get_element(  ).

  lo_el_context->set_attribute(
      name =  `ACTION`
      value = lv_action ).

It has a default value which I try to change by this code.

Any ideas?

Best regards, Steffen

Edited by: Steffen Weber on Aug 4, 2008 11:03 AM

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

you can use

wd_context->set_attribute( name = 'ACTION' value = '<value>' ).

Abhi

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi steffen,

The thing which you are doing is possible (u can have an attribute directly under context node whose value u can change dynamically).

And the way which you are doing it is also correct .

I tried the same way and i think i am getting it.

Please see the below code its working for me and it may work for u also.

data lo_el_context type ref to if_wd_context_element.

data ls_context type wd_this->element_context.

data lv_test like ls_context-test.

lo_el_context = wd_context->get_element( ).

lo_el_context->get_attribute( exporting name = `TEST` importing value = lv_test ).

lv_test = 10.

lo_el_context->set_attribute( exporting name = 'TEST' value = lv_test ).

clear lv_test.

lo_el_context->get_attribute( exporting name = `TEST` importing value = lv_test ).

just try to understand why i want to show(u can debug this code). Here i have created an attribute TEST under context node and which didnt have any value...i am storing a value in in and trying to get it (and i am getting it).

So i think u r trying to do the right thing.

steffen_weber
Employee
Employee
0 Kudos

That's it, thanks a lot!!!