*---Simple Calculator Program In ABAP using parameter passing.--*
REPORT ZTFIVE.
PARAMETERS:
pa_int1 TYPE i,
pa_op TYPE c Length 1,
pa_int2 TYPE i.
DATA gv_result TYPE p LENGTH 16 DECIMALS 2.
IF ( pa_op = '+' OR
pa_op = '-' OR
pa_op = '*').
CASE pa_op.
WHEN '+'.
gv_result = pa_int1 + pa_int2.
WHEN '-'.
gv_result = pa_int1 - pa_int2.
WHEN '*'.
gv_result = pa_int1 * pa_int2.
ENDCASE.
WRITE: 'Result'(res), gv_result.
ENDIF.
OUTPUT
REPORT ZTFIVE.
PARAMETERS:
pa_int1 TYPE i,
pa_op TYPE c Length 1,
pa_int2 TYPE i.
DATA gv_result TYPE p LENGTH 16 DECIMALS 2.
IF ( pa_op = '+' OR
pa_op = '-' OR
pa_op = '*').
CASE pa_op.
WHEN '+'.
gv_result = pa_int1 + pa_int2.
WHEN '-'.
gv_result = pa_int1 - pa_int2.
WHEN '*'.
gv_result = pa_int1 * pa_int2.
ENDCASE.
WRITE: 'Result'(res), gv_result.
ENDIF.
OUTPUT
hi, how should we catch the error in case of division by zero, can anyone help?
ReplyDeleteto write lost of the programe.
ReplyDeletewhen others.
write 'what ever you want write errors'.
endif.
I'm not getting result box. It just taking inputs plz let me know solution
ReplyDeleteHow to design calculator and to call function module in main program
ReplyDelete