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

excel mail attachment in background execution

Former Member
0 Likes
1,057

I want to send excel as mail attachment with 53 columns when exceute in background. But i_attach has 255 characters so its truncating more than 255 characters in header and values of excel.

so pls tel how to send attachment with all internal table contents.

  • Adding Attachment

CALL METHOD L_DOCUMENT->ADD_ATTACHMENT

EXPORTING

I_ATTACHMENT_TYPE = C_EXT

I_ATTACHMENT_SIZE = L_SIZE

I_ATTACHMENT_SUBJECT = 'Valid Standard Cost Estimate'

I_ATT_CONTENT_TEXT = I_ATTACH[].

I want to send excel as mail attachment with 53 columns when exceute in background. But i_attach has 255 characters so its truncating more than 255 characters in header and values of excel.

so pls tel how to send attachment with all internal table contents.

  • Adding Attachment

CALL METHOD L_DOCUMENT->ADD_ATTACHMENT

EXPORTING

I_ATTACHMENT_TYPE = C_EXT

I_ATTACHMENT_SIZE = L_SIZE

I_ATTACHMENT_SUBJECT = 'Valid Standard Cost Estimate'

I_ATT_CONTENT_TEXT = I_ATTACH[].

5 REPLIES 5
Read only

Former Member
0 Likes
891

Hi,

What extension are you using? Try 'BIN' Extension and remove the size parameter.

Also add it to the HEX table, not the text one.



          CALL METHOD lv_document->add_attachment
            EXPORTING
              i_attachment_type    = 'BIN'
              i_attachment_subject = lv_string
              i_att_content_hex    = lt_attach[]
              i_attachment_header  = lt_att_table[].

Thanks

Ernesto

Read only

0 Likes
891

thanks for ur reply

but all hex and text are also declared with 255 ly.

or otherwise i can download that internal table into excel in background execution and upload it and send as mail attachment ah.

but how to download,upload and send mail in background

Read only

0 Likes
891

Hi,

You can check SAP Std. Program BCS_EXAMPLE_5. It sends a Word Document by email. Excel file should be the same.

If you do not specify the size, it will automatically calculate it.

Regards,

Edited by: Ernesto Caballero on Mar 4, 2011 10:08 AM

Read only

0 Likes
891

they use the same method CALL METHOD lv_document->add_attachment

it allows the internal table only for 255 characters

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
891

Excel itself has a restriction that there can be no more than 255 characters in a cell (at least before 2010 version).

I'm not sure why it would truncate data in Excel, e.g. I send PDFs as attachment and they're just a stream of binary data. The content is placed in the same 255 char. table, but it's binary data, so at the end it comes out OK anyway. It's supposed to be magically reassembled when leaving SAP (as far as I understand). Are you using binary transfer?

There are numerous examples already available on SDN. Here is just one from the top of the list: