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: 

Sending .xlsx files as attachments from sap

Former Member
0 Kudos
109

Hi gurus,

I am able to send the '.xls' no issues regarding this technique.

But now I was asked to send the files with extension '.xlsx'.

These type of files are not able to open in the mobile devices (ex : Blackberry)

Please suggest me in this issue.

Thanks,

Here is the code i'm using

TRY.

             SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).

             APPEND 'Please find the attachment for the sales register' TO MAIN_TEXT. "#EC NOTEXT

             DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(

               I_TYPE    = 'RAW'

               I_TEXT    = MAIN_TEXT

               I_SUBJECT G_VAR2 ) ."' Sales Register ' ).

             DOCUMENT->ADD_ATTACHMENT(

               I_ATTACHMENT_TYPE    = 'xls'                  "#EC NOTEXT

               I_ATTACHMENT_SUBJECT G_VAR1              "'Sales'

               I_ATTACHMENT_SIZE    = SIZE

               I_ATT_CONTENT_HEX    = BINARY_CONTENT[] ).

             SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).

             RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( MAILTO ).

             SEND_REQUEST->ADD_RECIPIENT( RECIPIENT ).

             SENT_TO_ALL = SEND_REQUEST->SEND( I_WITH_ERROR_SCREEN = 'X' ).

             COMMIT WORK.

             IF SENT_TO_ALL IS INITIAL.

               MESSAGE I500(SBCOMS) WITH MAILTO.

             ELSE.

               MESSAGE S022(SO).

             ENDIF.

*   ------------ exception handling ----------------------------------

*   replace this rudimentary exception handling with your own one !!!

           CATCH CX_BCS INTO BCS_EXCEPTION.

             MESSAGE I865(SO) WITH BCS_EXCEPTION->ERROR_TYPE.

         ENDTRY.

1 REPLY 1

alessandroieva
Active Participant
0 Kudos
68

Hi,

 

maybe, this post could be useful:

let me know,

AI