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: 

Convert report spool to pdf

former_member207153
Participant
0 Kudos
128

Hi,

1. i had problem while i want to convert my spool into pdf. Im hit error "Make sure all parm is complete" during execution using logic below.

could anyone help me?

2. did anyone have simple step how to create simple smartform which consist company logo plus content of my report spool, and will be convert to pdf on final part.

thx in advance.

REPORT FLEX009 LINE-COUNT 60.

DATA: PRI_PARAMS LIKE PRI_PARAMS,

ARC_PARAMS LIKE ARC_PARAMS,

VALID TYPE C.

DATA: PARAMS LIKE PRI_PARAMS.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

NO_DIALOG = 'X'

IMPORTING

OUT_PARAMETERS = PRI_PARAMS

ARC_PARAMETERS = ARC_PARAMS

VALID = VALID.

IF VALID <> SPACE AND SY-SUBRC = 0.

SET PF-STATUS 'PRINT'.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

IN_ARC_PARAMETERS = ARC_PARAMS

IN_PARAMETERS = PRI_PARAMS

LAYOUT = 'X_65_200'

NO_DIALOG = 'X'

IMPORTING

OUT_PARAMETERS = PRI_PARAMS

ARC_PARAMETERS = ARC_PARAMS

VALID = VALID.

ENDIF.

IF VALID <> SPACE AND SY-SUBRC = 0.

NEW-PAGE PRINT ON PARAMETERS PRI_PARAMS NO DIALOG.

PERFORM write_report_heading.

PERFORM write_report_detail.

ENDIF.

SUBMIT FLEX009 TO SAP-SPOOL SPOOL PARAMETERS PRI_PARAMS ARCHIVE PARAMETERS ARC_PARAMS.

1 ACCEPTED SOLUTION

amit_khare
Active Contributor
0 Kudos
90

Refer the links -

Regards,

Amit

Reward all helpful replies.

5 REPLIES 5

amit_khare
Active Contributor
0 Kudos
91

Refer the links -

Regards,

Amit

Reward all helpful replies.

0 Kudos
90

did you have any sample of within report program ? i mean report program during at final WRITE statement, program will retrieve spool that this program produce and send to pdf.

Former Member
0 Kudos
90

Hi,

You can Check these links out,

http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm

Regards,

Samson Rodrigues.

former_member189059
Active Contributor
0 Kudos
90
PARAMETER spoolnum LIKE tsp01-rqident ."obligatory.

DATA: itab_pdf LIKE tline OCCURS 0 WITH HEADER LINE.
DATA: w_ident LIKE tsp01-rqident,
w_doctype LIKE tsp01-rqdoctype,
w_bytecount TYPE i.

    PERFORM get_abap_spool_in_pdf.
    PERFORM write_pdf_spool_to_pc.


FORM get_abap_spool_in_pdf.
  REFRESH itab_pdf.
  w_ident = spoolnum.

  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid              = w_ident
    IMPORTING
      pdf_bytecount            = w_bytecount
    TABLES
      pdf                      = itab_pdf
    EXCEPTIONS
      err_no_abap_spooljob     = 1
      err_no_spooljob          = 2
      err_no_permission        = 3
      err_conv_not_possible    = 4
      err_bad_destdevice       = 5
      user_cancelled           = 6
      err_spoolerror           = 7
      err_temseerror           = 8
      err_btcjob_open_failed   = 9
      err_btcjob_submit_failed = 10
      err_btcjob_close_failed  = 11
      OTHERS                   = 12.

  IF sy-subrc NE 0.
    MESSAGE e398(00) WITH 'Cannot convert to PDF. Error =' sy-subrc.
  ENDIF.
ENDFORM.                    "get_abap_spool_in_pdf



FORM write_pdf_spool_to_pc.

  DATA: name TYPE string,
        path TYPE string,
        fullpath TYPE string,
        ext TYPE string.
  DATA mode(3) TYPE c VALUE 'BIN'.
  DATA extension(4) TYPE c VALUE '.pdf'.
  IF mode <> 'ASC' AND mode <> 'BIN'.
    sy-subrc = 1. EXIT.
  ENDIF.

  ext = extension.
  IF ext(1) = '.'.
    SHIFT ext.
  ENDIF.
  name = pcfile. "filename.
  IF name IS INITIAL.
    name = 'test.*'.
    REPLACE '$' WITH ext INTO name.
  ELSEIF name NA '.'. "name has no extension, add ext
    CONCATENATE name '.' ext INTO name.
  ENDIF.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
     bin_filesize                    = w_bytecount
      filename                        = name
     filetype                        = 'BIN'
    TABLES
      data_tab                        = itab_pdf
            .
  IF sy-subrc <> 0.
    MESSAGE e398(00) WITH 'Cannot download to PC. Error =' sy-subrc.
  ENDIF.

ENDFORM.                    "write_pdf_spool_to_pc 

Edited by: Kris Donald on Nov 7, 2008 2:13 PM

former_member207153
Participant
0 Kudos
90

case close