cancel
Showing results for 
Search instead for 
Did you mean: 

How to send thr o/p to spool and not for printing?

Former Member
0 Kudos

Hi,

I have a requirement wherein I need to send the background job output to spool and it should never get printed. right now every time the t.code is executed the document gets printed. So hundreds of documents getting printed everyday.

Even if its not sent to spool also fine. We don't want that one to get printed.

Points will be rewarded.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member70391
Contributor
0 Kudos

Hi Chandra,

Just for an interest, Did you try the code what I pasted. Does it fullfilled your requirement.

Thanks & Regards,

Nagaraj Kalbavi

Former Member
0 Kudos

Nagraj,

I will let you know for sure once the testing is done.

Thanks for the help.

former_member70391
Contributor
0 Kudos

Hi Chandrashekar,

I think it is your 3rd post regarding same issue. :-).

  • Without archiving

DATA: PARAMS LIKE PRI_PARAMS,

DAYS(1) TYPE N VALUE 2,

COUNT(3) TYPE N VALUE 1,

VALID TYPE C.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING DESTINATION = 'LT50'

COPIES = COUNT

LIST_NAME = 'TEST'

LIST_TEXT = 'SUBMIT ... TO SAP-SPOOL'

IMMEDIATELY = 'X'

RELEASE = 'X'

NEW_LIST_ID = 'X'

EXPIRATION = DAYS

LINE_SIZE = 79

LINE_COUNT = 23

LAYOUT = 'X_PAPER'

SAP_COVER_PAGE = 'X'

COVER_PAGE = 'X'

RECEIVER = 'SAP*'

DEPARTMENT = 'System'

NO_DIALOG = ' '

IMPORTING OUT_PARAMETERS = PARAMS

VALID = VALID.

IF VALID <> SPACE.

SUBMIT RSTEST00 TO SAP-SPOOL

SPOOL PARAMETERS PARAMS

WITHOUT SPOOL DYNPRO.

ENDIF.

Thanks & Regards,

Nagaraj Kalbavi

Former Member
0 Kudos

Hi Nagraj,

Thanks for your inputs.

Yes you are correct I am so desperate to find a solution to this issue.

I have tried this thing earlier but the issue is I can't test whether it is getting printed or not until we move the code to production. After changing the code also the spool is getting generated and when I checked the spool parameters the storage mode is set to PRINT.

There is a field ARMOD in the PRI_PARAMS structure which sets this value. Since we are not passing any values for IN_PARAMETERS in the FM blank value is passed as default and 1 is assgned for ARMOD field.

So I am not really sure whether this will solve the issue. Is there anything you can suggest me here?

Thanks a lot for your time.

former_member70391
Contributor
0 Kudos

Hi Chandra Shekaran,

Here is the code which I wrote just for an example. In this case I am generating the PDF from from ABAP List Output. Here in this case 2 spools are created in SP01. Try to remove the code which is not required for you example: You can remove the code section and try:

The only problem is I have used my own Pf-status for this. May may uo can run this program and check SP01 there will to spool one with Get_print_parameters and second to convert this content to pdf format.

Hopefully it helps you.

&----


*& Report Z_CREATE_PDF_ABAPLIST

&----


*& Description: Simple Program to generate PDF from ABAP List Output

&----


REPORT Z_CREATE_PDF_ABAPLIST NO STANDARD PAGE HEADING.

  • PF-status containing a PDF button in the report Output to generate

  • PDF form

SET PF-STATUS 'Z_PDF'.

-


*Table Declarations

-


TABLES: MARA, MARC, MAKT.

-


  • Internal Table Declarations

-


DATA: BEGIN OF TS_MARA OCCURS 0,

MATNR LIKE MARA-MATNR,

MTART LIKE MARA-MTART,

MATKL LIKE MARA-MATKL,

LVORM LIKE MARA-LVORM,

WERKS LIKE MARC-WERKS,

MAKTX LIKE MAKT-MAKTX,

END OF TS_MARA.

-


  • Selection Screen Parameters

-


SELECTION-SCREEN BEGIN OF BLOCK B1.

SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY,

S_WERKS FOR MARC-WERKS OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1.

-


TOP-OF-PAGE.

-


write: 40 'Generating PDF from List Output' color 1 intensified on.

skip 1.

write: /1 'Date :', SY-DATUM,

/1 'User ID :', SY-UNAME,

/1(112) SY-ULINE.

-


START-OF-SELECTION.

-


  • Perform for Basic Selection

PERFORM GET_MARA.

  • Perform to Display Data

PERFORM DISPLAY_MARA.

-


AT USER-COMMAND.

