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

Unable to read excel attachment received thru email using function module ?

Former Member
0 Likes
633

Hi...

I am using the function module 'SO_DOCUMENT_SEND_API1' to send an email attachement in EXCEL format.

The email is getting received along with the attachment, but when i try to open the excel file, i am getting an error stating "Unable to Read File"......

What could be the reason behind this error.......

Plz Help......

5 REPLIES 5
Read only

Former Member
0 Likes
588

Hi,

Declare above fun mod 'SO_DOCUMENT_SEND_API1' it_objpack-doc_type = 'CSV'.

Check in fun mod 'SO_DOCUMENT_SEND_API1'

TABLES

packing_list = it_objpack

Thanks,

Krishna..

Read only

0 Likes
588

Krishna...

I am still getting the same error.....

Read only

Former Member
0 Likes
588

Hi,

If the excel file is not SAP generated (like downloaded by any report) it usually creates problem in uploading the same (may be due to some format problem, also try removing worksheets from the excel file so that only one worksheet remains in the file).

The best way to overcome the problem is to convert the Excel file to a tab-delimited Text file first. Now convert this tab-delimited text file back to an Excel file.

Now if you try uploading this created excel file to SAP then there should be no problems.

Cheers.

Read only

0 Likes
588

Hi..

I tried the tab delimited text file but still i am gettin the same error...... ... ...

Read only

Former Member
0 Likes
588

Hi,

Firstly, convert Excel Format with FM: SAP_CONVERT_TO_TXT_FORMAT ,

" Format convert(Excel content)

CALL FUNCTION 'SAP_CONVERT_TO_TXT_FORMAT'

EXPORTING

I_LINE_HEADER = 'X'

TABLES

I_TAB_SAP_DATA = GIT_DATA "Before convert

CHANGING

I_TAB_CONVERTED_DATA = GIT_EXCEL "After convert

LOOP AT GIT_EXCEL INTO LFC_STMP.

LI_ITMP = STRLEN( LFC_STMP ).

LFC_STMP+LI_ITMP = CL_ABAP_CHAR_UTILITIES=>CR_LF.

MODIFY GIT_EXCEL FROM LFC_STMP.

ENDLOOP.

Then, send Email with .xls attachment via FM: SO_DOCUMENT_SEND_API1.

Best Regards

Lily