REFX Contract Index Adjustment Data Extraction

The program below lists all the indexations that have occurred for a REFX lease contracts. ( For contracts that have not had or will never have any indexations, some info is available in table VIAJSEPCINDX (fields INDEXSERIES and INDEXBASEYEAR) )

For a given contract ID it derives the INTRENO (internal object ID).

The INTRENO is used to get all relevant records in VIAJRECORD. The records that correspond to past indexations have a status 3 in field ADJMDRECORDSTAT (‘Adjustment Complete’).
Other useful info => ADJMFROMOLD and ADJMFROMCALC (previous index date and index adjustement date)

Each record in VIAJRECORD is linked to a record in VIAJRECINDX via PROCESSGUID + INTRENO.

In VIAJRECINDX you can retrieve INDEXSERIES/INDEXBASEYEAR + ADJMINDEXBASE (index value at adjustement date) and FIRSTINDEXBASE (reference index at initial date of index calculations).

The program can be downloaded in SAPLINK format here


*&———————————————————————*
*& Report ZREFX_CNT_INDX_DATA
*&
*&———————————————————————*
*&
*&
*&———————————————————————*

REPORT zrefx_cnt_indx_data.
DATA:
ls_viajrecindx TYPE viajrecindx,
ls_viajrecord TYPE viajrecord,
lt_viajrecindx TYPE TABLE OF viajrecindx,
lt_viajrecord TYPE TABLE OF viajrecord.

DATA:
lr_contrtype TYPE RANGE OF recncontracttype,
lrs_contrtype LIKE LINE OF lr_contrtype.

DATA: l_bukrs TYPE bukrs.
SELECT-OPTIONS: s_bukrs FOR l_bukrs.
DATA: l_reccnr TYPE recnnumber.
SELECT-OPTIONS: s_recnnr FOR l_reccnr.

DATA:
ls_contract TYPE recn_contract,
lt_rnsim TYPE re_t_renewal_sim,
ls_rnsim TYPE retm_renewal_sim.

“Limit to ZRDD, ZEXT and ZRIN
lrs_contrtype-sign = ‘I’.
lrs_contrtype-option = ‘EQ’.
lrs_contrtype-low = ‘ZRDD’.
APPEND lrs_contrtype TO lr_contrtype.
lrs_contrtype-low = ‘ZRIN’.
APPEND lrs_contrtype TO lr_contrtype.
lrs_contrtype-low = ‘ZEXT’.
APPEND lrs_contrtype TO lr_contrtype.
SELECT * FROM vicncn INTO ls_contract
WHERE bukrs IN s_bukrs
AND recnnr IN s_recnnr
AND recntype IN lr_contrtype.

REFRESH lt_viajrecord.
REFRESH lt_viajrecindx.

SELECT * FROM viajrecord
INTO TABLE lt_viajrecord
WHERE adjmdrecordstat = ‘3’
AND intreno = ls_contract-intreno.

SELECT * FROM viajrecindx
INTO TABLE lt_viajrecindx
FOR ALL ENTRIES IN lt_viajrecord
WHERE processguid = lt_viajrecord-processguid
and intreno = lt_viajrecord-intreno.

LOOP AT lt_viajrecord INTO ls_viajrecord.
read table lt_viajrecindx into ls_viajrecindx
with key processguid = ls_viajrecord-processguid
intreno = ls_viajrecord-intreno.
NEW-LINE.
WRITE: ls_contract-recnnr, ‘:’, ls_viajrecindx-firstindexbase ,’:’, ls_viajrecindx-indexseries ,’:’, ls_viajrecindx-indexbaseyear , ‘:’, ls_viajrecord-adjmfromold, ‘:’,’:’, ls_viajrecord-adjmfromcalc, ‘:’, ls_viajrecindx-adjmindexbase.
ENDLOOP.
ENDSELECT.

Leave a Reply