‎2006 Oct 12 7:45 AM
Hello,
I have a fuction module and I will export errors. When I export an error, the function module must stop. How can I stop the function module after the error message? Can I use exit?
‎2006 Oct 12 7:47 AM
‎2006 Oct 12 7:52 AM
Put an export value check after execution of function module.
‎2006 Oct 12 7:59 AM
hi,
1. If y r handling the exceptions, u can stop the FM using 'RAISE exception1' statement. This will return the sy-subrc with the value u assigned to 'exception1'. By checking the sy-subrc u can display the erroe message.
2. If y r not handling the exceptions:
if <condition>.
message i002(sy) with 'ERROR'.
exit.
endif.
Regards,
Rajesh
‎2006 Oct 12 8:44 AM
I don't use exceptions. In my function module I have some subroutines. In this subroutines are the error messages. When I use exit it don't stop? What can I do?
For example:
FORM XY CHANGING MSGERROR TYPE BAPIRETURN.
...
IF NOT XX <> ''.
error-type = 'W'.
error-message = 'Error'(001).
exit.
ENDIF.
ENDFORM.
‎2006 Oct 12 9:00 AM
HI,
May be you are in LOOP...ENDLOOP statement.
If Yes, Just put a flag in the error scenario.
And after loop...
IF V_FLAG = 'X'.
EXIT.
ENDIF.
Thanks,
Ramakrishna
‎2006 Oct 12 8:51 AM
I guess it is coming out of subroutine. If this is true again use exit by checking a condition in FM as the subsequent statement to subroutine call.
‎2006 Oct 12 9:02 AM
@Rajesh kumar kaveti: That was it, thank you! Now I want to click Solved Problem (10), so that you get 10 Points, but there is an error: Rewarding the message failed.
Sorry, so I don't rate you...
‎2006 Oct 12 8:54 AM
Hi,
Use can use a RETURN statement once you check for the error and found any error in the routine.
Regards,
Uma.
‎2006 Oct 12 9:15 AM
Hi,
There so noway in ABAP where you can exit the program. If you use EXIT or RETURN this will only stop the current processing block. So if you say EXIT from a subroutine it only exits the subroutine not the Function Module. You can use LEAVE PROGRAM if you really want to comeout of the program. If you just want to come out of the FM its better use set some flag in the subroutine before exit and use that flat in FM to call EXIT again.
Best Regards,
Sesh