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 with .xlsx attachment is not able open but .docx is opening GUI 720

Former Member
0 Kudos

Hi Experts,

I have searched in SDN before posting this thread.

I have requirement to get a .docx or .xlsx document from SRM system into ECC system and send email with this attachment.

email is sent with attachment correctly, but attachment is not opening , when trying to open data is getting corrupted. But the .docx attachment is opening.Could you please provide me the solution for this.

using below code..

CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'

EXPORTING

documenttype = gc_dokar_srm "SRM

documentnumber = gw_docu-doknr

documentpart = '000'

documentversion = '00'

getobjectlinks = 'X'

getcomponents = 'X'

IMPORTING

return = lw_return

TABLES

documentfiles = gt_docfiles.

LOOP AT gt_docfiles INTO gw_docfiles.

CALL METHOD cl_http_client=>create_by_url

EXPORTING

url = gw_url

IMPORTING

client = lif_client

EXCEPTIONS

argument_not_found = 1

plugin_not_active = 2

internal_error = 3

OTHERS = 4.

  • Make the call

CALL METHOD lif_client->send

EXCEPTIONS

http_communication_failure = 1

http_invalid_state = 2

http_processing_failed = 3

http_invalid_timeout = 4

OTHERS = 5.

  • Receive the Response Object

CALL METHOD lif_client->receive

EXCEPTIONS

http_communication_failure = 1

http_invalid_state = 2

http_processing_failed = 3

OTHERS = 4.

  • Get the response content

gw_xcontent = lif_client->response->get_data( ).

REFRESH: lt_data.

  • Convert data into binary format

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

buffer = gw_xcontent

TABLES

binary_tab = lt_data.

CALL METHOD cl_document_bcs->add_attachment

EXPORTING

i_attachment_type = 'XLS' "gw_docfiles-wsapplication

i_attachment_subject = gw_objdes "definition of output type

i_att_content_hex = lt_data.

endloop.

Thanks & Regards,

Raahul G.

1 ACCEPTED SOLUTION

ChandraMahajan
Active Contributor
0 Kudos

Hi,

check

Thanks,

Chandra

2 REPLIES 2

ChandraMahajan
Active Contributor
0 Kudos

Hi,

check

Thanks,

Chandra

0 Kudos

This message was moderated.