on 10-06-2008 2:51 PM
Hi..am converting spool output to pdf using the FM 'CONVERT_ABAPSPOOLJOB_2_PDF'. But the resultant output table contains just scrap.
My internal output table contains 10 columns and 7 rows.
Kindly let me know a solution for this.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_tsp01-rqident
no_dialog = ' '
dst_device = c_device
pdf_destination = ' '
IMPORTING
pdf_bytecount = v_size
TABLES
pdf = it_pdf_output
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.
Useful answers will be rewarded.
Regards
>But the resultant output table contains just scrap.
That data will be in binary format, you can't understand that. PDF reader can read/understand those instructions. what ever you are doing is correct. the part which you showed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Following code works for me. try to compare this with your code.
IF sy-subrc EQ 0.
NEW-LINE.
WRITE: sy-uline NO-GAP.
NEW-PAGE PRINT OFF.
l_spool = sy-spono.
*--- create unique filename
WRITE: sy-uzeit TO l_time USING NO EDIT MASK.
CONCATENATE sy-uname l_time 'cckps.pdf' INTO x_filename.
PERFORM convert_spool_to_pdf USING sy-spono
x_filename.
ENDIF.
&----
*& Form CONVERT_SPOOL_TO_PDF
&----
FORM convert_spool_to_pdf USING p_spool LIKE sy-spono
p_x_filename.
DATA: l_spool LIKE tsp01-rqident,
l_pdf_bytecount TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_list_pagecount TYPE i,
l_btc_jobname TYPE tbtcjob-jobname,
l_btc_jobcount TYPE tbtcjob-jobcount,
lt_pdf LIKE STANDARD TABLE OF tline WITH HEADER LINE,
l_file TYPE string
VALUE '/usr/sap/&/EHS_DOC/'.
REPLACE '&' WITH sy-sysid INTO l_file.
CONDENSE l_file NO-GAPS.
CONCATENATE l_file p_x_filename INTO l_file.
l_spool = p_spool.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = l_spool
IMPORTING
pdf_bytecount = l_pdf_bytecount
pdf_spoolid = l_pdf_spoolid
list_pagecount = l_list_pagecount
btc_jobname = l_btc_jobname
btc_jobcount = l_btc_jobcount
TABLES
pdf = lt_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.
OPEN DATASET l_file FOR OUTPUT IN BINARY MODE.
LOOP AT lt_pdf.
TRANSFER lt_pdf TO l_file.
ENDLOOP.
CLOSE DATASET l_file.
ENDFORM. " CONVERT_SPOOL_TO_PDF
Thanks,
Sree.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.