Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

is this functionality possible with Submit?

Former Member
0 Likes
1,675

hi,

SUBMIT ZB21 WITH P_WERKS EQ P_WERKS

WITH P_LGORT EQ P_LGORT

EXPORTING LIST TO MEMORY

AND RETURN.

this is my submit statement...now, is it possible to capture the values of p_werks and p_lgort from my calling program in prog. zb21 at runtime? do suggest...thanks all

regards,

Sathish. R

2 REPLIES 2
Read only

Former Member
0 Likes
624

Affecting Lists in Called Programs

When you call an ABAP program, you can modify its lists, send them to a spool file instead of the screen, or store them in ABAP memory.

Modifying the List Structure

You can modify the list structure of a called program by using the following additions in the SUBMIT statement:

SUBMIT... [LINE-SIZE <width>] [LINE-COUNT <length>].

If the called program contains no such options in the REPORT statement, the system formats the lists of the called program according to the options in the SUBMIT statement. If, on the other hand, the REPORT statement in the called program does specify a list structure, the additions in the SUBMIT statement are ignored. For further information about these additions, refer to Defining Your Own List Structure.

REPORT STARTER NO STANDARD PAGE HEADING.

DATA: NAME(8) VALUE 'SAPMZTS1',

WID TYPE I VALUE 80,

LEN TYPE I VALUE 0.

SET PF-STATUS 'SELECT'.

WRITE: 'Select a report and its list format:',

/ '----


'.

SKIP.

WRITE: 'Report ', NAME INPUT ON,

/ 'Line size ', WID INPUT ON,

/ 'Page length', LEN INPUT ON.

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'SELE'.

READ LINE: 4 FIELD VALUE NAME,

5 FIELD VALUE WID,

6 FIELD VALUE LEN.

SUBMIT (NAME) LINE-SIZE WID LINE-COUNT LEN AND RETURN.

ENDCASE.

You can use this program to start programs with user-defined list formatting. On the basic list, the user can enter a report name and the desired list width and length by overwriting the default values:

In the AT USER-COMMAND event, the system reads the values and starts the specified executable program using SUBMIT. If the REPORT statement in the called program has no LINE-SIZE or LINE-COUNT specification of its own, its lists are displayed using the values WID and LEN. At the end of the called program, you can change the input values on the basic list and start a new program.

Printing Lists

You can send a list from a called program directly to the spool system instead of displaying it on the screen. To do this, use the TO SAP-SPOOL addition in the SUBMIT statement:

SUBMIT... TO SAP-SPOOL <print-parameters>.

For details of the parameters that you can use here, refer to Printing Lists.

Saving Lists

Instead of displaying a list on the screen, you can store it in ABAP memory using the EXPORTING LIST TO MEMORY addition in the SUBMIT statement:

SUBMIT... AND RETURN

EXPORTING LIST TO MEMORY.

This statement stores the list in ABAP memory, allowing the calling program to access it once the called program has finished. You must use the AND RETURN addition in this case. You cannot use the additions EXPORTING LIST TO MEMORY and TO SAP-SPOOL together.

The function group SLST provides function modules for accessing the saved list, including for example:

LIST_FROM_MEMORY

WRITE_LIST

DISPLAY_LIST

SUBMIT

Syntax

SUBMIT {rep|(name)} [selscreen_options]

[ list_options ]

[ job_options]

[AND RETURN].

Addition:

... AND RETURN

Effect

The SUBMIT statement accesses an executable program rep. The executable program is executed as described under Calling Executable Reports.

The program name rep can either be specified directly or as the content of a character-like data object name. The data object name must contain the name of the program to be accessed in block capitals. If the program specified in name is not found, an irretrievable exception is generated.

The selscreen_options additions can be used to determine the selection screen for the program accessed and to supply it with values.

The list_options additions allow you to influence the output medium and the page size in the basic list for the program accessed.

You can schedule the program for background processing by specifying job_options.

Addition

... AND RETURN

Effect

The AND RETURN addition determines the object accessed by the runtime environment after program access is completed:

Without the AND RETURN addition, the internal session of the program accessed replaces the internal session of the calling program in the same position in the call sequence. Once program access is completed, the system returns to before the position from which the calling program was started.

As of Release 6.10, the content of the system field sy-calld at SUBMIT is copied by the calling program without AND RETURN. Before 6.10, the system entered the value "X", which was incorrect when the program was accessed from the first program in a call sequence.

