Hi,
im neu in ABAP Welt and tried to write a calculator but whenever i click a button. it deletes field which i want to also see. Can You experts help me for this?
here is my code:
MODULE user_command_2000 INPUT.
IF sy–ucomm EQ ‘BACK’.
LEAVE TO SCREEN 0.
ELSEIF sy–ucomm EQ ‘CLEAR’.
CLEAR:
gv_numinp1 ,
gv_numinp2 ,
gv_numoutp1.
ELSEIF sy–ucomm EQ ‘EXIT’ OR sy–ucomm EQ ‘CANC’.
LEAVE PROGRAM.
ELSEIF sy–ucomm EQ ‘CALC’.
IF gv_numinp1 IS INITIAL AND gv_numinp2 IS INITIAL.
MESSAGE ‘bitte’ TYPE ‘S’ DISPLAY LIKE ‘E’.
ENDIF.
CREATE OBJECT go_main EXPORTING iv_num1 = gv_numinp1 iv_num2 = gv_numinp2.
IF gv_radplus EQ abap_true. “Summe
go_main->sum(
IMPORTING
ev_result = gv_numoutp1 ” RESULT
).
ELSEIF gv_radmin EQ abap_true. “Minus
go_main->subtraction(
IMPORTING
ev_result = gv_numoutp1 ” RESULT
).
ELSEIF gv_radmultip EQ abap_true. “multiplication
go_main->multiplication(
IMPORTING
ev_result = gv_numoutp1 ” RESULT
).
ELSEIF gv_raddiv EQ abap_true. “division
go_main->division(
IMPORTING
ev_result = gv_numoutp1 ” RESULT
).
ENDIF.
ENDIF.
WRITE gv_numoutp1.
ENDMODULE.
and Photos:
before:
and after click:
BR.