cancel
Showing results for 
Search instead for 
Did you mean: 

what is the need of reference by attribute wd_context ?

Former Member
0 Kudos

Hi friends...

I am new to WDA..

I hav some basic doubts...

l_sflight = wd_context->get_child_node( 'DATA_TAB' ).

l_sflight->bind_table( t_table1 ).

in tha above statement, get_child_node and bind_table are the methods of interface IF_WD_CONTEXT_NODE. if its correct..

why get_child_node is reference by attribute wd_context and bind_table is not reference by wd_context attribute..

give me some ideas..

Regards

Deva

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Deva,

WD_CONTEXT is the reference to the controller's context root node, and thus to the entire context.

Each controller method automatically recognizes the reference to the root node of its associated context. This reference is called WD_CONTEXT and is always of the type IF_WD_CONTEXT_NODE. The GET_CHILD_NODE method now enables the generation of a reference to the required subnodes. In Webdynpro ABAP you basically work with context nodes and attributes. So suppose if you want to read the value from a context attribute then you need to do 2 things:

1) Get the reference of the node under which the attribute has been created.

2) Use the corresponding class method up on this obtained reference

So in your example you were trying to bind an internal table with values to a context node. So you first get the node reference using the statement:

l_sflight = wd_context->get_child_node( 'DATA_TAB' ).

And then you are calling the bind_table method on the obtained reference to set the desired values to the context node.

l_sflight->bind_table( t_table1 ).

Arjun has given you the link to a very good document on SDN which would help you grasp the basics of working with context in WebDynpro ABAP. Just through it and you would have all your doubts cleared.

Regards,

Uday

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

wd_context refers to the root node context and whatever nodes you create under this root node context,in order to access them we use wd_context->get_child_nodes() method.

Former Member
0 Kudos

Hi Deva

l_sflight = wd_context->get_child_node( 'DATA_TAB' ).

explaination: since your context can have any number of node, get_child_node needs to find which node it has to refer to ?? nodes may be DATA_TAB, DATA_TAB2 , DATA_TAB3 etc etc.

Almost like XML where you need to get THRU parent to reach CHILD node

after

l_sflight = wd_context->get_child_node( 'DATA_TAB' ).

executes

we have traversed till CHILD node in this case DATA_TAB and we can get or set its attribute. we dont need to use its GRAND PARENT

l_sflight->bind_table( t_table1 ).

hope you could make sense.

Greetings

Prashant

arjun_thakur
Active Contributor
0 Kudos

Hi Deva,

Please refer this [article|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814], it will provide you some clearity.

Regards

Arjun