-


  • User Command to generate PDF Form

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'PDF'.

DATA: L_PARAMS TYPE PRI_PARAMS,

L_VALID TYPE STRING,

W_SPOOL_NR LIKE TSP01-RQIDENT.

  • TO GET PRINT PARAMETERS

CALL FUNCTION 'GET_PRINT_PARAMETERS'

IMPORTING

OUT_PARAMETERS = L_PARAMS

VALID = L_VALID.

IF SY-SUBRC <> 0.

ENDIF.

  • Internal table for Selection Screen

DATA: BEGIN OF I_RSPARAMS OCCURS 0.

INCLUDE STRUCTURE RSPARAMS.

DATA: END OF I_RSPARAMS.

  • Store the current selection screen details

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

EXPORTING

CURR_REPORT = SY-REPID

  • IMPORTING

  • SP =

TABLES

SELECTION_TABLE = I_RSPARAMS

  • EXCEPTIONS

  • NOT_FOUND = 1

  • NO_REPORT = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • SUBMIT TO GET THE SPOOL NUMBER

SUBMIT Z_CREATE_PDF_ABAPLIST WITH SELECTION-TABLE I_RSPARAMS

TO SAP-SPOOL

SPOOL PARAMETERS L_PARAMS

WITHOUT SPOOL DYNPRO

AND RETURN.

  • SELECT THE RECENTLY CREATED SPOOL

SELECT MAX( RQIDENT ) INTO W_SPOOL_NR FROM TSP01

WHERE RQCLIENT = SY-MANDT

AND RQOWNER = SY-UNAME.

*----


*Remaining Part is for generating PDF

*----


*REPORT TO GENERATE SPOOL NUMBER FOR PDF CONVERT

SUBMIT RSTXPDF5 WITH SPOOLNO = W_SPOOL_NR

WITH DSTDEVIC = 'LOCL' AND RETURN .

IF SY-SUBRC EQ 0.

CLEAR W_SPOOL_NR.

  • SELECT THE RECENTLY CREATED SPOOL FOR PDF

SELECT MAX( RQIDENT ) INTO W_SPOOL_NR FROM TSP01

WHERE RQCLIENT = SY-MANDT

AND RQOWNER = SY-UNAME.

*REPORT TO DOWNLOAD PDF SPOOL TO GUI

SUBMIT RSTXPDFT5 WITH SPOOLID = W_SPOOL_NR

AND RETURN.

ENDIF.

ENDCASE.

&----


*& Form GET_MARA

&----


  • text

-


  • --> p1 text

  • <-- p2 text

-


FORM GET_MARA .

CLEAR : TS_MARA.

REFRESH: TS_MARA.

  • To select Materials based on Selection Criteria

SELECT A~MATNR A~MTART A~MATKL A~LVORM B~WERKS INTO CORRESPONDING

FIELDS OF TABLE TS_MARA FROM MARA AS A

INNER JOIN MARC AS B ON A~MATNR EQ B~MATNR

WHERE A~MATNR IN S_MATNR

AND B~WERKS IN S_WERKS.

LOOP AT TS_MARA.

SELECT SINGLE * FROM MAKT WHERE MATNR EQ TS_MARA-MATNR

AND SPRAS EQ SY-LANGU.

MOVE MAKT-MAKTX TO TS_MARA-MAKTX.

MODIFY TS_MARA INDEX SY-TABIX.

ENDLOOP.

ENDFORM. " GET_MARA

&----


*& Form DISPLAY_MARA

&----


  • text

-


  • --> p1 text

  • <-- p2 text

-


FORM DISPLAY_MARA .

CLEAR : TS_MARA.

WRITE: /1 '|', 2(18) 'Material Number' COLOR 7,

21 '|', 22(5) 'Plant ' COLOR 7,

28 '|', 29(13) 'Material Type ' COLOR 7,

42 '|', 43(14) 'Material Group ' COLOR 7,

57 '|', 58(13) 'Deletion Flag ' COLOR 7,

71 '|', 72(40) 'Description ' COLOR 7,

112 '|'.

WRITE: /1(112) SY-ULINE.

LOOP AT TS_MARA.

WRITE: /1 '|', 2(18) TS_MARA-MATNR,

21 '|', 22(5) TS_MARA-WERKS,

28 '|', 29(13) TS_MARA-MTART,

42 '|', 43(14) TS_MARA-MATKL,

57 '|', 58(13) TS_MARA-LVORM,

71 '|', 72(40) TS_MARA-MAKTX,

112 '|'.

WRITE: /1(112) SY-ULINE.

ENDLOOP.

ENDFORM. " DISPLAY_MARA