07-17-2012 12:55 PM
Hi,
I'm sending an Excel(.XLS) file as an attachment to an E-Mail from SAP by using the CL_BCS class.
The problem with the attached Excel file is that it has a column which consists of MATERIAL number.
I've material numbers like "575121.010".
These are being displayed as "575121.01" with the trailing zeros being truncated in the excel file.
When I open the Excel file from the E-Mail, the Material Number is Not being formatted as a text.
Instead all the columns are being formatted as 'General'.
Is there a way in SAP which allows me to format the Excel column properties as TEXT while creating the File.
FYI.
I'm creating the EXCEL document in SAP by using the process below.
I'm creating the document by using the cl_document_bcs=>create_document( ) with type as "RAW".
After that I'm attaching the document to the mail and sending the document as an attachment with the mail.
Please help me with this one.
Regards,
Narayana Reddy A V L.
07-17-2012 2:16 PM
we used 'HTM' for I_TYPE parameter, maybe it solves your problem.
07-17-2012 1:26 PM
Hi Narayana,
Please check the following link. It may helpful for your scenario.
http://wiki.sdn.sap.com/wiki/display/Snippets/Formatted+Excel+as+Email+Attachment
Regards,
Vanita
07-17-2012 3:53 PM
Hi vanita,
Thanks for the early reply.
I've gone through the link given by you.
Is there any other possibility to format the excel column as TEXT by not using the XML concept ( OLE will not be helpful as I'm scheduling my program as a background job) .
As of now I'm sending it using CL_BCS class. Is there any possibility to use the CL_BCS class to format the excel attachment.
Thank you.
Regards,
Narayana Reddy A V L.
07-17-2012 2:16 PM
we used 'HTM' for I_TYPE parameter, maybe it solves your problem.
07-17-2012 3:56 PM
Hi Emre,
Thanks for the reply.
I have tried using 'HTM'. But still the problem is there. The excel file columns are being formatted as "General" only and the trailing zeros are being truncated in the excel file.
Is there any other way to format the columns.
Thanks.
Regards,
Narayana Reddy A V L.
07-17-2012 4:22 PM
Hi
try to this code.
LV_MATNR = '575121.010'.
CONCATENATE '=REPLACE("' LV_MATNR '";1;20;"'
LV_MATNR '")' INTO LV_MATNR_OUT .
EXCEL_TAB-MATNR = LV_MATNR_OUT.
07-18-2012 11:27 AM
Thanks Luis,
I've solved my problem by using the above piece of code and the excel file is now displaying the Trailing Zeros without any problem.
The below statement is the one which I had used in my program and it solved my issue.
CONCATENATE '=REPLACE("' lv_matnr '",1,40,"' lv_matnr '")' INTO lv_matnr.
Thanks for the help.
Regards,
Narayana Reddy A V L.
07-18-2012 8:31 AM
Hi,
if the last method isn't solved your problem, i think you must use OLE to create excel file then attach and send mail.
with your method you can't format excel format because you create a tab delimated file and change extention to xls, it's a tricky method.
07-18-2012 11:30 AM
Thanks Emre,
My issue has been resolved by using the code given by Luis.
Thanks again for all the help.
Regards,
Narayana Reddy A V L.
07-18-2012 8:32 AM
07-18-2012 11:32 AM
Thank you everyone for all the support.
I'm closing the Discussion.
Regards,
Narayana Reddy A V L.