The addition AND RETURN starts the executable program in a new internal session. The session for the calling program is retained. Once program access is completed, program execution for the calling program continues after the SUBMIT statement.

Note

When the SUBMIT statement is executed, the system runs an authorization check for the authorization group specified in the program attributes.

SUBMIT - selscreen_options

Syntax

... [USING SELECTION-SCREEN dynnr]

[VIA SELECTION-SCREEN]

[selscreen_parameters] ... .

Extras:

1. ... USING SELECTION-SCREEN dynnr

2. ... VIA SELECTION-SCREEN

Effect

The addition USING SELECTION-SCREEN specifies the selection screen, VIA SELECTION-SCREEN specifies whether it is displayed. The additions selscreen_parameters provide values for the parameters, selection criteria, and the free selection of the called selection screen.

The values are transferred to the selection screen between the events INITIALIZATION and AT SELECTION-SCREEN OUTPUT The following hierarchy applies for transferring values:

First, the variant of the addition USING SELECTION-SET is transferred, which sets all parameters and selection criteria to the values of the variant. The values previously set in the called program are overwritten.

The values are then transferred to the table of the addition WITH SELECTION-TABLE. All parameters and selection criteria specified there are overwritten accordingly.

Finally, the values of the additions WITH sel value are transferred. All parameters and selection criteria are overwritten accordingly. If the addition WITH sel value is used more than once for the same parameter, this is overwritten with the last specified value. If the addition WITH sel value is used more than once for the same selection criterion, a selection table with the corresponding number of lines is transferred.

Providing values for free selections is independent of this hierarchy.

Notes

The options for parameter transfer enable a selection screen to be viewed as a parameter interface of an executable program. This applies particularly for background selection screen processing and for parameters and selection criteria that are defined without screen elements using the addition NO-DISPLAY.

The additions selscreen_parameters only work the first time the called program is executed. If a selection screen is displayed in the called program, the runtime environment calls the program again after it is finished, thereby replacing the values specified in selscreen_parameters with the previous input values.

Addition 1

... USING SELECTION-SCREEN dynnr

Effect

This addition specifies which selection screen is called. dynnr is a data object that must contain the screen number of a selection screen defined in the called program when the SUBMIT statement is called.

If the addition USING SELECTION-SCREEN is omitted or the screen number 1000 is entered, the standard selection screen is called. If no standard selection screen is defined in the called program, no selection screen is called.

If a screen number that is not 1000 is entered in the addition USING SELECTION-SCREEN, the corresponding independent selection screen is called. If no selection screen with this screen number is defined in the called program, this leads to an untreatable exception.

Addition 2

... VIA SELECTION-SCREEN

Effect

If this addition is specified, the selection screen is displayed on the screen. Otherwise, background selection screen processing takes place. In background selection screen processing, the selection screen events are triggered without the selection screen being displayed.

SUBMIT - selscreen_parameters

Syntax

... [USING SELECTION-SET variant]

[USING SELECTION-SETS OF PROGRAM prog]

[WITH SELECTION-TABLE rspar]

[WITH sel1 value1 WITH sel2 value2 ...]

[WITH FREE SELECTIONS texpr] ... .

Extras:

1. ... USING SELECTION-SET variant

2. ... USING SELECTION-SETS OF PROGRAM prog

3. ... WITH SELECTION-TABLE rspar

4. ... WITH sel1 value1 WITH sel2 value2 ...

5. ... WITH FREE SELECTIONS texpr

Effect

USING-SELECTION-SET supplies all the selection screen components by means of a Variante variant. If you specify USING-SELECTION-SETS OF PROGRAM , you can use a variant from a different program; if you specify WITH SELECTION-TABLE, values for several selection screen components are transferred as the content of an internal table rspar; WITH sel value supplies individual selection screen components sel with values value. The addition WITH FREE SELECTIONS allows you to transfer dynamic selections to the selection screen for a logical database.

Addition 1

... USING SELECTION-SET variant

Effect

If you specify this edition, the parameters and selection criteria for the selection screen are supplied with values from a variant. For variant, you must specify a character-like data object that contains the name of a variant for the program accessed when the statement is executed. If the variant does not exist, the system sends an error message. If the variant belongs to a different selection screen, it is ignored.

Note

You can create and manage variants for every program in which selection screens are defined, either in the ABAP Workbench or during execution of the program by choosing Goto - Variants on a selection screen.

Addition 2

... USING SELECTION-SETS OF PROGRAM prog

Effect

