cancel
Showing results for 
Search instead for 
Did you mean: 

Child node is not getting for context

nandishm
Participant
0 Kudos

Hi

In my web dynpro app,  i am trying to set context   by using below code

          DATA lo_nd_employee TYPE REF TO if_wd_context_node.

           DATA lo_el_employee TYPE REF TO if_wd_context_element.

           lo_nd_employee = wd_context->get_child_node( name = wd_this->wdctx_employee ).

           lo_el_employee = lo_nd_employee->get_element( ).



lo_nd_employee is getting nodes but,     lo_el_employee = lo_nd_employee->get_element( ).


Not getting elements, lo_el_employee is still initail .

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member222068
Active Participant
0 Kudos

Hi Nandish,

          DATA lo_nd_employee TYPE REF TO if_wd_context_node.

           DATA lo_el_employee TYPE REF TO if_wd_context_element.

           lo_nd_employee = wd_context->get_child_node( name = wd_this->wdctx_employee ).

           lo_el_employee = lo_nd_employee->get_element( ).


Replace above statement with below one:


         lo_el_employee = wdevent->get_context_element( 'CONTEXT_ELEMENT'  ).


Even if Initialize Lead Selection  property of node is not checked, this will return the selected record.



Thanks & Regards,

Sankar Gelivi

former_member184578
Active Contributor
0 Kudos

Hi,

When reading the child node use the path.

lo_nd_employee = wd_context->path_get_node( path = `PARENT_NODE.EMPLOPEE` ). " PARENT_NODE is the node name of parent node and EMPLOYEE here is the node name of CHILD

hope this helps u,

Regards,

Kiran

nandishm
Participant
0 Kudos

hi kiran ..

In my component there is only one node under the context i.e EMPLOYEE, so can you tell me the root node name ( i think root will be context node only )

nandishm
Participant
0 Kudos

Hi kiran

Can you tell me, how to call a method of specific view from window...

Ex:-

Consider I have one window, in that i have 2 views but i want display any one of view, it will be decided at run time by url ......i also wanted to pass one integer value to view ....

i m checking url in HANDLEDEFAULT method

former_member184578
Active Contributor
0 Kudos

Hi,

Yes, Context is the Root Node. I was confused by the Title of your post. Seems you didn't selected the 'Initialize Lead Selection' of you Context Node 'Employee'.

Select the 'Initialize Lead Selection'  checkbox of your context Node.

hope this helps,

Regards,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi Nandish,

You may get the node reference but it is always not true that you should get elements from node. Because, node exists without any elements in it.

Make sure that your node has any elements in it.

If you are not able to get, please elaborate your requirement in detail.

Regards,

Rama

nandishm
Participant
0 Kudos

My node has more than 3 attributes ....

ramakrishnappa
Active Contributor
0 Kudos

Hi Nandish,

I think you need to understand the basics of context node, element and attributes.

Example:  Node : Employee

               Attributes: PERNR, BEGDA, ENDDA

        

Now you cannot think that you can get attributes.......

          Set the Lead Index Initialization, to get element based on lead index.

At runtime, the context node can have as many as context elements based on cardinality. Until your node has any context element, you cannot get the attributes value at runtime.

First you need to set data to context node EMPLOYEE and then you can read it back

Are you using your node in Table or for input screen ?

if its used in Table, you need to add rows, to make context elements available at runtime.

if its used in input screen, you can get 1 context element available. So you code works.

I suggest you, please go through some basic tutorials to understand the GET/SET concepts of context node / context element.

Regards,

Rama