Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Build a tree with recursion

Former Member
0 Kudos

I need to Create a tree and with recursion (not to use SAP FM)

and i have a tree like the following

assume i have a root like

root is level 1 -> customer

child level 2 -> like contact person & address

child level 3 like visiting hours (contact person ) & Email address (adress )

e.g. of the table that i need to provide as output is

item parent_key child_key

customer 0001

contant person 0001 0002

address 0001 0002

vist 0002 0003

email 0002 0003

etc...

let say i get as input always the root and i check for his child and for this node i

look for his child etc how can i provide a table like the above table

Thanks and Regards

James

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

build your tree step-by-step:

-root node is always shown -> initially add it to the node table of your alv-tree

->user expands root node

->event expand_no_children has to be handled

->check which node threw that event

->if root node, select all persons

->add the person nodes to your alv-tree node-list, as parent use the root node

->refresh alv tree

->user expands person-node

->event expand_no_children has to be handled

->check which node threw that event

->if person node, select all visiting hours

->add the visiting hour nodes to your alv-tree node-list, as parent use the person node

->refresh alv tree

Greetings,

dsp

1 REPLY 1

Former Member
0 Kudos

Hi,

build your tree step-by-step:

-root node is always shown -> initially add it to the node table of your alv-tree

->user expands root node

->event expand_no_children has to be handled

->check which node threw that event

->if root node, select all persons

->add the person nodes to your alv-tree node-list, as parent use the root node

->refresh alv tree

->user expands person-node

->event expand_no_children has to be handled

->check which node threw that event

->if person node, select all visiting hours

->add the visiting hour nodes to your alv-tree node-list, as parent use the person node

->refresh alv tree

Greetings,

dsp