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: 
Read only

formatting the excel attachment while sending mail using CL_BCS.

Former Member
0 Likes
3,633

Hi All,

i have requirement in which i have to send a mail with excel attachment.

I am using CL_BCS class to acheive this.

Now there is a field batch in the excel. This field is character field in sap. So '0123' and '123' are two different batches.

Now in my excel it is considering this field as number field and is displaying as '123' instead of '0123'.

Can anyone please let me know how to convert this column to a text column instead of number field ?

kindly provide the sample code.

Note: My funtional consultant doesnot want to use  =" " or REPLACE (old,length,new)  as in the formula bar its showing as ="0123".

He doesnt want the above concatenation for the fields.

Kindly provide any other solution by using some class can i acheive this?

Hi All,

i have requirement in which i have to send a mail with excel attachment.

I am using CL_BCS class to acheive this.

Now there is a field batch in the excel. This field is character field in sap. So '0123' and '123' are two different batches.

Now in my excel it is considering this field as number field and is displaying as '123' instead of '0123'.

Can anyone please let me know how to convert this column to a text column instead of number field ?

kindly provide the sample code.

Note: My funtional consultant doesnot want to use  =" " or REPLACE (old,length,new)  as in the formula bar its showing as ="0123".

He doesnt want the above concatenation for the fields.

Kindly provide any other solution by using some class can i acheive this?

9 REPLIES 9
Read only

rajeshkothamasu
Active Participant
0 Likes
2,004

This message was moderated.

Read only

0 Likes
2,004

Hi Rajesh,

The above link that you have mentioned was to send an unformatted excel attachement.

I need to know how to convert a column in excel into text format while sending mail.

Read only

0 Likes
2,004

Hi,

Refer the program  BCS_EXAMPLE_7

Regards,

Rajesh K

Read only

ipravir
Active Contributor
0 Likes
2,004

Hi,

Pass the Batch Value like

" ' wa-Batch_value ".

Since in excel, we use ' symbol to display or keep remain same the zero value before the digit.

Regards.

Praveer.

Read only

Former Member
0 Likes
2,004

Hi Praveen,

If I pass the single quote it is showing as single quote in my excel as well and even in the formula bar fx its showing as '0123 which my funtional doesnot want.

Can we make the column as text by any code change.

Read only

ipravir
Active Contributor
0 Likes
2,004

Hi,

It's excel functionality, to display the Digit with zero prefix.

Or you have to use the OLE (Object Link Enabled ) method and there you can change the format of a particular columns as text in excel.

Regards.

Praveer.

Read only

Former Member
0 Likes
2,004

This message was moderated.

Read only

Former Member
0 Likes
2,004

Hi,

can you give the code in OLE that satisfies my requirement.

Thanks

Balaji.A

Read only

ipravir
Active Contributor
0 Likes
2,004

Hi,

Please find the below link, which is having most of the functionality of the OLE.

http://scn.sap.com/community/abap/application-development/objects/blog/2012/09/27/ole-programming-fo...

Since, SAP is not provided the actual excel object, so through the OLE we can create the excel file in local system and after creation you can attach the same to send in mail.

Regards.

Praveer,