I am using cl_bcs based functionality to send email to sap inbox with Excel attachment. Everything is Ok, the only problem is the data which I am getting for some fields got trimmed in excel. e.g in internal table i have '00001' and when I see the data in my generated excel sheet, its just '1'...leading zero's are gone.
cl_bcs_convert=>string_to_solix( EXPORTING iv_string = lv_string1 iv_codepage = '4103' "suitable for MS Excel, leave empty iv_add_bom = 'X' "for other doc types IMPORTING et_solix = binary_content ev_size = size ).
I am using above mentioned method for conversion. I am using concatenate statement to move the data to lv_string1 inside a loop.
Could you please suggest the solution.
If you can see the single apostrophe, then that is the excel problem and you need to re-format cell in excel to text format or create a excel macro to format cell and text.
Select colum and then 'Ctrl' + 1. In the 'Number' tab, Number -> text
Apostrophe solution has worked for me so far. You can try it in excel. by entering '0001 and it will retain the zeroes without apostrophe. Apostrophe in excel is a way to retain the number as string in excel
You can even try the following. I have not used it, but you can tell us if it works too
[Truncate leading zeroes using REPLACE|http://www.sapdev.co.uk/reporting/email/attach_zeros.htm]