Skip to Content
0
Apr 02, 2008 at 09:24 AM

Regarding CONVERT_OTFSPOOLJOB_2_PDF

81 Views

Hi Friends

I am using FM: CONVERT_OTFSPOOLJOB_2_PDF as follows.

Here instead of PDF data, I am getting Junk data.

Can anyone please correct me where I am wrong in this code.

TABLES: tsp01. " Spool Requests

TYPES: BEGIN OF t_spool,

rqident TYPE tsp01-rqident,

END OF t_spool.

DATA: it_spool TYPE STANDARD TABLE OF t_spool,

wa_spool TYPE t_spool.

TYPES: lv_ty_tab_pdf type tline occurs 0. "SAPscript: Text Lines

DATA: lv_pdf TYPE lv_ty_tab_pdf,

lv_spool TYPE tsp01-rqident,

SELECT rqident FROM tsp01

INTO TABLE it_spool

WHERE rqowner = sy-uname.

SORT it_spool DESCENDING BY rqident.

LOOP AT it_spool INTO wa_spool.

ENDLOOP.

lv_spool = wa_spool-rqident.

CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = lv_spool

no_dialog = ' '

TABLES

pdf = lv_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 <> 0.

WRITE: / 'error', sy-subrc.

ENDIF.

**/ Convert the PDF format to the table type required for the attachment.

CALL FUNCTION 'QCE1_CONVERT'

TABLES

t_source_tab = lv_pdf

t_target_tab = lv_objbin

EXCEPTIONS

convert_not_possible = 1

OTHERS = 2.

IF sy-subrc <> 0.

WRITE: / 'error', sy-subrc.

ENDIF.