cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass value to subnode

Former Member
0 Kudos

Hi

i have a node as 'node_1' and subnode as 'snode_2'.

snode_2 has 4 attributes.

i binded this node with a table...

now i want to pass value to the subnode 'snode_2'.

code

DATA lo_nd_node1 TYPE REF TO if_wd_context_node,

lo_nd_snode_2 TYPE REF TO if_wd_context_node,

lo_el_node2 TYPE REF TO if_wd_context_element,

ls_snode_2 TYPE wd_this->elements_node2.

lo_nd_snode_2 = wd_context->get_child_node( name = 'NODE_1.SNODE_2' ).

SELECT carrid connid fldate price from sflight into CORRESPONDING FIELDS OF TABLE ls_snode_2.

LO_ND_NODE2->BIND_TABLE( ls_snode_2 ).

error:

Subnode firstview.node_1.snode_2' does not exist

Accepted Solutions (0)

Answers (4)

Answers (4)

uday_gubbala2
Active Contributor
0 Kudos

Hi,

the best & easiest way for populating your subnodes with data would be to make use of the concept called, "[Supply Function|http://help.sap.com/saphelp_nwmobile71/helpdata/en/f1/177741adb7167de10000000a155106/content.htm]" in Web Dynpro ABAP. You would have to first understand the concepts of Supply function & Singleton. Just try go through the sap help link which I had shared with you to have a basic theorotical overview of the same.

In this approach you associate a method (supply function method) with your subnode & this would get triggered whenever the leadselection changes for the parent root node. To put it in other words suppose you have 2 tables displaying information from MARA & MAKT. You have 2 context nodes MARA & MAKT. You create MAKT as a subnode of MARA and associate a supply function with the MAKT node. So whenever the user does a lead selection in the table bound to MARA, the system would automatically trigger the supply function method for MAKT. The system does pass on the reference of the lead selected row in MARA. So you can easily fetch the relevant MAKT data and bind it to your node within this method.

Go through this [pdf|http://www.octavia.de/fileadmin/octavia_files/content_bilder/Hauptnavigation/SAP_NetWeaver/WebDynpro/Web_Dynpro_Part_IV.pdf] where they explain with an example as to how you can work with supply functions in Web Dynpro ABAP.

You can go through this [pdf|/people/thomas.szcs/blog/2006/12/13/web-dynpro-abap--singleton-context-nodes-revisited] for more information about singleton nodes.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Try go through this [pdf|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814] for more information about how you can work with context nodes and attributes. Its a very small document but it does help equip you with all the basic fundamentals for working with context.

Regards,

Uday

Former Member
0 Kudos

Hi,

DATA lo_nd_node1 TYPE REF TO if_wd_context_node,
lo_nd_snode_2 TYPE REF TO if_wd_context_node,
lo_el_node2 TYPE REF TO if_wd_context_element,
ls_snode_2 TYPE wd_this->elements_node2.
lt_table type standard table of <<strucure name>>.

lo_nd_node1 = wd_context->get_child_node( name = 'NODE1' ).
lo_nd_snode_2 = lo_nd_node1->get_child_node( name = 'NODE_1.SNODE_2' ).


*Here there will be a mismatch you cant directly move data to ls_snnode2 because this holds the elements reference.


SELECT carrid connid fldate price from sflight into CORRESPONDING FIELDS OF TABLE lt_table.
LO_ND_NODE2->BIND_TABLE( lt_table ).

Regards,

Lekha.

uday_gubbala2
Active Contributor
0 Kudos

Hi,

You need to change your syntax a bit in order to retrieve the reference of your subnode. You can follow 2 approaches:

DATA lo_nd_node1 TYPE REF TO if_wd_context_node,
lo_nd_snode_2 TYPE REF TO if_wd_context_node.


lo_nd_node1 = wd_context->get_child_node( name = 'NODE_1' ).

lo_nd_snode_2 = lo_nd_node1->get_child_node( name = 'NODE_2' ).

Or

lo_nd_snode_2 = wd_context->path_get_node( 'NODE_1.NODE_2' ).

Regards,

Uday