we are introduced to ABAP in my university and the task is to write a simple calculator. However, we have to add possible conditions for the user to add, either the sum not going higher than 1.000.000 or below 0.
So I tried to check if the user inputs a condition parameter. If he does, I want to check if the result meets the conditions, if it doesn't it should output an error and exit, but for me it just prints the result, even though the conditions are not met. E.g. user limits sum to a maximum of 1mil and adds 2 to 999.999, it still prints out 1.000.001 and not, that the number is too high.
The if-statement looks like this:
IF ( Einschr = 'l' AND ergebnis > 1000000 ).
WRITE: 'Ergebnis größer als 1.000.000'.
exit.
ELSEIF ( Einschr = 'p' AND ergebnis < 0 ).
WRITE: 'Ergebnis kleiner als 0'.
exit.
ENDIF.
WRITE: 'Ergebnis'(res), ergebnis.
Is there something wrong with my if-statement or does it have to be in the rest of the code?
Would appreciate any help.
Aucun commentaire:
Enregistrer un commentaire