‎2010 Mar 31 8:36 AM
Hi,
I'm using BADI_RECN_CONTRACT to check the condition currencies in the contract. When I use the reference if_recd_condition_mngr and call the method get_currency, it gives me only first condition currency.
I want all the condition currencies to be checked.
I see in the class cl_recn_condition_mngr_cn, there is an protected attribute MTO_CONDITION where I get all the condition values. But I'm not able to read as it is protected attribute. I've shown my code below.
DATA: ld_contract TYPE REF TO cl_recn_contract,
lo_condition TYPE REF TO if_recd_condition_mngr,
lc_condition TYPE REF TO cl_recn_condition_mngr_cn.
DATA: lt_cond TYPE re_t_recd_condition,
lt_condref TYPE REF TO RE_T_IF_RECD_CONDITION.
* additional check
ld_contract ?= io_object.
l_curr = ld_contract->get_recncncurr( ).
lo_condition = ld_contract->mo_condition_mngr.
lc_condition ?= lo_condition.
* lt_condref = lc_condition->MTO_CONDITION.
l_condcurr = lo_condition->get_currency( ).Can anyone please tell me how can I access protected attribute ?
Regards,
JMB
‎2010 Apr 01 7:47 PM
Hello JMB
You have to use the method which returns you all condition objects:
DATA: ld_contract TYPE REF TO cl_recn_contract,
lo_cond_mngr TYPE REF TO if_recd_condition_mngr,
lo_cond_mngr_cn TYPE REF TO cl_recn_condition_mngr_cn.
DATA: lt_cond TYPE re_t_recd_condition,
lt_condref TYPE REF TO RE_T_IF_RECD_CONDITION.
* additional check
ld_contract ?= io_object.
l_curr = ld_contract->get_recncncurr( ).
lo_cond_mngr = ld_contract->mo_condition_mngr.
" lo_cond_mngr_cn ?= lo_cond_mngr.
DATA: lto_conditions TYPE RE_T_IF_RECD_CONDITION.
CALL METHOD lo_cond_mngr->GET_LIST
EXPORTING
eto_condition = lto_conditions.
" Now LOOP over these instances
...
Regards
Uwe
‎2010 Apr 01 5:29 PM
hi,
Protected data members are accessible from within members of their base-class; from within members of the friends of their base-class; and from within members and friends of any classes derived from that base-class.
so you can access the protected data of the class only by the member functions of that class or the member functions
of the friend class. and inherited classes
‎2010 Apr 01 7:47 PM
Hello JMB
You have to use the method which returns you all condition objects:
DATA: ld_contract TYPE REF TO cl_recn_contract,
lo_cond_mngr TYPE REF TO if_recd_condition_mngr,
lo_cond_mngr_cn TYPE REF TO cl_recn_condition_mngr_cn.
DATA: lt_cond TYPE re_t_recd_condition,
lt_condref TYPE REF TO RE_T_IF_RECD_CONDITION.
* additional check
ld_contract ?= io_object.
l_curr = ld_contract->get_recncncurr( ).
lo_cond_mngr = ld_contract->mo_condition_mngr.
" lo_cond_mngr_cn ?= lo_cond_mngr.
DATA: lto_conditions TYPE RE_T_IF_RECD_CONDITION.
CALL METHOD lo_cond_mngr->GET_LIST
EXPORTING
eto_condition = lto_conditions.
" Now LOOP over these instances
...
Regards
Uwe
‎2010 Apr 03 5:22 AM
Hi,
Thank u very much. I dont know how did I miss that method.
Regards,
JMB
‎2010 Apr 04 10:00 AM
Hello JMB
For me it clear why you missed this method - because you did not clearly distinguish between an "object" and its corresponding "object manager" (see coding below).
Every manager object has a method to retrieve its collection of "sub-ordinated" objects:
- Condition Manager => conditions
- Resubmission Manager => resubmissons
- Partner Manager => partners
- ...
Thus, my recommendation is to use naming conventions for these clearly distinct objects.
DATA: ld_contract TYPE REF TO cl_recn_contract,
lo_condition TYPE REF TO if_recd_condition_mngr,
lc_condition TYPE REF TO cl_recn_condition_mngr_cn.
DATA: lt_cond TYPE re_t_recd_condition,
lt_condref TYPE REF TO RE_T_IF_RECD_CONDITION.
...
Regards
Uwe