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

How to use Submit Statement for mutiple Spools.

Former Member
0 Likes
584

Hi Gurus,

I have a requirement wherein I need to Submit a Report Program to SAP-SPOOL which generates output for multiple Idocs.

For each Idoc I need to attach the spool to a particular object_id.

As of now I am doing this by putting the Submit statement in a loop.

I want to meet the same functionality without using a loop for different Idocs.

Ex.

LOOP AT IDOCS.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

.

.

.

CALL FUNCTION 'JOB_OPEN'

.

.

.

IF sy-subrc = 0.

SUBMIT YFAPINV_IDOC_RPTS TO SAP-SPOOL "USING SELECTION-SCREEN '1000'

WITHOUT SPOOL DYNPRO

SPOOL PARAMETERS print_parameters

WITH CREDATE IN CREDATE

WITH CRETIME IN CRETIME

WITH DOCNUM IN DOCNUM

WITH VENDOR IN VENDOR

WITH V_INVOIC IN V_INVOIC

WITH MESCODE IN MESCODE

WITH DOCSTAT IN DOCSTAT

WITH DC_NBR IN DC_NBR

WITH DOC_TYPE IN DOC_TYPE

WITH S_BSART IN S_BSART

WITH ap1_flag eq 'X'

AND RETURN.

IF sy-subrc EQ 0.

CALL FUNCTION 'JOB_CLOSE'

.

.

.

ENDIF.

ENDIF.

SELECT rqident rqcretime FROM tsp01

INTO (rqident,rqcretime)

WHERE rqowner = sy-uname

ORDER BY rqcretime DESCENDING.

EXIT.

ENDSELECT.

IF rqident IS NOT INITIAL.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

.

.

.

DATA l_line TYPE docs-lines.

LOOP AT l_tline.

CLEAR l_line.

MOVE l_tline-tdline TO l_line.

l_docs-lines = l_line.

APPEND l_docs.

ENDLOOP.

ENDIF.

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
473

Try to use

submit XXXXXXXX1 exporting list to memory

with p_docno = xdocno

with p_netcb = 'X'

with p_item = 'X'

with p_hold = 'X'

and return.

then use

call function 'LIST_FROM_MEMORY'

or use call function LIST_TO_ASCI

a®

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
474

Try to use

submit XXXXXXXX1 exporting list to memory

with p_docno = xdocno

with p_netcb = 'X'

with p_item = 'X'

with p_hold = 'X'

and return.

then use

call function 'LIST_FROM_MEMORY'

or use call function LIST_TO_ASCI

a®

Read only

0 Likes
473

Hi,

Thanks for your guidance.

I can not use this Function Module in my Program due to some Performance Issues.

Is there any other way to obtain the same functionality.

Regards,

Amit.

Read only

Former Member
0 Likes
473

Hi,

Each submit will create only one spool. So I dont think this is possible. Yes what you can do though is that submit the program for all the IDocs at once ( provided your program YFAPINV can handle this) and then process the spool and separate the output for each IDoc after you retrieve the data from spool.

To retrieve the data from the spool, you can use the function 'RSPO_RETURN_ABAP_SPOOLJOB' pass the spool request number and it will return you a internal table with the spool data.

regards,

Advait