SUBMIT ( SAP ABAP Keyword)

SUBMIT is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.

SUBMIT

Basic form
SUBMIT rep.

Additions
1. … LINE-SIZE col
2. … LINE-COUNT lin
3. … TO SAP-SPOOL
4. … VIA SELECTION-SCREEN
5. … AND RETURN
6. … EXPORTING LIST TO MEMORY
7. … USER user VIA JOB job NUMBER n
8. … Various additions for parameter transfer to rep
9. … USING SELECTION-SETS OF PROGRAM prog

Effect
Calls the report rep . Leaves the active program and starts the new report rep .

—————————————————
Addition 1
LINE-SIZE col

Effect
Prints the report with the line width col .
—————————————————–
Addition 2
LINE-COUNT lin

Effect
Prints the report with lin lines (per page).
—————————————————-
SUBMIT TO SAP-SPOOL

Basic form
SUBMIT rep … TO SAP-SPOOL.

Additions

1. … DESTINATION dest
… COPIES cop
… LIST NAME name
… LIST DATASET dsn
… COVER TEXT text
… LIST AUTHORITY auth
… IMMEDIATELY flag
… KEEP IN SPOOL flag
… NEW LIST IDENTIFICATION flag
… DATASET EXPIRATION days
… LINE-COUNT lin
… LINE-SIZE col
… LAYOUT layout
… SAP COVER PAGE mode
… COVER PAGE flag
… RECEIVER rec
… DEPARTMENT dep
… ARCHIVE MODE armode
… ARCHIVE PARAMETERS arparams
… WITHOUT SPOOL DYNPRO

2. … SPOOL PARAMETERS params
… ARCHIVE PARAMETERS arparams
… WITHOUT SPOOL DYNPRO

Effect
Calls the report rep with list output to the SAP spool database.

Additions

… DESTINATION dest (output device)

… COPIES cop (number of copies)

… LIST NAME name (name of list)

… LIST DATASET dsn (name of spool dataset)

… COVER TEXT text (title of spool request)

… LIST AUTHORITY auth (authorization for display)

… IMMEDIATELY flag (print immediately ?)

… KEEP IN SPOOL flag (keep list after print ?)

… NEW LIST IDENTIFICATION flag (new spool request ?)

… DATASET EXPIRATION days (number of days list retained)

… LINE-COUNT lin ( lin lines per page)

… LINE-SIZE col ( col columns per line)

… LAYOUT layout (print format)

… SAP COVER PAGE mode ( SAP cover sheet ?)

… COVER PAGE flag (selection cover sheet ?)

… RECEIVER rec ( SAP user name of
recipient)

… DEPARTMENT dep (name of department)

… ARCHIVE MODE armode (archiving mode)

… ARCHIVE PARAMETERS arparams (structure with archiving
parameters)

… WITHOUT SPOOL DYNPRO (skip print control screen)
With
the parameters IMMEDIATELY , KEEP IN SPOOL , NEW LIST IDENTIFICATION
and COVER TEXT , flag must be a literal or character field with the
length 1. If flag is blank, the parameter is switched off, but any
other character switches the parameter on. You can also omit any of the
sub-options of PRINT ON . mode with SAP COVER PAGE can accept the
values ‘ ‘ , ‘X’ and ‘D’ . These values have the following meaning:

‘ ‘ : Do not output cover sheet
‘X’ : Output cover sheet
‘D’ : Cover sheet output according to printer setting

armode with ARCHIVE MODE can accept the values ‘1’ , ‘2’ and ‘3’ . These values have the following meaning:

‘1’ : Print only
‘2’ : Archive only
‘3’ : Print and archive

arparams
with ARCHIVE PARAMETERS must have the same structure as ARC_PARAMS .
This parameter should only be processed with the function module
GET_PRINT_PARAMETERS .

Effect
Output is to the SAP spool
database with the specified parameters. If you omit one of the
parameters, the system uses a default value. Before output to the
spool, you normally see a screen where you can enter and/or modify the
spool parameters. However, you can suppress this screen with the
following statement:

… TO SAP-SPOOL WITHOUT SPOOL DYNPRO

This you could use this option if all the spool parameters have already been set!

Note
When specifying the LINE-SIZE , you should not give any value > 132 because most printers cannot print wider lists.

Addition 2

