Application Development and Automation 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: 
Read only

Cannot Generate PDF with Open Dataset Command

Former Member
0 Likes
1,156

I am using the commands below, to generate PDF in background. The file was generated, but there is a lack on the file, some characters disappeared. Any idea why it happens?

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

     EXPORTING

       src_spoolid   = v_spool_nr

     IMPORTING

       pdf_bytecount = v_pdf_filesize

     TABLES

       pdf           = tg_pdf_output.

   v_spool_nr_del = v_spool_nr.

   CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'

     EXPORTING

       spoolid = v_spool_nr_del.

   v_bin_filesize = v_pdf_filesize.

   OPEN DATASET v_arquivo FOR OUTPUT IN LEGACY BINARY MODE.

   LOOP AT tg_pdf_output.

     TRANSFER tg_pdf_output-tdline TO v_arquivo.

     CLEAR wg_line-tdline.

   ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
968

Solved, the problem was:

   OPEN DATASET v_arquivo FOR OUTPUT IN LEGACY BINARY MODE.

   LOOP AT tg_pdf_output.

     TRANSFER tg_pdf_output-tdline TO v_arquivo.

     TRANSFER tg_pdf_output TO v_arquivo.

     CLEAR wg_line-tdline.

   ENDLOOP.

1 REPLY 1
Read only

Former Member
0 Likes
969

Solved, the problem was:

   OPEN DATASET v_arquivo FOR OUTPUT IN LEGACY BINARY MODE.

   LOOP AT tg_pdf_output.

     TRANSFER tg_pdf_output-tdline TO v_arquivo.

     TRANSFER tg_pdf_output TO v_arquivo.

     CLEAR wg_line-tdline.

   ENDLOOP.