
Create New Transformation
Select Simple Transformation
Enter Code in SourceCode section as shown here
<!--***************************************************************************
**************** Transformation ZEXCEL_XML_TRANS
***************************************************************************
* Description : Make Xml For Excel file
* Module : HCM
* Trans. code :
* Author : Navneet Anand
*Date & Time : 29.07.2019 17:55:35
***************************************************************************
* -->
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="excelMeta"/>
<tt:root name="sheets"/>
<tt:template>
<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" tt:extensible="deep-static">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>
<tt:value ref="excelMeta.DocumentProperties.Author"/>
</Author>
</DocumentProperties>
<tt:serialize>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
</Style>
<tt:loop name="Styles" ref=".excelMeta.Styles">
<Style>
<tt:attribute name="ss:ID" value-ref="$Styles.ID"/>
<Alignment>
<tt:cond check="not-initial($Styles.Alignment.Horizontal)">
<tt:attribute name="ss:Horizontal" value-ref="$Styles.Alignment.Horizontal"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Alignment.Vertical)">
<tt:attribute name="ss:Vertical" value-ref="$Styles.Alignment.Vertical"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Alignment.WrapText)">
<tt:attribute name="ss:WrapText" value-ref="$Styles.Alignment.WrapText"/>
</tt:cond>
</Alignment>
<Borders>
<Border ss:Position="Bottom" >
<tt:cond check="not-initial($Styles.border.weight)">
<tt:attribute name="ss:Weight" value-ref="$Styles.border.weight"/>
</tt:cond>
<tt:cond check="not-initial($Styles.border.linestyle.Bottom)">
<tt:attribute name="ss:LineStyle" value-ref="$Styles.border.linestyle.Bottom"/>
</tt:cond>
<tt:cond check="not-initial($Styles.border.Color.Bottom)">
<tt:attribute name="ss:Color" value-ref="$Styles.border.Color.Bottom"/>
</tt:cond>
</Border>
<Border ss:Position="Top" >
<tt:cond check="not-initial($Styles.border.weight)">
<tt:attribute name="ss:Weight" value-ref="$Styles.border.weight"/>
</tt:cond>
<tt:cond check="not-initial($Styles.border.linestyle.Top)">
<tt:attribute name="ss:LineStyle" value-ref="$Styles.border.linestyle.Top"/>
</tt:cond>
<tt:cond check="not-initial($Styles.border.Color.Top)">
<tt:attribute name="ss:Color" value-ref="$Styles.border.Color.Top"/>
</tt:cond>
</Border>
<Border ss:Position="Left" >
<tt:cond check="not-initial($Styles.border.weight)">
<tt:attribute name="ss:Weight" value-ref="$Styles.border.weight"/>
</tt:cond>
<tt:cond check="not-initial($Styles.border.linestyle.Left)">
<tt:attribute name="ss:LineStyle" value-ref="$Styles.border.linestyle.Left"/>
</tt:cond>
<tt:cond check="not-initial($Styles.border.Color.left)">
<tt:attribute name="ss:Color" value-ref="$Styles.border.Color.left"/>
</tt:cond>
</Border>
<Border ss:Position="Right" >
<tt:cond check="not-initial($Styles.border.weight)">
<tt:attribute name="ss:Weight" value-ref="$Styles.border.weight"/>
</tt:cond>
<tt:cond check="not-initial($Styles.border.linestyle.Right)">
<tt:attribute name="ss:LineStyle" value-ref="$Styles.border.linestyle.Right"/>
</tt:cond>
<tt:cond check="not-initial($Styles.border.Color.Right)">
<tt:attribute name="ss:Color" value-ref="$Styles.border.Color.Right"/>
</tt:cond>
</Border>
</Borders>
<Font>
<tt:cond check="not-initial($Styles.Font.fontname)">
<tt:attribute name="ss:FontName" value-ref="$Styles.Font.fontname"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Font.Family)">
<tt:attribute name="x:Family" value-ref="$Styles.Font.Family"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Font.Color)">
<tt:attribute name="ss:Color" value-ref="$Styles.Font.Color"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Font.Bold)">
<tt:attribute name="ss:Bold" value-ref="$Styles.Font.Bold"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Font.Italic)">
<tt:attribute name="ss:Italic" value-ref="$Styles.Font.Italic"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Font.Underline)">
<tt:attribute name="ss:Underline" value-ref="$Styles.Font.Underline"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Font.Font_Size)">
<tt:attribute name="ss:Size" value-ref="$Styles.Font.Font_Size"/>
</tt:cond>
</Font>
<Interior>
<tt:cond check="not-initial($Styles.Interior.Colorindex)">
<tt:attribute name="ss:Color" value-ref="$Styles.Interior.Colorindex"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Interior.Pattern)">
<tt:attribute name="ss:Pattern" value-ref="$Styles.Interior.Pattern"/>
</tt:cond>
<tt:cond check="not-initial($Styles.Interior.patterncolorindex)">
<tt:attribute name="ss:PatternColor" value-ref="$Styles.Interior.patterncolorindex"/>
</tt:cond>
</Interior>
</Style>
</tt:loop>
</Styles>
</tt:serialize>
<tt:loop name="sheet" ref=".sheets">
<Worksheet>
<tt:attribute name="ss:Name" value-ref="$sheet.Sheetname"/>
<Table>
<tt:cond check="not-initial($sheet.ColWidth)">
<tt:loop name="ColWidth" ref="$sheet.ColWidth">
<Column>
<tt:attribute name="ss:Index" value-ref="$ColWidth.Col_index"/>
<tt:attribute name="ss:Width" value-ref="$ColWidth.Col_width"/>
</Column>
</tt:loop>
</tt:cond>
<tt:loop name="line" ref="$sheet.sheetx">
<Row>
<tt:cond check="not-initial($line.RowHight)">
<tt:attribute name="ss:Height" value-ref="$line.RowHight"/>
</tt:cond>
<tt:loop name="Cell" ref="$line.Cells">
<Cell>
<tt:cond>
<tt:attribute name="ss:StyleID" value-ref="$Cell.StyleID"/>
</tt:cond>
<tt:cond>
<Data>
<tt:attribute name="ss:Type" value-ref="$Cell.Type"/>
<tt:value ref="$Cell.cell_content"/>
</Data>
</tt:cond>
</Cell>
</tt:loop>
</Row>
</tt:loop>
</Table>
</Worksheet>
</tt:loop>
</Workbook>
</tt:template>
</tt:transform>
DATA binary_content TYPE solix_tab.
DATA :BEGIN OF ls_xls_cell,
styleid TYPE string,
type TYPE string,
cell_content TYPE string,
END OF ls_xls_cell,
li_xls_cells LIKE TABLE OF ls_xls_cell,
BEGIN OF ls_column_width,
col_index TYPE i ,
col_width TYPE i ,
end of ls_column_width ,
li_column_width like TABLE OF ls_column_width ,
BEGIN OF ls_xls_row,
rownr TYPE i,
RowHight TYPE i ,
cells LIKE li_xls_cells,
END OF ls_xls_row ,
li_xls_row LIKE TABLE OF ls_xls_row.
DATA : BEGIN OF sheets ,
sheetname TYPE string,
sheetx LIKE li_xls_row,
ColWidth like li_column_width,
END OF sheets ,
it_sheets LIKE TABLE OF sheets.
DATA : lv_xml_string TYPE xstring,
BEGIN OF ls_documentproperties,
author TYPE string,
END OF ls_documentproperties,
BEGIN OF ls_font,
family TYPE string VALUE 'Swiss' ,
FontName TYPE string VALUE 'Arial' ,
Font_Size TYPE i VALUE 10 ,
color TYPE String ,
bold TYPE char1,
italic TYPE char1 ,
Underline TYPE string ,
END OF ls_font,
BEGIN OF ls_alignment ,
Horizontal TYPE char10 , "VALUE 'Left',
vertical TYPE char10 , "VALUE 'Bottom',
WrapText TYPE char1 ,
END OF ls_alignment ,
BEGIN OF ls_border_face,
top TYPE string ,
bottom TYPE string ,
left TYPE string ,
right TYPE string ,
END OF ls_border_face,
BEGIN OF ls_border,
linestyle like ls_border_face,
weight TYPE char1,
Color like ls_border_face,
END OF ls_border,
BEGIN OF ls_interior,
colorindex TYPE string,
pattern TYPE string,
patterncolorindex TYPE string,
END OF ls_interior,
BEGIN OF ls_style,
id TYPE string,
font LIKE ls_font,
Alignment like ls_alignment ,
border LIKE ls_border,
interior LIKE ls_interior,
END OF ls_style,
BEGIN OF ls_excelmeta,
documentproperties LIKE ls_documentproperties,
styles LIKE TABLE OF ls_style,
END OF ls_excelmeta .",
ls_excelmeta-documentproperties-author = sy-uname.
***********includes all Excel style formatting
CLEAR: ls_style.
ls_style-id = 's21'. " Style 1 for includes all formatting
ls_style-font-family = 'Script' ."'Swiss'.
ls_style-font-fontname = 'Ink Free' .
ls_style-font-bold = '1'.
ls_style-font-italic = '0'.
ls_style-font-underline = 'Single' . " 'Double' .
ls_style-font-color = '#92D050' .
ls_style-alignment-horizontal = 'Center' .
ls_style-alignment-vertical = 'Center' .
ls_style-alignment-wraptext = '1' .
ls_style-border-linestyle-bottom =
ls_style-border-linestyle-top =
ls_style-border-linestyle-left =
ls_style-border-linestyle-right = 'SlantDashDot'. "'Continuous' . "'SlantDashDot' "'DashDotDot "'Double' "'DashDot' ..
ls_style-border-weight = '1'.
ls_style-border-color-top =
ls_style-border-color-bottom =
ls_style-border-color-left =
ls_style-border-color-right = '#FF0000' .
ls_style-interior-colorindex = '#FFFFF1'.
ls_style-interior-pattern = 'Gray0625'. "'HorzStripe'.
ls_style-interior-patterncolorindex = '#FF0000'.
APPEND ls_style TO ls_excelmeta-styles.
ls_xls_cell-type = 'String'.
ls_xls_cell-styleid = 's21'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = 'S21-includes all formatting' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_row-rowhight = 100 . " Row 1 Hight will be 100
APPEND ls_xls_row TO li_xls_row.
CLEAR ls_xls_cell-cell_content.
CLEAR ls_xls_row.
ls_column_width-col_index = 2 .
ls_column_width-col_width = 200 .
append ls_column_width to li_column_width .
sheets-colwidth = li_column_width .
sheets-sheetx = li_xls_row .
sheets-sheetname = 'Sheet 1' .
translate sheets-sheetname TO UPPER CASE .
APPEND sheets TO it_sheets.
CLEAR sheets.
CALL TRANSFORMATION ZGEN9_139391
SOURCE excelmeta = ls_excelmeta
sheets = it_sheets
RESULT XML lv_xml_string.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_xml_string
TABLES
binary_tab = binary_content.
DATA : filename TYPE string .
CONCATENATE 'C:\TestExcel' '\Excel_sheet_' sy-datum '_' sy-uzeit '.XLS' INTO filename .
CONDENSE filename .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
filetype = 'BIN'
TABLES
data_tab = binary_content .
ls_excelmeta-documentproperties-author = sy-uname.
ls_style-font-family = 'Script' ."'Swiss'.
ls_style-font-fontname = 'Ink Free' .
ls_style-font-bold = '1'."Bold
ls_style-font-italic = '1'.
ls_style-font-underline = 'Single' . " 'Double' .
ls_style-font-color = '#92D050' .
ls_style-alignment-vertical = 'Center' ."'Bottom' . "'Top'. "'Justify'."'Distributed'
ls_style-alignment-horizontal = 'Center' ."'Left'."'Right'."'Fill'."'Justify' ....
ls_style-alignment-wraptext = '1' .
ls_style-border-color-top =
ls_style-border-color-bottom =
ls_style-border-color-left =
ls_style-border-color-right = '#FF0000' .
ls_style-border-linestyle-bottom =
ls_style-border-linestyle-top =
ls_style-border-linestyle-left =
ls_style-border-linestyle-right = 'SlantDashDot'. "'Continuous' . "'SlantDashDot' "'DashDotDot "'Double' "'DashDot' ..
ls_style-border-weight = '1'.
ls_style-interior-colorindex = '#FFFFF1'.
ls_style-interior-pattern = 'Gray0625'. "'HorzStripe'.
ls_style-interior-patterncolorindex = '#FF0000'.
ls_xls_row-rowhight = 100 .
ls_xls_cell-type = 'String'."'Number' .
ls_column_width-col_index = 3 .
ls_column_width-col_width = 400 .
append ls_column_width to li_column_width .
sheets-colwidth = li_column_width .
sheets-sheetx = li_xls_row1 . "Sheet 1 Data
sheets-sheetname = 'Sheet 1' .
translate sheets-sheetname TO UPPER CASE .
APPEND sheets TO it_sheets.
sheets-sheetx = li_xls_row2 . "Sheet 2 Data
sheets-sheetname = 'Sheet 2' .
translate sheets-sheetname TO UPPER CASE .
APPEND sheets TO it_sheets.
REPORT Z_DOWNLOAD_EXCEL.
DATA binary_content TYPE solix_tab.
DATA :BEGIN OF ls_xls_cell,
styleid TYPE string,
type TYPE string,
cell_content TYPE string,
END OF ls_xls_cell,
li_xls_cells LIKE TABLE OF ls_xls_cell,
BEGIN OF ls_column_width,
col_index TYPE i ,
col_width TYPE i ,
end of ls_column_width ,
li_column_width like TABLE OF ls_column_width ,
BEGIN OF ls_xls_row,
rownr TYPE i,
RowHight TYPE i ,
cells LIKE li_xls_cells,
END OF ls_xls_row ,
li_xls_row LIKE TABLE OF ls_xls_row.
DATA : BEGIN OF sheets ,
sheetname TYPE string,
sheetx LIKE li_xls_row,
ColWidth like li_column_width,
END OF sheets ,
it_sheets LIKE TABLE OF sheets.
DATA : lv_xml_string TYPE xstring,
BEGIN OF ls_documentproperties,
author TYPE string,
END OF ls_documentproperties,
BEGIN OF ls_font,
family TYPE string VALUE 'Swiss' ,
FontName TYPE string VALUE 'Arial' ,
Font_Size TYPE i VALUE 10 ,
color TYPE String ,
bold TYPE char1,
italic TYPE char1 ,
Underline TYPE string ,
END OF ls_font,
BEGIN OF ls_alignment ,
Horizontal TYPE char10 , "VALUE 'Left',
vertical TYPE char10 , "VALUE 'Bottom',
WrapText TYPE char1 ,
END OF ls_alignment ,
BEGIN OF ls_border_face,
top TYPE string ,
bottom TYPE string ,
left TYPE string ,
right TYPE string ,
END OF ls_border_face,
BEGIN OF ls_border,
linestyle like ls_border_face,
weight TYPE char1,
Color like ls_border_face,
END OF ls_border,
BEGIN OF ls_interior,
colorindex TYPE string,
pattern TYPE string,
patterncolorindex TYPE string,
END OF ls_interior,
BEGIN OF ls_style,
id TYPE string,
font LIKE ls_font,
Alignment like ls_alignment ,
border LIKE ls_border,
interior LIKE ls_interior,
END OF ls_style,
BEGIN OF ls_excelmeta,
documentproperties LIKE ls_documentproperties,
styles LIKE TABLE OF ls_style,
END OF ls_excelmeta .",
ls_excelmeta-documentproperties-author = sy-uname.
* SET THE HEADER STYLE
***********includes all Excel style formatting
CLEAR: ls_style.
ls_style-id = 's21'. " Style 1 for includes all formatting
ls_style-font-family = 'Script' ."'Swiss'.
ls_style-font-fontname = 'Ink Free' .
ls_style-font-bold = '1'.
ls_style-font-italic = '0'.
ls_style-font-underline = 'Single' . " 'Double' .
ls_style-font-color = '#92D050' .
ls_style-alignment-horizontal = 'Center' .
ls_style-alignment-vertical = 'Center' .
ls_style-alignment-wraptext = '1' .
ls_style-border-linestyle-bottom =
ls_style-border-linestyle-top =
ls_style-border-linestyle-left =
ls_style-border-linestyle-right = 'SlantDashDot'. "'Continuous' . "'SlantDashDot' "'DashDotDot "'Double' "'DashDot' ..
ls_style-border-weight = '1'.
ls_style-border-color-top =
ls_style-border-color-bottom =
ls_style-border-color-left =
ls_style-border-color-right = '#FF0000' .
ls_style-interior-colorindex = '#FFFFF1'.
ls_style-interior-pattern = 'Gray0625'. "'HorzStripe'.
ls_style-interior-patterncolorindex = '#FF0000'.
APPEND ls_style TO ls_excelmeta-styles.
**** Text with Font 'BOLD' 'ITALIC' 'SINGLE UNDERLINE' AND 'FONT FAMILY "Decorative" '
CLEAR: ls_style.
ls_style-id = 's22'. " Style 2 for text formattign
ls_style-font-family = 'Decorative'.
ls_style-font-fontname = 'Tempus Sans ITC' .
ls_style-font-bold = '1'.
ls_style-font-italic = '1'.
ls_style-font-underline = 'Single' . " 'Double' .
ls_style-font-color = '#00B0F0' .
APPEND ls_style TO ls_excelmeta-styles.
**** Text with Font :- 'ITALIC' 'DOUBLE UNDERLINE' AND 'FONT FAMILY "Decorative" '
CLEAR: ls_style.
ls_style-id = 's23'. " Style 3 for text formattign
ls_style-font-family = 'Decorative'.
ls_style-font-fontname = 'Tempus Sans ITC' .
ls_style-font-italic = '1'.
ls_style-font-underline = 'Double' .
ls_style-font-color = '#7030A0' .
APPEND ls_style TO ls_excelmeta-styles.
**** Text with Font :- 'BOLD' AND 'FONT FAMILY default different font colour '
CLEAR: ls_style.
ls_style-id = 's24'. " Style 3 for text formattign
ls_style-alignment-WrapText = '1' .
ls_style-font-bold = '1'.
ls_style-font-color = '#FA0000' .
APPEND ls_style TO ls_excelmeta-styles.
********************* Border design and formatting
*********************** Border with all DashDotDot and diff col
CLEAR: ls_style.
ls_style-id = 'b21'.
ls_style-border-linestyle-bottom = 'DashDotDot'.
ls_style-border-linestyle-top = 'DashDotDot'.
ls_style-border-linestyle-left = 'DashDotDot'.
ls_style-border-linestyle-right = 'DashDotDot'.
ls_style-border-weight = '2'.
ls_style-border-color-top = '#7030A0' .
ls_style-border-color-bottom = '#7030A0' .
ls_style-border-color-left = '#7030A0' .
ls_style-border-color-right = '#7030A0' .
APPEND ls_style TO ls_excelmeta-styles.
*********************** Border with bottom and right double and top DashDotDot and diff col
CLEAR: ls_style.
ls_style-id = 'b22'.
ls_style-border-linestyle-bottom = 'Double'.
ls_style-border-linestyle-top = 'DashDotDot'.
* ls_style-border-linestyle-left = 'Double'.
ls_style-border-linestyle-right = 'Double'.
ls_style-border-weight = '2'.
ls_style-border-color-top = '#00B0F0' .
ls_style-border-color-bottom = '#00B0F0' .
ls_style-border-color-left = '#00B0F0' .
ls_style-border-color-right = '#00B0F0' .
APPEND ls_style TO ls_excelmeta-styles.
*********************** Border with all DashDot and diff col
CLEAR: ls_style.
ls_style-id = 'b23'.
ls_style-border-linestyle-bottom =
ls_style-border-linestyle-top =
ls_style-border-linestyle-left =
ls_style-border-linestyle-right = 'DashDot'. "'Continuous' . "'SlantDashDot' "'DashDotDot "'Double' "'DashDot' ..
ls_style-border-weight = '2'.
ls_style-border-color-top = '#7030A0' .
ls_style-border-color-bottom = '#7030A0' .
ls_style-border-color-left = '#7030A0' .
ls_style-border-color-right = '#7030A0' .
APPEND ls_style TO ls_excelmeta-styles.
********************** Interior cell formatting
********************** Cell With pattern without colour
CLEAR: ls_style.
ls_style-id = 'I21'.
* ls_style-interior-colorindex = '#FFFFF1'.
ls_style-interior-pattern = 'HorzStripe'.
ls_style-interior-patterncolorindex = '#FF0000'.
APPEND ls_style TO ls_excelmeta-styles.
********************** Cell With pattern without colour
CLEAR: ls_style.
ls_style-id = 'I22'.
* ls_style-interior-colorindex = '#FFFFF1'.
ls_style-interior-pattern = 'ThinHorzCross'.
ls_style-interior-patterncolorindex = '#FF0000'.
APPEND ls_style TO ls_excelmeta-styles.
********************** Cell With pattern with colour
CLEAR: ls_style.
ls_style-id = 'I23'.
ls_style-font-font_size = 24 .
ls_style-interior-colorindex = '#F5909C'.
ls_style-interior-pattern = 'ThinHorzCross'.
ls_style-interior-patterncolorindex = '#7030A0'.
APPEND ls_style TO ls_excelmeta-styles.
CLEAR ls_xls_row.
********************************* Create Header for Excel output **************************************************
ls_xls_cell-type = 'String'.
ls_xls_cell-styleid = 's21'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = 'S21-includes all formatting' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 's22'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = ' ''BOLD'' ''ITALIC'' ''SINGLE UNDERLINE'' AND ''FONT FAMILY "Decorative"'' ' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 's23'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = '''ITALIC'' ''DOUBLE UNDERLINE'' AND ''FONT FAMILY ''Decorative'' ' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 's24'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = '''BOLD'' AND ''FONT FAMILY default different font colour'' ' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_row-rowhight = 100 . " Row 1 Hight will be 100
APPEND ls_xls_row TO li_xls_row.
CLEAR ls_xls_cell-cell_content.
CLEAR ls_xls_row.
ls_xls_cell-type = 'String'.
ls_xls_cell-styleid = 'b21'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = 'Border with all DashDotDot and diff color' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 'b22'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = 'Border with bottom and right double and top DashDotDot and diff col' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 'b23'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-type = 'String'.
ls_xls_cell-cell_content = 'Border with all DashDot and diff col' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 'Default'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-type = 'Number'.
ls_xls_cell-cell_content = '0002345677' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_row-rowhight = 50 .
APPEND ls_xls_row TO li_xls_row.
CLEAR ls_xls_cell-cell_content.
CLEAR ls_xls_row.
ls_xls_cell-type = 'String'.
ls_xls_cell-styleid = 'I21'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = 'Cell With pattern without colour' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 'I22'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-cell_content = 'diff pattern without colour' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 'I23'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-type = 'String'.
ls_xls_cell-cell_content = 'Cell With pattern with colour' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 'I23'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-type = 'Number'.
ls_xls_cell-cell_content = '87656545343' .
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_row-rowhight = 150 .
APPEND ls_xls_row TO li_xls_row.
CLEAR ls_xls_cell-cell_content.
CLEAR ls_xls_row.
ls_column_width-col_index = 2 .
ls_column_width-col_width = 200 .
append ls_column_width to li_column_width .
ls_column_width-col_index = 3 .
ls_column_width-col_width = 400 .
append ls_column_width to li_column_width .
sheets-colwidth = li_column_width .
sheets-sheetx = li_xls_row .
sheets-sheetname = 'Sheet 1' .
translate sheets-sheetname TO UPPER CASE .
APPEND sheets TO it_sheets.
CLEAR sheets.
sheets-sheetx = li_xls_row .
sheets-sheetname = 'Sheet 2' .
translate sheets-sheetname TO UPPER CASE .
APPEND sheets TO it_sheets.
CLEAR sheets.
CALL TRANSFORMATION ZEXCEL_XML_TRANS
SOURCE excelmeta = ls_excelmeta
sheets = it_sheets
RESULT XML lv_xml_string.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_xml_string
TABLES
binary_tab = binary_content.
DATA : filename TYPE string .
CONCATENATE 'C:\TestExcel' '\Excel_sheet_' sy-datum '_' sy-uzeit '.XLS' INTO filename .
CONDENSE filename .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = filename
filetype = 'BIN'
TABLES
data_tab = binary_content .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |