10-29-2009 2:53 PM
Hello Experts, i have two questions about submit.
1- How to know that a program was called by "Submit"? I find in SND that is not possible with SYST fields.
2- I am calling a report with 'SUBMIT' statement (Submit and Return), the called program has some error message ( MESSAGE e....). When the error occurs in the called program, an error message is displayed in the screen without coming back to calling program. I want that the called program be executed and when the error occurs, I get back to calling program.
How can I do that?
Correct answers will be greatly appreciated!!
10-29-2009 3:12 PM
>
> 1- How to know that a program was called by "Submit"? I find in SND that is not possible with SYST fields.
=== export a variable from calling program and import it in the called progra,, if you find the same value as exported.. you know that its been called from that program.
for more information.. press F1 on EXPORT or IMPORT.
>
> 2- I am calling a report with 'SUBMIT' statement (Submit and Return), the called program has some error message ( MESSAGE e....). When the error occurs in the called program, an error message is displayed in the screen without coming back to calling program. I want that the called program be executed and when the error occurs, I get back to calling program.
> How can I do that?
yes you can... dont populate the message in the called program... (remove the error message) rather than that... use same export import method as i said above.. export a error flag variable from called program and import the error value in the calling program.. then do what ever you want..
10-29-2009 3:12 PM
>
> 1- How to know that a program was called by "Submit"? I find in SND that is not possible with SYST fields.
=== export a variable from calling program and import it in the called progra,, if you find the same value as exported.. you know that its been called from that program.
for more information.. press F1 on EXPORT or IMPORT.
>
> 2- I am calling a report with 'SUBMIT' statement (Submit and Return), the called program has some error message ( MESSAGE e....). When the error occurs in the called program, an error message is displayed in the screen without coming back to calling program. I want that the called program be executed and when the error occurs, I get back to calling program.
> How can I do that?
yes you can... dont populate the message in the called program... (remove the error message) rather than that... use same export import method as i said above.. export a error flag variable from called program and import the error value in the calling program.. then do what ever you want..
10-29-2009 3:17 PM
Hi,
Before passing control to the called program, store the calling program's name in a memory id.
And compare the memory id variable and the sy-repid, if there are different, then the program is called by a SUBMIT stmt.
When sy-subrc is not zero, do not display the error message using MESSAGE, instead assign the error message to the standard variables sy-msgid, sy-msgno, sy-msgv1..sy-msgv4 and RETURN.
Hopefully, when you come back to the calling program, all these variables will still be available until it is overridden by any other message (success or failure).
Regards,
Subramanian