04-16-2009 5:25 AM
Hi All,
Iam having an issue while opening the PDF-Attachment in which iam sending it as attachment to the mail.While opening the PDF iam getting the error that "Aodbe Reader could not open the document because it is either not a supported file type or because the file has been damaged(for example,it was sent as an email attachment and was'nt correctly decoded)".
The function-module "SO_NEW_DOCUMENT_ATT_SEND_API1" is getting use to send the attachment.
First iam converting the internal table data into PDF and then am sending the mail with PDF-attchment.
Thanks,
Asmitha.
04-16-2009 6:06 AM
Even i had a smilar problem. The reason is perhaps the data in internal table doesnt get converted into PDF corectly. In my case i had to convert into PDF and download on local machine. Attching below code for it.Maybe u can get pointers to your problem.
REPORT sy-repid
NO STANDARD PAGE HEADING
LINE-COUNT 74
LINE-SIZE 200
MESSAGE-ID zz.
PARAMETERS : pcfile LIKE rlgrap-filename LOWER CASE.
DATA :textlines LIKE tline OCCURS 100 WITH HEADER LINE.
DATA otf LIKE itcoo OCCURS 1000 WITH HEADER LINE.
DATA it_lines LIKE tline OCCURS 100 WITH HEADER LINE.
DATA options LIKE itcpo.
DATA header LIKE thead.
DATA result LIKE itcpp.
DATA: bin_filesize TYPE i.
DATA: filesize TYPE i,
convcount TYPE i,
cancel(1).
************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pcfile.
************************************************
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',*.*,*.*.'
IMPORTING
filename = pcfile
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
START-OF-SELECTION.
DATA : BEGIN OF itab OCCURS 0,
matnr TYPE mara-matnr,
END OF itab.
SELECT matnr FROM mara UP TO 10 ROWS INTO TABLE itab.
LOOP AT itab.
textlines-tdformat = '*'.
textlines-tdline = itab-matnr. APPEND textlines.
ENDLOOP.
options-tdgetotf = 'X'.
options-tdnoprev = 'X'.
CALL FUNCTION 'PRINT_TEXT'
EXPORTING
dialog = ' '
header = header
OPTIONS = options
IMPORTING
RESULT = RESULT
tables
lines = textlines
otfdata = otf
EXCEPTIONS
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
unknown = 6
format = 7
textformat = 8
communication = 9
bad_pageformat_for_print = 10
OTHERS = 11.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = filesize
TABLES
otf = otf
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_bad_otf = 2.
DATA : g_file TYPE string.
g_file = pcfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = g_file
filetype = 'BIN'
TABLES
data_tab = it_lines
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6.
Regards,
Mansi
04-20-2009 6:35 AM
Thanks for your reply.........it helped me a lot..........
Thanks & Regards,
Asmitha.
04-16-2009 6:15 AM
Dear ,
This might be system related prob not SAP .
Because onces its exported then its related to the software which is used to open the PDF
rgds ankit
04-16-2009 7:12 AM
Hi,
check the below link
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/mailsendthroughoutputcontrols
Regards,
Madhu