cancel
Showing results for 
Search instead for 
Did you mean: 

getting OTF spool into internal table

Former Member
0 Kudos

Hi experts !

I am trying to get an OTF spool into an internal table (in order to send it to a web application).

I use FM CONVERT_OTFSPOOLJOB_2_PDF :


    PARAMETERS : p_spoolid LIKE tsp01-rqident.
    DATA : lt_numbytes TYPE i,
           lt_pdf TYPE TABLE OF tline. 

    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid              = p_spoolid
      IMPORTING
        pdf_bytecount            = lt_numbytes
      TABLES
        pdf                      = lt_pdf
      EXCEPTIONS
        err_no_otf_spooljob      = 1
        err_no_spooljob          = 2
        err_no_permission        = 3
        err_conv_not_possible    = 4
        err_bad_dstdevice        = 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.

The table lt_pdf then contains some junk characters such as


TDFORMAT                       †潆
TDLINE                         瑮吠䵉卅††潮浲污䰠湡⁧剆਍启灹⁥䘯湯൴⼊畓

Any idea of how I can get that fixed ??

A strange thing is when I save it as a local file (for testing purpose) using GUI_DOWNLOAD, I have a nice readable PDF file ...


CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    BIN_FILESIZE                  = '10884'
    FILENAME                      = 'C:	est.pdf'
    FILETYPE                      = 'BIN'
  TABLES
    DATA_TAB                      = lt_pdf
  EXCEPTIONS
          FILE_WRITE_ERROR              = 1 ...

Thank you for your help !

Yann Portrait

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

try to Pass parameters like this

CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = spoolno

NO_DIALOG = ' '

  • DST_DEVICE =

  • PDF_DESTINATION =

IMPORTING

PDF_BYTECOUNT = numbytes

PDF_SPOOLID = pdfspoolid

  • OTF_PAGECOUNT =

BTC_JOBNAME = jobname

BTC_JOBCOUNT = jobcount

TABLES

PDF = pdf

EXCEPTIONS

ERR_NO_OTF_SPOOLJOB = 1

ERR_NO_SPOOLJOB = 2

ERR_NO_PERMISSION = 3

ERR_CONV_NOT_POSSIBLE = 4

ERR_BAD_DSTDEVICE = 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.

Former Member
0 Kudos

Ok, I reply to myself as I finally got some help another way :

I used FM SCMS_BINARY_TO_TEXT to convert my strange table to a readable one.