Skip to Content
-2

Not able to open .XLSX file from email which was implemented using Note 1459896 to avoid pop up.

Mar 02 at 09:36 AM

89

avatar image
Former Member

Hi All,

The requirement is to send .XLSX as email. Since normal cl_bcs supports .XLS (i.e) only of 3 character extension type ,Sap has provided the note 1459896 to avoid the pop up. But when I implement the note, Iam not even able to open the file as it is showing below error.

Please check below code

DATA send_request TYPE REF TO cl_bcs. " Send Request
DATA document TYPE REF TO cl_document_bcs. " Email Document
DATA sender TYPE REF TO cl_sapuser_bcs. " Sender
DATA recipient TYPE REF TO if_recipient_bcs. " Receiver
DATA bcs_exception TYPE REF TO cx_bcs. " Exception
DATA text TYPE bcsy_text. " Text
DATA lv_string TYPE string.

TRY.

* Get new Send Request
send_request = cl_bcs=>create_persistent( ).

* create document from internal table with text
APPEND 'Please find attached files as REI Upload Error Report.'(t01) TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = 'REI Upload Error Report'(t02) ).
* attachments
me->add_attachments( document ).

* add document to send request
send_request->set_document( document ).

* Sender
sender = cl_sapuser_bcs=>create( sy-uname ).
send_request->set_sender( i_sender = sender ).

* Receiver
recipient = cl_cam_address_bcs=>create_internet_address( v_email ).
send_request->add_recipient(
i_recipient = recipient
i_express = 'X' ).

* Send email
send_request->send(
EXPORTING
i_with_error_screen = 'X' ).

COMMIT WORK.

CONCATENATE 'Email has been generated and sent to:'(m01) v_email
INTO lv_string
SEPARATED BY space.
MESSAGE lv_string TYPE 'S'.

CATCH cx_bcs INTO bcs_exception.
lv_string = bcs_exception->get_text( ).
MESSAGE 'Error while generating Email'(m02) TYPE 'S'.
MESSAGE lv_string TYPE 'S'.
ENDTRY.

Kindly help me where I went wrong or let me know if anyone got the solution.

error1.png (9.6 kB)
error1.png (9.6 kB)
error2.png (8.9 kB)
10 |10000 characters needed characters left characters exceeded

Relevant code is in:

me->add_attachments( document ).

:-(

1
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Jozsef Hegyi
Mar 08 at 02:44 PM
3

Hi

sap cannot gewnerate xlsx file just comma or tab separated file. (like csv) the 4 digit extention you

should put in the header table of the document or attachment with the key word '&SO_FILENAME as it is just

written in the note.

Best regards

Jozsef H

Share
10 |10000 characters needed characters left characters exceeded