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

print spool

Former Member
0 Likes
336

hi to all

in my bdc report i have to files success and error records files.

i am passing records into these two files.

if i error record filr contains reords.

then i have to pass message to print spool and screen like below

write to printspool “Errorlines are written to 'some filename' Errorrecordsfile"

write message to screen “Errorlines are written to 'some filename' Errorrecordsfile

can any one help me

2 REPLIES 2
Read only

Former Member
0 Likes
293

Hi,

Check below code:



DATA: pripar TYPE pri_params,
      arcpar TYPE arc_params,
      lay TYPE pri_params-paart,
      lines TYPE pri_params-linct,
      rows TYPE pri_params-linsz.
DATA: val(1), val1(1).
DATA: dest TYPE pri_params-pdest VALUE 'NHREMOTE'. " Printer Name, can use local printer
DATA: name TYPE pri_params-plist VALUE 'Testing'.
DATA: i_pdf TYPE STANDARD TABLE OF tline.
DATA: spono TYPE tsp01-rqident.


CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    destination            = dest
    no_dialog              = 'X'
    immediately            = ' '
  IMPORTING
    out_archive_parameters = arcpar
    out_parameters         = pripar
    valid                  = val
    valid_for_spool_creation = val1
  EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params   = 2
    invalid_archive_params = 3
    OTHERS                 = 4.
IF sy-subrc NE 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

pripar-prdsn = 'DSN'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    in_archive_parameters    = arcpar
    in_parameters            = pripar
    no_dialog                = 'X'
    list_name                = name
  IMPORTING
    out_archive_parameters   = arcpar
    out_parameters           = pripar
    valid                    = val
    valid_for_spool_creation = val1
  EXCEPTIONS
    archive_info_not_found   = 1
    invalid_print_params     = 2
    invalid_archive_params   = 3
    OTHERS                   = 4.

IF sy-subrc EQ 0.
  NEW-PAGE PRINT ON  " Starts spool, all WRITE statements from here will be to the spool
  NEW-SECTION
  PARAMETERS pripar
  ARCHIVE PARAMETERS arcpar
  NO DIALOG.
ELSE.
  WRITE:/ 'Unable to create spool'.
ENDIF.

WRITE:/ 'First Line'.
WRITE:/ 'Second Line'.

NEW-PAGE PRINT OFF. " Closing the spool

Kind Regards

Eswar

Read only

Former Member
0 Likes
293

hi ehwar

My problem solved

thank you