UNCTION ZREFX_CNT_INDEX_NEXTADJMDATE .
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_RECNNR) TYPE RECNNUMBER
*" REFERENCE(I_BUKRS) TYPE BUKRS
*" EXPORTING
*" REFERENCE(E_NEXTADJMDATE) TYPE REAJNEXTADJMDATE
*"----------------------------------------------------------------------
statics:
lrt_recntype type range of RECNCONTRACTTYPE WITH HEADER LINE,
lrt_condtype type range of RECDCONDTYPE WITH HEADER LINE.
data:
l_numb type RECDCONDNUMBER,
lo_condition_mngr TYPE REF TO IF_RECD_CONDITION_MNGR,
lo_condition TYPE REF TO IF_RECD_CONDITION,
ls_condition TYPE RECD_CONDITION,
l_next TYPE REAJNEXTADJMDATE,
l_max type REAJNEXTADJMDATE,
lo_contract TYPE REF TO if_recn_contract,
ls_contract TYPE recn_contract.
if lrt_recntype[] is initial.
* No filtering on condtions for the moment
* If necessary to filter on rent, need to add
* 1FI, 1BC, 1CC 1DIMF?, 1PFO, 1ER, 1WO , 1VE, 1UC
* lrt_condtype-sign = 'I'.
* lrt_condtype-option = 'BT'.
* lrt_condtype-low = '0010'.
* lrt_condtype-high = '0019'.
* append lrt_condtype.
lrt_recntype-sign = 'I'.
lrt_recntype-option = 'EQ'.
lrt_recntype-low = 'ZRDD'.
lrt_recntype-high = ''.
append lrt_recntype.
lrt_recntype-sign = 'I'.
lrt_recntype-option = 'EQ'.
lrt_recntype-low = 'ZRIN'.
lrt_recntype-high = ''.
append lrt_recntype.
endif.
clear E_NEXTADJMDATE.
select single * from vicncn into CORRESPONDING FIELDS OF ls_contract
WHERE recnnr = i_recnnr
and bukrs = i_bukrs.
check ls_contract-recntype in lrt_recntype.
check ls_contract-RECNENDABS > sy-datum.
* get object
CALL METHOD cf_recn_contract=>find_by_detail
EXPORTING
is_detail = ls_contract
RECEIVING
ro_instance = lo_contract
EXCEPTIONS
OTHERS = 0.
IF lo_contract IS BOUND.
lo_condition_mngr = lo_contract->get_condition_mngr( ).
l_numb = '0001'.
do.
CALL METHOD lo_condition_mngr->GET_CONDITION
EXPORTING
ID_NUMBER = l_numb
RECEIVING
RO_CONDITION = lo_condition.
if lo_condition is not BOUND.
exit.
endif.
CALL METHOD LO_CONDITION->GET_DETAIL
RECEIVING
RS_DETAIL = ls_condition.
if ls_condition-condtype in lrt_condtype.
CALL METHOD lo_condition->GET_NEXTADJMDATE
RECEIVING
RD_NEXTADJMDATE = l_next.
if E_NEXTADJMDATE < l_next.
E_NEXTADJMDATE = l_next.
endif.
endif.
l_numb = l_numb + 1.
enddo.
endif.
ENDFUNCTION.Serkan AKKAVAK
Computer Engineer
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments