F Simple calculator program in SAP ABAP | CodeTheta

Simple calculator program in SAP ABAP


Code :

REPORT zvp_calculator.

PARAMETERS: p_a TYPE char10,
            p_b TYPE char10,
            p_c TYPE char10.

DATA : p_d TYPE char10.


IF p_c = '+'.

  p_d = p_a + p_b.
  WRITE: 'Calculated Value : ' , p_d.

ELSEIF p_c = '-'.
  p_d = p_a - p_b.
  WRITE: 'Calculated Value : ' , p_d.

ELSEIF p_c = '*'.
  p_d = p_a * p_b.
  WRITE: 'Calculated Value : ',  p_d.

ELSEIF p_c = '/'.
  p_d = p_a / p_b.
  WRITE: 'Calculated Value : ', p_d.

ELSE.
  WRITE: 'Only + , - , * , / signs are allowed'.
ENDIF.

Output :

First Variable               5
Second Variable           3
Sign (+ or - or * or /)   +

Calculated Value :       8


IDE Used To Test This Code : SAP Netweaver

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment