Skip to Content
2
Former Member
Jul 10, 2007 at 11:30 AM

iNVALID OPERATOR.

19 Views

hI,

This is my program.

REPORT ZAC_TAB25.

PARAMETERS:

P_NUM1 TYPE I,

P_NUM2 TYPE I,

P_OPER TYPE C.

DATA:

W_RESULT TYPE I.

CALL FUNCTION 'ZAC_CALCULATE'

EXPORTING

IM_NUM1 = P_NUM1

IM_NUM2 = P_NUM2

IM_OPER = P_OPER

IMPORTING

EX_RESULT = W_RESULT.

  • EXCEPTIONS

  • INVALID_OPERATOR1 = 1

  • ZERO_DIVIDE1 = 2

  • OTHERS = 3

.

IF SY-SUBRC EQ 0.

WRITE:/ 'RESULT IS', W_RESULT.

ELSEIF SY-SUBRC EQ 1.

WRITE:/ 'INVALID OPERATION'.

ELSEIF SY-SUBRC EQ 2.

WRITE:/ 'CANNOT DIVIDE BY ZERO'.

ELSE.

WRITE:/ 'UNKNOWN EXCEPTION'.

ENDIF.

Here when i am giving Invalid operator, it is giving result as zero instead of getting message as Invalid operator.