Files
abap-llm/tasks_gen/train/G1107/reference/lkr_fee.func.abap
2026-10-05 18:02:52 +02:00

35 lines
720 B
ABAP

FUNCTION {{p}}lkr_fee
IMPORTING
iv_size_code TYPE string
iv_days TYPE i
iv_member TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
EXCEPTIONS
invalid_days.
IF iv_days < 1.
RAISE invalid_days.
ENDIF.
DATA lv_rate TYPE decfloat34.
CASE iv_size_code.
WHEN 'S'.
lv_rate = '2.50'.
WHEN 'M'.
lv_rate = '4.25'.
WHEN 'L'.
lv_rate = '6.75'.
WHEN OTHERS.
" The specification gives no rule for a size code that is not S, M or L.
RETURN.
ENDCASE.
ev_fee = lv_rate * iv_days.
IF iv_member = abap_true.
ev_fee = ev_fee / 2.
ENDIF.
ev_fee = round( val = ev_fee dec = 2 mode = cl_abap_math=>round_half_up ).
ENDFUNCTION.