SUBMIT Statement in SAP ABAP (Updated for HANA)

SUBMIT is a keyword in SAP ABAP where you can use to execute an ABAP program within an another ABAP Program. There are multiple variations how you can use SUBMIT statement in SAP ABAP. For example, with different variations of SUBMIT statement syntax, you can define how to set Selection Screen parameters of the calling program, define if you want to execute the ABAP program in background mode, or if you want to save the list results to ABAP Memory.

We need to identify there are two programs when we discuss SUBMIT function.

  1. Calling Program: ABAP program which calls or executes the external ABAP program. This is the ABAP program we will implement the SUBMIT statement code.
  2. Executed (Called) Program: The Executable program we will execute from the Calling Program.

Types of ABAP Programs You Can SUBMIT.

Executable ABAP programs are the only programs we can execute using SUBMIT statement. Before coding your calling program you need to first check the type of the program you intend to execute.

Find the Type of the ABAP Program via Transaction se38.

You identify the type of the ABAP program from attributes of the program in transaction se38. Go to transaction se38 and enter the name of the ABAP program and select ‘Attributes’ and choose Display.

Find the ABAP Program type from Attributes of transaction se38
Find the ABAP Program type from Attributes of transaction se38

 

Find the Type of the ABAP Program using Transaction Code.

Maybe you are only aware of the Transaction code, not the ABAP program name. To find the the program name, go to transaction to se93 (Maintain Transaction) and find the the program name in the next screen. Finally, go to Transaction se38 to identify the program type.

Choose Display option in Transaction se93 to find the the ABAP program name of a transaction
Choose Display option in Transaction se93

 

ABAP Program name of the Transaction Code displayed in transaction se93.
ABAP Program name of the Transaction Code

Syntax of ABAP SUBMIT Statement.

Syntax of the SUBMIT statement is as follows.

SUBMIT

<Executed (called) program name>

<Selection Screen options>

<Output list options>

<Background job options>

[AND RETURN].

 

Executed (called) Program Name.

This option defines the name of the Executed (called) program. This program should be of type “Executable” as discussed previously. You define the name of the Executed program as a variable or hard-code the program name. Use an variable to define the program name if the program name should be derived dynamically at run-time.

Selection Screen Options

Executed (called) program might have a Selection Screen. If you require to set the Selection Screen parameters of the Executed program, use this syntax option. Here you can supply the values to the Selection Screen fields of the Executed program from the Calling Program.

Output List Options

Using Output list options, we can define how to handle the output of the program. Using addition, EXPORTING LIST TO MEMORY you can save the list in ABAP memory. Addition TO SAP-SPOOL creates a new Spool request with the Executed output list.

Background Job Options

Addition VIA JOB syntax allow us to execute the program in background mode.

AND RETURN

If you specify AND RETURN, Executed program is started in a new internal session. After the Executed program has run has been completed, Calling Program continue after the SUBMIT statement. We use this addition if we need to sequence the execution of the Calling program and Executed program at run-time. 


Sample ABAP Programs with SUBMIT Statement.

Let’s call transaction FBL5N (program rfitemar) which is used to check customer open items. I will call this report for company code 3000 and key date as at today.

In this example Calling program name is ‘zcalling_program‘ and the Executed program name is ‘rfitemar‘.

Company code parameter name is ‘DD_BUKARS’ and Key date selection screen parameter name is ‘PA_STIDA’.

SAP Version Sample ABAP Code was Implemented.

  • SAP ABAP PLATFORM 1809
  • SAP S/4HANA 1809
  • SAP S/4HANA FOUNDATION 1809

SUBMIT with WITH SELECTION-TABLE.

SUBMIT with Setting Values for Individual Parameters.

Set the values of individual Selection Screen parameters using WITH addition.

Operators EQ|NE|CP|NP|GT|GE|LT|LE passes single values while BETWEEN passes ranges to the selection parameters. IN can be used to pass a range of values. To pass a range, create a internal table with RANGE OF addition.


SUBMIT with a Variant
.

Use the following syntax to call the program with a Variant ‘TEST_VARIANT_1’. Assign the Company Code and Key date values in the variant.

Call Report and Export the List to Memory.

In this variation of SUBMIT, we call the program and export the output list to memory. Next we read the list from memory and write to screen.

In this method you can export the result of the report output to memory. This memory can be read by function modules LIST_FROM_MEMORY, WRITE_LIST , and DISPLAY_LIST.

Export the SUBMIT List Results to Spool.

TO SAPSPOOL allow you to create a new Spool request with the results. In this method use Function Module ‘GET_PRINT_PARAMETERS’ to fetch the print parameters of the program.

New Spool request created will be displayed as a information message in the calling program. Go to transaction sp01 to view the created spool request.

New spool request created.
New spool request created.

 

Display spool request under transaction sp01
Display spool request under transaction sp01

Call Report (program) in Background Mode via a Batch Job.

Another important variation is executing a program in background mode. This calling program submit the executed program via a batch job named ‘SUBMIT_BATCHJOB’.

Addition VIA JOB can be only used with AND RETURN.

Go to transaction sm37 to monitor the status of the background job created from the calling program.

Background job created from the SUBMIT calling program displayed in transaction sm37.
Background job created from the SUBMIT calling program.

If not specified, default behavior is Batch Job created under the login User and Logon language. You can change the Batch Job user name and language with additions USER and LANGUAGE to the SUBMIT statement.

Practical Issues with SUBMIT Statement.

Suppress Pop-up Windows.

Unfortunately, pop-up windows of Executed program cannot be suppressed in SUBMIT. This is an issue specially if the Executed program is a standard program. If you are calling a custom Z program, you can change the code or copy the program to a new program and change to code to accommodate SUBMIT function.


Have you come across other variations of SUBMIT statement that came in handy? If you have any questions on how to use SUBMIT statement in SAP ABAP, please leave a comment below.

Get the latest tips and tricks on SAP!

2 Comments

Add a Comment

Your email address will not be published. Required fields are marked *

Get the latest tips and tricks on SAP!