How to create an instance of CL_RECN_CONTRACT

To create an instance of the Contract object, for a given contract you can use method FIND_BY_DETAIL of the Factory Class CF_RECN_CONTRACT. Here is an example code:

data:
lo_contract TYPE REF TO if_recn_contract,
ls_contract TYPE recn_contract.

select single * from vicncn into CORRESPONDING FIELDS OF ls_contract
WHERE recnnr = i_recnnr
and bukrs = i_bukrs.

* get object

CALL METHOD cf_recn_contract=>find_by_detail
EXPORTING
is_detail = ls_contract
RECEIVING
ro_instance = lo_contract
EXCEPTIONS
OTHERS = 0.