cancel
Showing results for 
Search instead for 
Did you mean: 

convert sapscripts to pdf

Former Member
0 Kudos

hi,

I want to convert SAPscript to Adobe PDF format and also want to store that PDF file to my local drive.

I dont want to do it by program RSTXPDFT4. it should generate the PDF file automatically.

If any one knows please help me.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks for the detail discription on this thread.

Thanks And Regards

Vipin

Former Member
0 Kudos

Hi vipin,

SAP have created a standard program RSTXPDFT4 to convert your Sapscripts spools into a PDF format.

Specify the spool number and you will be able to download the sapscripts spool into your local harddisk.

Please note that it is not restricted to sapsciprts spool only. Any reports in the spool can be converted using the program 'RSTXPDFT4'.

1.Go to sp01 and get the spool number

2.Run the program RSTXPDFT4 in se38

3. Give the spool number and mention the directory and filename where to want to store the pdf file

4. press execute

<b>

If u want to convert OTF into pdf by using a program use,</b>

CONVERT_OTF_2_PDF or SX_OBJECT_CONVERT_OTF_PDF function modules in u r program.

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = pdf_bytecount

TABLES

otf = otf_data

doctab_archive = lt_docs

lines = pdfout

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

OTHERS = 3.

( or )

CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'

EXPORTING

FORMAT_SRC = 'OTF'

FORMAT_DST = 'PDF'

DEVTYPE = 'ASCIIPRI'

LEN_IN = LEN_IN

IMPORTING

LEN_OUT = LEN_OUT

TABLES

CONTENT_IN = OTF_TAB

CONTENT_OUT = ITAB2

EXCEPTIONS

ERR_CONV_FAILED = 1

OTHERS = 2.

anversha_s
Active Contributor
0 Kudos

hi,

Visit this link for SAMple code of SAPSCRIPT to PDF.:

http://www.sapgenie.com/abap/pdf_creation.htm

and check the following weblog for code samples.

/people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp

chk this one

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

some function modules useful would be

CONVERT_OTF

SO_NEW_DOCUMENT_ATT_SEND_API1 to send mails with attachments

plzz refer to this link..it will solve ur problem

Rgds

Anver

Former Member
0 Kudos

put like this

  call function 'CLOSE_FORM'
    importing
      result                   = result
      rdi_result               = rdi
    tables
      otfdata                  = otf_table
    exceptions
      unopened                 = 1
      bad_pageformat_for_print = 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.
call function 'CONVERT_OTF'
 exporting
   format                      = 'PDF'
*   MAX_LINEWIDTH               = 132
*   ARCHIVE_INDEX               = ' '
*   COPYNUMBER                  = 0
*   ASCII_BIDI_VIS2LOG          = ' '
  importing
    bin_filesize                = len_out
*   BIN_FILE                    =
  tables
    otf                         = otf_table
    lines                       = pdf
* EXCEPTIONS
*   ERR_MAX_LINEWIDTH           = 1
*   ERR_FORMAT                  = 2
*   ERR_CONV_NOT_POSSIBLE       = 3
*   ERR_BAD_OTF                 = 4
*   OTHERS                      = 5
          .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
clear: file.
call function 'GUI_DOWNLOAD'
  exporting
    bin_filesize                    = len_out
    filename                        = 'C:/TESTING07.PDF'
    filetype                        = 'BIN'
*   APPEND                          = ' '
*   WRITE_FIELD_SEPARATOR           = ' '
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE                        = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
* IMPORTING
*   FILELENGTH                      =
  tables
    data_tab                        = pdf
*   FIELDNAMES                      =
* EXCEPTIONS
*   FILE_WRITE_ERROR                = 1
*   NO_BATCH                        = 2
*   GUI_REFUSE_FILETRANSFER         = 3
*   INVALID_TYPE                    = 4
*   NO_AUTHORITY                    = 5
*   UNKNOWN_ERROR                   = 6
*   HEADER_NOT_ALLOWED              = 7
*   SEPARATOR_NOT_ALLOWED           = 8
*   FILESIZE_NOT_ALLOWED            = 9
*   HEADER_TOO_LONG                 = 10
*   DP_ERROR_CREATE                 = 11
*   DP_ERROR_SEND                   = 12
*   DP_ERROR_WRITE                  = 13
*   UNKNOWN_DP_ERROR                = 14
*   ACCESS_DENIED                   = 15
*   DP_OUT_OF_MEMORY                = 16
*   DISK_FULL                       = 17
*   DP_TIMEOUT                      = 18
*   FILE_NOT_FOUND                  = 19
*   DATAPROVIDER_EXCEPTION          = 20
*   CONTROL_FLUSH_ERROR             = 21
*   OTHERS                          = 22
          .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

Regards

Prabhu

Former Member
0 Kudos