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

Pdf document not getting opened in mail

Former Member
0 Likes
458

Hello All,

I have created one pdf document from the spool request created

using function module CONVERT_ABAPSPOOLJOB_2_PDF and

now i have to send this document in mail for that i have used the

function module SO_NEW_DOCUMENT_ATT_SEND_API1.

Now the document is getting recieved in the mail but while opening

it is giving an error *There was an error opening this document, the file is

damaged and could not be repaired*.

What should be done to open the pdf file in mail without being damaged.

Please help.

Regards,

Mansi

2 REPLIES 2
Read only

Former Member
0 Likes
396

check what is the sy-subrc value after the function module execution

SO_NEW_DOCUMENT_ATT_SEND_API1.

I guess it should be 0 , if it is 0 then this is not an sap error..

The pdf file is getting corrupted..

Just try to send that mail to another person and try to open that in another system..

May be this can help you..

value of sy-subrc <> 0, then it is sap error.. just try to debugg and check if you can get any error or exception triggered..

Regards,

Satish Boguda

Read only

Former Member
0 Likes
396

  • Attachment
  • Create Message Body Title and Description
  • Main Text
  • Attachment (pdf-Attachment)
  • ELSE.
  • CONCATENATE 'Mail Sent to' wa_eplant-email_add INTO lv_tt.
  • MESSAGE lv_tt TYPE 'S' DISPLAY LIKE 'S'.
CALL FUNCTION 'CONVERT_OTF' EXPORTING format = 'PDF' max_linewidth = 132 IMPORTING bin_filesize = v_len_in TABLES otf = i_otf lines = i_tline EXCEPTIONS err_max_linewidth = 1 err_format = 2 err_conv_not_possible = 3 OTHERS = 4. IF sy-subrc <> 0. ENDIF. LOOP AT i_tline. TRANSLATE i_tline USING '~'. CONCATENATE wa_buffer i_tline INTO wa_buffer. ENDLOOP. TRANSLATE wa_buffer USING '~'. DO. i_record = wa_buffer. APPEND i_record. SHIFT wa_buffer LEFT BY 255 PLACES. IF wa_buffer IS INITIAL. EXIT. ENDIF. ENDDO. REFRESH: i_reclist, i_objtxt, i_objbin, i_objpack. CLEAR wa_objhead. i_objbin[] = i_record[]. i_objtxt = text-011. "'Dear Sir/Madam,'." '."'test with pdf-Attachment!'. APPEND i_objtxt. i_objtxt = text0. "'Please find the Inward Rejection Report as an PDF attachment'." '."'test with pdf-Attachment!'. APPEND i_objtxt. i_objtxt = text-013. "'Warm Regards'." '."'test with pdf-Attachment!'. APPEND i_objtxt. i_objtxt = wa_head-inspected_by." '."'test with pdf-Attachment!'. APPEND i_objtxt. DESCRIBE TABLE i_objtxt LINES v_lines_txt. READ TABLE i_objtxt INDEX v_lines_txt. wa_doc_chng-obj_name = lv_t."'smartform'. wa_doc_chng-expiry_dat = sy-datum + 10. wa_doc_chng-obj_descr = lv_t." 'smartform'. wa_doc_chng-sensitivty = 'F'. wa_doc_chng-doc_size = v_lines_txt * 255. CLEAR i_objpack-transf_bin. i_objpack-head_start = 1. i_objpack-head_num = 0. i_objpack-body_start = 1. i_objpack-body_num = v_lines_txt. i_objpack-doc_type = 'RAW'. APPEND i_objpack. i_objpack-transf_bin = 'X'. i_objpack-head_start = 1. i_objpack-head_num = 0. i_objpack-body_start = 1. DESCRIBE TABLE i_objbin LINES v_lines_bin. READ TABLE i_objbin INDEX v_lines_bin. i_objpack-doc_size = v_lines_bin * 255 . i_objpack-body_num = v_lines_bin. i_objpack-doc_type = 'PDF'. i_objpack-obj_name = 'smart'. i_objpack-obj_descr = lv_t ."'test'. APPEND i_objpack. REFRESH i_reclist. LOOP AT it_email INTO wa_email. w_reclist-receiver = wa_email-smtp_addr. w_reclist-rec_type = 'U'. APPEND w_reclist TO i_reclist. ENDLOOP. LOOP AT it_eplant INTO wa_eplant. w_reclist-receiver = wa_eplant-email_add. w_reclist-rec_type = 'U'. IF wa_eplant-cc1 = 'X'. w_reclist-copy = 'X'. ENDIF. IF wa_eplant-bcc = 'X'. w_reclist-blind_copy = 'X'. ENDIF. APPEND w_reclist TO i_reclist. CLEAR w_reclist. ENDLOOP. CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING document_data = wa_doc_chng put_in_outbox = 'X' commit_work = 'X' TABLES packing_list = i_objpack object_header = wa_objhead contents_bin = i_objbin contents_txt = i_objtxt receivers = i_reclist . IF sy-subrc <> 0. MESSAGE 'Error When Sending the File' TYPE 'E' DISPLAY LIKE 'S'. ENDIF.

Edited by: Rasheed salman on Dec 30, 2009 6:03 AM