If you specify this addition, the variants of the program prog are used in the program accessed. For prog, you must specify a character-like data object that contains the name of a program when the statement is executed. The addition has the following effect:

If a variant variant is specified with USING SELECTION-SET, the system searches for this variant in the program prog.

If the selection screen is displayed with VIA SELECTION-SCREEN, all the functions that can be accessed by means of the menu path Goto - Variants affect the variants of the program prog. However, these functions are only active if prog is an executable program.

Note

The program prog should contain a selection screen that has the same parameters and selection criteria as the selection screen used in the program accessed.

Addition 3

... WITH SELECTION-TABLE rspar

Effect

If you specify this addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:

SELNAME (length 8),

KIND (length 1),

SIGN (length 1),

OPTION (length 2),

LOW (length 45),

HIGH (length 45).

To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:

SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals

KIND must contain the type of selection screen component (P for parameters, S for selection criteria)

SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.

If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.

The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.

Note

In contrast to selection tables, the data types of the components LOW and HIGH in table rspar are always of type CHAR and are converted to the type of the parameter or selection criterion during transfer, if necessary.

Addition 4

... WITH sel1 value1 WITH sel2 value2 ...

Effect

This addition supplies values to individual parameters or selection criteria sel for the selection screen. For sel, you must specify the name of a parameter or selection criterion directly. Parameters are supplied with single values and selection criteria with selection tables that overwrite values already specified in the program accessed. The selection table to be transferred is compiled from all the WITH sel additions that address the same selection criterion sel. You can specify the following statements for value:

{EQ|NE|CP|NP|GT|GE|LT|LE} dobj [SIGN sign]

Transfer of a single value.

The operators before dobj correspond to the values specified for column OPTION for selection tables. For dobj, you must specify a data object whose data type can be converted to the data type of the selection screen component sel. For sign, you can specify a character-like field that must contain 'I' or 'E'. The standard value is 'I'.

If sel is a selection criterion, the system appends a line in the selection table to be transferred, placing the operator in column OPTION, the content of dobj in column LOW, and the content of sign in column SIGN.

If sel is a parameter, it is set to the value of dobj in the program accessed. The operator and the value of sign are not taken into account.

[NOT] BETWEEN dobj1 AND dobj2 [SIGN sign]

Transfer of an interval.

In this case, sel must be a selection criterion. For dobj, you must specify data objects whose data type can be converted to that of the columns LOW and HIGH for the selection criterion sel. For sign, you can specify a character-like field that must contain 'I' or 'E'. The standard value is 'I'.

A line is appended in the selection table to be transferred. If NOT is specified, the value 'NB' is placed in column OPTION; otherwise, the value entered is 'BT'. The content of the data objects dobj and sign is placed in the columns LOW, HIGH, and SIGN.

IN rtab

Transfer of a ranges table.

In this case, sel must be a selection criterion. For rtab, you must specify an internal table that has the same structure as the selection table for selection criterion sel. You can create a table like this using the addition RANGE OF to the statements TYPES and DATA.

The lines in table rtab are appended to the selection table to be transferred.

Note

You can also use = or INCL instead of the operator EQ.

You can specify the addition WITH sel value more than once, and you can also specify the same selection screen component more than once.

Example

The program report1 has a stand-alone selection screen with the screen number 1100. In the program report2, an internal table with row type RSPARAMS and a ranges table are filled for this selection screen. These are transferred at SUBMIT together with a single condition.

Program accessed

REPORT report1.

DATA text(10) TYPE c.

SELECTION-SCREEN BEGIN OF SCREEN 1100.

SELECT-OPTIONS: selcrit1 FOR text,

selcrit2 FOR text.

SELECTION-SCREEN END OF SCREEN 1100.

...

Calling program

REPORT report2.

DATA: text(10) TYPE c,

rspar_tab TYPE TABLE OF rsparams,

rspar_line LIKE LINE OF rspar_tab,

range_tab LIKE RANGE OF text,

range_line LIKE LINE OF range_tab.

...

rspar_line-selname = 'SELCRIT1'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'EQ'.

rspar_line-low = 'ABAP'.

APPEND rspar_line TO rspar_tab.

range_line-sign = 'E'.

range_line-option = 'EQ'.

range_line-low = 'H'.

APPEND range_line TO range_tab.

range_line-sign = 'E'.

range_line-option = 'EQ'.

range_line-low = 'K'.

APPEND range_line TO range_tab.

SUBMIT report1 USING SELECTION-SCREEN '1100'

