Application Development 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: 

Email attachment were corrupted

veerusap
Participant
0 Kudos

Hi all,

I have a requirement to send attachments to customer with different type of formats.

I'm sending the documents in .ZIP format, can you help me on this..

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' EXPORTING buffer = l_vzip * IMPORTING * output_length = lv_len TABLES binary_tab = lit_content_255.

Thanks in advance,

Satish

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

You must first identify where the real problem is. How do you know it's because of SCMS_XSTRING_TO_BINARY? It could be because you pass the internal table to the mail in text mode, or you forget to pass the length of the ZIP (unit: number of bytes)

5 REPLIES 5

Sandra_Rossi
Active Contributor

You must first identify where the real problem is. How do you know it's because of SCMS_XSTRING_TO_BINARY? It could be because you pass the internal table to the mail in text mode, or you forget to pass the length of the ZIP (unit: number of bytes)

0 Kudos

Hi Rossi,

Thanks for your reply.

Actually I'm pulling these attachments from SRM system in raw format. Based on attachment number i'm converting these attachments into XSTRING format and adding into ZIP format. And finally i'm converting ZIP data into Binary format using few classes. Finally I'm passing my internal table raw data ( lit_content_255 ) into CALL METHOD document->add_attachment.

CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'ZIP'
i_attachment_subject = lv_sub
i_att_content_hex = lit_content_255.

Note: In few cases (for few PO's) the attachments are sending properly ( not corrupting ). but in some cases the attachments corrupted.

Can you suggest me , is there any notes needs to implement for this type of issue. Pls help me.

Regards,

Satish

0 Kudos

You should pass the length of the ZIP using I_ATTACHMENT_SIZE parameter of ADD_ATTACHMENT (otherwise, the length is considered being the number of lines of LIT_CONTENT_255 multiplied by 255 bytes).

veerusap
Participant
0 Kudos

Thanq Rossi... Finally I fixed the bug. Actually that is sorting problem. I sorted internal table of raw data by attachment number, that's why attachments corrupted. Now I removed "SORT statement. Issue resolved.

Thanks for your reply.

Regards,

Satish

Jelena
Active Contributor

If this is resolved then kindly close the question. It still appears as unanswered as of now.

Thanks.