Skip to Content
0
Former Member
Feb 10, 2011 at 08:13 AM

unable to open PDF File attchment in Mail

229 Views

Hi,

i am sending pdf as an attachment but the pdf is not opening. Its giving me an error. If i comment

t_objpack-transf_bin = c_true then pdf is opening but body of mail is coming into a txt file as an attachment.

I dont know where i am going wrong. Please help me out.

Here is the code.

Loop at t_mail_texts into w_mail_text

where text_typ eq c_tt_bodytext.

Move w_mail_text-text to t_objtxt.

Append t_objtxt.

Endloop.

Clear t_objpack.

t_objpack-transf_bin = c_true.

t_objpack-head_start = 1.

t_objpack-head_num = 1.

t_objpack-body_start = 1.

Describe table t_objbin lines w_lines_bin.

Read table t_objbin index w_lines_bin.

t_objpack-doc_size = w_lines_bin * 255 .

t_objpack-body_num = w_lines_bin.

t_objpack-doc_type = 'PDF'.

t_objpack-obj_name = text-008.

Concatenate text-007 '_' sy-datum sy-uzeit

into t_objpack-obj_descr.

APPEND t_objpack.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = wa_doc_chng

PUT_IN_OUTBOX = c_True

COMMIT_WORK = c_True

TABLES

PACKING_LIST = t_objpack

OBJECT_HEADER = wa_objhead

CONTENTS_BIN = t_objbin

CONTENTS_TXT = t_objtxt

RECEIVERS = t_reclist

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

DOCUMENT_TYPE_NOT_EXIST = 3

OPERATION_NO_AUTHORIZATION = 4

PARAMETER_ERROR = 5

X_ERROR = 6

ENQUEUE_ERROR = 7

OTHERS = 8.