and now let the coding begin.
REPORT bc400_mos subroutine.
TYPE gty_result TYPE p LENGTH 16 DECIMALS 2.
PARAMETERS:
pa_int1 TYPE i,
pa_int2 TYPE i,
pa_op TYPE c LENGTH 1.
DATA gv_result TYPE gty_result.
IF ( pa_op = '+' OR
pa_op = '-' OR
pa_op = '*' OR
pa_op = '/' and pa_int2 <> 0 ) .
CASE pa_op.
WHEN '+'.
gv_result = pa_int1 + pa_int2.
WHEN '-'.
gv_result = pa_int1 - pa_int2.
WHEN '*'.
gv_result = pa_int1 * pa_int2.
WHEN '/'.
gv_result = pa_int1 / pa_int2.
WRITE: 'Result:'(res), gv_result.
ELSEIF pa_op = ' / ' AND pa_int2 = 0.
WRITE: 'No division by zero.!' (dbz).
ELSE.
WRITE: 'Invalid Operator.!'(iop).
ENDIF.
No comments:
Post a Comment