‎2007 Jun 06 6:40 AM
Hi,
The following is the program.
<b>REPORT ZTX2007.
parameters parm_in default 'A'.
data vout(4) value 'INIT'.
CALL FUNCTION 'Z_TX_2008'
EXPORTING
exname = parm_in
IMPORTING
POUT = vout
EXCEPTIONS
ERROR_A = 1
ERROR_B = 4
ERROR_C = 4
OTHERS = 99.
write: / 'sy-subrc =', sy-subrc,
/ 'vout =', vout.</b>
Below is the function module.
<b>FUNCTION Z_TX_2008.
*"----
""Local interface:
*" IMPORTING
*" VALUE(EXNAME)
*" EXPORTING
*" VALUE(POUT)
*" EXCEPTIONS
*" ERROR_A
*" ERROR_B
*" ERROR_C
*"----
pout = 'XXX'.
case exname.
when 'A'.
raise error_a.
when 'B'.
raise error_b.
when 'C'.
raise error_c.
endcase.
ENDFUNCTION.</b>
Output:
When parm_in = 'A' , sy-subrc value is 1.
When parm_in = 'B', sy-subrc value is 4.
When parm_in = 'C', sy-subrc value is 4.
For the above 3 cases, i get the desired output.
I want the sy-subrc value to be 99 when i enter any other characters in Parm_in.
How to accomplish this?
Do i have to make any changes in the function module?
Please explain...
Thanks,
Vijay
‎2007 Jun 06 6:43 AM
Hi your FM ,
use
when others.
raise error_OTHERS.
endcase
also define an excpetion in se37 - exception tabs with the same name.
‎2007 Jun 06 6:43 AM
Hi your FM ,
use
when others.
raise error_OTHERS.
endcase
also define an excpetion in se37 - exception tabs with the same name.
‎2007 Jun 06 6:46 AM
hi,
I think in the case statement u need to write the condition
when 'OTHERS'.