Hi Amit,
entire field level routine for interest calculation.
IF COMM_STRUCTURE-FI_DOCSTAT EQ 'C'.
RESULT = COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-NETDUEDATE.
ELSE.
RESULT = 0.
endif.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
CLEAR:
MONITOR[].
ENDFORM. "routine_0001
FORM routine_0002
TABLES
P_MONITOR structure rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_47
CHANGING
RESULT TYPE _ty_s_TG_1_full-INT_CALC_1
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* result value of the routine
RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-DSCT_DAYS1 / 100.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
CLEAR:
MONITOR[].
ENDFORM. "routine_0002
FORM routine_0003
TABLES
P_MONITOR structure rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_48
CHANGING
RESULT TYPE _ty_s_TG_1_full-INT_CALC_2
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* result value of the routine
RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-DSCT_DAYS2 / 100.
* UNIT = COMM_STRUCTURE-LOC_CURRCY.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
CLEAR:
MONITOR[].
ENDFORM. "routine_0003
FORM routine_0004
TABLES
P_MONITOR structure rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_49
CHANGING
RESULT TYPE _ty_s_TG_1_full-INT_CALC_N
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* result value of the routine
RESULT = COMM_STRUCTURE-DEB_CRE_LC * COMM_STRUCTURE-NETTERMS / 100.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
CLEAR:
MONITOR[].
ENDFORM. "routine_0004
FORM routine_0005
TABLES
P_MONITOR structure rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_50
CHANGING
RESULT TYPE _ty_s_TG_1_full-INT_CALCT1
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* result value of the routine
DATA: DSCT1 LIKE COMM_STRUCTURE-DEB_CRE_LC.
DSCT1 = COMM_STRUCTURE-DSCT_PCT1 * COMM_STRUCTURE-DEB_CRE_LC / 100.
DSCT1 = DSCT1 / 10 * 9.
IF COMM_STRUCTURE-DSC_AMT_LC >= DSCT1 AND
COMM_STRUCTURE-FI_DOCSTAT EQ 'C'.
RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-DSCT_DATE1 ).
RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.
ELSE.
RESULT = 0.
ENDIF.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
CLEAR:
MONITOR[].
ENDFORM. "routine_0005
FORM routine_0006
TABLES
P_MONITOR structure rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_51
CHANGING
RESULT TYPE _ty_s_TG_1_full-INT_CALCT2
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* result value of the routine
DATA: DSCT1 LIKE COMM_STRUCTURE-DEB_CRE_LC.
DSCT1 = COMM_STRUCTURE-DSCT_PCT1 * COMM_STRUCTURE-DEB_CRE_LC / 100.
DSCT1 = DSCT1 / 10 * 9.
IF COMM_STRUCTURE-DSC_AMT_LC < DSCT1 AND
COMM_STRUCTURE-DSC_AMT_LC > 0 AND
COMM_STRUCTURE-FI_DOCSTAT = 'C'.
RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-DSCT_DATE2 ).
RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.
ELSE.
RESULT = 0.
ENDIF.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
CLEAR:
MONITOR[].
ENDFORM. "routine_0006
FORM routine_0007
TABLES
P_MONITOR structure rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_52
CHANGING
RESULT TYPE _ty_s_TG_1_full-INT_CALCTN
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* result value of the routine
IF COMM_STRUCTURE-DSC_AMT_LC = 0 AND
COMM_STRUCTURE-FI_DOCSTAT = 'C'.
RESULT = ( COMM_STRUCTURE-CLEAR_DATE - COMM_STRUCTURE-NETDUEDATE ).
RESULT = RESULT * COMM_STRUCTURE-DEB_CRE_LC / 100.
ELSE.
RESULT = 0.
ENDIF.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
thanks
Ramesh G