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 access class instance deep ref variables in BADI during runtime

former_member213475
Participant
0 Kudos

Hello Experts,

I have implemented the BADI and in that Badi I want to get the some field values from the structure ITEM_DATA which is inside I_TSW_NODE.

I have attached the three images for reference.. I want the structure which is present in the I_TSW_NODE------>ITEM_NODE ---->ITEM_DATA. These variablesimage1.pngimage2.pngimage3.png are defined with type ref to.

Please help me how to get the ITEM_DATA structure to another structure.

Regards,

Saran

1 ACCEPTED SOLUTION

former_member213475
Participant

Hi,

I have resolved on my own and the solution is as follows.

DATA(item_node_temp) = i_tsw_node->get_parent( ).
DATA(item_data) = item_node_temp->get_data( ).
DATA(ls_item) = item_data-item.

Thanks for the replies.

Regards,

Saran.

5 REPLIES 5

Tomas_Buryanek
Active Contributor
0 Kudos

ITEM_DATA is private attribute. It can only be accessed in that class methods. Check "Where used" functionality on that attribute. Maybe you will find "Getter" or some other usefull method.

I do not have this class in my system, so I cannot check.

-- Tomas --

Sandra_Rossi
Active Contributor

Please show the images instead of hyperlinks, in order to have both the text and the image in one place. It's even more useful when there are several images, it avoids the pain to open and close each of them separately and repeatedly.

Sandra_Rossi
Active Contributor
0 Kudos

and the last one:

Sandra_Rossi
Active Contributor
0 Kudos

First of all, I agree with Tomas.

It's always difficult to access a private member of a standard class because you don't know how the class works, how you need to instantiate it, which methods to call till you can access that member.

Sometimes it's not possible when the data is not stored persistently and the only solution is to use the Enhancement Framework to create a public method to access the private member.

former_member213475
Participant

Hi,

I have resolved on my own and the solution is as follows.

DATA(item_node_temp) = i_tsw_node->get_parent( ).
DATA(item_data) = item_node_temp->get_data( ).
DATA(ls_item) = item_data-item.

Thanks for the replies.

Regards,

Saran.