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: 

how to find parent node key in the child node determination class 'execute' method.

Former Member
0 Kudos

Hi,

I have implemented Determination for child node and Inside this DETERMINATION class I would like to get the data of Parent node inside the EXECUTE method.

As per my understand By passing the Parent node key to IO_READ->RETRIEVE can get the data of root node.

But How can we get the ROOT node key inside determination class execute method.

Please suggest me the steps to achieve this functionality.

Thank you .

Regards,

Shivajiraju.

1 ACCEPTED SOLUTION

Dhivya
Active Participant
0 Kudos

Hi Shivaji,

  If you wish to traverse from child to root, BOPF model will automatically taken care for the association called to_root using retrieve_by_association. There is no need to get Root key to get the root data,

io_read->retrieve_by_association(

     EXPORTING

           it_key = it_key

           iv_node = zif_bo_c=>sc_node-child_name

           iv_association = zif_bo_c=>sc_association-child_name-to_root

           iv_fill_data = abap_true "we need root data

     IMPORTING

           et_target_data = lt_root ).

whereas zif_bo_c is the constant interface for the particular BO.

Regards,

Dhivya

8 REPLIES 8

cyclingfisch_
Active Contributor
0 Kudos

Hi Shivajiraju,

now can find the key of the root node in your constant interface.

You get the key of your current root instance by following the "to_parent" association.

Regards,

Martin

Dhivya
Active Participant
0 Kudos

Hi Shivaji,

  If you wish to traverse from child to root, BOPF model will automatically taken care for the association called to_root using retrieve_by_association. There is no need to get Root key to get the root data,

io_read->retrieve_by_association(

     EXPORTING

           it_key = it_key

           iv_node = zif_bo_c=>sc_node-child_name

           iv_association = zif_bo_c=>sc_association-child_name-to_root

           iv_fill_data = abap_true "we need root data

     IMPORTING

           et_target_data = lt_root ).

whereas zif_bo_c is the constant interface for the particular BO.

Regards,

Dhivya

Former Member
0 Kudos

Hi Dhivya,

Thank you for your prompt replay.

One small question it_key are child node keys?. or Root node keys.

Thank you.

Regards,

Shivaji.

0 Kudos

Hi Shivaji,

it_key should contain the keys of the instances for which you want to get the root keys. So in your case most probably the keys of the child node instances. Very often you can use the propagated it_key parameter of your current method.

Cheers,

Martin

Former Member
0 Kudos

Thank you so much Martin.

Regards,

Shivajiraju.

Former Member
0 Kudos

Thank you so much Dhivya.

Regards,

Shivajiraju.

Dhivya
Active Participant
0 Kudos

Hi Shivaji,

it_key is child node keys. If you want to get the root node keys too, then in retreive_by_association you can get the data as well as key details.

io_read->retrieve_by_association(

     EXPORTING

           it_key = it_key

           iv_node = zif_bo_c=>sc_node-child_name

           iv_association = zif_bo_c=>sc_association-child_name-to_root

           iv_fill_data = abap_true "we need root data

     IMPORTING

     et_target_key = lt_root_key

           et_target_data = lt_root ).



Regards,

Dhivya.

vasantha_s
Employee
Employee
0 Kudos

Works thanks a lot