Skip to Content
0
Former Member
Jul 11, 2007 at 05:14 AM

Invalid operator

120 Views

Hi,

In 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.

when iam executing the program(F8)with invalid operator like T(p_oper=t), It is givimg result as zero, instead of givimg message as Invalid operator.

Thanks