‎2010 Sep 02 3:17 PM
Hi Folks,
I am using BCS classes to send excel attachment in an mail. Everything is working fine except the Auto fit functionality of the columns. When the user opens the excel attachment he wants to see the columns width to be autofit.
‎2010 Sep 02 11:16 PM
Hi,
check this SDN Blog [abap2xlsx - Generate your professional Excel spreadsheet from ABAP|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/20046] [original link is broken] [original link is broken] [original link is broken]; could be useful to you.
Regards,
Ivan
‎2010 Sep 03 5:22 AM
Hi Ivan,
My requirement here is, I have data in internal table and this internal table data has to be sent as an email in excel format. I made use of the standard BCS classes SAP provided and was able to successfully send the excel attachment but the columns here are not auto-fit according to the field width. I used the following classes to send data:
The below class what it does is, it converts the data in string(LV_STRING) into binary_content.
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = lv_string
iv_codepage = '4103' "suitable for MS Excel, leave empty for other doc types
iv_add_bom = 'X'
IMPORTING
et_solix = binary_content
ev_size = size ).
CATCH cx_bcs.
ENDTRY.
The above binary content is transformed into excel
Add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls'
i_attachment_subject = 'Excel_Attachment_Name'
i_attachment_size = size
i_att_content_hex = binary_content).
Add document object to send request
send_request->set_document( document ).
The links provided by you are very interesting but does not fulfill my requirement. Thanks and appreciate more responses.