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

Formated Excel attachment through Mail

Former Member
0 Likes
2,921

Hi SAP Gurus,

My requirement is as follows,

I need to send formatted excel as attachment.

I have gone through many posts and found it is possible by using IF_IXML_ELEMENT


The program is working fine however I am facing issue in formatting a particular cell in the sheet.

Requirement screen shot is attached below,

(I want to color the particular cell as red abd wrap it)

Code Attached:

Regards,

Pavan.

Hi SAP Gurus,

My requirement is as follows,

I need to send formatted excel as attachment.

I have gone through many posts and found it is possible by using IF_IXML_ELEMENT


The program is working fine however I am facing issue in formatting a particular cell in the sheet.

Requirement screen shot is attached below,

(I want to color the particular cell as red abd wrap it)

Code Attached:

Regards,

Pavan.

12 REPLIES 12
Read only

matt
Active Contributor
0 Likes
2,381

For email, search for CL_BCS. For doing stuff with excel the easy way, search for ABAP2XLSX.

matt

Read only

0 Likes
2,381

Actually, ABAP2XLSX itself would be enough as there are many examples included, one of them being sending the excel file per e-mail

Best,

Bruno

Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
2,381

But Pavan already have all that working (see included code and what he wrote).

He only needs to set "color" XML property of cell.

Pavan - see this example XML Excel:


<Styles>

  <Style ss:ID="s23">

   <Interior ss:Color="#800080" ss:Pattern="Solid"/>

  </Style>

  <Style ss:ID="s24">

   <Interior ss:Color="#0000FF" ss:Pattern="Solid"/>

  </Style>

</Styles>

<Worksheet ss:Name="Sheet1">

  <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="3" x:FullColumns="1"  x:FullRows="1">

   <Row>

    <Cell ss:StyleID="s23"><Data ss:Type="String">apple</Data></Cell>

   </Row>

   <Row>

    <Cell ss:StyleID="s24"><Data ss:Type="String">orange</Data></Cell>

   </Row>

  </Table>

</Worksheet>

-- Tomas --
Read only

Former Member
0 Likes
2,381

Hi,

Thanks for the reply,

CL_BCS is to send xls attachment as mail,

I want to send formatted xls.

Regards,

Pavan.

Read only

Former Member
0 Likes
2,381

Hi,

Thanks for the reply,

Is ABAP2XLSX a program name?

My requirement is to send formatted xls.

Regards,

Pavan.

Read only

0 Likes
2,381

Hi Pavan,

abap2xlsx is a series of solutions regarding excel in abap, which consists in many objects, which you can install using SAPLINK.

You can find it here: abap2xlsx by ivanfemia

Even if you manage to solve your issue in some other way, I would recommend you to try this. It is very powerful and the demo's that are provided with it are coded perfectly and might help you in many other areas.

Best,

Bruno

Read only

matt
Active Contributor
0 Likes
2,381

CL_BCS is to send mail.

It can send unformatted data, formatted xls, jpegs, embedded content...

Read only

matt
Active Contributor
0 Likes
2,381

We understand your requirement - you don't have to keep repeating it. Have you search on the keywords you've been supplied with? Try using this site for search.

Read only

Former Member
0 Likes
2,381

Why not suggest lmgtfy link with same query?

It also serves as a tutorial, a bit condescending though.

Read only

0 Likes
2,381

Hi Pawan,

Please take a look at this blog -

Using this approach , we can send the formatted output based on the Layout as an E-Mail attachment.

Include a field lt_s_color of type -  lvc_t_scol in your output table. Update this field as follows.

       ls_s_color-fname     fieldname

       ls_s_color-color-col = col_negative.

       ls_s_color-color-int = 0.

       ls_s_color-color-inv = 0.

       APPEND ls_s_color TO lt_s_color.

       CLEAR  ls_s_color.


Regards

Srini S

Read only

former_member76372
Participant
0 Likes
2,381

Hi Pavan,

I have encountered similar requirement before, and the approach was to use OLE approach on your issue.

To attach the file, I downloaded it to my desktop and then upload it again to attach to my email, then delete the downloaded file.

You can check on this link for more details. Thats just font color, but inside have several links to guide you with OLE.

Read only

Former Member
0 Likes
2,381

This message was moderated.