… SPOOL PARAMETERS params (structure with print
parameters)
… ARCHIVE PARAMETERS arparams (Structure with archive
parameters)
… WITHOUT SPOOL DYNPRO (skip print parameters
screen)

Effect
Output
is to the SAP spool database with the specified parameters. The print
parameters are passed by the field string params which must have the
structure of PRI_PARAMS . The field string can be filled anf modified
with the function module GET_PRINT_PARAMETERS . The specification
arparams with ARCHIVE PARAMETERS must have the structure of ARC_PARAMS
. This parameter should only be processed with the function module
GET_PRINT_PARAMETERS . Before output to the spool, you normally see a
screen where you can enter and/or modify the spool parameters. However,
you can suppress this screen with the following statement:

… WITHOUT SPOOL DYNPRO

Example

* Without archiving
DATA: PARAMS LIKE PRI_PARAMS,
DAYS(1) TYPE N VALUE 2,
COUNT(3) TYPE N VALUE 1,
VALID TYPE C.

CALL FUNCTION ‘GET_PRINT_PARAMETERS’
EXPORTING DESTINATION = ‘LT50’
COPIES = COUNT
LIST_NAME = ‘TEST’
LIST_TEXT = ‘SUBMIT … TO SAP-SPOOL’
IMMEDIATELY = ‘X’
RELEASE = ‘X’
NEW_LIST_ID = ‘X’
EXPIRATION = DAYS
LINE_SIZE = 79
LINE_COUNT = 23
LAYOUT = ‘X_PAPER’
SAP_COVER_PAGE = ‘X’
COVER_PAGE = ‘X’
RECEIVER = ‘SAP*’
DEPARTMENT = ‘System’
NO_DIALOG = ‘ ‘
IMPORTING OUT_PARAMETERS = PARAMS
VALID = VALID.

IF VALID <> SPACE.
SUBMIT RSTEST00 TO SAP-SPOOL
SPOOL PARAMETERS PARAMS
WITHOUT SPOOL DYNPRO.
ENDIF.

Example

* With archiving
DATA: PARAMS LIKE PRI_PARAMS,
ARPARAMS LIKE ARC_PARAMS,
DAYS(1) TYPE N VALUE 2,
COUNT(3) TYPE N VALUE 1,
VALID TYPE C.

CALL FUNCTION ‘GET_PRINT_PARAMETERS’
EXPORTING DESTINATION = ‘LT50’
COPIES = COUNT
LIST_NAME = ‘TEST’
LIST_TEXT = ‘SUBMIT … TO SAP-SPOOL’
IMMEDIATELY = ‘X’
RELEASE = ‘X’
NEW_LIST_ID = ‘X’
EXPIRATION = DAYS
LINE_SIZE = 79
LINE_COUNT = 23
LAYOUT = ‘X_PAPER’
SAP_COVER_PAGE = ‘X’
COVER_PAGE = ‘X’
RECEIVER = ‘SAP*’
DEPARTMENT = ‘System’
SAP_OBJECT = ‘RS’
AR_OBJECT = ‘TEST’
ARCHIVE_ID = ‘XX’
ARCHIVE_INFO = ‘III’
ARCHIVE_TEXT = ‘Description’
NO_DIALOG = ‘ ‘
IMPORTING OUT_PARAMETERS = PARAMS
OUT_ARCHIVE_PARAMETERS = ARPARAMS
VALID = VALID.

IF VALID <> SPACE.
SUBMIT RSTEST00 TO SAP-SPOOL
SPOOL PARAMETERS PARAMS
ARCHIVE PARAMETERS ARPARAMS
WITHOUT SPOOL DYNPRO.
ENDIF.
——————————————————

Addition 4
VIA SELECTION-SCREEN

Effect
Displays
the selection screen for the user. In this case, the selection screen
is redisplayed after return from the report list display – the user’s
entries are retained.

——————————————————————–
Addition 5
AND RETURN

Effect
Returns
to the calling transaction or program after the called program has been
executed. SUBMIT … AND RETURN creates a new internal mode .

——————————————————————-
Addition 6
EXPORTING LIST TO MEMORY

Effect
Does
not display the output list of the called report, but saves it in SAP
memory and leaves the called report immediately. Since the calling
program can read the list from memory and process it further, you need
to use the addition … AND RETURN . Also, since the called report
cannot be requested for printing, the addition … TO SAP-SPOOL is not
allowed here. You can read the saved list from SAP memory with the
function module ‘LIST_FROM_MEMORY’ and then (for example) store it in
the database with EXPORT . You can process this list further with the
function modules ‘WRITE_LIST’ , ‘DISPLAY_LIST’ … of the function
group “SLST” .

