Skip to Content
-1

Upload multiple files of any format from desktop using a zprogram and send them as attachment

Dec 14, 2016 at 12:05 PM

288

avatar image

Hi,

I want to write a custom program which allows the user to upload file of any extension and send this files to a email id. I have tried using GUI_UPLOAD and cl_document_bcs class. But not able to send .DOCX or .XLSX or .PPT file.

Kindly Advice.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Raymond Giuseppi
Dec 14, 2016 at 12:48 PM
0

For the four digits suffix, first look at 1459896 - BCS: Support for four-digit file name extension. (Also use google/launchpad)

Regards,
Raymond

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Hi Raymond,

My requirement is to attach .docx etc file from PC and mail it.

0

Classes CL_GUI_FRONTEND_SERVICES, CL_BCS. Sample BCS_EXAMPLE_* (Alternative: OLE with the mail client e.g. Outlook)

0

Already Checked. I am able to send multiple attachments with .doc or .ppt or .xls extensions. But i am not able to send files with .docx or .pptx or .xlsx extensions. The attachment in mail when opened shows some junk characters.

0

Jump back to first anwser

0

Thanks Raymond. SAP Note helped me understand the same

0
Rob Dielemans Dec 14, 2016 at 12:27 PM
1

Hi,

What is the added benefit? You can upload anything to email using S00 transaction and recipient type U Internet address.

Also how does this have more functionality than any other email software out there?

Kind regards, Rob Dielemans

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Rob,

User is creating a RFQ on its save I have to allow him to add attachments and send those attachments to the vendors email id. For initial feasibility test I am creating a zprogram to test if we can send any format file to a mail id.

0

Rob,thanks for letting us know S00 transaction.Any issue/disadvantage if we give the end user access to this transaction code in Production.

K.Kiran.

0
Preet SAP Dec 14, 2016 at 02:45 PM
1

Resolved.

Added i_attachment_size. While adding attachment SAP calculates the attachment size automatically which results in junk values for 4 digit extensions. So we need to pass the attachment size to get proper attachment. Below is the code for reference.

SAP Note - 1459896 - BCS: Support for four-digit file name extension helps to understand the same.

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = lv_filename
FILETYPE = 'BIN'

IMPORTING
FILELENGTH = lv_file_len

TABLES
DATA_TAB = lt_uploaded_data.

CALL METHOD document->add_attachment
EXPORTING i_attachment_type = l_att_type
i_attachment_subject = l_subject " attachment description
i_attachment_size = lv_file_size
i_att_content_hex = lt_uploaded_data.

Share
10 |10000 characters needed characters left characters exceeded