i have to write an abap that sends a pdf-file from a unix (SAP server) by mail to some people.
The mailing part is done, but for creating the attachment. I'm reading the pdf-file into an internal table (in a binary way). Then i'm using this int.table to send the mail.
The email is sent with an attachment, but i cannot open the pdf-file because of an error ( file damaged ). So before sending it by mail, i'm downloading the pdf file to my pc by using WS_DOWNLOAD with the same internal table. The download file gives the same error.
If i look at the size :
- originally pdf file 71743 bytes
- resulting pdf file 71665 bytes (281 lines x 255)
The creation of the internal table is as follows :
open dataset g_file for input in binary mode. check sy-subrc eq 0. do. * read dataset g_file MAXIMUM LENGTH 255 into wa_pdf. read dataset g_file into wa_pdf. if sy-subrc ne 0. exit. endif. append wa_pdf_hex to i_pdf. enddo. close dataset g_file.
types: tt_pdf type table of soli, "raw 255 long data: i_pdf type tt_pdf, wa_pdf like line of i_pdf
Is there a better way to read in the pdf-file ? Any suggestions ?