on 08-20-2014 10:02 AM
Hi Experts ,
Please help me to understand how can i access private attribute of one class from its friend class.
I am coding in Method (DO_SAVE) of class /BOBF/CL_TRA_TRANSACTION_MGR.
I need to access private variable ( MO_BOPF) of class /BOBF/CL_TRA_SERVICE_MGR ( Friend of /BOBF/CL_TRA_TRANSACTION_MGR ).
Regards,
Reny Richard
Hi Reny,
You should be able to access by creating object of friend class.
Sample:
data lo_frnd TYPE REF TO /BOBF/CL_TRA_SERVICE_MGR.
data lo_compl type REF TO /BOBF/IF_TRA_TRANS_MGR_COMPL.
create OBJECT lo_frnd
exporting
iv_bo_key = '111'
IO_COMPL_TRANSACTION_MANAGER = lo_compl.
"access the private object of friend class
clear lo_frnd->MO_BOPF.
Note: need to provide iv_bo_key & IO_COMPL_TRANSACTION_MANAGER while creating object.
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If it is a static attribute you can access using /BOBF/CL_TRA_SERVICE_MGR=>MO_BOPF
It is is instance attribute, create an object for the class and access it using that object
data lr_srv_mgr type ref to /BOBF/CL_TRA_SERVICE_MGR.
create object lr_srv_mgr.
lv_bopf = lr_srv_mgr->mo_bopf.
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.