——————————————————————–
Addition 7
USER user VIA JOB job NUMBER n

Effect
Schedules
the specified report in the job specified by the job name job and the
job number n . The job runs under the user name user and you can omit
the addition USER user . The assignment of the job number occurs via
the function module JOB_OPEN (see also the documentation for the
function modules JOB_CLOSE and JOB_SUBMIT . This addition can only be
used with the addition …AND RETURN .
Note
When scheduling a
report with the SUBMIT … VIA JOB job NUMBER n statement, you should
always use the addition …TO SAP-SPOOL to pass print and/or archive
parameters. Otherwise, default values are used to generate the list and
this disturbs operations in a production environment.
————————————————————————

Passing parameters with SUBMIT

Variants

1. … USING SELECTION-SET vari
2. … WITH p op f SIGN s
3. … WITH p BETWEEN f1 AND f2 SIGN s
4. … WITH p NOT BETWEEN f1 AND f2 SIGN s
5. … WITH p IN sel
6. … WITH SELECTION-TABLE seltab
7. … WITH FREE SELECTIONS texpr

Effect
Passes
values to the SELECT-OPTIONS and PARAMETERS of the program rep (these
can also be defined in the database program SAPDBldb of the relevant
logical database ldb ). p is the name of a parameter or selection
criterion .

Variant 1
… USING SELECTION-SET vari

Effect
The variable vari contains the name of a variant used to start the report.

Variant 2
… WITH p op f SIGN s

Effect
op
is one of the operations EQ, NE, CP, NP, GE, LT, LE, GT . s is a
variable which must contain one of the values ‘I’ or ‘E’ (any other
values result in a runtime error). The addition SIGN is optional and
the default is ‘I’ . If p is a selection criterion (SELECT-OPTIONS ),
an entry with LOW = f , OPTION = op and SIGN = s is generated in the
relevant internal table.
If p is a parameter (PARAMETERS ), the
system treats all options like EQ , i.e. it always transfers a single
value. The field f is passed to the parameter p or to the field p-LOW
of the selection criterion (xxx in the above list) in internal format.
If p is not the same type as f , a type conversion is performed in the
target report when data is passed.

Variant 3
… WITH p BETWEEN f1 AND f2 SIGN s

Effect
Passes
the range with the lower limit f1 and the upper limit f2 to the
selection criterion p . As with variant 2, f1 and f2 are passed in
internal format and the handling of SIGN is also the same. The system
thus generates an entry with LOW = f1 , HIGH = f2 , OPTION = BT and
SIGN = s . When data is passed, a type conversion is performed.

Variant 4
… WITH p NOT BETWEEN f1 AND f2 SIGN s

Effect
Similar to 3, except that OPTION NB is generated instead of OPTION BT .

Variant 5
… WITH p IN sel

Effect
p
is a selection criterion and sel is an internal table which is
compatible with p and contains the transfer values. You are recommended
to define sel with RANGES . The lines of sel must have exactly the same
structure as the lines of a sdlection table (see SELECT-OPTIONS ).

Variant 6
… WITH SELECTION-TABLE seltab

Effect
seltab is an internal table with the structure RSPARAMS.
This variant allows you to set the names and contents of the parameters and selection options dynamically at runtime.
You
can use the function module RS_REFRESH_FROM_SELECTOPTIONS to read the
contents of the parameters and selection options of the current program
into an internal table seltab with the structure RSPARAMS . By using
SUBMIT … WITH SELECTION-TABLE seltab , you can then pass these values
on directly.

Variant 7
… WITH FREE SELECTIONS texpr

Effect
Passes dynamic selections.

texpr is an internal table of the type RSDS_TEXPR (see type pool RSDS).

Note
You can, for example, fill the object texpr in one of the following ways:

While
processing a report with dynamic selections, call the function module
RS_REFRESH_FROM_DYNAMICAL_SEL . This returns an object of the type
RSDS_TRANGE which a subsequent function module
FREE_SELECTIONS_RANGE_2_EX then converts to an object of the type
RSDS_TEXPR . In this way, you can pass on the dynamic selections of the
current report with SUBMIT .
Call the function modules
FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG in order to offer the
user a dialog for entering dynamic selections. These function modules
return an object of the type RSDS_TEXPR .

Notes
You can
combine the variants 1-7 in any permutation. The same selection
criterion may be addressed several times with WITH . This generates
several lines in the internal table assigned to the selection criterion
p . You can also combine parameter transfer using a variant with
explicit parameter passing via the WITH clause. In the event of a
conflict, the parameter passed explicitly overwrites the corresponding
parameter or selection criterion from the variant. Addition 6 ( WITH
SELECTION-TABLE ) can be combined with parameter transfer using a
variant (like directly written WITH clauses), but not with direct WITH
clauses.
The values passed during SUBMIT are not taken over until
the event INITIALIZATION has been processed, i.e. default values set at
INITIALIZATION are overwritten if values are passed for the PARAMETER
or SELECT-OPTION during SUBMIT .
Example
1st combination – variant and WITH

RANGES RANGE_LANGU FOR SY-LANGU.

PARAMETERS: MSG_FR LIKE T100-MSGNR,
MSG_TO LIKE T100-MSGNR.

MOVE: ‘I’ TO RANGE_LANGU-SIGN,
‘BT’ TO RANGE_LANGU-OPTION,
‘D’ TO RANGE_LANGU-LOW,
‘I’ TO RANGE_LANGU-HIGH.
APPEND RANGE_LANGU.

MOVE: ‘EQ’ TO RANGE_LANGU-OPTION,
‘E’ TO RANGE_LANGU-LOW.
APPEND RANGE_LANGU.

SUBMIT REPORT00
USING SELECTION-SET ‘VARIANT1’
WITH MSG BETWEEN MSG_FR AND MSG_TO
WITH LANGU IN RANGE_LANGU.

Example
2nd combination – variant and WITH SELECTION-TABLE

DATA: BEGIN OF SELTAB OCCURS 5.
INCLUDE STRUCTURE RSPARAMS.
DATA: END OF SELTAB.

MOVE: ‘LANGU’ TO SELTAB-SELNAME,
‘S’ TO SELTAB-KIND, ” SELECT-OPTION
‘I’ TO SELTAB-SIGN,
‘BT’ TO SELTAB-OPTION,
‘D’ TO SELTAB-LOW,
‘I’ TO SELTAB-HIGH.
APPEND SELTAB.

MOVE: ‘E’ TO SELTAB-SIGN,
‘EQ’ TO SELTAB-OPTION,
‘F’ TO SELTAB-LOW,
SPACE TO SELTAB-HIGH.
APPEND SELTAB.

CLEAR SELTAB.
MOVE: ‘ARBGB’ TO SELTAB-SELNAME,
‘P’ TO SELTAB-KIND, ” PARAMETER
‘XX’ TO SELTAB-LOW.
APPEND SELTAB.

SUBMIT REPORT00
USING SELECTION-SET ‘VARIANT1’
WITH SELECTION-TABLE SELTAB
AND RETURN.

————————————————————-

Addition 9
USING SELECTION-SETS OF PROGRAM prog

Effect
Uses variants of the program prog when executing the program rep .

Note
Important

The
programs prog and rep must have the same SELECT-OPTIONS and PARAMETER
s. Otherwise, variants of the program prog may be destroyed.

Note
When
using this addition, the specified variant vari of the program prog is
taken in USING SELECTION-SET vari . On the other hand, all
variant-related actions on the selection screen of rep (Get , Save as
variant , Display , Delete ) refer to the variants of prog .

Example

SUBMIT REPORT01
VIA SELECTION-SCREEN
USING SELECTION-SET ‘VARIANT1’
USING SELECTION-SETS OF PROGRAM ‘REPORT00’
AND RETURN.

Effect
Executes the program REPORT01 with the variant VARIANT1 of the program REPORT00 .

Note
Runtime errors

LOAD_PROGRAM_NOT_FOUND : The specified program was not found.
SUBMIT_WRONG_TYPE : The specified program is not a report.
SUBMIT_IMPORT_ONLY_PARAMETER : Only one value passed to a report parameter.
SUBMIT_WRONG_SIGN : Invalid value passed to a selection with the addition SIGN .
SUBMIT_IN_ITAB_ILL_STRUCTURE : Table passed to a selection with WITH sel IN itab had an unexpected structure.