‎2008 Mar 05 12:30 PM
Hi All,
I have a requirement like I have one program say zrep1 this will have the spool request number as select options and when the user selects multiple option it should navigate to other transaction which should be exactly similar to sp02 say zsp02 and when the user selects multiple spool numbers in this transaction the control should go back to the report program ZREP1.Please suggest somebody how to do this?
Regards
Ramesh
‎2008 Mar 05 12:33 PM
Hi,
Kindly use statement 'SUBMIT' to call different programs for different conditions.
SUBMIT
Basic forms:
1. SUBMIT rep.
2. SUBMIT (name).
Extras:
1. ... LINE-SIZE col
2. ... LINE-COUNT line
3. ... TO SAP-SPOOL List output to the SAP spool database
4. ... USING SELECTION-SCREEN scr
5. ... VIA SELECTION-SCREEN
6. ... AND RETURN
7. ... EXPORTING LIST TO MEMORY
8. ... USER user VIA JOB job NUMBER n
9. ...Various additions for passing parameters to rep
10. ... USING SELECTION-SETS OF PROGRAM prog
Effect
Calls report rep.
The system leaves the active program and starts the new report rep. In basic form 2, you can specify the name of the report in the field name. You must specify the name in uppercase, otherwise a runtime error occurs.
Note
You can only start programs with type '1' using SUBMIT. If the program has a different type, the system triggers a runtime error.
Please consult Data Area and Modularization Unit Organization documentation as well.
Addition 1
... LINE-SIZE col
Effect
The list generated by the report has the line width col.
Addition 2
... LINE-COUNT line
Effect
The list generated by the report has line lines per page.
Addition 4
... USING SELECTION-SCREEN scr
Effect
When you execute the report, the system uses the selection screen number that you specify in the scr field. This must be a selection screen defined using the SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statements.If you omit the addition, the system uses the standard selection screen 1000.
This addition allows you to start the same report in different situations, using a different selection screen each time.
Notes
The addition VIA SELECTION SCREEN determines whether the report is processed in the foreground or the background.
What happens if the required screen does not exist or is not a selection screen?
Screen 1000:
If you want to use the standard selection screen (... USING SELECTION-SCREEN 1000 or do not specify a ... USING SELECTION-SCREEN) addition, the system does not process a selection screen.
Other selection screens:
The system triggers a runtime error.
Addition 5
... VIA SELECTION-SCREEN
Effect
The selection screen is displayed. In this case, the selection screen is displayed again after the report list has been displayed. The values entered by the user remain displayed.
Addition 6
... AND RETURN
Effect
Returns to the calling transaction or program after the called program has been executed. SUBMIT ... AND RETURN creates a new internal session.
Addition 7
... EXPORTING LIST TO MEMORY
Effect
Does not display the output list of the called report, but saves it in ABAP 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. In addition, you must not assign a function code to the ENTER key in the current GUI status. The saved list is read from the SAP memory using the function module 'LIST_FROM_MEMORY' and can then be saved to the database using EXPORT, for example. You can process this list further with the function modules 'WRITE_LIST', 'DISPLAY_LIST' ... of the function group "SLST".
Addition 8
... 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.
SY-SUBRC = 0:
Job scheduled successfully
SY-SUBRC = 4:
Job scheduling terminated by user
SY-SUBRC = 8:
Error in job scheduling (JOB_SUBMIT)
SY-SUBRC = 12:
Error in internal number assignment
Addition 10
... 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 PARAMETERs. 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.
Exceptions
Non-Catchable Exceptions
Cause: The specified program was not found.
Runtime Error: LOAD_PROGRAM_NOT_FOUND
Cause: Invalid value passed to a selection with SIGN.
Runtime Error: SUBMIT_WRONG_SIGN
Cause: The specified program is not a report.
Runtime Error: SUBMIT_WRONG_TYPE
Cause: More than one value passed to a report parameter.
Runtime Error: SUBMIT_IMPORT_ONLY_PARAMETER
Cause: Table passed to a selection with WITH sel IN itab that has an unexpected structure.
Runtime Error: SUBMIT_IN_ITAB_ILL_STRUCTURE
Regs,
Saurabh
‎2008 Mar 05 12:37 PM
Hi,
To send the output of reports you call from within your program using SUBMIT to the spool system, you must include the TO SAP-SPOOL option into the SUBMIT statement:
Syntax
SUBMIT <rep> TO SAP-SPOOL
[<params>|SPOOL PARAMETERS <pripar>]
[ARCHIVE PARAMETERS <arcpar>]
[WITHOUT SPOOL DYNPRO].
The SUBMIT statement is described in detail in the section Calling Executable Programs. If you use the TO SAP-SPOOL option, the list is formatted for printing while it is being
created, and then sent to the spool system. The remaining additions set the print parameters.
Setting the Print Parameters
The same applies to setting the print parameters as described for the NEW-PAGE PRINT ON statement (see Printing from within the Program).
Although you can set each print parameter individually using one of the <params> additions (refer to the keyword documentation ), or by using a user dialog in the SUBMIT statement, you should only retrieve the parameters using the function module GET_PRINT_PARAMETERS. (For further information, refer to Setting Print Parameters from within the Program). The function module GET_PRINT_PARAMETERS decouples the user dialog from the SUBMIT statement,
and guarantees a complete parameter set even without executing the user dialog. To determine the parameters, use only the options SPOOL PARAMETERS and ARCHIVE PARAMETERS and, to suppress the user dialog of the SUBMIT statement, use the WITHOUT SPOOL DYNPRO
option.
The following executable program is connected to the logical database F1S:
REPORT SAPMZTS1.
TABLES SPFLI.
GET SPFLI.
NEW-LINE.
WRITE: SPFLI-MANDT, SPFLI-CARRID, SPFLI-CONNID,
SPFLI-CITYFROM, SPFLI-AIRPFROM, SPFLI-CITYTO,
SPFLI-AIRPTO, SPFLI-FLTIME, SPFLI-DEPTIME, SPFLI-ARRTIME,
SPFLI-DISTANCE, SPFLI-DISTID, SPFLI-FLTYPE.
The following program calls SAPMZTS1 and sends the output to the spool system:
REPORT SAPMZTST NO STANDARD PAGE HEADING.
DATA: VAL,
PRIPAR LIKE PRI_PARAMS,
ARCPAR LIKE ARC_PARAMS.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
LAYOUT = 'X_65_132'
LINE_COUNT = 65
LINE_SIZE = 132
IMPORTING
OUT_PARAMETERS = PRIPAR
OUT_ARCHIVE_PARAMETERS = ARCPAR
VALID = VAL
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
IF VAL <> SPACE AND SY-SUBRC = 0.
SUBMIT SAPMZTS1 TO SAP-SPOOL
SPOOL PARAMETERS PRIPAR
ARCHIVE PARAMETERS ARCPAR
WITHOUT SPOOL DYNPRO.
ENDIF.
Regards,
Bhaskar
‎2008 Mar 05 12:38 PM
Hi,
You can use SUBMIT keyword to call one program to another program .
syntax:
SUBMIT <PROGRAM NAME>.
Other Options Available Are:
SUBMIT {rep|(name)} [selscreen_options]
[ list_options ]
[ job_options]
[AND RETURN].
1. The selscreen_options additions can be used to determine the selection screen for the program accessed and to supply it with values.
2. The list_options additions allow you to influence the output medium and the page size in the basic list for the program accessed.
3. You can schedule the program for background processing by specifying job_options.
Regards,
kavitha.
‎2008 Mar 05 12:41 PM