Skip to Content
avatar image
Former Member

Attachment size in CL_document_bcs->send

Hello Experts,

In a customized function we are using cl_document_bsc->add_attachment to attach documents and then cl_document_bsc->send to send email with attachments.

Some times we are not able to open the documents attached in the emails.

Following attributes are used for building the attachment.

lwa_inv_attach-type = c_pdf

lwa_inv_attach-sub = lv_subject.

lwa_inv_attach-content = it_soli.

lwa_inv_attach-size = 0.

and here it was commented as "Size of attachment should be 0, if you do try to get the size and pass it, the attachment won't open"

Could you please help me understand what is the significance of the size attribute here. We are not able to open the documents only in some instances. Is that because of this size attribute.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jul 19, 2017 at 07:20 PM

    Where did you find this comment? In my experience, it's exactly the opposite - you need to fill in size otherwise you'll get an error when opening.

    E.g. in one program I use size = XSTRLEN( lv_xstring ) (where lv_xstring is binary content) and then pass that value. Don't remember if I tried it with 0 but it seems totally possible that you'd end up with a wrong size then which would lead to the problem you've described.

    Add comment
    10|10000 characters needed characters exceeded

    • It won't work with "some size". You need the correct number. Or, as Raymond's comment suggests, this should work with 0 size too. Either way, the comment "put 0 or it won't work" seems inaccurate to me. I wouldn't rely on it - the functionality could've changed since it was made. Or maybe the comment's author just ran into one case and made an incorrect assumption. Anyone can make a mistake.

  • Jul 20, 2017 at 07:51 AM

    If you pass an initial I_ATTACHMENT_SIZE the class will compute it itself, so that should usually not be a problem. You could check method COUNT_DOC_SIZE of the class.

    Add comment
    10|10000 characters needed characters exceeded