on 04-06-2009 9:16 AM
Hi Experts,
I'm trying to send out a converted sapscript (OTF-PDF) via mail and when I try to view the document on SBWP, Adobe reader cannot open the file, here's the error message i'm getting 'Adobe reader could not open 'file' because it is either not a supported filetype or because the file has been damaged....'
please assist.
thanx in advance.
Hi
check the below code may be it will help you
CREATE OBJECT G_HTML_CONTAINER
EXPORTING
CONTAINER_NAME = 'PDF'.
CREATE OBJECT G_HTML_CONTROL
EXPORTING
PARENT = G_HTML_CONTAINER.
Convert xstring to binary table to pass to the LOAD_DATA method
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = LV_CONTENT
TABLES
BINARY_TAB = LT_DATA.
Load the HTML
CALL METHOD G_HTML_CONTROL->LOAD_DATA(
EXPORTING
TYPE = 'application'
SUBTYPE = 'pdf'
IMPORTING
ASSIGNED_URL = LV_URL
CHANGING
DATA_TABLE = LT_DATA
EXCEPTIONS
DP_INVALID_PARAMETER = 1
DP_ERROR_GENERAL = 2
CNTL_ERROR = 3
OTHERS = 4 ).
Show it
CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
IN_PLACE = 'X' ).
regards,
Sreenivasa sarma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there,
Here's the solution to my problem.
If you are sending the doc to email via FM SO_DOCUMENT_SEND_API1,
you need to first convert the the document format to PDF using the 'CONVERT_OTF' FM then pack the PDF lines into the attachment lines, see below:
*Convert the OTF output to PDF format*
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = lf_pdfsize
TABLES
otf = hotfdata
lines = lt_pdf
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
CLEAR t_attachment.
REFRESH t_attachment.
Pack the PDF lines into the attachment lines.*
lf_pdfooff = 0.
lf_pdfolen = 255.
LOOP AT lt_pdf INTO ls_pdf.
Convert the pdf line into binary*
ASSIGN ls_pdf-tdformat TO <pdf_line> CASTING.
lf_pdfline(2) = <pdf_line>.
ASSIGN ls_pdf-tdline TO <pdf_line> CASTING.
lf_pdfline+2 = <pdf_line>.
lf_pdfioff = 0.
lf_pdfilen = 134.
if the pdf line can fit into the attachment line then move the pdf*
into the available space in the attachment line
IF lf_pdfilen <= lf_pdfolen.
t_attachment-line+lf_pdfooff = lf_pdfline.
Calculate offset in attachment line and the new available space
lf_pdfooff = lf_pdfooff + lf_pdfilen.
lf_pdfolen = lf_pdfolen - lf_pdfilen.
If line is totally filled then append line
IF lf_pdfolen = 0.
APPEND t_attachment.
lf_pdfooff = 0.
lf_pdfolen = 255.
ENDIF.
otherwise move the portion of the pdf line into the attachment line
that are available. Appends the attachment line and move the rest
of the pdf line into a new attachment line
ELSE.
t_attachment-line+lf_pdfooff = lf_pdfline.
APPEND t_attachment.
Calculate the offset of the pdf line and remaining amount
of bytes left in the pdf line
lf_pdfioff = lf_pdfolen.
lf_pdfilen = 134 - lf_pdfolen.
lf_pdfooff = 0.
lf_pdfolen = 255.
t_attachment-linelf_pdfooff = lf_pdflinelf_pdfioff.
Calculate offset in attachment line and the new available space
lf_pdfooff = lf_pdfooff + lf_pdfilen.
lf_pdfolen = lf_pdfolen - lf_pdfilen.
ENDIF.
ENDLOOP.
Appends last attachment line
IF lf_pdfooff > 0.
APPEND t_attachment.
ENDIF.
ENDIF.
IF it_vend-r_fax = 'X'.
LOOP AT hotfdata.
t_attachment-line(2) = hotfdata-tdprintcom.
t_attachment-line+2 = hotfdata-tdprintpar.
APPEND t_attachment.
ENDLOOP.
ENDIF.
then you can call your SO_DOCUMENT_SEND_API1 FM to send your document.
'hope this helps.
sorry, can't get the formatting of this thing right, so excuse the mess.
Edited by: Pumpkin on Apr 15, 2009 11:14 AM
hi
check this sap Note 701641 - Problems opening Adobe acrobat .pdf file in IE browser.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.