cancel
Showing results for 
Search instead for 
Did you mean: 

CL_RECD_CONDITION / retrieve condition amount in ABAP

Former Member
0 Kudos

Hi All,

New on RE-FX, I am in charge of developping a report for RE-FX, returning in particular the conditions amounts.

I need yearly amounts for each contracts, knowing that contracts have several conditions.

APIs and BAPIs dont provide calculated amounts. I found the class CL_RECD_CONDITION, and I would like to use one of these methods (i guess at least one will provide req. info):

- IF_RECD_CONDITION~GET_CALC_VALUES

-IF_RECD_CONDITION~GET_STANDARD_VALUES

Unfortunately, I'm not able to call these methods in the abap, I always have this error message:

"You cannot create an instance of the class "CL_RECD_CONDITION" within

the class itself or one of its subclasses."

my code is as following:

DATA lr_cond TYPE REF TO cl_recd_condition.

CREATE OBJECT lr_cond.

CALL METHOD lr_cond->if_recd_condition~get_standard_values

  • CALL METHOD if_recd_condition->get_standard_values

EXPORTING

id_keydate = w_keydate

  • if_distribution = ABAP_FALSE

id_distobjnr = wa_vicncn-objnr

IMPORTING

  • ed_condvalueday =

  • ed_condvalueweek =

  • ed_condvaluemonth =

ed_condvalueyear = w_recdcondvalueyear

  • ed_taxvalueday =

  • ed_taxvalueweek =

  • ed_taxvaluemonth =

  • ed_taxvalueyear =

  • ed_calcvalue =

  • ed_distvalue =

  • ed_taxvalue =.

Many thanks for your help if you have informations on the correct way to get these conditions' amounts!

Cheers

Oli

Accepted Solutions (1)

Accepted Solutions (1)

franz_posch
Active Contributor

Hi Oli,

you just have first to create contract and condition manager to call afterwards methods for conditions.

Here a sample coding:

go_contract TYPE REF TO if_recn_contract,

go_condition_mngr TYPE REF TO if_recd_condition_mngr,

gto_cond TYPE re_t_if_recd_condition,

go_condition_mngr TYPE REF TO if_recd_condition_mngr,

go_cond TYPE REF TO if_recd_condition.

1. Find contract

CALL METHOD cf_recn_contract=>find

EXPORTING

id_bukrs = p_bukrs

id_recnnr = p_recnnr

id_activity = gd_activity

if_auth_check = abap_true

if_enqueue = abap_true

RECEIVING

ro_instance = go_contract

EXCEPTIONS

error = 1

OTHERS = 2.

2. Get condition manager

go_condition_mngr = go_contract->get_condition_mngr( ).

3. Get condition objects

  • get cond list

CALL METHOD go_cond_mngr->get_list

EXPORTING

if_incl_booking_context = abap_false

if_incl_booking_min_max = abap_false

if_incl_lock_context = abap_false

IMPORTING

eto_condition = gto_cond.

4. Loop at conditions and call method

LOOP AT gto_cond INTO go_cond.

  • get standard values

CALL METHOD go_cond->get_standard_values

EXPORTING

id_keydate = id_keydate

IMPORTING

ed_condvalueday = ld_condvalueday

ed_condvalueweek = ld_condvalueweek

ed_condvaluemonth = ld_condvaluemonth

ed_condvalueyear = ld_condvalueyear

ed_taxvalueday = ld_taxvalueday

ed_taxvalueweek = ld_taxvalueweek

ed_taxvaluemonth = ld_taxvaluemonth

ed_taxvalueyear = ld_taxvalueyear.

ENDLOOP.

Hope that helps.

Regards, Franz

Former Member
0 Kudos

Hi Franz,

many, many thanks! That solved completely the issue I was facing. That's really nice.

Points have been rewarded.

Have a nice day,

Cheers,

Oli

Answers (0)