The statement SUBMIT calls an
executable program. The executable program is executed as described under
Flow of an Executable Program. If the called program contains a syntax error, an exception is raised that cannot be handled. The
name of the called program can be specified as follows:
Specified directly and statically as rep.
Specified as the content of a parenthesized flat character-like data object name.
The data object name must contain the name of the program accessed in uppercase letters. The following can be specified for name:
Literal or constants
If the data object name is specified as
a text field literal or as a constant, it can be evaluated statically and the called program is known as the used object.
If the data object name is specified as a variable, it is specified only dynamically and the content is not evaluated statically.
When the statement is executed, name is not evaluated until runtime (in both
cases). If the program specified in name is not found, a non-handleable exception is raised.
If the name of a program unit is specified dynamically when it is called, and this name is passed to
a program from outside, the result is a serious security risk. Any names passed to a program from outside
must be checked thoroughly before being used in calls. The system class CL_ABAP_DYN_PRG, for example, can be used to do this. See
Call program DEMO_PROGRAM_SUBMIT_REP without returning to the calling program.
... AND RETURN
The addition AND RETURN determines the object accessed by the runtime environment after the program is called:
If the addition AND RETURN is not specified, the
internal session of the program accessed replaces the internal session of the calling program in the same position in the
call sequence, with the current
SAP LUW being exited. Once
program access is completed, the system returns to before the position from which the calling program
was started. The content of the system field sy-calld at SUBMIT is copied by the calling program without AND RETURN.
The addition AND RETURN starts the executable program in a new internal session of the current
call sequence. The session of the calling program and the current
SAP LUW are preserved. The
called program runs in its own SAP LUW. Once the program call is finished, resumes execution of the program execution is continued after the statement SUBMIT.
The number of internal sessions in a call sequence is restricted to nine. If this is exceeded by SUBMIT ... AND RETURN, the program terminates and the entire call sequence is deleted.
If there are still procedures registered in the current
SAP LUW in the case of
SUBMITs without AND RETURN, the SAP LUW exits without calling or rolling back the procedures. Registered
modules can no longer be executed. In cases like this, therefore, it is advisable to execute the
statement COMMIT WORK
or ROLLBACK WORK explicitly before the program call.
Call program DEMO_PROGRAM_SUBMIT_REP and return to the calling program.