‎2009 Jan 21 7:11 AM
Hi,
I have a function module in which i am extracting output message from NAST based on vbeln.
I record is not found, then i am updating return table with error message using 'MESSAGE_TEXT_BUILD'.
Now i have to exit from the function module as my select statement is unsuccessful.
how do you do this?
can i use subroutines in a function module?
thanks,
Sandeep
‎2009 Jan 21 7:17 AM
Hi Sandeep,
You can use EXIT statement to exit out of the FM.
Yes, you can use sub-routines in Function Module. If you are using EXIT inside a sub-routine, the program control will come out of sub-routine and not the FM> So if it is inside a sub-routine, return sy-subrc value as a parameter of the sub-routine. Outside the sub-routine, check the value and use EXIT statement accordingly.
Best Regards,
Ram.
‎2009 Jan 21 7:21 AM
create an exception for ur FM.and after filling return tab.put RAISE exception.
it ll come out of FM.. with sy-subrc = the value for exception
‎2009 Jan 21 7:23 AM
‎2009 Jan 21 8:03 AM
Hi Sandeep,
You can use EXIT to come out of FM but make sure that you dont write EXIT inside a LOOP..
Better way would be to RAISE an exception... All you have to do is declare an exception in Exceptions tab.. and do a RAISE <exception_name>
You may have subroutines in FM.. the form can be declared in the MAIN program or any of the includes.