Application Development and Automation 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: 
Read only

Return message capture issue while using API_RE_CN_CHANGE

Former Member
0 Likes
704

Hi Experts

I have an issue in capturing return messages while using API_RE_CN_CHANGE to alter a real estate contract.follows is the problem description -

API_RE_CN_CHANGE is called to change a realestate contract(insert a condition) with key to identify the contract as "Object instance of the contract". In this case, the return message form the API is empty. this is how i use the API function module -

CALL METHOD cf_recn_contract=>find

EXPORTING

id_bukrs = bukrs

id_recnnr = recnnr

id_activity = reca1_activity-change " Change mode

if_auth_check = abap_false

if_enqueue = abap_true " LOck the contract

RECEIVING

ro_instance = lo_contract " getting the contract object instance

EXCEPTIONS

error = 1

OTHERS = 2.

CALL FUNCTION 'API_RE_CN_CHANGE'

EXPORTING

  • id_bukrs = g_t_contracts-bukrs " Not using this field

  • id_recnnr = g_t_contracts-recnnr " Not using this field

io_object = lo_contract

it_term_sr_sales = lt_term_sr_sl_intc

it_condition = lt_condition_intc

if_test_run = g_testrun_flg

if_msglist_instead_of_exc = 'X'

io_msglist = lo_msglist_t " Error messages list

IMPORTING

EF_STORED = ef_stored

EXCEPTIONS

ERROR = 1

OTHERS = 2

.

  • convert messages to bapi return list

CALL METHOD lo_msglist_t->get_list_as_bapiret

IMPORTING

et_list = g_t_return[]. " Read the messages in internal table

Here the method does not give the return message as import parameter. but all these stuff works if i call API_RE_CN_CHANGE using company code(BUKRS) & Contract number(RECNNR).

Can anybody suggest a solution.

Thanks

Mukundhan

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
535

Hello Mukundhan

While function module API_RE_CN_CHANGE may work this is not the way how I would change a contract condition. Since you are obviously working with RE-FX and dealing with a contract instance (IF_RECN_CONTRACT) I would apply the following logic:

DATA:
  lo_contract              TYPE REF TO if_recn_contract,
  lo_condition_Mngr    TYPE REF TO if_recd_condition_manager,
  lo_condition             TYPE REF TO if_recd_condition.


" Create contract instance
  CALL METHOD cf_recn_contract=>find
    EXPORTING
      ...
    RECEIVING
      ro_instance = lo_contract
   EXCEPTIONS
     others = 1.

" Get condition manager from contract
  lo_condition_mngr = 
        lo_contract->IF_RECD_HAS_CONDITION~GET_CONDITION_MNGR( ).


" Insert a new condition
   CALL METHOD lo_condition_mngr->insert_condition
     EXPORTING
       ...
    RECEIVING
      ro_condition = lo_condition.

Regards

Uwe

1 REPLY 1
Read only

uwe_schieferstein
Active Contributor
0 Likes
536

Hello Mukundhan

While function module API_RE_CN_CHANGE may work this is not the way how I would change a contract condition. Since you are obviously working with RE-FX and dealing with a contract instance (IF_RECN_CONTRACT) I would apply the following logic:

DATA:
  lo_contract              TYPE REF TO if_recn_contract,
  lo_condition_Mngr    TYPE REF TO if_recd_condition_manager,
  lo_condition             TYPE REF TO if_recd_condition.


" Create contract instance
  CALL METHOD cf_recn_contract=>find
    EXPORTING
      ...
    RECEIVING
      ro_instance = lo_contract
   EXCEPTIONS
     others = 1.

" Get condition manager from contract
  lo_condition_mngr = 
        lo_contract->IF_RECD_HAS_CONDITION~GET_CONDITION_MNGR( ).


" Insert a new condition
   CALL METHOD lo_condition_mngr->insert_condition
     EXPORTING
       ...
    RECEIVING
      ro_condition = lo_condition.

Regards

Uwe