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: 

ABAP List output to spool

Former Member
0 Kudos

Hi all,

Iam executing a report in the foreground and i want to send the output data directly to the spool instead of displaying as list output.

Any idea.

Regards,

Shiva

6 REPLIES 6

Former Member
0 Kudos

Hi,

Use Function BP_JOB_CREATE

Reward if useful!

Rashid_Javed
Contributor
0 Kudos

You can use ABAP command

NEW-PAGE PRINT ON.

After this command, all your 'WRITE' statments will be directed to printer/spool instead of list output.

Check SAP help for new-page and you will see the example program there(that is used to send program output to spool directly)

Cheers

RJv

0 Kudos

Hi

use FM 'GET_PRINT_PARAMETERS'. u can meet ur requirement

Thanks & Regards,

Praveena

Former Member
0 Kudos

hi

try to use FM

<b>SUBMIT_TRCM_DATA_TO_SPOOL</b>

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Former Member
0 Kudos

Hi,

I got such kind of scenario and implemeted like this..please follow this code and it will work

Constants:lc_pri_params-pdest TYPE pri_params-pdest VALUE 'LOCL'.

IF NOT it_messtab[] IS INITIAL .

*FM to get the parameters to write into a spool

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

destination = lc_pri_params-pdest

line_size = 220

layout = 'X_65_255'

release = ' '

mode = 'CURRENT'

no_dialog = 'X'

IMPORTING

out_parameters = l_params

valid = l_valid

EXCEPTIONS

archive_info_not_found = 1

invalid_print_params = 2

invalid_archive_params = 3

OTHERS = 4.

NEW-PAGE PRINT ON PARAMETERS l_params NO DIALOG.

*Write Error Report into Spool

IF NOT it_messtab[] IS INITIAL.

WRITE:/ 'ERROR REPORT'(005).

LOOP AT it_messtab.

WRITE:/ it_messtab.

ENDLOOP.

ENDIF.

NEW-PAGE PRINT OFF.

ENDIF.

Thanks

Pramod

Former Member
0 Kudos

*****u CAN SEND THE REPORT TO SPOOL USING SUBMIT STATEMENT

****Check the code below, u have to use Logic of Checkbox to save u from

****infinite loop.

data:

w_repid like sy-repid,

MC_VALID(1) TYPE C,

MSTR_PRINT_PARMS LIKE PRI_PARAMS.

parameters:

p_matnr like mara-matnr,

chk_box as checkbox. "Send To Spool

at selection-screen.

if sy-ucomm eq 'ONLI' or sy-ucomm eq 'PRIN'.

if chk_box eq 'X'.

perform sendto_spool.

endif.

endif.

start-of-selection.

perform display_data.

&----


*& Form sendto_spool

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM sendto_spool .

*-- Setup the Print Parmaters

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

AUTHORITY = SPACE

COPIES = '1'

COVER_PAGE = SPACE

DATA_SET = SPACE

DEPARTMENT = SPACE

DESTINATION = SPACE

EXPIRATION = '1'

IMMEDIATELY = SPACE

IN_ARCHIVE_PARAMETERS = SPACE

IN_PARAMETERS = SPACE

LAYOUT = SPACE

MODE = SPACE

NEW_LIST_ID = 'X'

NO_DIALOG = 'X'

USER = SY-UNAME

IMPORTING

OUT_PARAMETERS = MSTR_PRINT_PARMS

VALID = MC_VALID

EXCEPTIONS

ARCHIVE_INFO_NOT_FOUND = 1

INVALID_PRINT_PARAMS = 2

INVALID_ARCHIVE_PARAMS = 3

OTHERS = 4.

*-- Make sure that a printer destination has been set up

IF MSTR_PRINT_PARMS-PDEST = SPACE.

MSTR_PRINT_PARMS-PDEST = 'LOCL'.

ENDIF.

*-- Explicitly set output format

  • IF P_PAART IS INITIAL.

  • P_PAART = 'X_65_255'.

  • ENDIF.

MSTR_PRINT_PARMS-PAART = 'X_65_255'.

MOVE SY-REPID TO W_REPID.

SUBMIT (W_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO

SPOOL PARAMETERS MSTR_PRINT_PARMS

USING SELECTION-SCREEN 1000

with p_matnr eq p_matnr

with chk_box eq ' '

AND RETURN.

ENDFORM. " sendto_spool

&----


*& Form display_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM display_data .

write: p_matnr,sy-datum.

ENDFORM. " display_data