WITH SELECTION-TABLE rspar_tab

WITH selcrit2 BETWEEN 'H' AND 'K'

WITH selcrit2 IN range_tab

AND RETURN.

Result

After report1 has been accessed by report2, the selection tables for the selection criteria selcrit1 and selcrit2 in the program accessed contain the following entries:

SIGN OPTION LOW HIGH

selcrit1 I EQ ABAP

selcrit2 I BT H K

selcrit2 E EQ H

selcrit2 E EQ K

Addition 5

... WITH FREE SELECTIONS texpr

Effect

This addition supplies values to the dynamic selections for the selection screen for a logical database. The program accessed must be linked to a logical database that supports dynamic selections. texpr must be an internal table of the type RSDS_TEXPR from type group RSDS.

In texpr, the selections for the dynamic selections are specified in an internal format (stack formula). You can use the function modules FREE_SELECTIONS_INIT, FREE_SELECTIONS_DIALOG, and FREE_SELECTIONS_RANGE_2_EX from the function group SSEL to fill texpr in the calling program. While the first two function modules execute a user dialog, you can transfer ranges tables to FREE_SELECTIONS_RANGE_2_EX for each node in the dynamic selection in an internal table of the type RSDS_TRANGE. These are then converted to a table of the row type RSDS_TEXPR. If the calling program contains a selection screen with the same dynamic selections, you can transfer its content beforehand to a table of the type RSDS_TRANGE using the function module RS_REFRESH_FROM_DYNAMICAL_SEL.

The lines in the internal table type RSDS_TRANGE contain a flat component TABLENAME for each node and a table-like component FRANGE_T of the type RSDS_FRANGE_T for the fields in the node. The lines in RSDS_FRANGE_T contain a flat component FIELDNAME for each field and a table-like component SELOPT_T of the row type RSDSSELOPT from the ABAP Dictionary. RSDSSELOPT contains the four components SIGN, OPTION, LOW, and HIGH and can include the ranges table.

Example

Program report1 is linked to the logical database F1S, which supports dynamic selections for the node SPFLI. Program report2 enters conditions in a nested internal table of the type rsds_trange with selection conditions for field CONNID in node SPFLI; this is then converted to a table of the type rsds_texpr, which is transferred at SUBMIT.

Program accessed

REPORT report1.

NODES: spfli, sflight, sbook.

...

Calling program

REPORT report2.

TYPE-POOLS rsds.

DATA: trange TYPE rsds_trange,

trange_line

LIKE LINE OF trange,

trange_frange_t_line

LIKE LINE OF trange_line-frange_t,

trange_frange_t_selopt_t_line

LIKE LINE OF trange_frange_t_line-selopt_t,

texpr TYPE rsds_texpr.

trange_line-tablename = 'SPFLI'.

trange_frange_t_line-fieldname = 'CONNID'.

trange_frange_t_selopt_t_line-sign = 'I'.

trange_frange_t_selopt_t_line-option = 'BT'.

trange_frange_t_selopt_t_line-low = '0200'.

trange_frange_t_selopt_t_line-high = '0800'.

APPEND trange_frange_t_selopt_t_line

TO trange_frange_t_line-selopt_t.

trange_frange_t_selopt_t_line-sign = 'I'.

trange_frange_t_selopt_t_line-option = 'NE'.

trange_frange_t_selopt_t_line-low = '0400'.

APPEND trange_frange_t_selopt_t_line

TO trange_frange_t_line-selopt_t.

APPEND trange_frange_t_line TO trange_line-frange_t.

APPEND trange_line TO trange.

CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'

EXPORTING

field_ranges = trange

IMPORTING

expressions = texpr.

SUBMIT report1 VIA SELECTION-SCREEN

WITH FREE SELECTIONS texpr.

SUBMIT - list_options

Syntax

... [LINE-SIZE width]

[LINE-COUNT page_lines]

{ [EXPORTING LIST TO MEMORY]

| [TO SAP-SPOOL print_options] }.

Extras:

1. ... LINE-SIZE width

2. ... LINE-COUNT page_lines

3. ... EXPORTING LIST TO MEMORY

4. ... TO SAP-SPOOL print_options

Effect

These additions affect the basic list in the program accessed. While LINE-SIZE and LINE-COUNT influence the formatting, the other two additions determine the output type of the list.

EXPORTING LIST TO MEMORY saves the list to the ABAP Memory and TO SAP-SPOOL sends it as a print list to the SAP spool system. If you do not specify these additions, the basic list is displayed as a screen list.

