‎2008 Oct 21 1:24 PM
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.
‎2008 Oct 21 1:35 PM
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®
‎2008 Oct 21 1:35 PM
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®
‎2008 Oct 22 5:56 AM
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.
‎2008 Oct 21 1:50 PM
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