cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to bind elements to context

Sharathmg
Active Contributor
0 Kudos

Hello all,

As part of POC, I have created a table and have to push some dummy(hard-coded) data into the table. I have the reference to context node. But, there are methods to bind element/elements/structure to the node and not to add element to node.

Now, i tried to populate the element and add it to internal tab and bind it to context node. It creates an entry in table but the data is not displayed.

The code is given below:

method WDDOINIT .

DATA lo_nd_zviposhead TYPE REF TO if_wd_context_node.

DATA lo_el_zviposhead TYPE REF TO if_wd_context_element.

DATA ls_zviposhead TYPE wd_this->element_zviposhead.

TYPES: BEGIN OF ty_itab,

node_elements TYPE REF TO if_wd_context_element,

END OF ty_itab.

DATA: element_itab TYPE table of ty_itab,

wa_element type ty_itab.

  • navigate from <CONTEXT> to <ZVIPOSHEAD> via lead selection

lo_nd_zviposhead = wd_context->get_child_node( name = wd_this->wdctx_zviposhead ).

  • @TODO handle not set lead selection

lo_el_zviposhead = lo_nd_zviposhead->create_element( ).

***lo_el_zviposhead->set_attribute( name = 'FIELD1' value = '0.601.010.005').

***lo_el_zviposhead->set_attribute( name = 'FIELD2' value = 'Ordered').

***lo_el_zviposhead->set_attribute( name = 'FIELD3' value = '4').

***lo_el_zviposhead->set_attribute( name = 'FIELD4' value = '14').

***lo_el_zviposhead->set_attribute( name = 'FIELD5' value = '0').

wa_element-node_elements = lo_el_zviposhead.

append wa_element to element_itab.

<< the above code is repeated to add 3 more sets of data >>

Accepted Solutions (0)

Answers (3)

Answers (3)

Sharathmg
Active Contributor
0 Kudos

It was answered in similar thread in the same forum.

Sharathmg
Active Contributor
0 Kudos

It was answered in similar thread in the same forum.

ChrisPaine
Active Contributor
0 Kudos

Please be aware this is a duplicate thread - please ref to thread

Sharath, could you please close this thread/mark it as answered so that others don't accidentally try to reply!

Thanks,

Chris