cancel
Showing results for 
Search instead for 
Did you mean: 

How to get current node element for recursive node.

former_member185029
Active Contributor
0 Kudos

Hello Xperts,

I have a requirement where I need to find the current node element of the recursive node.

I was trying following code for the same



Data:

selected_elem type ref to if_wd_context_element.

 
selected_elem  = WDEVENT->GET_CONTEXT_ELEMENT( NAME = 'CONTEXT_ELEMENT' ).

 selected_elem  ->get_static_attributes(
    IMPORTING
      static_attributes = sel_attri ).

But it does not work for me and I always get 1st node value.

Please help me in this issue.

-Ashutosh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I could not understand ur question properly...

If you mean that you want to get the selected row of the node use one of the following...

GET_LEAD_SELECTION	Instance Method	                               	Returns Element of Lead Selection
GET_LEAD_SELECTION_INDEX	Instance Method	                               	Returns Index of Lead Seletion

Thanks,

former_member185029
Active Contributor
0 Kudos

Hi,

Yes that is right assumption.

I have a tree element where I need to check which child of the tree has been selected.

The code that you have given has been already tried and tested, but it does not work.

Generally while dealing with recursive node, we have a method in WDP java

wdContext.node<NodeName>().node<ChildNode>()...

Do we have similar function available in ABAP as well?

-Ashutosh

uday_gubbala2
Active Contributor
0 Kudos

Hi Ashutosh,

Am sorry but am not at office and donu2019t have access to IDES for giving it out a try myself. Try going through these below threads which might be of help for you:

Regards,

Uday

former_member185029
Active Contributor
0 Kudos

Hi Uday,

Thanks a lot for your reply.

Unfortunately I am still struggling to get current selection of the recursive node.

-Ashutosh

former_member187651
Active Participant
0 Kudos

Hello Ashutosh,

I am new to the webdynpro. I have the problem with reading the Recursive node value with onlcick. I am using the table tree in my application.

When I am trying to read the value with read method of webdynpro (code generated automatically) I am getting value of parent node only.

Kindly let me know the steps, to read the node value as I click on the table.

I am writing my code in 'onselect' event method of table.

I am making my table tree with following reference .

  http://divulgesap.com/blog.php?p=ODQ=

My context node are:

 

Answers (5)

Answers (5)

former_member187651
Active Participant
0 Kudos

Hello Ashutosh,

How did you resolve the problem. I am really stuck with this point . I need to read the node value of recursive node. but I am always getting parent node value.

How you did to the looping at node. Please let me know its urgent for today.

Waiting for your reply

My context node is:

Thanks.....

Former Member
0 Kudos

Hello Ashutsoh ,

If you are using the the recursive tree node then you can add the import parameter

context_element . This will help .

Regards

Vivek

former_member185029
Active Contributor
0 Kudos

Hello Vivek,

When I add CONTEXT_ELEMENT (type IF_WD_CONTEXT_ELEMENT) I get error that Access via NULL object reference is not possible

-Ashutosh

former_member185029
Active Contributor
0 Kudos

issue resolved by looping at node

Former Member
0 Kudos

Hi

In the event 'onACTION' of the node,create an import parameter 'context_element' type ref to if_wd_context_element and access this variable inside the event handler method

Hope this helps U

Regards

Tamil

Former Member
0 Kudos

Hello ,

Do you have checkbox as a table column ? Are you adding the paramter in the event handler of checkbox . then its wrong . You have to add the parameter to load children.

Regards

Vivek

former_member185029
Active Contributor
0 Kudos

Hello Vivek,

Thanks again for the reply,

I am not using any checkbox in my table.

I just have a tree column which is mapped with the recursive node.

I added the PATH parameter to onLoadChildren event of the tree column. It had no impact.

Infact when I set the debugger inside this event, it doesn't even gets called.

-Ashutosh

Former Member
0 Kudos

Hello ,

If you implementing a simple tree ( not table tree ) and you want the selected element for

OnLoadChildren event .

Then create an importing parameter CONTEXT_ELEMENT of type IF_WD_CONTEXT_ELEMENT

in the event handler of onLoadChildren .

Webdynpro framework automatically filled up the context element with the current node in the tree .

I tried it , It really worked for me .

If you have a table tree then you need to create an importing parameter PATH of type String in tha event handler .

Webdynpro frame automatically fills the PATH .

the use can use the following method to get the element from the PATH .

wd_context->path_get_element( path ).

I tried it , It also worked for me .

Regards

Vivek

PS : please provide the points if answer is helpful .

former_member185029
Active Contributor
0 Kudos

Hi Vivek,

I tried the solution you suggested.

I have added a parameter named PATH in the event handler.

I got an error Parameter PATH contains an invalid value

Please guide me.

-Ashutosh