Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

2 spool - 1 program

Hi folks,

Lets say that I want to create a program that is going to produce 2 different spools. This program will be a batch so will run in background. By defaulf everything that I write using the WRITE statement is going to go in a spool. I have a requirement to split the information in 2 spools.

The way I am thinking of doing it is:

- Execute Program1

- Send the information to be displayed in the second spool in either a Z-Table or in ABAP Memory

- Submit Program2 from Program1, using:

SUBMIT program2

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

AND RETURN

Program2 would read from memory or Z-Table and would write that information to the list. This information would end up in the second spool.

- Once return from Program2, from Program1 write the information to go in the first spool.

I tried and it works ... But is there a better way ? I checked for a function that let me creates a spool and that I can send my information to be displayed in the spool. I could not find anything. Any of you guys would know something for this. I checked Function-Pool SLST for list processing and many of the Function-Pool for the spool(SPOA, SPOB, SPOC, SPOD, SPOF, SPOI, SPOK, SPOL, SPOO, SPOR, SPOS, SPOX). Can't find anything. Maybe one of you did this before.

Thanks,

Pat

Message was edited by: Pat Baillar

Message was edited by: Pat Baillar

Tags:
Former Member replied

Hi,

You can do that without complicating the calling sequence and submitting programs....

Use New-page print on command to open a spool request and New-page print off to close the spool. using this you can have any number of spools generated from one program.

Here is the sample code for your reference.

&----


*& Report YTEST2SPOOLS *

*& *

&----


*& *

*& *

&----


REPORT YTEST2SPOOLS .

DATA PARAMS LIKE PRI_PARAMS.

DATA: DAYS(1) TYPE N VALUE 2,

COUNT(3) TYPE N VALUE 1,

VALID TYPE C.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

DESTINATION = 'LOCL'

COPIES = COUNT

LIST_NAME = 'TEST'

LIST_TEXT = 'Test for multiple spools'

IMMEDIATELY = ' '

RELEASE = 'X'

NEW_LIST_ID = 'X'

EXPIRATION = DAYS

LINE_SIZE = 79

LINE_COUNT = 23

LAYOUT = 'X_PAPER'

SAP_COVER_PAGE = 'X'

RECEIVER = 'SAP*'

DEPARTMENT = 'System'

NO_DIALOG = 'X'

IMPORTING

OUT_PARAMETERS = PARAMS

VALID = VALID.

IF VALID <> SPACE.

NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.

WRITE / 'This goes into spool ONE'.

SKIP 5.

WRITE / 'This goes into spool ONE'.

NEW-PAGE PRINT OFF.

NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.

WRITE / 'This goes into spool TWO'.

WRITE / 'This goes into spool TWO'.

WRITE / 'This goes into spool TWO'.

WRITE / 'This goes into spool TWO'.

NEW-PAGE PRINT OFF.

ENDIF.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question