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

Internal Table to EXCEL

Former Member
0 Likes
751

Hell all,

I have a requirement where in which I need to download the dynamic internal table to Excel sheet and save the excel sheet in the application server and send the same in emai as attachmentl. All these need to be done in background. The no of columns in the internal table may vary from 40 to 60. Please help me with this.

Thanks & Regards

Hemanth

Hell all,

I have a requirement where in which I need to download the dynamic internal table to Excel sheet and save the excel sheet in the application server and send the same in emai as attachmentl. All these need to be done in background. The no of columns in the internal table may vary from 40 to 60. Please help me with this.

Thanks & Regards

Hemanth

5 REPLIES 5
Read only

Former Member
0 Likes
684

Hi,

See:

Best regards,

Leandro Mengue

Hi,

You can create the file in XML format.

Create a XLS (in Excel) with your formats and needs. Save it as XML. Open this file with Nodepad.

Your program have to follow this format.

Best regards,

Leandro Mengue

Example:

<?xml version="1.0"?>

<?mso-application progid="Excel.Sheet"?>

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"

xmlns:o="urn:schemas-microsoft-com:office:office"

xmlns:x="urn:schemas-microsoft-com:office:excel"

xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"

xmlns:html="http://www.w3.org/TR/REC-html40">

<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">

<Author>bmengue</Author>

<LastAuthor>bmengue</LastAuthor>

<Created>2010-05-17T15:19:12Z</Created>

<Company>xxxxx</Company>

<Version>11.9999</Version>

</DocumentProperties>

<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">

<WindowHeight>10230</WindowHeight>

<WindowWidth>18075</WindowWidth>

<WindowTopX>240</WindowTopX>

<WindowTopY>105</WindowTopY>

<ProtectStructure>False</ProtectStructure>

<ProtectWindows>False</ProtectWindows>

</ExcelWorkbook>

<Styles>

...

<Worksheet ss:Name="Plan1">

<Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="4" x:FullColumns="1"

x:FullRows="1">

<Row>

<Cell><Data ss:Type="String">A1</Data></Cell>

</Row>

<Row>

<Cell ss:Index="2"><Data ss:Type="String">B2</Data></Cell>

</Row>

<Row>

<Cell ss:Index="3"><Data ss:Type="String">C3</Data></Cell>

</Row>

<Row>

<Cell ss:Index="4" ss:StyleID="s21"><Data ss:Type="String">D4</Data></Cell>

</Row>

</Table>

...

  • replace A1,B2,C3,D4 by your values for cells A1,B2,C2,D4 ...

Read only

former_member214857
Contributor
0 Likes
684

Hi Hemanth

Actually, as your needs you have to write a program to export internal data manually to an XLS file. You will need work with tags defined in XLS definition

Export process like sample below:

OPEN DATASET myfile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  
    LOOP AT my_table.
        CONCATENATE '<Cell ss:Index="X">' my_table </cell> INTO x_value.        
        TRANSFER x_value TO myfile.
    ENDLOOP.

    CLOSE DATASET myfile.

After that, you can use FM SO_DOCUMENT_SEND_API1 to send emails and use exported file as attachment.

Kind regards

Edited by: Carlos Machado on May 31, 2010 3:30 PM

Read only

0 Likes
684

Thanks Carlos. I have a doubt here. So in the '<Cell>'. Do I need to give the Cell numbaer like A1,B1 as in excel??

Regards

Hemanth

Read only

0 Likes
684

Hi Hemanth

Actually, is necessary to nest <Row> and <Cell> tags, please check as sample below:

<Row ss:Index="3">
        <Cell ss:StyleID="s1">
          <Data ss:Type="String">Product</Data>
        </Cell>
        <Cell ss:StyleID="s1">
          <Data ss:Type="String">Sold</Data>
        </Cell>
        <Cell ss:StyleID="s1">
          <Data ss:Type="String">Price</Data>
        </Cell>
        <Cell ss:StyleID="s1">
          <Data ss:Type="String">Sum</Data>
        </Cell>
      </Row>

Edited by: Carlos Machado on Jun 3, 2010 2:11 AM

Read only

Former Member
0 Likes
684

This message was moderated.