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

File size problem when performing XML Transformation into Excel

Former Member
0 Likes
458

Hi All,

We are performing XML Transformation in ABAP which can open in Excel and saving to common share. But the file size of excel is around 50MB. After opening the excel and save with diffrent name the file is getting compressed and its below 1MB. So what kind of settings does we need to make to the transformation code which will create the excel files with less memory/size??

<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

<tt:root name="AAAAAAA"/>
<tt:root name="BBBBBBBB"/>
<tt:root name="CCCCCCCC"/>

<tt:template>

<?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:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
   <ProtectObjects>True</ProtectObjects>
   <ProtectScenarios>True</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
</Workbook>


</tt:template>

</tt:transform>
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
</DocumentProperties>
 <CustomDocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <ContentTypeId dt:dt="string">0x01010049B4763FE606154C9C9BC639FE7EE179</ContentTypeId>
 </CustomDocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  <Colors>
   <Color>
    <Index>0</Index>
    <RGB>#FF0000</RGB>
   </Color>
   <Color>
    <Index>1</Index>
    <RGB>#FFE4B5</RGB>
   </Color>
   <Color>
    <Index>2</Index>
    <RGB>#FFF8DC</RGB>
   </Color>
   <Color>
    <Index>3</Index>
    <RGB>#000000</RGB>
   </Color>
  </Colors>
 </OfficeDocumentSettings>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>7305</WindowHeight>
  <WindowWidth>11340</WindowWidth>
  <WindowTopX>0</WindowTopX>
  <WindowTopY>0</WindowTopY>
  <TabRatio>334</TabRatio>
  <ProtectStructure>True</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>


 </DocumentProperties>
 <CustomDocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <ContentTypeId dt:dt="string">0x01010049B4763FE606154C9C9BC639FE7EE179</ContentTypeId>
 </CustomDocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">

Hi All,

We are performing XML Transformation in ABAP which can open in Excel and saving to common share. But the file size of excel is around 50MB. After opening the excel and save with diffrent name the file is getting compressed and its below 1MB. So what kind of settings does we need to make to the transformation code which will create the excel files with less memory/size??

<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

<tt:root name="AAAAAAA"/>
<tt:root name="BBBBBBBB"/>
<tt:root name="CCCCCCCC"/>

<tt:template>

<?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:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
   <ProtectObjects>True</ProtectObjects>
   <ProtectScenarios>True</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
</Workbook>


</tt:template>

</tt:transform>
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
</DocumentProperties>
 <CustomDocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <ContentTypeId dt:dt="string">0x01010049B4763FE606154C9C9BC639FE7EE179</ContentTypeId>
 </CustomDocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  <Colors>
   <Color>
    <Index>0</Index>
    <RGB>#FF0000</RGB>
   </Color>
   <Color>
    <Index>1</Index>
    <RGB>#FFE4B5</RGB>
   </Color>
   <Color>
    <Index>2</Index>
    <RGB>#FFF8DC</RGB>
   </Color>
   <Color>
    <Index>3</Index>
    <RGB>#000000</RGB>
   </Color>
  </Colors>
 </OfficeDocumentSettings>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>7305</WindowHeight>
  <WindowWidth>11340</WindowWidth>
  <WindowTopX>0</WindowTopX>
  <WindowTopY>0</WindowTopY>
  <TabRatio>334</TabRatio>
  <ProtectStructure>True</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>


 </DocumentProperties>
 <CustomDocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <ContentTypeId dt:dt="string">0x01010049B4763FE606154C9C9BC639FE7EE179</ContentTypeId>
 </CustomDocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">

1 REPLY 1
Read only

Sandra_Rossi
Active Contributor
0 Likes
369

Hi Raghu,

have a look at the XLSX file generated by Excel, you'll see that it's simply a zipped file. So you can't do it with a transformation, but you need CL_ABAP_ZIP class. I advise you to look at the abap2xslx project ABAP code (currently 3.0) to see how it works.

Best regards,

Sandra