Note

The additions only take effect the first time the program accessed is executed. If a selection screen is displayed in the program accessed, the runtime environment accesses the program again after completion, without taking account of the list_options additions. This is particularly important to the addition TO SAP-SPOOL, because the basic list is displayed as a screen list and not as a print list when the program is accessed again. For this reason, is is advisable not to use the addition VIA SELECTION-SCREEN when using list_options.

Addition 1

... LINE-SIZE width

Addition 2

... LINE-COUNT page_lines

Effect

These additions define the line width and page length of the basic list. They have the same effect as the additions of the same name in the program initiating statement for the program accessed. If the program accessed has the same additions in the program initiating statement, these overwrite the values specified for SUBMIT.

Addition 3

... EXPORTING LIST TO MEMORY

Effect

This addition stores the basic list for the program accessed in the ABAP Memory. It can only be used together with the addition AND RETURN.

The list is stored in the ABAP Memory as an internal table of the row type ABAPLIST, ABAPLIST being a structured data type in the ABAP Dictionary.

The calling program can access the list stored once program access is completed, using function modules belonging to the function group SLST.

The function module LIST_FROM_MEMORY loads the list from the ABAP Memory to an internal table of the row type ABAPLIST.

The function module WRITE_LIST inserts the content of an internal table of the row type ABAPLIST in the current list.

The function module DISPLAY_LIST displays the content of an internal table of the row type ABAPLIST in a separate list screen.

Note

The addition can only work provided the function key Enter is not linked to a function code in the GUI status last defined for the program accessed.

Example

Once the program report has been accessed, the list stored there in the ABAP Memory is read by means of function modules and inserted in the current list.

DATA list_tab TYPE TABLE OF abaplist.

SUBMIT report EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list_tab

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

CALL FUNCTION 'WRITE_LIST'

TABLES

listobject = list_tab.

ENDIF.

Addition 4

... TO SAP-SPOOL print_options

Effect

If you specify this addition, a spool request is created for the basic list in the internal mode of the program accessed. All list output for the program accessed is transferred page by page to this spool request as a print list. The print_options additions are used to define the print and archiving parameters for the spool request.

Note

It is not possible to switch from the print list to the screen list in the program accessed. The NEW-PAGE PRINT ON statement has the effect that list output is still transferred to the spool request opened by SUBMIT TO SAP-SPOOL. The NEW-PAGE PRINT OFF closes this spool request and opens a new one.

Example

Accessing an executable program and creating a spool request.

DATA: print_parameters TYPE pri_params,

archi_parameters TYPE arc_params,

valid_flag(1) TYPE c.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

archive_mode = '3'

IMPORTING

out_parameters = print_parameters

out_archive_parameters = archi_parameters

valid = valid_flag

EXCEPTIONS

invalid_print_params = 2

OTHERS = 4.

IF valid_flag = 'X' AND sy-subrc = 0.

SUBMIT submitable TO SAP-SPOOL

SPOOL PARAMETERS print_parameters

ARCHIVE PARAMETERS archi_parameters

WITHOUT SPOOL DYNPRO.

ENDIF.

SUBMIT - print_options

Syntax

... SPOOL PARAMETERS pri_params

[ARCHIVE PARAMETERS arc_params]

WITHOUT SPOOL DYNPRO.

Extras:

1. ... SPOOL PARAMETERS pri_params

2. ... ARCHIVE PARAMETERS arc_params

3. ... WITHOUT SPOOL DYNPRO

Effect

These additions are used to supply the spool request with print and archiving parameters. The latter are required if the print list is to be archived using SAP ArchiveLink.

Notes

These additions must always be used as indicated here. It is particularly important that the standard print dialog box be suppressed. If the standard print dialog box is used, inconsistent parameters may be passed on to the program accessed if the user chooses Cancel to exit the dialog box. Instead, the print dialog box can be displayed when the function module GET_PRINT_PARAMETERS is executed. This function module has an output parameter VALID that indicates the consistency of the print parameters created.

Use of the addition WITHOUT SPOOL DYNPRO without transferring print parameters is no longer allowed in ABAP objects. In other objects, the print parameters are derived from the user master record, as far as possible.

The same obsolete additions apply to the statement SUBMIT TO SAP-SPOOL as to the statement NEW-PAGE PRINT ON.

Addition 1

... SPOOL PARAMETERS pri_params

Effect

