37 lines
821 B
ABAP
37 lines
821 B
ABAP
FUNCTION {{p}}loan_check
|
|
IMPORTING
|
|
iv_fragile TYPE abap_bool
|
|
iv_insured TYPE abap_bool
|
|
iv_days TYPE i
|
|
EXPORTING
|
|
ev_approved TYPE abap_bool
|
|
ev_reason TYPE string
|
|
EXCEPTIONS
|
|
invalid_days.
|
|
|
|
IF iv_days < 1.
|
|
RAISE invalid_days.
|
|
ENDIF.
|
|
|
|
IF iv_days > 90.
|
|
ev_approved = abap_false.
|
|
ev_reason = 'TOO_LONG'.
|
|
RETURN.
|
|
ENDIF.
|
|
|
|
" Open point: rules 3 and 4 give opposite priority to the insurance rule and
|
|
" the fragility rule for an insured fragile exhibit. This reference applies
|
|
" rule 3 (the insurance rule first).
|
|
IF iv_insured = abap_true.
|
|
ev_approved = abap_true.
|
|
ev_reason = 'INSURED'.
|
|
ELSEIF iv_fragile = abap_true.
|
|
ev_approved = abap_false.
|
|
ev_reason = 'FRAGILE'.
|
|
ELSE.
|
|
ev_approved = abap_true.
|
|
ev_reason = 'OK'.
|
|
ENDIF.
|
|
|
|
ENDFUNCTION.
|