Application Development 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: 

How to combine output from 2 programs into the same spool

Former Member
0 Kudos
416

Hi All,

I need to run a program that takes the snapshots of the output screens of 2 Z programs. I want to combine the 2 outputs into the same spool. Can you please let me know what am i missing?

Here is the code -

DATA: PARAMS LIKE PRI_PARAMS,

DAYS(1) TYPE N VALUE 2,

COUNT(3) TYPE N VALUE 1,

LINE_CNT LIKE PRI_PARAMS-LINCT VALUE '65',

LINE_SZE LIKE PRI_PARAMS-LINSZ VALUE '132',

SPOOL_NAME like PRI_PARAMS-PRTXT value 'Test',

VALID TYPE C.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

DESTINATION = 'LOCL' "Printer Name

COPIES = COUNT

LIST_NAME = 'Test' "Spool Name

LIST_TEXT = SPOOL_NAME

IMMEDIATELY = ' '

NEW_LIST_ID = 'X'

NO_DIALOG = 'X'

LINE_COUNT = LINE_CNT

LINE_SIZE = LINE_SZE

IMPORTING

OUT_PARAMETERS = PARAMS

VALID = VALID.

SUBMIT ZTEST1 TO SAP-SPOOL AND RETURN

SPOOL PARAMETERS PARAMS

WITHOUT SPOOL DYNPRO.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

DESTINATION = 'LOCL' "Printer Name

COPIES = COUNT

LIST_NAME = 'Test' "Spool Name

LIST_TEXT = SPOOL_NAME

IMMEDIATELY = ' '

  • NEW_LIST_ID = 'X'

NEW_LIST_ID = ' ' "output to same spool

NO_DIALOG = 'X'

LINE_COUNT = LINE_CNT

LINE_SIZE = LINE_SZE

IMPORTING

OUT_PARAMETERS = PARAMS

VALID = VALID.

SUBMIT ZTest2 TO SAP-SPOOL AND RETURN

SPOOL PARAMETERS PARAMS

WITHOUT SPOOL DYNPRO.

5 REPLIES 5

former_member205763
Active Contributor
0 Kudos
145

set PARAMS-PRNEW = space,

let me know if this works

0 Kudos
145

This is already set.

surajarafath
Contributor
0 Kudos
145

Then try like this..

DATA: PARAMS LIKE PRI_PARAMS,
DAYS(1) TYPE N VALUE 2,
COUNT(3) TYPE N VALUE 1,
LINE_CNT LIKE PRI_PARAMS-LINCT VALUE '65',
LINE_SZE LIKE PRI_PARAMS-LINSZ VALUE '132',
SPOOL_NAME like PRI_PARAMS-PRTXT value 'Test',
VALID TYPE C.

DATA w_arcpar      TYPE arc_params.

CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
DESTINATION = 'LOCL' "Printer Name
COPIES = COUNT
LIST_NAME = 'Test' "Spool Name
LIST_TEXT = SPOOL_NAME
IMMEDIATELY = ' '
NEW_LIST_ID = 'X'
NO_DIALOG = 'X'
LINE_COUNT = LINE_CNT
LINE_SIZE = LINE_SZE
IMPORTING
out_archive_parameters = w_arcpar
OUT_PARAMETERS = PARAMS
VALID = VALID.
IF VALID NE SPACE AND SY-SUBRC EQ 0.
NEW-PAGE PRINT ON  NEW-SECTION PARAMETERS PARAMS ARCHIVE PARAMETERS w_arcpar NO DIALOG.
     ENDIF.
***
SUBMIT 2 reports here 

NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
and also check SY-SPONO

0 Kudos
145

Thanks playsuji, but with this addition, it is showing the output from the 2nd submit statement only.

So far, doesn't matter how i submit my reports, i'm only getting 1 output in the spool, and that too, the output from the last sbumit statement i have in my program. I'm looking to have both the outputs from both the submit statements in the same spool.

0 Kudos
145

sap help mentions this:

Addition 4

... TO SAP-SPOOL spool_options

Effect

This addition causes a new print list level to be opened in the internal session of the program called and assures that the first output statement for the basic list creates a new spool request. All list outputs of the program called are transferred as print lists, page by page, to the SAP spool system. Using the spool_options additions, the print parameters and archiving parameters of the spool request are specified.

may be thats the cause, one alternate would be to submit report with the option _EXPORTING LIST TO MEMORY

AND RETURN. _ then save the list from memory to an internal table using FM LIST_FROM_MEMORY, submit second report to memory get the output and check if these 2 internal tables can be combined,

and then send the combined internal table to SPOOL,

Edited by: Kartik Tarla on Jan 26, 2012 10:09 PM