The addition SPOOL PARAMETERS is used to transfer the print parameters in a pri_params structure that belongs to the data type PRI_PARAMS from the ABAP Dictionary.

Addition 2

... ARCHIVE PARAMETERS arc_params

Effect

If you specify in pri_params that archiving is to take place, archiving parameters with the addition ARCHIVE PARAMETERS must be transferred in a structure arc_params belonging to the data type ARC_PARAMS from the ABAP Dictionary.

Structures belonging to the data types PRI_PARAMS and ARC_PARAMS can only be filled by the function module GET_PRINT_PARAMETERS. When this function module is accessed, some or all of the print parameters can be specified in the program and/or a print dialog box can be displayed. The function module creates a set of valid print and archiving parameters for use as pri_params and arc_params and adds these to its output parameters.

Addition 3

... WITHOUT SPOOL DYNPRO

Effect

The addition WITHOUT SPOOL DYNPRO suppresses the print dialog box that is displayed as standard when you use the addition TO SAP-SPOOL.

SUBMIT - job_options

Syntax

... [USER user] VIA JOB job NUMBER n.

Effect

This addition schedules the execution of the program accessed as a background task with the number n in the background request job. The number n for a background request job is supplied by function module JOB_OPEN in function group BTCH. The full program is not processed directly but in background processing, according to the parameters specified for the background request. You can use the optional addition USER to specify a user ID user of the type sy-uname, which is used to execute the background task. The addition VIA JOB can only be used together with the addition AND RETURN.

The VIA JOB addition also loads the program accessed in a separate internal mode when the SUBMIT statement is executed and the system performs all the steps specified before START-OF-SELECTION. This means the events LOAD-OF-PROGRAM and INITIALIZATION are triggered and selection screen processing is performed. If the selection screen is not processed in the background when VIA SELECTION-SCREEN is specified, the user of the calling program can eidit it and schedule the program accessed in the background request using the function Place in Job. If the user cancels selection screen processing, the program is not scheduled in the background job. In both cases, execution of the program executed is completed after selection screen processing and the system returns to the calling program due to the AND RETURN statement.

When the program is scheduled in the background task, the selections specified by the user or in the additions for filling the selection screen are stored in an internal variant. When the program is executed in the background request, it is processed fully but the selection screen is processed in the background. The system triggers all events, including that for selection screen processing. The variant stored internally is transferred to the selection screen between the INITIALIZATION and AT SELECTION SCREEN OUTPUT events.

If a basic list is created in the program accessed, you should create a spool request with explicit print parameters by specifying TO SAP-SPOOL. Otherwise, the VIA JOB addition implicitly creates a spool request that derives its print parameters from standard values, some of which are taken from the user defaults, and which are not necessarily consistent.

System fields

sy-subrc Meaning

0 Background task scheduled successfully.

4 Scheduling cancelled by user on the selection screen.

8 Error during scheduling, i.e. when accessing JOB_SUBMIT internally.

12 Error in internal number assignment.

Note

You can create and monitor background jobs by choosing the menu path System - Services - Jobs. In addition to JOB_OPEN, the function modules JOB_CLOSE and JOB_SUBMIT can also be used in the ABAP program. JOB_CLOSE closes creation of a background request. Like the SUBMIT statement, JOB_SUBMIT schedules an ABAP program as a background task in a background request. JOB_SUBMIT provides more control options for background processing but must receive the input values for the selection screen in an existing variant. The SUBMIT statement creates this variant and accesses JOB_SUBMIT internally.

Example

Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately.

DATA: number TYPE tbtcjob-jobcount,

name TYPE tbtcjob-jobname VALUE 'JOB_TEST',

print_parameters TYPE pri_params.

...

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = name

IMPORTING

jobcount = number

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc = 0.

SUBMIT submitable TO SAP-SPOOL

SPOOL PARAMETERS print_parameters

WITHOUT SPOOL DYNPRO

VIA JOB name NUMBER number

AND RETURN.

IF sy-subrc = 0.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = number

jobname = name

strtimmed = 'X'

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

OTHERS = 8.

IF sy-subrc <> 0.

...

ENDIF.

ENDIF.

ENDIF.

this is complete option

Message was edited by:

sunil kumar

Read only

Former Member
0 Likes
624

hi,

yes, u can access the values in the calling program.

SUBMIT ZB21 WITH P_WERKS EQ P_WERKS

WITH P_LGORT EQ P_LGORT

EXPORTING LIST TO MEMORY

AND RETURN.

u can capture th e values of p_werks and p_lgort.