03-09-2016 6:36 AM
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.
03-09-2016 7:28 AM
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
03-09-2016 6:59 AM
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
03-09-2016 7:28 AM
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
03-09-2016 8:11 AM
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.
03-09-2016 8:17 AM
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
03-09-2016 8:37 AM
03-09-2016 8:38 AM
03-09-2016 8:39 AM
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.
06-09-2021 5:59 PM