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: 

getting root data in item node

former_member5006
Participant
0 Kudos

Hi all,

          i am created 2 nodes . They are root node and item as subnode.

Initially i entered root data then i went to item data ,here i want to read the root data .

How i can read the root data in item node.  ???

ex: root node and item node i am having emp_id field.. here once i enter the root data emp id ,then i go to item node here emp_id filled by default with  emp id entered in root node.

through determination i am trying to read the root data. in item level..

can anyone give me the code to read the root data in item node..?

4 REPLIES 4

0 Kudos

Hello Naveen,

Every composition subnode ( like your item subnode ) has two default associations. They are "To Parent" and "To Root", since your subnode item is a subnode of the ROOT , executing either of them will get you the ROOT data. Execute a Retrieve By Association, with your item node instance keys , node as ITEM , association as "TO ROOT" or "TO PARENT" and the "IV_FILL_DATA" set to true , to collect the ROOT node data directly from the Retrieve By Association call.

Regards,

Indranil.

0 Kudos

Hello Naveen,

      You can able to read the root information from the item information using io_read->retrieve_by_assocation method.

       pass the exporting parameter has

                      it_key          = item key

                      association = item-to_root

                      fill_data        = abap_true

      Importing

                     et_data ( root information )

Thanks,

Dinesh

laxmikant_soni
Explorer
0 Kudos

Hi Naveen,

To get RooT data you have to use to_root  association as in your case root is also a parent node you can use to_parent association also.

io_read->retrieve_by_assocation

       exporting

                      it_key          =  lt_key               " key table  that hold item keys

                      association = item-to_root    " association name (it is created by default)

                      fill_data       = abap_true       "  make it  to fetch data

      Importing

                     et_data =    lt_root_data

you will get your root data in lt_root_data.

Regards

LK

Former Member
0 Kudos

Hi Naveen,

To get the root data create a Determination in item node,

in the determination do the retrieve with help of parent key

then the root value will retrieve.

Then map the root emp_id to item emp_id

then do_modify and pass item->emp_id to change fields.

Regards

Shamsundarsing