Compare commits

..

No commits in common. "main" and "v7.14.0" have entirely different histories.

410 changed files with 307208 additions and 11859 deletions

View File

@ -1,17 +0,0 @@
name: unit
on:
pull_request:
permissions:
contents: read
jobs:
unit:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- run: npm test

6
.gitignore vendored
View File

@ -1,6 +0,0 @@
node_modules/
package-lock.json
output
foo.zip
foo.xlsx
foo

1
.npmrc
View File

@ -1 +0,0 @@
ignore-scripts=true

View File

@ -1,4 +1,4 @@
Apache License Apache License
Version 2.0, January 2004 Version 2.0, January 2004
http://www.apache.org/licenses/ http://www.apache.org/licenses/
@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright 2010 abap2xlsx Contributors Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,9 +1,6 @@
# abap2xlsx - Read and generate Excel Spreadsheets with ABAP # abap2xlsx - Read and generate Excel Spreadsheets with ABAP
For general information please refer to the blog series [abap2xlsx - Generate your professional Excel spreadsheet from ABAP](http://scn.sap.com/community/abap/blog/2010/07/12/abap2xlsx--generate-your-professional-excel-spreadsheet-from-abap) and the [documentation](https://abap2xlsx.github.io/abap2xlsx/). For general information please refer to the blog series [abap2xlsx - Generate your professional Excel spreadsheet from ABAP](http://scn.sap.com/community/abap/blog/2010/07/12/abap2xlsx--generate-your-professional-excel-spreadsheet-from-abap) and the [documentation](https://sapmentors.github.io/abap2xlsx/).
Please refer to the official wiki for the [abapGit installation guide](https://abap2xlsx.github.io/abap2xlsx/abapGit-installation). Please refer to the official wiki for the [abapGit installation guide](https://sapmentors.github.io/abap2xlsx/abapGit-installation).
Note that the **Demo programs** are provided in a [separate repository](https://github.com/abap2xlsx/demos), and can be installed after abap2xlsx.
For questions, bug reports and more information on contributing to the project, please refer to the [contributing guidelines](./CONTRIBUTING.md). For questions, bug reports and more information on contributing to the project, please refer to the [contributing guidelines](./CONTRIBUTING.md).
Version support: minimum tested version is SAP_ABA 731, it might work on older versions still but we need volunteers to test it.

View File

@ -1,3 +0,0 @@
# Reporting Security Issues
To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/abap2xlsx/abap2xlsx/security/advisories/new) tab.

View File

@ -1,61 +0,0 @@
{
"input_folder": "{src,test}",
"input_filter": [
"src/zcl_excel_a",
"src/zcl_excel_c",
"src/zcl_excel_d",
"src/zcl_excel_fill_template",
"src/zcl_excel_font TODO, missing TDFONTSIZE",
"src/zcl_excel_g",
"src/zcl_excel_h",
"src/zcl_excel_l",
"src/zcl_excel_o",
"src/zcl_excel_r",
"src/zcl_excel_s",
"src/zcl_excel_t",
"src/zcl_excel_w",
"src/zcl_excel.clas",
"src/zcx_",
"src/zexcel_.*doma",
"src/zexcel_.*dtel",
"src/not_cloud/zexcel_.*dtel",
"src/not_cloud/zexcel_.*doma",
"src/zexcel_c",
"src/zexcel_p",
"src/zexcel_s",
"src/zexcel_t",
"src/zif_",
"test/"
],
"output_folder": "output",
"lib": "https://github.com/open-abap/open-abap",
"write_unit_tests": true,
"write_source_map": true,
"options": {
"ignoreSyntaxCheck": false,
"addFilenames": true,
"addCommonJS": true,
"unknownTypes": "runtimeError",
"skip": [
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_number", "note": "SXML in open-abap currently only handles json, todo"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_shared_string", "note": "SXML in open-abap currently only handles json, todo"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_shared_string_missing", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_inline_string", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_empty_cells", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_boolean", "note": "SXML in open-abap currently only handles json, todo"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_style", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_style_missing", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_formula", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_read_shared_strings", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_shared_string_some_empty", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_shared_string_multi_style", "note": "??"},
{"object": "ZCL_EXCEL_READER_HUGE_FILE", "class": "lcl_test", "method": "test_skip_to_inexistent", "note": "??"},
{"object": "ZCL_EXCEL_WRITER_2007", "class": "ltc_column_formula", "method": "one_column_formula", "note": "?? CALL TRANSFORMATION xml_header = 'no'"},
{"object": "ZCL_EXCEL_WRITER_2007", "class": "ltc_column_formula", "method": "two_column_formulas", "note": "??"},
{"object": "ZCL_EXCEL_COMMON", "class": "ltc_utclong_to_excel_string", "method": "simple", "note": "?? missing method CL_ABAP_TSTMP=>UTCLONG2TSTMP_SHORT, I'm too lazy to add it today"},
{"object": "ZCL_EXCEL_COMMON", "class": "lcl_excel_common_test", "method": "convert_column2int_oob_empty", "note": "?? sy value defaults"}
]
}
}

View File

@ -1,11 +0,0 @@
{
"configurations": {
"default": {
"filename": "./abaplint.json"
},
"steampunk": {
"filename": "./abaplint-steampunk.json",
"annotations": false
}
}
}

View File

@ -1,54 +0,0 @@
{
"global": {
"files": "/src/**/*.*",
"noIssues": ["/demos/", "/not_cloud/"]
},
"dependencies": [
{
"url": "https://github.com/abapedia/steampunk-2205-api",
"files": "/src/**/*.*"
}
],
"syntax": {
"version": "Cloud",
"errorNamespace": "."
},
"rules": {
"begin_end_names": {
"severity": "Warning"
},
"check_ddic": {
"severity": "Warning"
},
"check_include": {
"severity": "Warning"
},
"check_syntax": {
"severity": "Warning"
},
"global_class": {
"severity": "Warning"
},
"implement_methods": {
"severity": "Warning"
},
"method_implemented_twice": {
"severity": "Warning"
},
"parser_error": {
"severity": "Warning"
},
"parser_missing_space": {
"severity": "Warning"
},
"superclass_final": {
"severity": "Warning"
},
"unknown_types": {
"severity": "Warning"
},
"xml_consistency": {
"severity": "Warning"
}
}
}

View File

@ -19,27 +19,10 @@
"globalMacros": [] "globalMacros": []
}, },
"rules": { "rules": {
"align_parameters": false,
"cds_legacy_view": true,
"cds_parser_error": true,
"classic_exceptions_overlap": true,
"local_testclass_consistency": true,
"no_aliases": false,
"no_chained_assignment": false,
"unnecessary_pragma": false,
"unnecessary_chaining": false,
"superfluous_value": true,
"static_call_via_instance": false,
"slow_parameter_passing": false,
"prefer_corresponding": true,
"pragma_style": true,
"omit_preceding_zeros": true,
"no_inline_in_optional_branches": false,
"nrob_consistency": true,
"no_external_form_calls": true,
"constant_classes": true, "constant_classes": true,
"cyclic_oo": false, "cyclic_oo": false,
"many_parentheses": true, "many_parentheses": true,
"pragma_placement": true,
"unused_ddic": true, "unused_ddic": true,
"dangerous_statement": true, "dangerous_statement": true,
"db_operation_in_loop": false, "db_operation_in_loop": false,
@ -53,7 +36,7 @@
"prefer_raise_exception_new": true, "prefer_raise_exception_new": true,
"select_add_order_by": false, "select_add_order_by": false,
"select_performance": false, "select_performance": false,
"uncaught_exception": true, "uncaught_exception": false,
"unsecure_fae": false, "unsecure_fae": false,
"use_class_based_exceptions": false, "use_class_based_exceptions": false,
"call_transaction_authority_check": true, "call_transaction_authority_check": true,
@ -94,7 +77,6 @@
"avoid_use": { "avoid_use": {
"define": true, "define": true,
"describeLines": false, "describeLines": false,
"testSeams": true,
"statics": false, "statics": false,
"defaultKey": false, "defaultKey": false,
"break": true "break": true
@ -105,6 +87,7 @@
"check_comments": false, "check_comments": false,
"check_ddic": true, "check_ddic": true,
"check_include": true, "check_include": true,
"check_no_handler_pragma": true,
"check_syntax": true, "check_syntax": true,
"check_text_elements": false, "check_text_elements": false,
"check_transformation_exists": true, "check_transformation_exists": true,
@ -123,22 +106,12 @@
"in_statement_indentation": false, "in_statement_indentation": false,
"indentation": false, "indentation": false,
"keep_single_parameter_on_one_line": false, "keep_single_parameter_on_one_line": false,
"keyword_case": { "keyword_case": false,
"style": "upper",
"ignoreExceptions": true,
"ignoreLowerClassImplmentationStatement": true,
"ignoreGlobalClassDefinition": false,
"ignoreGlobalInterface": false,
"ignoreKeywords": [],
"ignoreGlobalClassBoundaries": false,
"ignoreFunctionModuleName": false
},
"local_class_naming": false, "local_class_naming": false,
"local_testclass_location": true,
"main_file_contents": true, "main_file_contents": true,
"message_exists": false, "message_exists": false,
"msag_consistency": { "msag_consistency": true,
"numericParamters": false
},
"newline_between_methods": false, "newline_between_methods": false,
"no_public_attributes": false, "no_public_attributes": false,
"object_naming": { "object_naming": {
@ -179,10 +152,7 @@
"allowExit": false "allowExit": false
}, },
"line_only_punc": false, "line_only_punc": false,
"obsolete_statement": { "obsolete_statement": false,
"refresh": true,
"move": true
},
"start_at_tab": false, "start_at_tab": false,
"whitespace_end": true, "whitespace_end": true,
"exporting": false, "exporting": false,

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<DEVC DEVCLASS="ZABAP2XLSX" CTEXT="abap2xlsx" LANGUAGE="E" MASTERLANG="E" KORRFLAG="X" PDEVCLASS="ZHVE" DLVUNIT="HOME" NAMESPACE="/0CUST/" PARENTCL="ZT3G_NW_DEV" CREATED_BY="FEMIA" CREATED_ON="20140905" CHANGED_BY="FEMIA" CHANGED_ON="20141226" PROJECT_GUID="00000000000000000000000000000000"/>

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-16"?>
<PROG NAME="ZAKE_SVN_A2X" VARCL="X" SUBC="1" CNAM="FEMIA" CDAT="20100713" UNAM="DEVELOPER" UDAT="20120310" VERN="000020" RSTAT="T" RMAND="000" RLOAD="E" FIXPT="X" SDATE="20120310" STIME="172535" IDATE="20120310" ITIME="172535" UCCHECK="X">
<textPool>
<language SPRAS="E">
<textElement ID="R" ENTRY="Program Z_ZAKE_SVN" LENGTH="18 "/>
</language>
</textPool>
<source>*&amp;---------------------------------------------------------------------*
*&amp; Report Z_ZAKE_SVN
*&amp;
*&amp;---------------------------------------------------------------------*
*&amp; Checkout / Checkin the ZAKE_SVN Project
*&amp;
*&amp;---------------------------------------------------------------------*
REPORT zake_svn_a2x.
CONSTANTS cl_svn TYPE seoclsname VALUE &apos;ZCL_ZAKE_SVN&apos;.
CONSTANTS cl_tortoise_svn TYPE seoclsname VALUE &apos;ZCL_ZAKE_TORTOISE_SVN&apos;.
DATA package TYPE devclass.
DATA zake TYPE REF TO zake.
DATA objects TYPE scts_tadir.
DATA object LIKE LINE OF objects.
DATA files TYPE string_table.
DATA file LIKE LINE OF files.
DATA zake_build TYPE string.
DATA zake_nuggetname TYPE string.
DATA comment_str TYPE string.
DATA loclpath_str TYPE string.
DATA svnpath_str TYPE string.
DATA username_str TYPE string.
DATA password_str TYPE string.
DATA class TYPE seoclsname.
DATA: ex TYPE REF TO zcx_saplink,
message TYPE string.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE a.
PARAMETERS:
checkout TYPE flag RADIOBUTTON GROUP act,
update TYPE flag RADIOBUTTON GROUP act DEFAULT &apos;X&apos;,
install TYPE flag RADIOBUTTON GROUP act,
export TYPE flag RADIOBUTTON GROUP act,
build TYPE flag RADIOBUTTON GROUP act,
checkin TYPE flag RADIOBUTTON GROUP act.
SELECTION-SCREEN END OF BLOCK a.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE b.
PARAMETERS:
svn TYPE flag RADIOBUTTON GROUP cl,
tortoise TYPE flag RADIOBUTTON GROUP cl.
SELECTION-SCREEN END OF BLOCK b.
SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE c.
PARAMETERS:
loclpath TYPE char512 DEFAULT &apos;C:\Projects\abap2xlsx\trunk&apos; LOWER CASE OBLIGATORY,
zakenugg TYPE char512 DEFAULT &apos;C:\Projects\abap2xlsx\nuggs\abap2xlsx_Daily.nugg&apos; LOWER CASE OBLIGATORY,
svnpath TYPE char512 DEFAULT &apos;https://code.sdn.sap.com/svn/abap2xlsx/trunk&apos; LOWER CASE OBLIGATORY,
comment TYPE char512 DEFAULT &apos;&apos; LOWER CASE,
username TYPE char512 LOWER CASE,
password TYPE char512 LOWER CASE,
testrun TYPE flag DEFAULT &apos;X&apos;.
SELECTION-SCREEN END OF BLOCK c.
INITIALIZATION.
a = &apos;Action&apos;.
b = &apos;Version Controll Program&apos;.
c = &apos;Parameters&apos;.
START-OF-SELECTION.
svnpath_str = svnpath.
loclpath_str = loclpath.
zake_nuggetname = zakenugg.
comment_str = comment.
&quot; SELECT * INTO TABLE objects FROM tadir WHERE devclass = &apos;ZABAP2XLSX&apos;.
&quot; DELETE zake_objects WHERE object = &apos;DEVC&apos;.
TRY.
IF svn = &apos;X&apos;.
class = cl_svn.
ELSE.
class = cl_tortoise_svn.
ENDIF.
CREATE OBJECT zake
TYPE
(class)
EXPORTING
i_svnpath = svnpath_str
i_localpath = loclpath_str.
zake-&gt;set_testrun( testrun ).
zake-&gt;set_package( &apos;ZA2X&apos; ).
IF checkout = &apos;X&apos;.
zake-&gt;checkout( ).
ELSEIF update = &apos;X&apos;.
zake-&gt;update( ).
ELSEIF install = &apos;X&apos;.
zake-&gt;install_slinkees_from_lm( testrun ).
&quot; zake-&gt;install_objects( zake_objects ).
ELSEIF export = &apos;X&apos;.
&quot; Build Object list for Export
&quot; Programs
object-object = &apos;PROG&apos;.
object-obj_name = &apos;ZAKE_SVN_A2X&apos;.
APPEND object TO objects.
zake-&gt;set_checkin_objects( objects ).
zake-&gt;download_slinkees_to_lm = abap_true.
zake-&gt;download_nugget_to_lm = space.
zake-&gt;download_zip_to_lm_flag = space.
zake-&gt;create_slinkees( zake_nuggetname ).
ELSEIF build = &apos;X&apos;.
&quot; Build a complete package for download
zake-&gt;set_checkin_objects( objects ).
&quot; We don&apos;t want that for the complete Package Slinkees are created
&quot; in the ZAKE folder
zake-&gt;download_slinkees_to_lm = space.
zake-&gt;download_nugget_to_lm = space.
zake-&gt;create_slinkees( zake_nuggetname ).
ELSEIF checkin = &apos;X&apos;.
zake-&gt;set_package( &apos;ZA2X&apos; ).
zake-&gt;set_checkin_objects( objects ).
zake-&gt;create_slinkees( zake_nuggetname ).
IF testrun IS INITIAL.
zake-&gt;checkin( comment_str ).
ENDIF.
ENDIF.
CATCH zcx_saplink INTO ex.
message = ex-&gt;msg.
WRITE: / &apos;An Error occured: &apos;, message.
ENDTRY.</source>
</PROG>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-16"?>
<PROG NAME="ZDEMO_EXCEL_GAPPS" VARCL="X" SUBC="1" CNAM="IANNACCI" CDAT="20110823" UNAM="FEMIA" UDAT="20110907" VERN="000012" RSTAT="T" RMAND="001" RLOAD="E" FIXPT="X" SDATE="20110907" STIME="221339" IDATE="20110907" ITIME="221339" UCCHECK="X">
<textPool>
<language SPRAS="E">
<textElement ID="R" ENTRY="From abap2xlsx to abap2gapps Demo: Hello World" LENGTH="46 "/>
<textElement ID="S" KEY="P_PATH" ENTRY="D ." LENGTH="9 "/>
</language>
</textPool>
<source>*&amp;---------------------------------------------------------------------*
*&amp; Report ZDEMO_EXCEL1
*&amp;
*&amp;---------------------------------------------------------------------*
*&amp;
*&amp;
*&amp;---------------------------------------------------------------------*
REPORT zdemo_excel_gapps.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zif_excel_writer,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_hyperlink TYPE REF TO zcl_excel_hyperlink,
column_dimension TYPE REF TO zcl_excel_worksheet_columndime.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i.
PARAMETERS: consumer TYPE zoauth2_consumer_name,
username TYPE zoauth2_user_name,
proxyhst TYPE string,
proxysrv TYPE string,
ssl_id TYPE ssfapplssl DEFAULT &apos;ANONYM&apos;.
START-OF-SELECTION.
&quot; Creates active sheet
CREATE OBJECT lo_excel.
&quot; Get active sheet
lo_worksheet = lo_excel-&gt;get_active_worksheet( ).
lo_worksheet-&gt;set_title( ip_title = &apos;Sheet1&apos; ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 2 ip_value = &apos;Hello world&apos; ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 3 ip_value = sy-datum ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 3 ip_value = sy-uzeit ).
lo_hyperlink = zcl_excel_hyperlink=&gt;create_external_link( iv_url = &apos;https://cw.sdn.sap.com/cw/groups/abap2xlsx&apos; ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 4 ip_value = &apos;Click here to visit abap2xlsx homepage&apos; ip_hyperlink = lo_hyperlink ).
column_dimension = lo_worksheet-&gt;get_column_dimension( ip_column = &apos;B&apos; ).
column_dimension-&gt;set_width( ip_width = 11 ).
CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
lv_file = lo_excel_writer-&gt;write_file( lo_excel ).
&quot; Save the file ONLINE
DATA: lo_spreadsheet TYPE REF TO zcl_docs_spreadsheet.
CREATE OBJECT lo_spreadsheet
EXPORTING
i_consumer_name = consumer
i_user_name = username
i_proxy_host = proxyhst
i_proxy_service = proxysrv
i_ssl_id = ssl_id.
lv_bytecount = XSTRLEN( lv_file ).
lo_spreadsheet-&gt;zif_docs~upload( i_document = lv_file
i_title = &apos;demo1froma2xlsx&apos; i_size = lv_bytecount ).</source>
</PROG>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-16"?>
<WDYA APPLICATION_NAME="ZDEMO_EXCEL_WDA01" COMPONENT="ZDEMO_EXCEL_WDA01" STARTUP_VIEW="W_MAIN" STARTUP_PLUG="DEFAULT" DISPLAY_NAME="ZDEMO_EXCEL_WDA01" MSG_DISP_MODE="00" help_desc_txt="">
<wdy_applicationt APPLICATION_NAME="ZDEMO_EXCEL_WDA01" LANGU="E" DESCRIPTION="abap2xlsx Web Dynpro Demo 1"/>
</WDYA>

View File

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-16"?>
<WDYN COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VERSION="I" TYPE="0" CMP_CONTROLLER="COMPONENTCONTROLLER" CMP_INTERFACE="COMPONENTINTERFACE" DISPLAY_NAME="ZDEMO_EXCEL_WDA01" GENDATE="00000000" GENTIME="000000" CONFIG_EXPL_PROP="0" CONFIG_IMPL_PROP="0" P13N_EXPL_PROP="0" P13N_IMPL_PROP="0">
<wdy_componentt COMPONENT_NAME="ZDEMO_EXCEL_WDA01" LANGU="E" DESCRIPTION="abap2xlsx Web Dynpro Demo 1"/>
<view_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" VERSION="I" TYPE="CL_WDY_MD_VIEW" VIEW_TYPE="00" LIFESPAN="0" VIEW_CONTROLLER="V_MAIN" ROOT_UI_CONT="ROOTUIELEMENTCONTAINER" DISPLAY_NAME="V_MAIN" VISIBILITY="00">
<wdy_ui_element COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" ELEMENT_POSITION="1 " UI_ELEMENT_TYPE="CL_WDY_MD_BUTTON" DISPLAY_NAME="BTN_DOWNLOAD" UI_ELEM_DEF_LIB="STANDARD" UI_ELEMENT_DEF="BUTTON" PARENT_NAME="ROOTUIELEMENTCONTAINER" AGGREGATION_NAME="CHILDREN"/>
<wdy_ui_element COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD_LD" VERSION="I" ELEMENT_POSITION="1 " UI_ELEMENT_TYPE="CL_WDY_MD_FLOW_DATA" DISPLAY_NAME="BTN_DOWNLOAD_LD" UI_ELEM_DEF_LIB="STANDARD" UI_ELEMENT_DEF="FLOW_DATA" PARENT_NAME="BTN_DOWNLOAD" AGGREGATION_NAME="LAYOUT_DATA"/>
<wdy_ui_element COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" ELEMENT_POSITION="0 " UI_ELEMENT_TYPE="CL_WDY_MD_TRANSP_CONTAINER" DISPLAY_NAME="ROOTUIELEMENTCONTAINER" UI_ELEM_DEF_LIB="STANDARD" UI_ELEMENT_DEF="TRANSPARENT_CONTAINER"/>
<wdy_ui_element COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER_LAYOUT" VERSION="I" ELEMENT_POSITION="1 " UI_ELEMENT_TYPE="CL_WDY_MD_FLOW_LAYOUT" DISPLAY_NAME="ROOTUIELEMENTCONTAINER_LAYOUT" UI_ELEM_DEF_LIB="STANDARD" UI_ELEMENT_DEF="FLOW_LAYOUT" PARENT_NAME="ROOTUIELEMENTCONTAINER" AGGREGATION_NAME="LAYOUT"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="CONTEXT_MENU_BEHAVIOUR" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="DESIGN" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="ENABLED" PROPERTY_VALUE="X"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="HOTKEY" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="IMAGE_FIRST" PROPERTY_VALUE="X"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="TEXT" PROPERTY_VALUE="0202322174CD1ED1B3F0A0BDD61CD704" PropText="Download"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="TEXT_DIRECTION" PROPERTY_VALUE="02"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="VISIBLE" PROPERTY_VALUE="02"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD_LD" VERSION="I" PROPERTY_NAME="CELL_DESIGN" PROPERTY_VALUE="04"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD_LD" VERSION="I" PROPERTY_NAME="V_GUTTER" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="CONTEXT_MENU_BEHAVIOUR" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="ENABLED" PROPERTY_VALUE="X"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="IS_LAYOUT_CONTAINER" PROPERTY_VALUE="X"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="SCROLLING_MODE" PROPERTY_VALUE="02"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="VISIBLE" PROPERTY_VALUE="02"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER_LAYOUT" VERSION="I" PROPERTY_NAME="WRAPPING" PROPERTY_VALUE="X"/>
<wdy_ui_evt_bind COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" BINDING_NAME="ON_ACTION" VERSION="I" UI_ELEM_EVENT="ON_ACTION" BOUND_ACTION="BTN_DOWNLOAD"/>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" VERSION="I" CONTROLLER_TYPE="01" CONTEXT="CONTEXT" DISPLAY_NAME="V_MAIN">
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="BTN_DOWNLOAD" VERSION="I" CMPTYPE="CL_WDY_MD_ACTION" CMP_POSITION="0 " VISIBILITY="0" DISPLAY_NAME="BTN_DOWNLOAD" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="ONACTIONBTN_DOWNLOAD" VERSION="I" CMPTYPE="CL_WDY_MD_CTLR_EVENT_HANDLER" CMP_POSITION="0 " VISIBILITY="2" REF_CTLR_NAME="V_MAIN" REF_CMPNAME="BTN_DOWNLOAD" DISPLAY_NAME="ONACTIONBTN_DOWNLOAD" CODE_BODY="METHOD onactionbtn_download .
DATA: lo_excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zcl_excel_writer_2007,
lo_worksheet TYPE REF TO zcl_excel_worksheet.
DATA: lv_content TYPE xstring.
CREATE OBJECT lo_excel.
lo_worksheet = lo_excel-&gt;get_active_worksheet( ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos;
ip_row = &apos;2&apos;
ip_value = &apos;Welcome to Web Dynpro and abap2xlsx.&apos; ).
CREATE OBJECT lo_excel_writer.
lv_content = lo_excel_writer-&gt;zif_excel_writer~write_file( lo_excel ).
DATA: lv_filename TYPE string.
lv_filename = &apos;wda01.xlsx&apos;.
CALL METHOD cl_wd_runtime_services=&gt;attach_file_to_response
EXPORTING
i_filename = lv_filename
i_content = lv_content
i_mime_type = &apos;EXCEL&apos;
i_in_new_window = abap_false
i_inplace = abap_false.
ENDMETHOD.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOAFTERACTION" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOAFTERACTION" CODE_BODY="method WDDOAFTERACTION .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOBEFOREACTION" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOBEFOREACTION" CODE_BODY="method WDDOBEFOREACTION .
* data lo_api_controller type ref to if_wd_view_controller.
* data lo_action type ref to if_wd_action.
* lo_api_controller = wd_this-&gt;wd_get_api( ).
* lo_action = lo_api_controller-&gt;get_current_action( ).
* if lo_action is bound.
* case lo_action-&gt;name.
* when &apos;...&apos;.
* endcase.
* endif.
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOEXIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOEXIT" CODE_BODY="method WDDOEXIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOINIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOINIT" CODE_BODY="method WDDOINIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOMODIFYVIEW" CODE_BODY="method WDDOMODIFYVIEW .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOONCONTEXTMENU" CODE_BODY="method WDDOONCONTEXTMENU .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="BTN_DOWNLOAD" LANGU="E" DESCRIPTION="Download Excel file"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="ONACTIONBTN_DOWNLOAD" LANGU="E" DESCRIPTION="Download Excel file"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOAFTERACTION" LANGU="E" DESCRIPTION="Method for non-action specific operations before navigation"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOBEFOREACTION" LANGU="E" DESCRIPTION="Method for Validation of User Input"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" LANGU="E" DESCRIPTION="Method for Modifying the View Before Rendering"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" LANGU="E" DESCRIPTION="Method for Modifying the Context Menu"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" PARAMETER_NAME="FIRST_TIME" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDY_BOOLEAN" DISPLAY_NAME="FIRST_TIME"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" PARAMETER_NAME="VIEW" VERSION="I" PARAM_POSITION="2 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_VIEW" DISPLAY_NAME="VIEW"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="CONTEXT_MENU_EVENT" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_CONTEXT_MENU_EVENT" DISPLAY_NAME="CONTEXT_MENU_EVENT"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="CONTEXT_MENU_MANAGER" VERSION="I" PARAM_POSITION="2 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_CONTEXT_MENU_MANAGER" DISPLAY_NAME="CONTEXT_MENU_MANAGER"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="MENU" VERSION="I" PARAM_POSITION="3 " DECLARATION_TYPE="3" ABAP_TYPING="1" ABAP_TYPE="CL_WD_MENU" DISPLAY_NAME="MENU"/>
<wdy_ctlr_usage COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CTLR_USAGE_NAME="00O2TRN3HOPNY2XMW9ZPOIO72" VERSION="I" USED_CONTROLLER="COMPONENTCONTROLLER"/>
<wdy_ctx_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" NODE_NAME="CONTEXT" VERSION="I" NODE_TYPE="CL_WDY_MD_CONTEXT_VALUE_NODE" NODE_POSITION="0 " COLLECTION_TYPE="03" CARDINALITY="01" SELECTION="01" SINGLETON="X" DISPLAY_NAME="CONTEXT" ABAP_TYPING="0" INIT_LEAD_SELECT="X"/>
</controller_definition>
</view_definition>
<view_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="W_MAIN" VERSION="I" TYPE="CL_WDY_MD_WINDOW" VIEW_TYPE="00" LIFESPAN="0" VIEW_CONTROLLER="W_MAIN" DISPLAY_NAME="W_MAIN" DEF_ROOT_NODE="V_MAIN_USAGE_0" VISIBILITY="00">
<view_window title=""/>
<wdy_iobound_plug COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="W_MAIN" PLUG_NAME="DEFAULT" VERSION="I" PLUG_TYPE="CL_WDY_MD_INBOUND_PLUG" IN_PLUG_TYPE="1" OUT_PLUG_TYPE="0" DISPLAY_NAME="DEFAULT" IS_INTF_ITEM="X"/>
<wdy_vsh_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" WINDOW_NAME="W_MAIN" VSH_NODE_NAME="V_MAIN_USAGE_0" VERSION="I" VSH_NODE_TYPE="CL_WDY_MD_VIEW_USAGE" USED_VIEW="V_MAIN" DISPLAY_NAME="V_MAIN_USAGE_0"/>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" VERSION="I" CONTROLLER_TYPE="06" CONTEXT="CONTEXT" DISPLAY_NAME="W_MAIN">
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="HANDLEDEFAULT" VERSION="I" CMPTYPE="CL_WDY_MD_CTLR_EVENT_HANDLER" CMP_POSITION="1 " VISIBILITY="2" REF_VIEW_NAME="W_MAIN" REF_PLUG_NAME="DEFAULT" DISPLAY_NAME="HANDLEDEFAULT" CODE_BODY="method HANDLEDEFAULT .
endmethod." ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOEXIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOEXIT" CODE_BODY="method WDDOEXIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOINIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOINIT" CODE_BODY="method WDDOINIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONCLOSE" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOONCLOSE" CODE_BODY="method WDDOONCLOSE .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOONOPEN" CODE_BODY="method WDDOONOPEN .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONCLOSE" LANGU="E" DESCRIPTION="Handling For Closing of Window"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" LANGU="E" DESCRIPTION="Handling For Opening of Window"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" PARAMETER_NAME="WINDOW_DESCR" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_WINDOW_DESCRIPTION" DISPLAY_NAME="WINDOW_DESCR"/>
<wdy_ctlr_usage COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CTLR_USAGE_NAME="00O2TRN3HOPNY2XMW9ZPOIHVI" VERSION="I" USED_CONTROLLER="COMPONENTCONTROLLER"/>
<wdy_ctx_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" NODE_NAME="CONTEXT" VERSION="I" NODE_TYPE="CL_WDY_MD_CONTEXT_VALUE_NODE" NODE_POSITION="0 " COLLECTION_TYPE="03" CARDINALITY="01" SELECTION="01" SINGLETON="X" DISPLAY_NAME="CONTEXT" ABAP_TYPING="0" INIT_LEAD_SELECT="X"/>
</controller_definition>
</view_definition>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" VERSION="I" CONTROLLER_TYPE="02" CONTEXT="CONTEXT" DISPLAY_NAME="COMPONENTCONTROLLER" RUNTIME_OBJECT="ZIWCI_DEMO_EXCEL_WDA01">
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOAPPLICATIONSTATECHANGE" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOAPPLICATIONSTATECHANGE" CODE_BODY="method WDDOAPPLICATIONSTATECHANGE .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOBEFORENAVIGATION" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOBEFORENAVIGATION" CODE_BODY="method WDDOBEFORENAVIGATION .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOEXIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOEXIT" CODE_BODY="method WDDOEXIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOINIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOINIT" CODE_BODY="method WDDOINIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOPOSTPROCESSING" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOPOSTPROCESSING" CODE_BODY="method WDDOPOSTPROCESSING .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOAPPLICATIONSTATECHANGE" LANGU="E" DESCRIPTION="Handling for Suspending and Resuming an Application"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOBEFORENAVIGATION" LANGU="E" DESCRIPTION="Error Handling Before Navigation Through Application"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOPOSTPROCESSING" LANGU="E" DESCRIPTION="Prepare Output"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOAPPLICATIONSTATECHANGE" PARAMETER_NAME="STATE_CHANGE" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_APPLICATION_STATE_CHANGE" DISPLAY_NAME="STATE_CHANGE"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOBEFORENAVIGATION" PARAMETER_NAME="IS_CURRENT_ROOT" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDY_BOOLEAN" DISPLAY_NAME="IS_CURRENT_ROOT"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOEXIT" PARAMETER_NAME="REASON" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDR_APPL_EXIT_REASON" DISPLAY_NAME="REASON"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOPOSTPROCESSING" PARAMETER_NAME="IS_CURRENT_ROOT" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDY_BOOLEAN" DISPLAY_NAME="IS_CURRENT_ROOT"/>
<wdy_ctx_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" NODE_NAME="CONTEXT" VERSION="I" NODE_TYPE="CL_WDY_MD_CONTEXT_VALUE_NODE" NODE_POSITION="0 " COLLECTION_TYPE="03" CARDINALITY="01" SELECTION="01" SINGLETON="X" DISPLAY_NAME="CONTEXT" ABAP_TYPING="0" INIT_LEAD_SELECT="X" IS_INTF_ITEM="X"/>
</controller_definition>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="EMPTYVIEW" VERSION="A" CONTROLLER_TYPE="01" DISPLAY_NAME="EMPTYVIEW"/>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" VERSION="A" CONTROLLER_TYPE="01" DISPLAY_NAME="V_MAIN">
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="BTN_DOWNLOAD" LANGU="E" DESCRIPTION="Download Excel file"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="ONACTIONBTN_DOWNLOAD" LANGU="E" DESCRIPTION="Download Excel file"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOAFTERACTION" LANGU="E" DESCRIPTION="Method for non-action specific operations before navigation"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOBEFOREACTION" LANGU="E" DESCRIPTION="Method for Validation of User Input"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" LANGU="E" DESCRIPTION="Method for Modifying the View Before Rendering"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" LANGU="E" DESCRIPTION="Method for Modifying the Context Menu"/>
</controller_definition>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" VERSION="A" CONTROLLER_TYPE="06" DISPLAY_NAME="W_MAIN">
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONCLOSE" LANGU="E" DESCRIPTION="Handling For Closing of Window"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" LANGU="E" DESCRIPTION="Handling For Opening of Window"/>
</controller_definition>
</WDYN>

Binary file not shown.

42337
build/ABAP2XLSX_V_7_0_4.nugg Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

202
build/LICENSE.txt Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Binary file not shown.

BIN
build/Version history.docx Normal file

Binary file not shown.

BIN
build/Version history.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="utf-8"?>
<nugget name="ABAP2XLSX - EXTRA">
<INTF CLSNAME="ZIWCI_DEMO_EXCEL_WDA01" VERSION="1" LANGU="E" DESCRIPT="WebDynpro Interface COMPONENTCONTROLLER" CATEGORY="80" EXPOSURE="2" STATE="1" RELEASE="0" UNICODE="X">
<method CLSNAME="ZIWCI_DEMO_EXCEL_WDA01" CMPNAME="WD_GET_API" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="2 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZIWCI_DEMO_EXCEL_WDA01" CMPNAME="WD_GET_API" SCONAME="RESULT" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="IF_WD_CONTROLLER"/>
</method>
</INTF>
<WDYA APPLICATION_NAME="ZDEMO_EXCEL_WDA01" COMPONENT="ZDEMO_EXCEL_WDA01" STARTUP_VIEW="W_MAIN" STARTUP_PLUG="DEFAULT" DISPLAY_NAME="ZDEMO_EXCEL_WDA01" MSG_DISP_MODE="00" AUTHORITY_CHECK="00" SESSION_KIND="00" help_desc_txt="">
<wdy_applicationt APPLICATION_NAME="ZDEMO_EXCEL_WDA01" LANGU="E" DESCRIPTION="abap2xlsx Web Dynpro Demo 1"/>
</WDYA>
<WDYN COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VERSION="A" TYPE="0" CMP_CONTROLLER="COMPONENTCONTROLLER" CMP_INTERFACE="COMPONENTINTERFACE" DISPLAY_NAME="ZDEMO_EXCEL_WDA01" CONFIG_EXPL_PROP="0" CONFIG_IMPL_PROP="0" P13N_EXPL_PROP="0" P13N_IMPL_PROP="0">
<wdy_componentt COMPONENT_NAME="ZDEMO_EXCEL_WDA01" LANGU="E" DESCRIPTION="abap2xlsx Web Dynpro Demo 1"/>
<view_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" VERSION="A" TYPE="CL_WDY_MD_VIEW" VIEW_TYPE="00" LIFESPAN="0" VIEW_CONTROLLER="V_MAIN" ROOT_UI_CONT="ROOTUIELEMENTCONTAINER" DISPLAY_NAME="V_MAIN" VISIBILITY="00">
<wdy_ui_element COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" ELEMENT_POSITION="1 " UI_ELEMENT_TYPE="CL_WDY_MD_BUTTON" DISPLAY_NAME="BTN_DOWNLOAD" UI_ELEM_DEF_LIB="STANDARD" UI_ELEMENT_DEF="BUTTON" PARENT_NAME="ROOTUIELEMENTCONTAINER" AGGREGATION_NAME="CHILDREN"/>
<wdy_ui_element COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD_LD" VERSION="I" ELEMENT_POSITION="1 " UI_ELEMENT_TYPE="CL_WDY_MD_FLOW_DATA" DISPLAY_NAME="BTN_DOWNLOAD_LD" UI_ELEM_DEF_LIB="STANDARD" UI_ELEMENT_DEF="FLOW_DATA" PARENT_NAME="BTN_DOWNLOAD" AGGREGATION_NAME="LAYOUT_DATA"/>
<wdy_ui_element COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" ELEMENT_POSITION="0 " UI_ELEMENT_TYPE="CL_WDY_MD_TRANSP_CONTAINER" DISPLAY_NAME="ROOTUIELEMENTCONTAINER" UI_ELEM_DEF_LIB="STANDARD" UI_ELEMENT_DEF="TRANSPARENT_CONTAINER"/>
<wdy_ui_element COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER_LAYOUT" VERSION="I" ELEMENT_POSITION="1 " UI_ELEMENT_TYPE="CL_WDY_MD_FLOW_LAYOUT" DISPLAY_NAME="ROOTUIELEMENTCONTAINER_LAYOUT" UI_ELEM_DEF_LIB="STANDARD" UI_ELEMENT_DEF="FLOW_LAYOUT" PARENT_NAME="ROOTUIELEMENTCONTAINER" AGGREGATION_NAME="LAYOUT"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="CONTEXT_MENU_BEHAVIOUR" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="DESIGN" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="ENABLED" PROPERTY_VALUE="X"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="HOTKEY" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="IMAGE_FIRST" PROPERTY_VALUE="X"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="TEXT" PROPERTY_VALUE="0202322174CD1ED1B3F0A0BDD61CD704" PropText="Download"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="TEXT_DIRECTION" PROPERTY_VALUE="02"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" VERSION="I" PROPERTY_NAME="VISIBLE" PROPERTY_VALUE="02"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD_LD" VERSION="I" PROPERTY_NAME="CELL_DESIGN" PROPERTY_VALUE="04"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD_LD" VERSION="I" PROPERTY_NAME="V_GUTTER" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="CONTEXT_MENU_BEHAVIOUR" PROPERTY_VALUE="00"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="ENABLED" PROPERTY_VALUE="X"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="IS_LAYOUT_CONTAINER" PROPERTY_VALUE="X"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="SCROLLING_MODE" PROPERTY_VALUE="02"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER" VERSION="I" PROPERTY_NAME="VISIBLE" PROPERTY_VALUE="02"/>
<wdy_ui_property COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="ROOTUIELEMENTCONTAINER_LAYOUT" VERSION="I" PROPERTY_NAME="WRAPPING" PROPERTY_VALUE="X"/>
<wdy_ui_evt_bind COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="V_MAIN" ELEMENT_NAME="BTN_DOWNLOAD" BINDING_NAME="ON_ACTION" VERSION="I" UI_ELEM_EVENT="ON_ACTION" BOUND_ACTION="BTN_DOWNLOAD"/>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" VERSION="A" CONTROLLER_TYPE="01" CONTEXT="CONTEXT" DISPLAY_NAME="V_MAIN">
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="BTN_DOWNLOAD" VERSION="I" CMPTYPE="CL_WDY_MD_ACTION" CMP_POSITION="0 " VISIBILITY="0" DISPLAY_NAME="BTN_DOWNLOAD" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="ONACTIONBTN_DOWNLOAD" VERSION="I" CMPTYPE="CL_WDY_MD_CTLR_EVENT_HANDLER" CMP_POSITION="0 " VISIBILITY="2" REF_CTLR_NAME="V_MAIN" REF_CMPNAME="BTN_DOWNLOAD" DISPLAY_NAME="ONACTIONBTN_DOWNLOAD" CODE_BODY="METHOD onactionbtn_download .
DATA: lo_excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zcl_excel_writer_2007,
lo_worksheet TYPE REF TO zcl_excel_worksheet.
DATA: lv_content TYPE xstring.
CREATE OBJECT lo_excel.
lo_worksheet = lo_excel-&gt;get_active_worksheet( ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos;
ip_row = &apos;2&apos;
ip_value = &apos;Welcome to Web Dynpro and abap2xlsx.&apos; ).
CREATE OBJECT lo_excel_writer.
lv_content = lo_excel_writer-&gt;zif_excel_writer~write_file( lo_excel ).
DATA: lv_filename TYPE string.
lv_filename = &apos;wda01.xlsx&apos;.
CALL METHOD cl_wd_runtime_services=&gt;attach_file_to_response
EXPORTING
i_filename = lv_filename
i_content = lv_content
i_mime_type = &apos;EXCEL&apos;
i_in_new_window = abap_false
i_inplace = abap_false.
ENDMETHOD.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOAFTERACTION" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOAFTERACTION" CODE_BODY="method WDDOAFTERACTION .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOBEFOREACTION" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOBEFOREACTION" CODE_BODY="method WDDOBEFOREACTION .
* data lo_api_controller type ref to if_wd_view_controller.
* data lo_action type ref to if_wd_action.
* lo_api_controller = wd_this-&gt;wd_get_api( ).
* lo_action = lo_api_controller-&gt;get_current_action( ).
* if lo_action is bound.
* case lo_action-&gt;name.
* when &apos;...&apos;.
* endcase.
* endif.
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOEXIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOEXIT" CODE_BODY="method WDDOEXIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOINIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOINIT" CODE_BODY="method WDDOINIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOMODIFYVIEW" CODE_BODY="method WDDOMODIFYVIEW .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOONCONTEXTMENU" CODE_BODY="method WDDOONCONTEXTMENU .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="BTN_DOWNLOAD" LANGU="E" DESCRIPTION="Download Excel file"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="ONACTIONBTN_DOWNLOAD" LANGU="E" DESCRIPTION="Download Excel file"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOAFTERACTION" LANGU="E" DESCRIPTION="Method for non-action specific operations before navigation"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOBEFOREACTION" LANGU="E" DESCRIPTION="Method for Validation of User Input"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" LANGU="E" DESCRIPTION="Method for Modifying the View Before Rendering"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" LANGU="E" DESCRIPTION="Method for Modifying the Context Menu"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" PARAMETER_NAME="FIRST_TIME" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDY_BOOLEAN" DISPLAY_NAME="FIRST_TIME"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" PARAMETER_NAME="VIEW" VERSION="I" PARAM_POSITION="2 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_VIEW" DISPLAY_NAME="VIEW"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="CONTEXT_MENU_EVENT" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_CONTEXT_MENU_EVENT" DISPLAY_NAME="CONTEXT_MENU_EVENT"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="CONTEXT_MENU_MANAGER" VERSION="I" PARAM_POSITION="2 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_CONTEXT_MENU_MANAGER" DISPLAY_NAME="CONTEXT_MENU_MANAGER"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="MENU" VERSION="I" PARAM_POSITION="3 " DECLARATION_TYPE="3" ABAP_TYPING="1" ABAP_TYPE="CL_WD_MENU" DISPLAY_NAME="MENU"/>
<wdy_ctlr_usage COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CTLR_USAGE_NAME="00O2TRN3HOPNY2XMW9ZPOIO72" VERSION="I" USED_CONTROLLER="COMPONENTCONTROLLER"/>
<wdy_ctx_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" NODE_NAME="CONTEXT" VERSION="I" NODE_TYPE="CL_WDY_MD_CONTEXT_VALUE_NODE" NODE_POSITION="0 " COLLECTION_TYPE="03" CARDINALITY="01" SELECTION="01" SINGLETON="X" DISPLAY_NAME="CONTEXT" ABAP_TYPING="0" INIT_LEAD_SELECT="X"/>
</controller_definition>
</view_definition>
<view_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="W_MAIN" VERSION="A" TYPE="CL_WDY_MD_WINDOW" VIEW_TYPE="00" LIFESPAN="0" VIEW_CONTROLLER="W_MAIN" DISPLAY_NAME="W_MAIN" DEF_ROOT_NODE="V_MAIN_USAGE_0" VISIBILITY="00">
<view_window title=""/>
<wdy_iobound_plug COMPONENT_NAME="ZDEMO_EXCEL_WDA01" VIEW_NAME="W_MAIN" PLUG_NAME="DEFAULT" VERSION="I" PLUG_TYPE="CL_WDY_MD_INBOUND_PLUG" IN_PLUG_TYPE="1" OUT_PLUG_TYPE="0" DISPLAY_NAME="DEFAULT" IS_INTF_ITEM="X"/>
<wdy_vsh_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" WINDOW_NAME="W_MAIN" VSH_NODE_NAME="V_MAIN_USAGE_0" VERSION="I" VSH_NODE_TYPE="CL_WDY_MD_VIEW_USAGE" USED_VIEW="V_MAIN" DISPLAY_NAME="V_MAIN_USAGE_0"/>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" VERSION="A" CONTROLLER_TYPE="06" CONTEXT="CONTEXT" DISPLAY_NAME="W_MAIN">
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="HANDLEDEFAULT" VERSION="I" CMPTYPE="CL_WDY_MD_CTLR_EVENT_HANDLER" CMP_POSITION="1 " VISIBILITY="2" REF_VIEW_NAME="W_MAIN" REF_PLUG_NAME="DEFAULT" DISPLAY_NAME="HANDLEDEFAULT" CODE_BODY="method HANDLEDEFAULT .
endmethod." ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOEXIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOEXIT" CODE_BODY="method WDDOEXIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOINIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOINIT" CODE_BODY="method WDDOINIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONCLOSE" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOONCLOSE" CODE_BODY="method WDDOONCLOSE .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOONOPEN" CODE_BODY="method WDDOONOPEN .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONCLOSE" LANGU="E" DESCRIPTION="Handling For Closing of Window"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" LANGU="E" DESCRIPTION="Handling For Opening of Window"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" PARAMETER_NAME="WINDOW_DESCR" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_WINDOW_DESCRIPTION" DISPLAY_NAME="WINDOW_DESCR"/>
<wdy_ctlr_usage COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CTLR_USAGE_NAME="00O2TRN3HOPNY2XMW9ZPOIHVI" VERSION="I" USED_CONTROLLER="COMPONENTCONTROLLER"/>
<wdy_ctx_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" NODE_NAME="CONTEXT" VERSION="I" NODE_TYPE="CL_WDY_MD_CONTEXT_VALUE_NODE" NODE_POSITION="0 " COLLECTION_TYPE="03" CARDINALITY="01" SELECTION="01" SINGLETON="X" DISPLAY_NAME="CONTEXT" ABAP_TYPING="0" INIT_LEAD_SELECT="X"/>
</controller_definition>
</view_definition>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" VERSION="A" CONTROLLER_TYPE="02" CONTEXT="CONTEXT" DISPLAY_NAME="COMPONENTCONTROLLER" RUNTIME_OBJECT="ZIWCI_DEMO_EXCEL_WDA01">
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOAPPLICATIONSTATECHANGE" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOAPPLICATIONSTATECHANGE" CODE_BODY="method WDDOAPPLICATIONSTATECHANGE .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOBEFORENAVIGATION" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOBEFORENAVIGATION" CODE_BODY="method WDDOBEFORENAVIGATION .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOEXIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOEXIT" CODE_BODY="method WDDOEXIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOINIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOINIT" CODE_BODY="method WDDOINIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOPOSTPROCESSING" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOPOSTPROCESSING" CODE_BODY="method WDDOPOSTPROCESSING .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOAPPLICATIONSTATECHANGE" LANGU="E" DESCRIPTION="Handling for Suspending and Resuming an Application"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOBEFORENAVIGATION" LANGU="E" DESCRIPTION="Error Handling Before Navigation Through Application"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOPOSTPROCESSING" LANGU="E" DESCRIPTION="Prepare Output"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOAPPLICATIONSTATECHANGE" PARAMETER_NAME="STATE_CHANGE" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_APPLICATION_STATE_CHANGE" DISPLAY_NAME="STATE_CHANGE"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOBEFORENAVIGATION" PARAMETER_NAME="IS_CURRENT_ROOT" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDY_BOOLEAN" DISPLAY_NAME="IS_CURRENT_ROOT"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOEXIT" PARAMETER_NAME="REASON" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDR_APPL_EXIT_REASON" DISPLAY_NAME="REASON"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" CMPNAME="WDDOPOSTPROCESSING" PARAMETER_NAME="IS_CURRENT_ROOT" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDY_BOOLEAN" DISPLAY_NAME="IS_CURRENT_ROOT"/>
<wdy_ctx_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="COMPONENTCONTROLLER" NODE_NAME="CONTEXT" VERSION="I" NODE_TYPE="CL_WDY_MD_CONTEXT_VALUE_NODE" NODE_POSITION="0 " COLLECTION_TYPE="03" CARDINALITY="01" SELECTION="01" SINGLETON="X" DISPLAY_NAME="CONTEXT" ABAP_TYPING="0" INIT_LEAD_SELECT="X" IS_INTF_ITEM="X"/>
</controller_definition>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="EMPTYVIEW" VERSION="A" CONTROLLER_TYPE="01" DISPLAY_NAME="EMPTYVIEW"/>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" VERSION="A" CONTROLLER_TYPE="01" CONTEXT="CONTEXT" DISPLAY_NAME="V_MAIN">
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="BTN_DOWNLOAD" VERSION="I" CMPTYPE="CL_WDY_MD_ACTION" CMP_POSITION="0 " VISIBILITY="0" DISPLAY_NAME="BTN_DOWNLOAD" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="ONACTIONBTN_DOWNLOAD" VERSION="I" CMPTYPE="CL_WDY_MD_CTLR_EVENT_HANDLER" CMP_POSITION="0 " VISIBILITY="2" REF_CTLR_NAME="V_MAIN" REF_CMPNAME="BTN_DOWNLOAD" DISPLAY_NAME="ONACTIONBTN_DOWNLOAD" CODE_BODY="METHOD onactionbtn_download .
DATA: lo_excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zcl_excel_writer_2007,
lo_worksheet TYPE REF TO zcl_excel_worksheet.
DATA: lv_content TYPE xstring.
CREATE OBJECT lo_excel.
lo_worksheet = lo_excel-&gt;get_active_worksheet( ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos;
ip_row = &apos;2&apos;
ip_value = &apos;Welcome to Web Dynpro and abap2xlsx.&apos; ).
CREATE OBJECT lo_excel_writer.
lv_content = lo_excel_writer-&gt;zif_excel_writer~write_file( lo_excel ).
DATA: lv_filename TYPE string.
lv_filename = &apos;wda01.xlsx&apos;.
CALL METHOD cl_wd_runtime_services=&gt;attach_file_to_response
EXPORTING
i_filename = lv_filename
i_content = lv_content
i_mime_type = &apos;EXCEL&apos;
i_in_new_window = abap_false
i_inplace = abap_false.
ENDMETHOD.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOAFTERACTION" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOAFTERACTION" CODE_BODY="method WDDOAFTERACTION .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOBEFOREACTION" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOBEFOREACTION" CODE_BODY="method WDDOBEFOREACTION .
* data lo_api_controller type ref to if_wd_view_controller.
* data lo_action type ref to if_wd_action.
* lo_api_controller = wd_this-&gt;wd_get_api( ).
* lo_action = lo_api_controller-&gt;get_current_action( ).
* if lo_action is bound.
* case lo_action-&gt;name.
* when &apos;...&apos;.
* endcase.
* endif.
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOEXIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOEXIT" CODE_BODY="method WDDOEXIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOINIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOINIT" CODE_BODY="method WDDOINIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOMODIFYVIEW" CODE_BODY="method WDDOMODIFYVIEW .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="0 " VISIBILITY="2" DISPLAY_NAME="WDDOONCONTEXTMENU" CODE_BODY="method WDDOONCONTEXTMENU .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="BTN_DOWNLOAD" LANGU="E" DESCRIPTION="Download Excel file"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="ONACTIONBTN_DOWNLOAD" LANGU="E" DESCRIPTION="Download Excel file"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOAFTERACTION" LANGU="E" DESCRIPTION="Method for non-action specific operations before navigation"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOBEFOREACTION" LANGU="E" DESCRIPTION="Method for Validation of User Input"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" LANGU="E" DESCRIPTION="Method for Modifying the View Before Rendering"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" LANGU="E" DESCRIPTION="Method for Modifying the Context Menu"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" PARAMETER_NAME="FIRST_TIME" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="0" ABAP_TYPE="WDY_BOOLEAN" DISPLAY_NAME="FIRST_TIME"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOMODIFYVIEW" PARAMETER_NAME="VIEW" VERSION="I" PARAM_POSITION="2 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_VIEW" DISPLAY_NAME="VIEW"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="CONTEXT_MENU_EVENT" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_CONTEXT_MENU_EVENT" DISPLAY_NAME="CONTEXT_MENU_EVENT"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="CONTEXT_MENU_MANAGER" VERSION="I" PARAM_POSITION="2 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_CONTEXT_MENU_MANAGER" DISPLAY_NAME="CONTEXT_MENU_MANAGER"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CMPNAME="WDDOONCONTEXTMENU" PARAMETER_NAME="MENU" VERSION="I" PARAM_POSITION="3 " DECLARATION_TYPE="3" ABAP_TYPING="1" ABAP_TYPE="CL_WD_MENU" DISPLAY_NAME="MENU"/>
<wdy_ctlr_usage COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" CTLR_USAGE_NAME="00O2TRN3HOPNY2XMW9ZPOIO72" VERSION="I" USED_CONTROLLER="COMPONENTCONTROLLER"/>
<wdy_ctx_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="V_MAIN" NODE_NAME="CONTEXT" VERSION="I" NODE_TYPE="CL_WDY_MD_CONTEXT_VALUE_NODE" NODE_POSITION="0 " COLLECTION_TYPE="03" CARDINALITY="01" SELECTION="01" SINGLETON="X" DISPLAY_NAME="CONTEXT" ABAP_TYPING="0" INIT_LEAD_SELECT="X"/>
</controller_definition>
<controller_definition COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" VERSION="A" CONTROLLER_TYPE="06" CONTEXT="CONTEXT" DISPLAY_NAME="W_MAIN">
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="HANDLEDEFAULT" VERSION="I" CMPTYPE="CL_WDY_MD_CTLR_EVENT_HANDLER" CMP_POSITION="1 " VISIBILITY="2" REF_VIEW_NAME="W_MAIN" REF_PLUG_NAME="DEFAULT" DISPLAY_NAME="HANDLEDEFAULT" CODE_BODY="method HANDLEDEFAULT .
endmethod." ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOEXIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOEXIT" CODE_BODY="method WDDOEXIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOINIT" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOINIT" CODE_BODY="method WDDOINIT .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONCLOSE" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOONCLOSE" CODE_BODY="method WDDOONCLOSE .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compo COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" VERSION="I" CMPTYPE="CL_WDY_MD_CONTROLLER_METHOD" CMP_POSITION="1 " VISIBILITY="2" DISPLAY_NAME="WDDOONOPEN" CODE_BODY="method WDDOONOPEN .
endmethod.
" ACTION_TYPE="0" ABAP_TYPING="0"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOEXIT" LANGU="E" DESCRIPTION="Controller Clean-Up Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOINIT" LANGU="E" DESCRIPTION="Controller Initialization Method"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONCLOSE" LANGU="E" DESCRIPTION="Handling For Closing of Window"/>
<wdy_ctlr_compot COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" LANGU="E" DESCRIPTION="Handling For Opening of Window"/>
<wdy_ctlr_param COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CMPNAME="WDDOONOPEN" PARAMETER_NAME="WINDOW_DESCR" VERSION="I" PARAM_POSITION="1 " DECLARATION_TYPE="0" ABAP_TYPING="1" ABAP_TYPE="IF_WD_WINDOW_DESCRIPTION" DISPLAY_NAME="WINDOW_DESCR"/>
<wdy_ctlr_usage COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" CTLR_USAGE_NAME="00O2TRN3HOPNY2XMW9ZPOIHVI" VERSION="I" USED_CONTROLLER="COMPONENTCONTROLLER"/>
<wdy_ctx_node COMPONENT_NAME="ZDEMO_EXCEL_WDA01" CONTROLLER_NAME="W_MAIN" NODE_NAME="CONTEXT" VERSION="I" NODE_TYPE="CL_WDY_MD_CONTEXT_VALUE_NODE" NODE_POSITION="0 " COLLECTION_TYPE="03" CARDINALITY="01" SELECTION="01" SINGLETON="X" DISPLAY_NAME="CONTEXT" ABAP_TYPING="0" INIT_LEAD_SELECT="X"/>
</controller_definition>
</WDYN>
</nugget>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,7 @@
FEMIA K WIR 1 191 312 0 0 2 0 0 0 330 731 . 0 0 0 0 0 800
#A
#/1/ A G D - R C T - Z RELE EX. _ _ _ _ _ CLI
TIR f 0000 20170516214711 yukon tiradm
TIR e 0000 20170516214720 yukon tiradm
WIR < 0000 20170516214748 yukon tiradm
TIR E 0000 20170516214748 yukon tiradm

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -22,6 +22,11 @@ Implement SAP OSS Notes:
[Note 1385713 - SUBMIT: Allowing parameter of type STRING](https://service.sap.com/sap/support/notes/1385713) [Note 1385713 - SUBMIT: Allowing parameter of type STRING](https://service.sap.com/sap/support/notes/1385713)
* Macro-Enabled workbook
Run report ZDEMO_EXCEL29 and use as VBA source file [TestMacro.xlsm](https://github.com/ivanfemia/abap2xlsx/blob/master/resources/TestMacro.xlsm) attached.
Basically abap2xlsx works using an existing VBA binary (we do not want to create a VBA editor).
* Download XLSX files in Background * Download XLSX files in Background
Run report ZDEMO_EXCEL25. Run report ZDEMO_EXCEL25.

View File

@ -4,12 +4,8 @@
## Procedure ## Procedure
Execute abapGit using the report **ZABAPGIT_STANDALONE**, click on *New Online*, fill the field *Git repository URL* with *https://github.com/abap2xlsx/abap2xlsx.git*, package with *$abap2xlsx* if you just want to test. If you want to transport abap2xlsx to production then use a non local package, for example ZABAP2XLSX. Click *Create package* if the package doesn't exist yet. Then click *Clone online repo*. Execute abapGit using the report **ZABAPGIT_FULL**, click on *New Online*, fill the field *Git repository URL* with *https://github.com/sapmentors/abap2xlsx.git*, package with *$abap2xls* if you just want to test. If you want to transport abap2xlsx to production then use a non local package. Click *Create package* if the package doesn't exist yet. Then click *Clone online repo*
![abapGit New Online Repository](new-online-abap2xlsx.png) ![abapGit New Online Repository](new-online-abap2xlsx.png)
To install abap2xlsx click *pull*. To install abap2xlsx click *pull*.
After installing, if you want to install the **demo programs**, repeat the actions above, starting from *New Online* to *pull*, and fill *Git repository URL* with *https://github.com/abap2xlsx/demos*. We recommend that you pick a local package name for the demos, for example $abap2xlsxdemos, since you most likely won't need them in a production system.
Be careful with the package name for demos: it should NOT be the basename of your abap2xlsx installation followed by "_demos"! If you have ZABAP2XLSX as base package, you may use ZABAP2XLSXDEMOS but not ZABAP2XLSX_DEMOS, for example. Quick background for the curious folks: before demos were spun off as a separate repository, they were placed in the "demos" subpackage of abap2xlsx and, yes, abapGit encodes the package / subpackage relationship with an underscore.

View File

@ -1,6 +1,6 @@
# Naming convention of variables, etc. # Naming convention of variables, etc.
In abap2xlsx, over time, alas, the ABAP code came to mix different [naming standards](https://github.com/abap2xlsx/abap2xlsx/issues/773). Naming standards may vary from one class to another, but one naming standards is usually correctly applied in each class. In abap2xlsx, over time, alas, the ABAP code came to mix different [naming standards](https://github.com/sapmentors/abap2xlsx/issues/773). Naming standards may vary from one class to another, but one naming standards is usually correctly applied in each class.
It's not possible to impose one naming standards by fixing the existing names, because clients may have developed custom programs which may already refer to them. It's not possible to impose one naming standards by fixing the existing names, because clients may have developed custom programs which may already refer to them.
When it's about adding a new variable, parameter or type in an existing object or method, it's embarrassing to impose one naming standards because that could be inconsistent with the variables, parameters or types which already exist at this place. When it's about adding a new variable, parameter or type in an existing object or method, it's embarrassing to impose one naming standards because that could be inconsistent with the variables, parameters or types which already exist at this place.

View File

@ -1,38 +0,0 @@
# Publishing a new release
Let's create a release from time to time, every 1 or 2 months for instance, to contain enough changes, but not too much.
Before beginning, you should ensure that ZDEMO_EXCEL_CHECKER (in the demos repo) shows all green checkmarks.
Below are the notes taken while publishing the release `7.16.0`.
Version numbering is based on [Semantic Versioning 2.0.0](https://semver.org/):
- `7`: a major release. NB: it will probably not change as we don't want to "make incompatible API changes".
- `16`: a minor release
- `0`: patch level (bug fixes)
Working directly on the upstream repository:
- create a branch for this new release; suggested naming for the branch: your own prefix - slash - release - number. For example: abo/release7.16.0 OR sandraros/release7.16.0
- change `version` in `zcl_excel` to indicate the new version number
- push the changes to this new release branch
With GitHub Desktop (or any Git console or Git user interface), [add the (lightweight) tag](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/managing-commits/managing-tags) `v7.16.0` to this branch; suggested naming for version-related tags is v + version number.
Do a pull request.
Wait for approval/commit(s) merged into the master branch.
Now [create the release in GitHub](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release):
- Click "Releases"
- Click "Draft a new release"
- Click "Choose a tag"
- Type the title, select the previous tag, click "Auto-generate release notes" and click "Preview" to verify; you should have a list with the changes from the previous release, edit as required and remember to include the list below as explanation:
- `+`: new feature
- `*`: bug fix
- `!`: feature modification
- `-`: feature removed
- Click "Publish release"
- It's done, zip and tar.gz files are automatically assigned to the release
- The new release appears in the Code home page, with the changelog in the release page itself.
Now create a release for the [demos](https://github.com/abap2xlsx/demos) repository as well: use the same process and tag the latest commit available at the time the main library is released, to ensure users will always have a matching set of demo programs.

View File

@ -7,4 +7,3 @@ This community project allows you to generate Professional Excel spreadsheets di
* [SAPLink](SAPLink-installation) (obsolete) * [SAPLink](SAPLink-installation) (obsolete)
* [F.A.Q.](FAQ) * [F.A.Q.](FAQ)
* [abap2xlsx Calender Gallery](abap2xlsx-Calender-Gallery) * [abap2xlsx Calender Gallery](abap2xlsx-Calender-Gallery)
* [Demos](https://github.com/abap2xlsx/demos)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -1,16 +0,0 @@
{
"license": "MIT",
"private": true,
"scripts": {
"test": "rm -rf output && abap_transpile abap_transpile.json && echo RUNNING && node output/index.mjs"
},
"repository": {
"type": "git",
"url": "git+https://github.com/abap2xlsx/abap2xlsx.git"
},
"devDependencies": {
"@abaplint/cli": "^2.112.10",
"@abaplint/transpiler-cli": "^2.10.9",
"@abaplint/runtime": "^2.10.9"
}
}

BIN
resources/TestMacro.xlsm Normal file

Binary file not shown.

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>Spreadsheet Demo Reports</CTEXT>
</DEVC>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,280 @@
*&---------------------------------------------------------------------*
*& Report ZABAP2XLSX_DEMO_SHOW
*&---------------------------------------------------------------------*
REPORT zabap2xlsx_demo_show.
*----------------------------------------------------------------------*
* CLASS lcl_perform DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_perform DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS: setup_objects,
collect_reports,
handle_nav FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row.
PRIVATE SECTION.
TYPES: BEGIN OF ty_reports,
progname TYPE reposrc-progname,
sort TYPE reposrc-progname,
description TYPE repti,
filename TYPE string,
END OF ty_reports.
CLASS-DATA:
lo_grid TYPE REF TO cl_gui_alv_grid,
lo_text TYPE REF TO cl_gui_textedit,
cl_document TYPE REF TO i_oi_document_proxy,
t_reports TYPE STANDARD TABLE OF ty_reports WITH NON-UNIQUE DEFAULT KEY.
CLASS-DATA:error TYPE REF TO i_oi_error,
t_errors TYPE STANDARD TABLE OF REF TO i_oi_error WITH NON-UNIQUE DEFAULT KEY,
cl_control TYPE REF TO i_oi_container_control. "Office Dokument
ENDCLASS. "lcl_perform DEFINITION
START-OF-SELECTION.
lcl_perform=>collect_reports( ).
lcl_perform=>setup_objects( ).
END-OF-SELECTION.
WRITE '.'. " Force output
*----------------------------------------------------------------------*
* CLASS lcl_perform IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS lcl_perform IMPLEMENTATION.
METHOD setup_objects.
DATA: lo_split TYPE REF TO cl_gui_splitter_container,
lo_container TYPE REF TO cl_gui_container.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_layout TYPE lvc_s_layo,
is_variant TYPE disvariant.
FIELD-SYMBOLS: <fc> LIKE LINE OF it_fieldcat.
CREATE OBJECT lo_split
EXPORTING
parent = cl_gui_container=>screen0
rows = 1
columns = 3
no_autodef_progid_dynnr = 'X'.
lo_split->set_column_width( EXPORTING id = 1
width = 20 ).
lo_split->set_column_width( EXPORTING id = 2
width = 40 ).
* Left: List of reports
lo_container = lo_split->get_container( row = 1
column = 1 ).
CREATE OBJECT lo_grid
EXPORTING
i_parent = lo_container.
SET HANDLER lcl_perform=>handle_nav FOR lo_grid.
is_variant-report = sy-repid.
is_variant-handle = '0001'.
is_layout-cwidth_opt = 'X'.
APPEND INITIAL LINE TO it_fieldcat ASSIGNING <fc>.
<fc>-fieldname = 'PROGNAME'.
<fc>-tabname = 'REPOSRC'.
APPEND INITIAL LINE TO it_fieldcat ASSIGNING <fc>.
<fc>-fieldname = 'SORT'.
<fc>-ref_field = 'PROGNAME'.
<fc>-ref_table = 'REPOSRC'.
<fc>-tech = abap_true. "No need to display this help field
APPEND INITIAL LINE TO it_fieldcat ASSIGNING <fc>.
<fc>-fieldname = 'DESCRIPTION'.
<fc>-ref_field = 'REPTI'.
<fc>-ref_table = 'RS38M'.
lo_grid->set_table_for_first_display( EXPORTING
is_variant = is_variant
i_save = 'A'
is_layout = is_layout
CHANGING
it_outtab = t_reports
it_fieldcatalog = it_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 ).
* Middle: Text with coding
lo_container = lo_split->get_container( row = 1
column = 2 ).
CREATE OBJECT lo_text
EXPORTING
parent = lo_container.
lo_text->set_readonly_mode( cl_gui_textedit=>true ).
lo_text->set_font_fixed( ).
* right: DemoOutput
lo_container = lo_split->get_container( row = 1
column = 3 ).
c_oi_container_control_creator=>get_container_control( IMPORTING control = cl_control
error = error ).
APPEND error TO t_errors.
cl_control->init_control( EXPORTING inplace_enabled = 'X'
no_flush = 'X'
r3_application_name = 'Demo Document Container'
parent = lo_container
IMPORTING error = error
EXCEPTIONS OTHERS = 2 ).
APPEND error TO t_errors.
cl_control->get_document_proxy( EXPORTING document_type = 'Excel.Sheet' " EXCEL
no_flush = ' '
IMPORTING document_proxy = cl_document
error = error ).
APPEND error TO t_errors.
* Errorhandling should be inserted here
ENDMETHOD. "setup_objects
"collect_reports
METHOD collect_reports.
FIELD-SYMBOLS <report> LIKE LINE OF t_reports.
DATA t_source TYPE STANDARD TABLE OF text255 WITH NON-UNIQUE DEFAULT KEY.
DATA texts TYPE STANDARD TABLE OF textpool.
DATA description TYPE textpool.
* Get all demoreports
SELECT progname
INTO CORRESPONDING FIELDS OF TABLE t_reports
FROM reposrc
WHERE progname LIKE 'ZDEMO_EXCEL%'
AND progname <> sy-repid
AND subc = '1'.
LOOP AT t_reports ASSIGNING <report>.
* Check if already switched to new outputoptions
READ REPORT <report>-progname INTO t_source.
IF sy-subrc = 0.
FIND 'INCLUDE zdemo_excel_outputopt_incl.' IN TABLE t_source IGNORING CASE.
ENDIF.
IF sy-subrc <> 0.
DELETE t_reports.
CONTINUE.
ENDIF.
* Build half-numeric sort
<report>-sort = <report>-progname.
REPLACE REGEX '(ZDEMO_EXCEL)(\d\d)\s*$' IN <report>-sort WITH '$1\0$2'. " REPLACE REGEX '(ZDEMO_EXCEL)([^][^])*$' IN <report>-sort WITH '$1$2'.REPLACE REGEX '(ZDEMO_EXCEL)([^][^])*$' IN <report>-sort WITH '$1$2'.REPLACE
REPLACE REGEX '(ZDEMO_EXCEL)(\d)\s*$' IN <report>-sort WITH '$1\0\0$2'.
* get report text
READ TEXTPOOL <report>-progname INTO texts LANGUAGE sy-langu.
READ TABLE texts INTO description WITH KEY id = 'R'.
IF sy-subrc > 0.
"If not available in logon language, use english
READ TEXTPOOL <report>-progname INTO texts LANGUAGE 'E'.
READ TABLE texts INTO description WITH KEY id = 'R'.
ENDIF.
"set report title
<report>-description = description-entry.
ENDLOOP.
SORT t_reports BY sort progname.
ENDMETHOD. "collect_reports
METHOD handle_nav.
CONSTANTS: filename TYPE text80 VALUE 'ZABAP2XLSX_DEMO_SHOW.xlsx'.
DATA: wa_report LIKE LINE OF t_reports,
t_source TYPE STANDARD TABLE OF text255,
t_rawdata TYPE solix_tab,
wa_rawdata LIKE LINE OF t_rawdata,
bytecount TYPE i,
length TYPE i,
add_selopt TYPE flag.
READ TABLE t_reports INTO wa_report INDEX e_row-index.
CHECK sy-subrc = 0.
* Set new text into middle frame
READ REPORT wa_report-progname INTO t_source.
lo_text->set_text_as_r3table( EXPORTING table = t_source ).
* Unload old xls-file
cl_document->close_document( ).
* Get the demo
* If additional parameters found on selection screen, start via selection screen , otherwise start w/o
CLEAR add_selopt.
FIND 'PARAMETERS' IN TABLE t_source.
IF sy-subrc = 0.
add_selopt = 'X'.
ELSE.
FIND 'SELECT-OPTIONS' IN TABLE t_source.
IF sy-subrc = 0.
add_selopt = 'X'.
ENDIF.
ENDIF.
IF add_selopt IS INITIAL.
SUBMIT (wa_report-progname) AND RETURN "#EC CI_SUBMIT
WITH p_backfn = filename
WITH rb_back = 'X'
WITH rb_down = ' '
WITH rb_send = ' '
WITH rb_show = ' '.
ELSE.
SUBMIT (wa_report-progname) VIA SELECTION-SCREEN AND RETURN "#EC CI_SUBMIT
WITH p_backfn = filename
WITH rb_back = 'X'
WITH rb_down = ' '
WITH rb_send = ' '
WITH rb_show = ' '.
ENDIF.
OPEN DATASET filename FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.
DO.
CLEAR wa_rawdata.
READ DATASET filename INTO wa_rawdata LENGTH length.
IF sy-subrc <> 0.
APPEND wa_rawdata TO t_rawdata.
ADD length TO bytecount.
EXIT.
ENDIF.
APPEND wa_rawdata TO t_rawdata.
ADD length TO bytecount.
ENDDO.
CLOSE DATASET filename.
ENDIF.
cl_control->get_document_proxy( EXPORTING document_type = 'Excel.Sheet' " EXCEL
no_flush = ' '
IMPORTING document_proxy = cl_document
error = error ).
cl_document->open_document_from_table( EXPORTING document_size = bytecount
document_table = t_rawdata
open_inplace = 'X' ).
ENDMETHOD. "handle_nav
ENDCLASS. "lcl_perform IMPLEMENTATION

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZABAP2XLSX_DEMO_SHOW</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo Show</ENTRY>
<LENGTH>19</LENGTH>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,756 @@
*&---------------------------------------------------------------------*
*& Report ZANGRY_BIRDS
*& Just for fun
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zangry_birds.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zif_excel_writer,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_border_light TYPE REF TO zcl_excel_style_border,
lo_style_color0 TYPE REF TO zcl_excel_style,
lo_style_color1 TYPE REF TO zcl_excel_style,
lo_style_color2 TYPE REF TO zcl_excel_style,
lo_style_color3 TYPE REF TO zcl_excel_style,
lo_style_color4 TYPE REF TO zcl_excel_style,
lo_style_color5 TYPE REF TO zcl_excel_style,
lo_style_color6 TYPE REF TO zcl_excel_style,
lo_style_color7 TYPE REF TO zcl_excel_style,
lo_style_credit TYPE REF TO zcl_excel_style,
lo_style_link TYPE REF TO zcl_excel_style,
lo_column TYPE REF TO zcl_excel_column,
lo_row TYPE REF TO zcl_excel_row,
lo_hyperlink TYPE REF TO zcl_excel_hyperlink.
DATA: lv_style_color0_guid TYPE zexcel_cell_style,
lv_style_color1_guid TYPE zexcel_cell_style,
lv_style_color2_guid TYPE zexcel_cell_style,
lv_style_color3_guid TYPE zexcel_cell_style,
lv_style_color4_guid TYPE zexcel_cell_style,
lv_style_color5_guid TYPE zexcel_cell_style,
lv_style_color6_guid TYPE zexcel_cell_style,
lv_style_color7_guid TYPE zexcel_cell_style,
lv_style_credit_guid TYPE zexcel_cell_style,
lv_style_link_guid TYPE zexcel_cell_style.
DATA: lv_col_str TYPE zexcel_cell_column_alpha,
lv_row TYPE i,
lv_col TYPE i,
lt_mapper TYPE TABLE OF zexcel_cell_style,
ls_mapper TYPE zexcel_cell_style.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab.
DATA: lv_full_path TYPE string,
lv_workdir TYPE string,
lv_file_separator TYPE c.
CONSTANTS: lv_default_file_name TYPE string VALUE 'angry_birds.xlsx'.
PARAMETERS: p_path TYPE zexcel_export_dir.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
lv_workdir = p_path.
cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
CHANGING selected_folder = lv_workdir ).
p_path = lv_workdir.
INITIALIZATION.
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ).
cl_gui_cfw=>flush( ).
p_path = lv_workdir.
START-OF-SELECTION.
IF p_path IS INITIAL.
p_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path.
" Creates active sheet
CREATE OBJECT lo_excel.
CREATE OBJECT lo_border_light.
lo_border_light->border_color-rgb = zcl_excel_style_color=>c_white.
lo_border_light->border_style = zcl_excel_style_border=>c_border_thin.
" Create color white
lo_style_color0 = lo_excel->add_new_style( ).
lo_style_color0->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_color0->fill->fgcolor-rgb = 'FFFFFFFF'.
lo_style_color0->borders->allborders = lo_border_light.
lv_style_color0_guid = lo_style_color0->get_guid( ).
" Create color black
lo_style_color1 = lo_excel->add_new_style( ).
lo_style_color1->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_color1->fill->fgcolor-rgb = 'FF252525'.
lo_style_color1->borders->allborders = lo_border_light.
lv_style_color1_guid = lo_style_color1->get_guid( ).
" Create color dark green
lo_style_color2 = lo_excel->add_new_style( ).
lo_style_color2->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_color2->fill->fgcolor-rgb = 'FF75913A'.
lo_style_color2->borders->allborders = lo_border_light.
lv_style_color2_guid = lo_style_color2->get_guid( ).
" Create color light green
lo_style_color3 = lo_excel->add_new_style( ).
lo_style_color3->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_color3->fill->fgcolor-rgb = 'FF9DFB73'.
lo_style_color3->borders->allborders = lo_border_light.
lv_style_color3_guid = lo_style_color3->get_guid( ).
" Create color green
lo_style_color4 = lo_excel->add_new_style( ).
lo_style_color4->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_color4->fill->fgcolor-rgb = 'FF92CF56'.
lo_style_color4->borders->allborders = lo_border_light.
lv_style_color4_guid = lo_style_color4->get_guid( ).
" Create color 2dark green
lo_style_color5 = lo_excel->add_new_style( ).
lo_style_color5->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_color5->fill->fgcolor-rgb = 'FF506228'.
lo_style_color5->borders->allborders = lo_border_light.
lv_style_color5_guid = lo_style_color5->get_guid( ).
" Create color yellow
lo_style_color6 = lo_excel->add_new_style( ).
lo_style_color6->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_color6->fill->fgcolor-rgb = 'FFC3E224'.
lo_style_color6->borders->allborders = lo_border_light.
lv_style_color6_guid = lo_style_color6->get_guid( ).
" Create color yellow
lo_style_color7 = lo_excel->add_new_style( ).
lo_style_color7->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_color7->fill->fgcolor-rgb = 'FFB3C14F'.
lo_style_color7->borders->allborders = lo_border_light.
lv_style_color7_guid = lo_style_color7->get_guid( ).
" Credits
lo_style_credit = lo_excel->add_new_style( ).
lo_style_credit->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lo_style_credit->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center.
lo_style_credit->font->size = 20.
lv_style_credit_guid = lo_style_credit->get_guid( ).
" Link
lo_style_link = lo_excel->add_new_style( ).
lo_style_link->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lo_style_link->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center.
* lo_style_link->font->size = 20.
lv_style_link_guid = lo_style_link->get_guid( ).
" Create image map " line 2
DO 30 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 3
DO 28 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 5 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 4
DO 27 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 5
DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 15 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 6
DO 7 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 13 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 7
DO 6 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 5 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 11 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 5 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 8
DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 9
DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 10
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 11
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 7 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 12
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 13
DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 8 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 14
DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 12 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 15
DO 6 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 8 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 16
DO 7 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 7 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 5 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 17
DO 8 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 13 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 18
DO 6 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 23 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 19
DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 27 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 20
DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 23 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 21
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 19 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 22
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 17 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 23
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 17 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 8 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 24
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 25
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 8 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 26
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color6_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 27
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color6_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 28
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color6_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 29
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 30
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 31
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color4_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 32
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 8 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color5_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 33
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 34
DO 3 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 35
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 11 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 36
DO 4 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 11 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 37
DO 5 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color7_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 11 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 38
DO 6 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 10 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 11 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 39
DO 7 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 22 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 1 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 40
DO 7 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 17 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 41
DO 8 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 3 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 15 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 42
DO 9 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 5 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 9 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 2 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 43
DO 11 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 5 TIMES. APPEND lv_style_color3_guid TO lt_mapper. ENDDO.
DO 7 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 44
DO 13 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 6 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
DO 4 TIMES. APPEND lv_style_color2_guid TO lt_mapper. ENDDO.
DO 8 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 45
DO 16 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 13 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" line 46
DO 18 TIMES. APPEND lv_style_color0_guid TO lt_mapper. ENDDO.
DO 8 TIMES. APPEND lv_style_color1_guid TO lt_mapper. ENDDO.
APPEND INITIAL LINE TO lt_mapper. " escape
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( ip_title = 'Angry Birds' ).
lv_row = 1.
lv_col = 1.
LOOP AT lt_mapper INTO ls_mapper.
lv_col_str = zcl_excel_common=>convert_column2alpha( lv_col ).
IF ls_mapper IS INITIAL.
lo_row = lo_worksheet->get_row( ip_row = lv_row ).
lo_row->set_row_height( ip_row_height = 8 ).
lv_col = 1.
lv_row = lv_row + 1.
CONTINUE.
ENDIF.
lo_worksheet->set_cell( ip_column = lv_col_str
ip_row = lv_row
ip_value = space
ip_style = ls_mapper ).
lv_col = lv_col + 1.
lo_column = lo_worksheet->get_column( ip_column = lv_col_str ).
lo_column->set_width( ip_width = 2 ).
ENDLOOP.
lo_worksheet->set_show_gridlines( i_show_gridlines = abap_false ).
lo_worksheet->set_cell( ip_column = 'AP'
ip_row = 15
ip_value = 'Created with abap2xlsx'
ip_style = lv_style_credit_guid ).
lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = 'https://sapmentors.github.io/abap2xlsx' ).
lo_worksheet->set_cell( ip_column = 'AP'
ip_row = 24
ip_value = 'https://sapmentors.github.io/abap2xlsx'
ip_style = lv_style_link_guid
ip_hyperlink = lo_hyperlink ).
lo_column = lo_worksheet->get_column( ip_column = 'AP' ).
lo_column->set_auto_size( ip_auto_size = abap_true ).
lo_worksheet->set_merge( ip_row = 15 ip_column_start = 'AP' ip_row_to = 22 ip_column_end = 'AR' ).
lo_worksheet->set_merge( ip_row = 24 ip_column_start = 'AP' ip_row_to = 26 ip_column_end = 'AR' ).
CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
lv_file = lo_excel_writer->write_file( lo_excel ).
" Convert to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_file
IMPORTING
output_length = lv_bytecount
TABLES
binary_tab = lt_file_tab.
* " This method is only available on AS ABAP > 6.40
* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ).
* lv_bytecount = xstrlen( lv_file ).
" Save the file
cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
filename = lv_full_path
filetype = 'BIN'
CHANGING data_tab = lt_file_tab ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZANGRY_BIRDS</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Styles</ENTRY>
<LENGTH>25</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,383 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_CALENDAR
*& abap2xlsx Demo: Create Calendar with Pictures
*&---------------------------------------------------------------------*
*& This report creates a monthly calendar in the specified date range.
*& Each month is put on a seperate worksheet. The pictures for each
*& month can be specified in a tab delimited UTF-8 encoded file called
*& "Calendar.txt" which is saved in the Export Directory.
*& By default this is the SAP Workdir. The file contains 3 fields:
*&
*& Month (with leading 0)
*& Image Filename
*& Image Description
*& URL for the Description
*&
*& The Images should be landscape JPEG's with a 3:2 ratio and min.
*& 450 pixel height. They must also be saved in the Export Directory.
*& In my tests I've discovered a limit of 20 MB in the
*& cl_gui_frontend_services=>gui_download method. So keep your images
*& smaller or change to a server export using OPEN DATASET.
*&---------------------------------------------------------------------*
REPORT zdemo_calendar.
TYPE-POOLS: abap.
CONSTANTS: gc_save_file_name TYPE string VALUE 'Calendar.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
INCLUDE zdemo_calendar_classes.
DATA: lv_workdir TYPE string.
PARAMETERS: p_from TYPE dfrom,
p_to TYPE dto.
SELECTION-SCREEN BEGIN OF BLOCK orientation WITH FRAME TITLE orient.
PARAMETERS: p_portr TYPE flag RADIOBUTTON GROUP orie,
p_lands TYPE flag RADIOBUTTON GROUP orie DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK orientation.
INITIALIZATION.
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ).
cl_gui_cfw=>flush( ).
p_path = lv_workdir.
orient = 'Orientation'(000).
p_from = |{ sy-datum(4) }0101|.
p_to = |{ sy-datum(4) }1231|.
START-OF-SELECTION.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_column TYPE REF TO zcl_excel_column,
lo_row TYPE REF TO zcl_excel_row,
lo_hyperlink TYPE REF TO zcl_excel_hyperlink,
lo_drawing TYPE REF TO zcl_excel_drawing.
DATA: lo_style_month TYPE REF TO zcl_excel_style,
lv_style_month_guid TYPE zexcel_cell_style.
DATA: lo_style_border TYPE REF TO zcl_excel_style,
lo_border_dark TYPE REF TO zcl_excel_style_border,
lv_style_border_guid TYPE zexcel_cell_style.
DATA: lo_style_center TYPE REF TO zcl_excel_style,
lv_style_center_guid TYPE zexcel_cell_style.
DATA: lv_full_path TYPE string,
image_descr_path TYPE string,
lv_file_separator TYPE c.
DATA: lv_content TYPE xstring,
width TYPE i,
lv_height TYPE i,
lv_from_row TYPE zexcel_cell_row.
DATA: month TYPE i,
month_nr TYPE fcmnr,
count TYPE i VALUE 1,
title TYPE zexcel_sheet_title,
value TYPE string,
image_path TYPE string,
date_from TYPE datum,
date_to TYPE datum,
row TYPE zexcel_cell_row,
to_row TYPE zexcel_cell_row,
to_col TYPE zexcel_cell_column_alpha,
to_col_end TYPE zexcel_cell_column_alpha,
to_col_int TYPE i.
DATA: month_names TYPE TABLE OF t247.
FIELD-SYMBOLS: <month_name> LIKE LINE OF month_names.
TYPES: BEGIN OF tt_datatab,
month_nr TYPE fcmnr,
filename TYPE string,
descr TYPE string,
url TYPE string,
END OF tt_datatab.
DATA: image_descriptions TYPE TABLE OF tt_datatab.
FIELD-SYMBOLS: <img_descr> LIKE LINE OF image_descriptions.
CONSTANTS: lv_default_file_name TYPE string VALUE 'Calendar', "#EC NOTEXT
c_from_row_portrait TYPE zexcel_cell_row VALUE 28,
c_from_row_landscape TYPE zexcel_cell_row VALUE 38,
from_col TYPE zexcel_cell_column_alpha VALUE 'C',
c_height_portrait TYPE i VALUE 450, " Image Height in Portrait Mode
c_height_landscape TYPE i VALUE 670, " Image Height in Landscape Mode
c_factor TYPE f VALUE '1.5'. " Image Ratio, default 3:2
IF p_path IS INITIAL.
p_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
CONCATENATE p_path lv_file_separator lv_default_file_name '.xlsx' INTO lv_full_path. "#EC NOTEXT
" Read Image Names for Month and Description
CONCATENATE p_path lv_file_separator lv_default_file_name '.txt' INTO image_descr_path. "#EC NOTEXT
cl_gui_frontend_services=>gui_upload(
EXPORTING
filename = image_descr_path " Name of file
filetype = 'ASC' " File Type (ASCII, Binary)
has_field_separator = 'X'
read_by_line = 'X' " File Written Line-By-Line to the Internal Table
codepage = '4110'
CHANGING
data_tab = image_descriptions " Transfer table for file contents
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
).
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
" Creates active sheet
CREATE OBJECT lo_excel.
" Create Styles
" Create an underline double style
lo_style_month = lo_excel->add_new_style( ).
" lo_style_month->font->underline = abap_true.
" lo_style_month->font->underline_mode = zcl_excel_style_font=>c_underline_single.
lo_style_month->font->name = zcl_excel_style_font=>c_name_roman.
lo_style_month->font->scheme = zcl_excel_style_font=>c_scheme_none.
lo_style_month->font->family = zcl_excel_style_font=>c_family_roman.
lo_style_month->font->bold = abap_true.
lo_style_month->font->size = 36.
lv_style_month_guid = lo_style_month->get_guid( ).
" Create border object
CREATE OBJECT lo_border_dark.
lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black.
lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin.
"Create style with border
lo_style_border = lo_excel->add_new_style( ).
lo_style_border->borders->allborders = lo_border_dark.
lo_style_border->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_right.
lo_style_border->alignment->vertical = zcl_excel_style_alignment=>c_vertical_top.
lv_style_border_guid = lo_style_border->get_guid( ).
"Create style alignment center
lo_style_center = lo_excel->add_new_style( ).
lo_style_center->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lo_style_center->alignment->vertical = zcl_excel_style_alignment=>c_vertical_top.
lv_style_center_guid = lo_style_center->get_guid( ).
" Get Month Names
CALL FUNCTION 'MONTH_NAMES_GET'
TABLES
month_names = month_names.
zcl_date_calculation=>months_between_two_dates(
EXPORTING
i_date_from = p_from
i_date_to = p_to
i_incl_to = abap_true
IMPORTING
e_month = month
).
date_from = p_from.
WHILE count <= month.
IF count = 1.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
ELSE.
lo_worksheet = lo_excel->add_new_worksheet( ).
ENDIF.
lo_worksheet->zif_excel_sheet_properties~selected = zif_excel_sheet_properties=>c_selected.
title = count.
value = count.
CONDENSE title.
CONDENSE value.
lo_worksheet->set_title( title ).
lo_worksheet->set_print_gridlines( abap_false ).
lo_worksheet->sheet_setup->paper_size = zcl_excel_sheet_setup=>c_papersize_a4.
lo_worksheet->sheet_setup->horizontal_centered = abap_true.
lo_worksheet->sheet_setup->vertical_centered = abap_true.
lo_column = lo_worksheet->get_column( 'A' ).
lo_column->set_width( '1.0' ).
lo_column = lo_worksheet->get_column( 'B' ).
lo_column->set_width( '2.0' ).
IF p_lands = abap_true.
lo_worksheet->sheet_setup->orientation = zcl_excel_sheet_setup=>c_orientation_landscape.
lv_height = c_height_landscape.
lv_from_row = c_from_row_landscape.
lo_worksheet->sheet_setup->margin_top = '0.10'.
lo_worksheet->sheet_setup->margin_left = '0.10'.
lo_worksheet->sheet_setup->margin_right = '0.10'.
lo_worksheet->sheet_setup->margin_bottom = '0.10'.
ELSE.
lo_column = lo_worksheet->get_column( 'K' ).
lo_column->set_width( '3.0' ).
lo_worksheet->sheet_setup->margin_top = '0.80'.
lo_worksheet->sheet_setup->margin_left = '0.55'.
lo_worksheet->sheet_setup->margin_right = '0.05'.
lo_worksheet->sheet_setup->margin_bottom = '0.30'.
lv_height = c_height_portrait.
lv_from_row = c_from_row_portrait.
ENDIF.
" Add Month Name
month_nr = date_from+4(2).
IF p_portr = abap_true.
READ TABLE month_names WITH KEY mnr = month_nr ASSIGNING <month_name>.
CONCATENATE <month_name>-ltx ` ` date_from(4) INTO value.
row = lv_from_row - 2.
to_col = from_col.
ELSE.
row = lv_from_row - 1.
to_col_int = zcl_excel_common=>convert_column2int( from_col ) + 32.
to_col = zcl_excel_common=>convert_column2alpha( to_col_int ).
to_col_int = to_col_int + 1.
to_col_end = zcl_excel_common=>convert_column2alpha( to_col_int ).
CONCATENATE month_nr '/' date_from+2(2) INTO value.
to_row = row + 2.
lo_worksheet->set_merge(
EXPORTING
ip_column_start = to_col " Cell Column Start
ip_column_end = to_col_end " Cell Column End
ip_row = row " Cell Row
ip_row_to = to_row " Cell Row
).
ENDIF.
lo_worksheet->set_cell(
EXPORTING
ip_column = to_col " Cell Column
ip_row = row " Cell Row
ip_value = value " Cell Value
ip_style = lv_style_month_guid
).
* to_col_int = zcl_excel_common=>convert_column2int( from_col ) + 7.
* to_col = zcl_excel_common=>convert_column2alpha( to_col_int ).
*
* lo_worksheet->set_merge(
* EXPORTING
* ip_column_start = from_col " Cell Column Start
* ip_column_end = to_col " Cell Column End
* ip_row = row " Cell Row
* ip_row_to = row " Cell Row
* ).
" Add drawing from a XSTRING read from a file
UNASSIGN <img_descr>.
READ TABLE image_descriptions WITH KEY month_nr = month_nr ASSIGNING <img_descr>.
IF <img_descr> IS ASSIGNED.
value = <img_descr>-descr.
IF p_portr = abap_true.
row = lv_from_row - 3.
ELSE.
row = lv_from_row - 2.
ENDIF.
IF NOT <img_descr>-url IS INITIAL.
lo_hyperlink = zcl_excel_hyperlink=>create_external_link( <img_descr>-url ).
lo_worksheet->set_cell(
EXPORTING
ip_column = from_col " Cell Column
ip_row = row " Cell Row
ip_value = value " Cell Value
ip_hyperlink = lo_hyperlink
).
ELSE.
lo_worksheet->set_cell(
EXPORTING
ip_column = from_col " Cell Column
ip_row = row " Cell Row
ip_value = value " Cell Value
).
ENDIF.
lo_row = lo_worksheet->get_row( row ).
lo_row->set_row_height( '22.0' ).
" In Landscape mode the row between the description and the
" dates should be not so high
IF p_lands = abap_true.
row = lv_from_row - 3.
lo_worksheet->set_cell(
EXPORTING
ip_column = from_col " Cell Column
ip_row = row " Cell Row
ip_value = ' ' " Cell Value
).
lo_row = lo_worksheet->get_row( row ).
lo_row->set_row_height( '7.0' ).
row = lv_from_row - 1.
lo_row = lo_worksheet->get_row( row ).
lo_row->set_row_height( '5.0' ).
ENDIF.
CONCATENATE p_path lv_file_separator <img_descr>-filename INTO image_path.
lo_drawing = lo_excel->add_new_drawing( ).
lo_drawing->set_position( ip_from_row = 1
ip_from_col = 'B' ).
lv_content = zcl_helper=>load_image( image_path ).
width = lv_height * c_factor.
lo_drawing->set_media( ip_media = lv_content
ip_media_type = zcl_excel_drawing=>c_media_type_jpg
ip_width = width
ip_height = lv_height ).
lo_worksheet->add_drawing( lo_drawing ).
ENDIF.
" Add Calendar
* CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
* EXPORTING
* day_in = date_from
* IMPORTING
* last_day_of_month = date_to.
date_to = date_from.
date_to+6(2) = '01'. " First of month
ADD 31 TO date_to. " Somewhere in following month
date_to = date_to - date_to+6(2). " Last of month
IF p_portr = abap_true.
zcl_helper=>add_calendar(
EXPORTING
i_date_from = date_from
i_date_to = date_to
i_from_row = lv_from_row
i_from_col = from_col
i_day_style = lv_style_border_guid
i_cw_style = lv_style_center_guid
CHANGING
c_worksheet = lo_worksheet
).
ELSE.
zcl_helper=>add_calendar_landscape(
EXPORTING
i_date_from = date_from
i_date_to = date_to
i_from_row = lv_from_row
i_from_col = from_col
i_day_style = lv_style_border_guid
i_cw_style = lv_style_center_guid
CHANGING
c_worksheet = lo_worksheet
).
ENDIF.
count = count + 1.
date_from = date_to + 1.
ENDWHILE.
lo_excel->set_active_sheet_index_by_name( '1' ).
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_CALENDAR</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>I</ID>
<KEY>000</KEY>
<ENTRY>Orientation</ENTRY>
<LENGTH>21</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>001</KEY>
<ENTRY>CW</ENTRY>
<LENGTH>12</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>002</KEY>
<ENTRY>Created with abap2xlsx. Find more information at https://github.com/sapmentors/abap2xlsx.</ENTRY>
<LENGTH>132</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Create Calendar with Pictures</ENTRY>
<LENGTH>45</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_FROM</KEY>
<ENTRY>From</ENTRY>
<LENGTH>12</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_LANDS</KEY>
<ENTRY>Landscape</ENTRY>
<LENGTH>17</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>Path</ENTRY>
<LENGTH>12</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PORTR</KEY>
<ENTRY>Portrait</ENTRY>
<LENGTH>16</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_TO</KEY>
<ENTRY>To</ENTRY>
<LENGTH>10</LENGTH>
</item>
</TPOOL>
<I18N_TPOOL>
<item>
<LANGUAGE>D</LANGUAGE>
<TEXTPOOL>
<item>
<ID>I</ID>
<KEY>000</KEY>
<ENTRY>Ausrichtung</ENTRY>
<LENGTH>21</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>001</KEY>
<ENTRY>KW</ENTRY>
<LENGTH>12</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>002</KEY>
<ENTRY>Erzeugt mit abap2xlsx. Weitere Informationen unter https://github.com/sapmentors/abap2xlsx.</ENTRY>
<LENGTH>132</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Erzeugen eines Kalenders mit Bildern</ENTRY>
<LENGTH>70</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_FROM</KEY>
<ENTRY>Von</ENTRY>
<LENGTH>38</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_LANDS</KEY>
<ENTRY>Querformat</ENTRY>
<LENGTH>38</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>Pfad</ENTRY>
<LENGTH>38</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PORTR</KEY>
<ENTRY>Hochformat</ENTRY>
<LENGTH>38</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_TO</KEY>
<ENTRY>Bis</ENTRY>
<LENGTH>38</LENGTH>
</item>
</TEXTPOOL>
</item>
</I18N_TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,476 @@
*&---------------------------------------------------------------------*
*& Include ZDEMO_CALENDAR_CLASSES
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Class ZCL_DATE_CALCULATION
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
CLASS zcl_date_calculation DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: months_between_two_dates
IMPORTING
i_date_from TYPE datum
i_date_to TYPE datum
i_incl_to TYPE flag
EXPORTING
e_month TYPE i.
ENDCLASS. "ZCL_DATE_CALCULATION
*----------------------------------------------------------------------*
* CLASS ZCL_DATE_CALCULATION IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_date_calculation IMPLEMENTATION.
METHOD months_between_two_dates.
DATA: date_to TYPE datum.
DATA: BEGIN OF datum_von,
jjjj(4) TYPE n,
mm(2) TYPE n,
tt(2) TYPE n,
END OF datum_von.
DATA: BEGIN OF datum_bis,
jjjj(4) TYPE n,
mm(2) TYPE n,
tt(2) TYPE n,
END OF datum_bis.
e_month = 0.
CHECK i_date_from IS NOT INITIAL AND i_date_to IS NOT INITIAL.
date_to = i_date_to.
IF i_incl_to = abap_true.
date_to = date_to + 1.
ENDIF.
datum_von = i_date_from.
datum_bis = date_to.
e_month = ( datum_bis-jjjj - datum_von-jjjj ) * 12
+ ( datum_bis-mm - datum_von-mm ).
ENDMETHOD. "MONTHS_BETWEEN_TWO_DATES
ENDCLASS. "ZCL_DATE_CALCULATION IMPLEMENTATION
*----------------------------------------------------------------------*
* CLASS zcl_date_calculation_test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_date_calculation_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS
.
PRIVATE SECTION.
METHODS:
months_between_two_dates FOR TESTING.
ENDCLASS. "zcl_date_calculation_test DEFINITION
*----------------------------------------------------------------------*
* CLASS zcl_date_calculation_test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_date_calculation_test IMPLEMENTATION.
METHOD months_between_two_dates.
DATA: date_from TYPE datum VALUE '20120101',
date_to TYPE datum VALUE '20121231'.
DATA: month TYPE i.
zcl_date_calculation=>months_between_two_dates(
EXPORTING
i_date_from = date_from
i_date_to = date_to
i_incl_to = abap_true
IMPORTING
e_month = month
).
cl_abap_unit_assert=>assert_equals(
exp = 12 " Data Object with Expected Type
act = month " Data Object with Current Value
msg = 'Calculated date is wrong' " Message in Case of Error
).
ENDMETHOD. "months_between_two_dates
ENDCLASS. "zcl_date_calculation_test IMPLEMENTATION
*----------------------------------------------------------------------*
* CLASS zcl_helper DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_helper DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
load_image
IMPORTING
filename TYPE string
RETURNING VALUE(r_image) TYPE xstring,
add_calendar
IMPORTING
i_date_from TYPE datum
i_date_to TYPE datum
i_from_row TYPE zexcel_cell_row
i_from_col TYPE zexcel_cell_column_alpha
i_day_style TYPE zexcel_cell_style
i_cw_style TYPE zexcel_cell_style
CHANGING
c_worksheet TYPE REF TO zcl_excel_worksheet
RAISING
zcx_excel,
add_calendar_landscape
IMPORTING
i_date_from TYPE datum
i_date_to TYPE datum
i_from_row TYPE zexcel_cell_row
i_from_col TYPE zexcel_cell_column_alpha
i_day_style TYPE zexcel_cell_style
i_cw_style TYPE zexcel_cell_style
CHANGING
c_worksheet TYPE REF TO zcl_excel_worksheet
RAISING
zcx_excel,
add_a2x_footer
IMPORTING
i_from_row TYPE zexcel_cell_row
i_from_col TYPE zexcel_cell_column_alpha
CHANGING
c_worksheet TYPE REF TO zcl_excel_worksheet
RAISING
zcx_excel,
add_calender_week
IMPORTING
i_date TYPE datum
i_row TYPE zexcel_cell_row
i_col TYPE zexcel_cell_column_alpha
i_style TYPE zexcel_cell_style
CHANGING
c_worksheet TYPE REF TO zcl_excel_worksheet
RAISING
zcx_excel.
ENDCLASS. "zcl_helper DEFINITION
*----------------------------------------------------------------------*
* CLASS zcl_helper IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_helper IMPLEMENTATION.
METHOD load_image.
"Load samle image
DATA: lt_bin TYPE solix_tab,
lv_len TYPE i.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = filename
filetype = 'BIN'
IMPORTING
filelength = lv_len
CHANGING
data_tab = lt_bin
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = lv_len
IMPORTING
buffer = r_image
TABLES
binary_tab = lt_bin
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMETHOD. "load_image
METHOD add_calendar.
DATA: day_names TYPE TABLE OF t246.
DATA: row TYPE zexcel_cell_row,
row_max TYPE i,
col_int TYPE zexcel_cell_column,
col_max TYPE i,
from_col_int TYPE zexcel_cell_column,
col TYPE zexcel_cell_column_alpha,
lo_column TYPE REF TO zcl_excel_column,
lo_row TYPE REF TO zcl_excel_row.
DATA: lv_date TYPE datum,
value TYPE string,
weekday TYPE wotnr,
weekrow TYPE wotnr VALUE 1,
day TYPE i,
width TYPE f,
height TYPE f.
DATA: hyperlink TYPE REF TO zcl_excel_hyperlink.
FIELD-SYMBOLS: <day_name> LIKE LINE OF day_names.
lv_date = i_date_from.
from_col_int = zcl_excel_common=>convert_column2int( i_from_col ).
" Add description for Calendar Week
c_worksheet->set_cell(
EXPORTING
ip_column = i_from_col " Cell Column
ip_row = i_from_row " Cell Row
ip_value = 'CW'(001) " Cell Value
ip_style = i_cw_style
).
" Add Days
CALL FUNCTION 'DAY_NAMES_GET'
TABLES
day_names = day_names.
LOOP AT day_names ASSIGNING <day_name>.
row = i_from_row.
col_int = from_col_int + <day_name>-wotnr.
col = zcl_excel_common=>convert_column2alpha( col_int ).
value = <day_name>-langt.
c_worksheet->set_cell(
EXPORTING
ip_column = col " Cell Column
ip_row = row " Cell Row
ip_value = value " Cell Value
ip_style = i_cw_style
).
ENDLOOP.
WHILE lv_date <= i_date_to.
day = lv_date+6(2).
CALL FUNCTION 'FIMA_X_DAY_IN_MONTH_COMPUTE'
EXPORTING
i_datum = lv_date
IMPORTING
e_wochentag_nr = weekday.
row = i_from_row + weekrow.
col_int = from_col_int + weekday.
col = zcl_excel_common=>convert_column2alpha( col_int ).
value = day.
CONDENSE value.
c_worksheet->set_cell(
EXPORTING
ip_column = col " Cell Column
ip_row = row " Cell Row
ip_value = value " Cell Value
ip_style = i_day_style " Single-Character Indicator
).
IF weekday = 7.
" Add Calender Week
zcl_helper=>add_calender_week(
EXPORTING
i_date = lv_date
i_row = row
i_col = i_from_col
i_style = i_cw_style
CHANGING
c_worksheet = c_worksheet
).
weekrow = weekrow + 1.
ENDIF.
lv_date = lv_date + 1.
ENDWHILE.
" Add Calender Week
zcl_helper=>add_calender_week(
EXPORTING
i_date = lv_date
i_row = row
i_col = i_from_col
i_style = i_cw_style
CHANGING
c_worksheet = c_worksheet
).
" Add Created with abap2xlsx
row = row + 2.
zcl_helper=>add_a2x_footer(
EXPORTING
i_from_row = row
i_from_col = i_from_col
CHANGING
c_worksheet = c_worksheet
).
col_int = from_col_int.
col_max = from_col_int + 7.
WHILE col_int <= col_max.
col = zcl_excel_common=>convert_column2alpha( col_int ).
IF sy-index = 1.
width = '5.0'.
ELSE.
width = '11.4'.
ENDIF.
lo_column = c_worksheet->get_column( col ).
lo_column->set_width( width ).
col_int = col_int + 1.
ENDWHILE.
row = i_from_row + 1.
row_max = i_from_row + 6.
WHILE row <= row_max.
height = 50.
lo_row = c_worksheet->get_row( row ).
lo_row->set_row_height( height ).
row = row + 1.
ENDWHILE.
ENDMETHOD. "add_calendar
METHOD add_a2x_footer.
DATA: value TYPE string,
hyperlink TYPE REF TO zcl_excel_hyperlink.
value = 'Created with abap2xlsx. Find more information at https://github.com/sapmentors/abap2xlsx.'(002).
hyperlink = zcl_excel_hyperlink=>create_external_link( 'https://github.com/sapmentors/abap2xlsx' ). "#EC NOTEXT
c_worksheet->set_cell(
EXPORTING
ip_column = i_from_col " Cell Column
ip_row = i_from_row " Cell Row
ip_value = value " Cell Value
ip_hyperlink = hyperlink
).
ENDMETHOD. "add_a2x_footer
METHOD add_calendar_landscape.
DATA: day_names TYPE TABLE OF t246.
DATA: lv_date TYPE datum,
day TYPE i,
value TYPE string,
weekday TYPE wotnr.
DATA: row TYPE zexcel_cell_row,
from_col_int TYPE zexcel_cell_column,
col_int TYPE zexcel_cell_column,
col TYPE zexcel_cell_column_alpha.
DATA: lo_column TYPE REF TO zcl_excel_column,
lo_row TYPE REF TO zcl_excel_row.
FIELD-SYMBOLS: <day_name> LIKE LINE OF day_names.
lv_date = i_date_from.
" Add Days
CALL FUNCTION 'DAY_NAMES_GET'
TABLES
day_names = day_names.
WHILE lv_date <= i_date_to.
day = lv_date+6(2).
CALL FUNCTION 'FIMA_X_DAY_IN_MONTH_COMPUTE'
EXPORTING
i_datum = lv_date
IMPORTING
e_wochentag_nr = weekday.
" Day name row
row = i_from_row.
col_int = from_col_int + day + 2.
col = zcl_excel_common=>convert_column2alpha( col_int ).
READ TABLE day_names ASSIGNING <day_name>
WITH KEY wotnr = weekday.
value = <day_name>-kurzt.
c_worksheet->set_cell(
EXPORTING
ip_column = col " Cell Column
ip_row = row " Cell Row
ip_value = value " Cell Value
ip_style = i_cw_style
).
" Day row
row = i_from_row + 1.
value = day.
CONDENSE value.
c_worksheet->set_cell(
EXPORTING
ip_column = col " Cell Column
ip_row = row " Cell Row
ip_value = value " Cell Value
ip_style = i_day_style " Single-Character Indicator
).
" width
lo_column = c_worksheet->get_column( col ).
lo_column->set_width( '3.6' ).
lv_date = lv_date + 1.
ENDWHILE.
" Add ABAP2XLSX Footer
row = i_from_row + 2.
c_worksheet->set_cell(
EXPORTING
ip_column = col " Cell Column
ip_row = row " Cell Row
ip_value = ' ' " Cell Value
).
lo_row = c_worksheet->get_row( row ).
lo_row->set_row_height( '5.0' ).
row = i_from_row + 3.
zcl_helper=>add_a2x_footer(
EXPORTING
i_from_row = row
i_from_col = i_from_col
CHANGING
c_worksheet = c_worksheet
).
" Set with for all 31 coulumns
WHILE day < 32.
day = day + 1.
col_int = from_col_int + day + 2.
col = zcl_excel_common=>convert_column2alpha( col_int ).
" width
lo_column = c_worksheet->get_column( col ).
lo_column->set_width( '3.6' ).
ENDWHILE.
ENDMETHOD. "ADD_CALENDAR_LANDSCAPE
METHOD add_calender_week.
DATA: week TYPE kweek,
week_int TYPE i,
value TYPE string.
" Add Calender Week
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
date = i_date " Date for which the week should be calculated
IMPORTING
week = week. " Week for date (format:YYYYWW)
value = week+4(2).
week_int = value.
value = week_int.
CONDENSE value.
c_worksheet->set_cell(
EXPORTING
ip_column = i_col " Cell Column
ip_row = i_row " Cell Row
ip_value = value " Cell Value
ip_style = i_style
).
ENDMETHOD. "add_calender_week
ENDCLASS. "zcl_helper IMPLEMENTATION

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_CALENDAR_CLASSES</NAME>
<SUBC>I</SUBC>
<RLOAD>E</RLOAD>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>Include ZDEMO_CALENDAR_CLASSES</ENTRY>
<LENGTH>30</LENGTH>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,89 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel.
DATA: lv_workdir TYPE string,
lv_filesep TYPE c LENGTH 1,
lv_upfile TYPE string.
PARAMETERS: p_path TYPE zexcel_export_dir.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
lv_workdir = p_path.
cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
CHANGING selected_folder = lv_workdir ).
p_path = lv_workdir.
INITIALIZATION.
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ).
cl_gui_cfw=>flush( ).
p_path = lv_workdir.
START-OF-SELECTION.
IF p_path IS INITIAL.
p_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_filesep ).
CONCATENATE p_path lv_filesep '01_HelloWorld.xlsx' INTO lv_upfile.
SUBMIT zdemo_excel1 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Hello world
SUBMIT zdemo_excel2 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Styles
SUBMIT zdemo_excel3 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: iTab binding
SUBMIT zdemo_excel4 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Multi sheets, page setup and sheet properties
SUBMIT zdemo_excel5 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Conditional formatting
SUBMIT zdemo_excel6 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Formulas
SUBMIT zdemo_excel7 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Conditional formatting
SUBMIT zdemo_excel8 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Ranges
SUBMIT zdemo_excel9 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Data validation
SUBMIT zdemo_excel10 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Bind table with field catalog
" zdemo_excel11 is not added because it has a selection screen and
" you also need to have business partners maintained in transaction BP
SUBMIT zdemo_excel12 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Column size
SUBMIT zdemo_excel13 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Merge cell
SUBMIT zdemo_excel14 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Alignment
" zdemo_excel15 added at the end
SUBMIT zdemo_excel16 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Drawing
SUBMIT zdemo_excel17 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Lock sheet
SUBMIT zdemo_excel18 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Lock workbook
SUBMIT zdemo_excel19 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Set active sheet
" zdemo_excel20 is not added because it uses ALV and cannot be processed (OLE2)
SUBMIT zdemo_excel21 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Color Picker
SUBMIT zdemo_excel22 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Bind table with field catalog & sheet style
SUBMIT zdemo_excel23 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Multiple sheets with and w/o grid lines, print options
SUBMIT zdemo_excel24 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Multiple sheets with different default date formats
SUBMIT zdemo_excel25 AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Create and xlsx on Application Server (could be executed in batch mode)
" zdemo_excel26 is not added because it uses ALV and cannot be processed (Native)
SUBMIT zdemo_excel27 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Conditional Formatting
SUBMIT zdemo_excel28 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: CSV writer
" SUBMIT zdemo_excel29 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Macro enabled workbook
SUBMIT zdemo_excel30 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: ABAP Cell data types + leading blanks string
SUBMIT zdemo_excel31 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Autosize Column with different Font sizes
" zdemo_excel32 is not added because it uses ALV and cannot be processed (Native)
SUBMIT zdemo_excel33 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Table autofilter
SUBMIT zdemo_excel34 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Static Styles Chess
SUBMIT zdemo_excel35 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Static Styles
SUBMIT zdemo_excel36 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Style applied to sheet, column and single cell
SUBMIT zdemo_excel37 WITH p_upfile = lv_upfile
WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Simplest call of the reader and writer - passthrough data
SUBMIT zdemo_excel38 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Show off integration of drawings ( here using the SAP-Icons )
SUBMIT zdemo_excel39 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Charts
SUBMIT zdemo_excel40 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Demo Printsettings
SUBMIT zdemo_excel41 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Inheritance
SUBMIT zdemo_excel44 WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: No line if empty
SUBMIT zdemo_excel_comments WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Comments
SUBMIT ztest_excel_image_header WITH rb_down = abap_true WITH rb_show = abap_false WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT abap2xlsx Demo: Image in Header and Footer
"
" Reader/Writer Demo must always run at the end
" to make sure all documents where created
"
SUBMIT zdemo_excel15 WITH p_path = p_path AND RETURN. "#EC CI_SUBMIT Read Excel and write it back

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo:</ENTRY>
<LENGTH>15</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>Select output path</ENTRY>
<LENGTH>26</LENGTH>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,61 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel1.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_hyperlink TYPE REF TO zcl_excel_hyperlink,
lo_column TYPE REF TO zcl_excel_column.
CONSTANTS: gc_save_file_name TYPE string VALUE '01_HelloWorld.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
" Creates active sheet
CREATE OBJECT lo_excel.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
* lo_worksheet->set_title( ip_title = 'Sheet1' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = sy-datum ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = sy-uzeit ).
lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = 'https://sapmentors.github.io/abap2xlsx' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 4 ip_value = 'Click here to visit abap2xlsx homepage' ip_hyperlink = lo_hyperlink ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 6 ip_value = '你好,世界' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 6 ip_value = '(Chinese)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 7 ip_value = 'नमस्ते दुनिया' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 7 ip_value = '(Hindi)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Hola Mundo' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 8 ip_value = '(Spanish)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'مرحبا بالعالم' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 9 ip_value = '(Arabic)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 10 ip_value = 'ওহে বিশ্ব ' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 10 ip_value = '(Bengali)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 11 ip_value = 'Bonjour le monde' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 11 ip_value = '(French)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 12 ip_value = 'Olá Mundo' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 12 ip_value = '(Portuguese)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 13 ip_value = 'Привет, мир' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 13 ip_value = '(Russian)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 14 ip_value = 'ہیلو دنیا' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 14 ip_value = '(Urdu)' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 15 ip_value = '👋🌎, 👋🌍, 👋🌏' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 15 ip_value = '(Emoji waving hand + 3 parts of the world)' ).
lo_column = lo_worksheet->get_column( ip_column = 'B' ).
lo_column->set_width( ip_width = 11 ).
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL1</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>RB_BACK</KEY>
<LENGTH>17</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Hello World</ENTRY>
<LENGTH>28</LENGTH>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,95 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL10
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel10.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style_cond TYPE REF TO zcl_excel_style_cond,
lo_column TYPE REF TO zcl_excel_column.
DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog,
ls_table_settings TYPE zexcel_s_table_settings,
ls_iconset TYPE zexcel_conditional_iconset.
CONSTANTS: gc_save_file_name TYPE string VALUE '10_iTabFieldCatalog.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
FIELD-SYMBOLS: <fs_field_catalog> TYPE zexcel_s_fieldcatalog.
" Creates active sheet
CREATE OBJECT lo_excel.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( 'Internal table' ).
ls_iconset-iconset = zcl_excel_style_cond=>c_iconset_5arrows.
ls_iconset-cfvo1_type = zcl_excel_style_cond=>c_cfvo_type_percent.
ls_iconset-cfvo1_value = '0'.
ls_iconset-cfvo2_type = zcl_excel_style_cond=>c_cfvo_type_percent.
ls_iconset-cfvo2_value = '20'.
ls_iconset-cfvo3_type = zcl_excel_style_cond=>c_cfvo_type_percent.
ls_iconset-cfvo3_value = '40'.
ls_iconset-cfvo4_type = zcl_excel_style_cond=>c_cfvo_type_percent.
ls_iconset-cfvo4_value = '60'.
ls_iconset-cfvo5_type = zcl_excel_style_cond=>c_cfvo_type_percent.
ls_iconset-cfvo5_value = '80'.
ls_iconset-showvalue = zcl_excel_style_cond=>c_showvalue_true.
"cond style
lo_style_cond = lo_worksheet->add_new_style_cond( ).
lo_style_cond->rule = zcl_excel_style_cond=>c_rule_iconset.
lo_style_cond->mode_iconset = ls_iconset.
lo_style_cond->priority = 1.
DATA lt_test TYPE TABLE OF sflight.
SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE
lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = lt_test ).
LOOP AT lt_field_catalog ASSIGNING <fs_field_catalog>.
CASE <fs_field_catalog>-fieldname.
WHEN 'CARRID'.
<fs_field_catalog>-position = 3.
<fs_field_catalog>-dynpfld = abap_true.
<fs_field_catalog>-totals_function = zcl_excel_table=>totals_function_count.
WHEN 'CONNID'.
<fs_field_catalog>-position = 4.
<fs_field_catalog>-dynpfld = abap_true.
<fs_field_catalog>-abap_type = cl_abap_typedescr=>typekind_int.
"This avoid the excel warning that the number is formatted as a text: abap2xlsx is not able to recognize numc as a number so it formats the number as a text with
"the related warning. You can force the type and the framework will correctly format the number as a number
WHEN 'FLDATE'.
<fs_field_catalog>-position = 2.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'PRICE'.
<fs_field_catalog>-position = 1.
<fs_field_catalog>-dynpfld = abap_true.
<fs_field_catalog>-totals_function = zcl_excel_table=>totals_function_sum.
<fs_field_catalog>-style_cond = lo_style_cond->get_guid( ).
WHEN OTHERS.
<fs_field_catalog>-dynpfld = abap_false.
ENDCASE.
ENDLOOP.
ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium5.
lo_worksheet->bind_table( ip_table = lt_test
is_table_settings = ls_table_settings
it_field_catalog = lt_field_catalog ).
lo_column = lo_worksheet->get_column( ip_column = 'D' ). "make date field a bit wider
lo_column->set_width( ip_width = 13 ).
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL10</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Format internal table with field catalog</ENTRY>
<LENGTH>57</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,374 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL11
*& Export Organisation and Contact Persons using ABAP2XLSX
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel11.
TYPE-POOLS: abap.
DATA: central_search TYPE bapibus1006_central_search,
addressdata_search TYPE bapibus1006_addr_search,
others_search TYPE bapibus1006_other_data.
DATA: searchresult TYPE TABLE OF bapibus1006_bp_addr,
return TYPE TABLE OF bapiret2.
DATA: lines TYPE i.
FIELD-SYMBOLS: <searchresult_line> LIKE LINE OF searchresult.
DATA: centraldata TYPE bapibus1006_central,
centraldataperson TYPE bapibus1006_central_person,
centraldataorganization TYPE bapibus1006_central_organ.
DATA: addressdata TYPE bapibus1006_address.
DATA: relationships TYPE TABLE OF bapibus1006_relations.
FIELD-SYMBOLS: <relationship> LIKE LINE OF relationships.
DATA: relationship_centraldata TYPE bapibus1006002_central.
DATA: relationship_addresses TYPE TABLE OF bapibus1006002_addresses.
FIELD-SYMBOLS: <relationship_address> LIKE LINE OF relationship_addresses.
DATA: lt_download TYPE TABLE OF zexcel_s_org_rel.
FIELD-SYMBOLS: <download> LIKE LINE OF lt_download.
CONSTANTS: gc_save_file_name TYPE string VALUE '11_Export_Org_and_Contact.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
PARAMETERS: md TYPE flag RADIOBUTTON GROUP act.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE TEXT-00a.
PARAMETERS: partnerc TYPE bu_type DEFAULT 2, " Organizations
postlcod TYPE ad_pstcd1 DEFAULT '8334*',
country TYPE land1 DEFAULT 'DE',
maxsel TYPE bu_maxsel DEFAULT 100.
SELECTION-SCREEN END OF BLOCK a.
PARAMETERS: rel TYPE flag RADIOBUTTON GROUP act DEFAULT 'X'.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE TEXT-00b.
PARAMETERS: reltyp TYPE bu_reltyp DEFAULT 'BUR011',
partner TYPE bu_partner DEFAULT '191'.
SELECTION-SCREEN END OF BLOCK b.
START-OF-SELECTION.
IF md = abap_true.
" Read all Companies by Master Data
central_search-partnercategory = partnerc.
addressdata_search-postl_cod1 = postlcod.
addressdata_search-country = country.
others_search-maxsel = maxsel.
others_search-no_search_for_contactperson = 'X'.
CALL FUNCTION 'BAPI_BUPA_SEARCH_2'
EXPORTING
centraldata = central_search
addressdata = addressdata_search
others = others_search
TABLES
searchresult = searchresult
return = return.
SORT searchresult BY partner.
DELETE ADJACENT DUPLICATES FROM searchresult COMPARING partner.
ELSEIF rel = abap_true.
" Read by Relationship
SELECT but050~partner1 AS partner FROM but050
INNER JOIN but000 ON but000~partner = but050~partner1 AND but000~type = '2'
INTO CORRESPONDING FIELDS OF TABLE searchresult
WHERE but050~partner2 = partner
AND but050~reltyp = reltyp.
ENDIF.
DESCRIBE TABLE searchresult LINES lines.
WRITE: / 'Number of search results: ', lines.
LOOP AT searchresult ASSIGNING <searchresult_line>.
" Read Details of Organization
CALL FUNCTION 'BAPI_BUPA_CENTRAL_GETDETAIL'
EXPORTING
businesspartner = <searchresult_line>-partner
IMPORTING
centraldataorganization = centraldataorganization.
" Read Standard Address of Organization
CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'
EXPORTING
businesspartner = <searchresult_line>-partner
IMPORTING
addressdata = addressdata.
" Add Organization to Download
APPEND INITIAL LINE TO lt_download ASSIGNING <download>.
" Fill Organization Partner Numbers
CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS'
EXPORTING
businesspartner = <searchresult_line>-partner
IMPORTING
businesspartnerout = <download>-org_number
businesspartnerguidout = <download>-org_guid.
MOVE-CORRESPONDING centraldataorganization TO <download>.
MOVE-CORRESPONDING addressdata TO <download>.
CLEAR: addressdata.
" Read all Relationships
CLEAR: relationships.
CALL FUNCTION 'BAPI_BUPA_RELATIONSHIPS_GET'
EXPORTING
businesspartner = <searchresult_line>-partner
TABLES
relationships = relationships.
DELETE relationships WHERE relationshipcategory <> 'BUR001'.
LOOP AT relationships ASSIGNING <relationship>.
" Read details of Contact person
CALL FUNCTION 'BAPI_BUPA_CENTRAL_GETDETAIL'
EXPORTING
businesspartner = <relationship>-partner2
IMPORTING
centraldata = centraldata
centraldataperson = centraldataperson.
" Read details of the Relationship
CALL FUNCTION 'BAPI_BUPR_CONTP_GETDETAIL'
EXPORTING
businesspartner = <relationship>-partner1
contactperson = <relationship>-partner2
IMPORTING
centraldata = relationship_centraldata.
" Read relationship address
CLEAR: relationship_addresses.
CALL FUNCTION 'BAPI_BUPR_CONTP_ADDRESSES_GET'
EXPORTING
businesspartner = <relationship>-partner1
contactperson = <relationship>-partner2
TABLES
addresses = relationship_addresses.
READ TABLE relationship_addresses
ASSIGNING <relationship_address>
WITH KEY standardaddress = 'X'.
IF sy-subrc = 0.
" Read Relationship Address
CLEAR addressdata.
CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'
EXPORTING
businesspartner = <searchresult_line>-partner
addressguid = <relationship_address>-addressguid
IMPORTING
addressdata = addressdata.
APPEND INITIAL LINE TO lt_download ASSIGNING <download>.
CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS'
EXPORTING
businesspartner = <relationship>-partner1
IMPORTING
businesspartnerout = <download>-org_number
businesspartnerguidout = <download>-org_guid.
CALL FUNCTION 'BAPI_BUPA_GET_NUMBERS'
EXPORTING
businesspartner = <relationship>-partner2
IMPORTING
businesspartnerout = <download>-contpers_number
businesspartnerguidout = <download>-contpers_guid.
MOVE-CORRESPONDING centraldataorganization TO <download>.
MOVE-CORRESPONDING addressdata TO <download>.
MOVE-CORRESPONDING centraldataperson TO <download>.
MOVE-CORRESPONDING relationship_centraldata TO <download>.
WRITE: / <relationship>-partner1, <relationship>-partner2.
WRITE: centraldataorganization-name1(20), centraldataorganization-name2(10).
WRITE: centraldataperson-firstname(15), centraldataperson-lastname(15).
WRITE: addressdata-street(25), addressdata-house_no,
addressdata-postl_cod1, addressdata-city(25).
ENDIF.
ENDLOOP.
ENDLOOP.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style_body TYPE REF TO zcl_excel_style,
lo_border_dark TYPE REF TO zcl_excel_style_border,
lo_column TYPE REF TO zcl_excel_column,
lo_row TYPE REF TO zcl_excel_row.
DATA: lv_style_body_even_guid TYPE zexcel_cell_style,
lv_style_body_green TYPE zexcel_cell_style.
DATA: row TYPE zexcel_cell_row.
DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog,
ls_table_settings TYPE zexcel_s_table_settings.
DATA: column TYPE zexcel_cell_column,
column_alpha TYPE zexcel_cell_column_alpha,
value TYPE zexcel_cell_value.
FIELD-SYMBOLS: <fs_field_catalog> TYPE zexcel_s_fieldcatalog.
" Creates active sheet
CREATE OBJECT lo_excel.
" Create border object
CREATE OBJECT lo_border_dark.
lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black.
lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin.
"Create style with border even
lo_style_body = lo_excel->add_new_style( ).
lo_style_body->fill->fgcolor-rgb = zcl_excel_style_color=>c_yellow.
lo_style_body->borders->allborders = lo_border_dark.
lv_style_body_even_guid = lo_style_body->get_guid( ).
"Create style with border and green fill
lo_style_body = lo_excel->add_new_style( ).
lo_style_body->fill->fgcolor-rgb = zcl_excel_style_color=>c_green.
lo_style_body->borders->allborders = lo_border_dark.
lv_style_body_green = lo_style_body->get_guid( ).
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( 'Internal table' ).
lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = lt_download ).
LOOP AT lt_field_catalog ASSIGNING <fs_field_catalog>.
CASE <fs_field_catalog>-fieldname.
WHEN 'ORG_NUMBER'.
<fs_field_catalog>-position = 1.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'CONTPERS_NUMBER'.
<fs_field_catalog>-position = 2.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'NAME1'.
<fs_field_catalog>-position = 3.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'NAME2'.
<fs_field_catalog>-position = 4.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'STREET'.
<fs_field_catalog>-position = 5.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'HOUSE_NO'.
<fs_field_catalog>-position = 6.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'POSTL_COD1'.
<fs_field_catalog>-position = 7.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'CITY'.
<fs_field_catalog>-position = 8.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'COUNTRYISO'.
<fs_field_catalog>-position = 9.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'FIRSTNAME'.
<fs_field_catalog>-position = 10.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'LASTNAME'.
<fs_field_catalog>-position = 11.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'FUNCTIONNAME'.
<fs_field_catalog>-position = 12.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'DEPARTMENTNAME'.
<fs_field_catalog>-position = 13.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'TEL1_NUMBR'.
<fs_field_catalog>-position = 14.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'TEL1_EXT'.
<fs_field_catalog>-position = 15.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'FAX_NUMBER'.
<fs_field_catalog>-position = 16.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'FAX_EXTENS'.
<fs_field_catalog>-position = 17.
<fs_field_catalog>-dynpfld = abap_true.
WHEN 'E_MAIL'.
<fs_field_catalog>-position = 18.
<fs_field_catalog>-dynpfld = abap_true.
WHEN OTHERS.
<fs_field_catalog>-dynpfld = abap_false.
ENDCASE.
ENDLOOP.
ls_table_settings-top_left_column = 'A'.
ls_table_settings-top_left_row = '2'.
ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium5.
lo_worksheet->bind_table( ip_table = lt_download
is_table_settings = ls_table_settings
it_field_catalog = lt_field_catalog ).
LOOP AT lt_download ASSIGNING <download>.
row = sy-tabix + 2.
IF NOT <download>-org_number IS INITIAL
AND <download>-contpers_number IS INITIAL.
" Mark fields of Organization which can be changed green
lo_worksheet->set_cell_style(
ip_column = 'C'
ip_row = row
ip_style = lv_style_body_green
).
lo_worksheet->set_cell_style(
ip_column = 'D'
ip_row = row
ip_style = lv_style_body_green
).
* CATCH zcx_excel. " Exceptions for ABAP2XLSX
ELSEIF NOT <download>-org_number IS INITIAL
AND NOT <download>-contpers_number IS INITIAL.
" Mark fields of Relationship which can be changed green
lo_worksheet->set_cell_style(
ip_column = 'L' ip_row = row ip_style = lv_style_body_green
).
lo_worksheet->set_cell_style(
ip_column = 'M' ip_row = row ip_style = lv_style_body_green
).
lo_worksheet->set_cell_style(
ip_column = 'N' ip_row = row ip_style = lv_style_body_green
).
lo_worksheet->set_cell_style(
ip_column = 'O' ip_row = row ip_style = lv_style_body_green
).
lo_worksheet->set_cell_style(
ip_column = 'P' ip_row = row ip_style = lv_style_body_green
).
lo_worksheet->set_cell_style(
ip_column = 'Q' ip_row = row ip_style = lv_style_body_green
).
lo_worksheet->set_cell_style(
ip_column = 'R' ip_row = row ip_style = lv_style_body_green
).
ENDIF.
ENDLOOP.
" Add Fieldnames in first row and hide the row
LOOP AT lt_field_catalog ASSIGNING <fs_field_catalog>
WHERE position <> '' AND dynpfld = abap_true.
column = <fs_field_catalog>-position.
column_alpha = zcl_excel_common=>convert_column2alpha( column ).
value = <fs_field_catalog>-fieldname.
lo_worksheet->set_cell( ip_column = column_alpha
ip_row = 1
ip_value = value
ip_style = lv_style_body_even_guid ).
ENDLOOP.
" Hide first row
lo_row = lo_worksheet->get_row( 1 ).
lo_row->set_visible( abap_false ).
DATA: highest_column TYPE zexcel_cell_column,
count TYPE int4,
col_alpha TYPE zexcel_cell_column_alpha.
highest_column = lo_worksheet->get_highest_column( ).
count = 1.
WHILE count <= highest_column.
col_alpha = zcl_excel_common=>convert_column2alpha( ip_column = count ).
lo_column = lo_worksheet->get_column( ip_column = col_alpha ).
lo_column->set_auto_size( ip_auto_size = abap_true ).
count = count + 1.
ENDWHILE.
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL11</NAME>
<SUBC>1</SUBC>
<RSTAT>K</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>I</ID>
<KEY>00A</KEY>
<ENTRY>Select by master data</ENTRY>
<LENGTH>132</LENGTH>
</item>
<item>
<ID>I</ID>
<KEY>00B</KEY>
<ENTRY>Select by relationship</ENTRY>
<LENGTH>132</LENGTH>
</item>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Export Organisation and Contact Persons</ENTRY>
<LENGTH>55</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>COUNTRY</KEY>
<ENTRY>.</ENTRY>
<LENGTH>19</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>MAXSEL</KEY>
<ENTRY>.</ENTRY>
<LENGTH>27</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>MD</KEY>
<ENTRY>Select by master data</ENTRY>
<LENGTH>29</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>PARTNER</KEY>
<ENTRY>.</ENTRY>
<LENGTH>24</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>PARTNERC</KEY>
<ENTRY>.</ENTRY>
<LENGTH>19</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>POSTLCOD</KEY>
<ENTRY>.</ENTRY>
<LENGTH>19</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>21</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>REL</KEY>
<ENTRY>Select by relationship</ENTRY>
<LENGTH>30</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>RELTYP</KEY>
<ENTRY>.</ENTRY>
<LENGTH>25</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,108 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL12
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel12.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_column TYPE REF TO zcl_excel_column,
lo_row TYPE REF TO zcl_excel_row.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab.
DATA: lv_full_path TYPE string,
lv_workdir TYPE string,
lv_file_separator TYPE c.
CONSTANTS: gc_save_file_name TYPE string VALUE '12_HideSizeOutlineRowsAndColumns.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
" Creates active sheet
CREATE OBJECT lo_excel.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( 'Sheet1' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world in AutoSize column' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Hello world in a column width size 50' ).
lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = 'Hello world (hidden column)' ).
lo_worksheet->set_cell( ip_column = 'F' ip_row = 2 ip_value = 'Outline column level 0' ).
lo_worksheet->set_cell( ip_column = 'G' ip_row = 2 ip_value = 'Outline column level 1' ).
lo_worksheet->set_cell( ip_column = 'H' ip_row = 2 ip_value = 'Outline column level 2' ).
lo_worksheet->set_cell( ip_column = 'I' ip_row = 2 ip_value = 'Small' ).
lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = 'Hello world (hidden row)' ).
lo_worksheet->set_cell( ip_column = 'E' ip_row = 5 ip_value = 'Hello world in a row height size 20' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'Simple outline rows 10-16 ( collapsed )' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 19 ip_value = '3 Outlines - Outlinelevel 1 is collapsed' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 19 ip_value = 'One of the two inner outlines is expanded, one collapsed' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 20 ip_value = 'Inner outline level - expanded' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 24 ip_value = 'Inner outline level - lines 25-28 are collapsed' ).
lo_worksheet->zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_off. " By default is on
lo_worksheet->zif_excel_sheet_properties~summaryright = zif_excel_sheet_properties=>c_right_off. " By default is on
" Column Settings
" Auto size
lo_column = lo_worksheet->get_column( ip_column = 'B' ).
lo_column->set_auto_size( ip_auto_size = abap_true ).
lo_column = lo_worksheet->get_column( ip_column = 'I' ).
lo_column->set_auto_size( ip_auto_size = abap_true ).
" Manual Width
lo_column = lo_worksheet->get_column( ip_column = 'C' ).
lo_column->set_width( ip_width = 50 ).
lo_column = lo_worksheet->get_column( ip_column = 'D' ).
lo_column->set_visible( ip_visible = abap_false ).
" Implementation in the Writer is not working yet ===== TODO =====
lo_column = lo_worksheet->get_column( ip_column = 'F' ).
lo_column->set_outline_level( ip_outline_level = 0 ).
lo_column = lo_worksheet->get_column( ip_column = 'G' ).
lo_column->set_outline_level( ip_outline_level = 1 ).
lo_column = lo_worksheet->get_column( ip_column = 'H' ).
lo_column->set_outline_level( ip_outline_level = 2 ).
lo_row = lo_worksheet->get_row( ip_row = 1 ).
lo_row->set_visible( ip_visible = abap_false ).
lo_row = lo_worksheet->get_row( ip_row = 5 ).
lo_row->set_row_height( ip_row_height = 20 ).
* Define an outline rows 10-16, collapsed on startup
lo_worksheet->set_row_outline( iv_row_from = 10
iv_row_to = 16
iv_collapsed = abap_true ). " collapsed
* Define an inner outline rows 21-22, expanded when outer outline becomes extended
lo_worksheet->set_row_outline( iv_row_from = 21
iv_row_to = 22
iv_collapsed = abap_false ). " expanded
* Define an inner outline rows 25-28, collapsed on startup
lo_worksheet->set_row_outline( iv_row_from = 25
iv_row_to = 28
iv_collapsed = abap_true ). " collapsed
* Define an outer outline rows 20-30, collapsed on startup
lo_worksheet->set_row_outline( iv_row_from = 20
iv_row_to = 30
iv_collapsed = abap_true ). " collapsed
* Hint: the order you create the outlines can be arbitrary
* You can start with inner outlines or with outer outlines
*--------------------------------------------------------------------*
* Hide columns right of column M
*--------------------------------------------------------------------*
lo_worksheet->zif_excel_sheet_properties~hide_columns_from = 'M'.
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL12</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Hide Columns</ENTRY>
<LENGTH>29</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,89 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL13
*&
*&---------------------------------------------------------------------*
*& Example by: Alvaro "Blag" Tejada Galindo.
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel13.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lv_style_bold_border_guid TYPE zexcel_cell_style,
lo_style_bold_border TYPE REF TO zcl_excel_style,
lo_border_dark TYPE REF TO zcl_excel_style_border.
CONSTANTS: gc_save_file_name TYPE string VALUE '13_MergedCells.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
CREATE OBJECT lo_excel.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( 'sheet1' ).
CREATE OBJECT lo_border_dark.
lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black.
lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin.
lo_style_bold_border = lo_excel->add_new_style( ).
lo_style_bold_border->font->bold = abap_true.
lo_style_bold_border->font->italic = abap_false.
lo_style_bold_border->font->color-rgb = zcl_excel_style_color=>c_black.
lo_style_bold_border->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lo_style_bold_border->borders->allborders = lo_border_dark.
lv_style_bold_border_guid = lo_style_bold_border->get_guid( ).
lo_worksheet->set_cell( ip_row = 2 ip_column = 'A' ip_value = 'Test' ).
lo_worksheet->set_cell( ip_row = 2 ip_column = 'B' ip_value = 'Banana' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 2 ip_column = 'C' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 2 ip_column = 'D' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 2 ip_column = 'E' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 2 ip_column = 'F' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 2 ip_column = 'G' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 4 ip_column = 'B' ip_value = 'Apple' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 4 ip_column = 'D' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 4 ip_column = 'E' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 4 ip_column = 'F' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 4 ip_column = 'G' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_merge( ip_row = 4 ip_column_start = 'B' ip_column_end = 'G' ).
" Test also if merge works when oher merged chells are empty
lo_worksheet->set_cell( ip_row = 6 ip_column = 'B' ip_value = 'Tomato' ).
lo_worksheet->set_merge( ip_row = 6 ip_column_start = 'B' ip_column_end = 'G' ).
" Test the patch provided by Victor Alekhin to merge cells in one column
lo_worksheet->set_cell( ip_row = 8 ip_column = 'B' ip_value = 'Merge cells also over multiple rows by Victor Alekhin' ).
lo_worksheet->set_merge( ip_row = 8 ip_column_start = 'B' ip_column_end = 'G' ip_row_to = 10 ).
" Test the patch provided by Alexander Budeyev with different column merges
lo_worksheet->set_cell( ip_row = 12 ip_column = 'B' ip_value = 'Merge cells with different merges by Alexander Budeyev' ).
lo_worksheet->set_cell( ip_row = 13 ip_column = 'B' ip_value = 'Test' ).
lo_worksheet->set_cell( ip_row = 13 ip_column = 'D' ip_value = 'Banana' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 14 ip_column = 'D' ip_value = '' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 13 ip_column = 'E' ip_value = 'Apple' ip_style = lv_style_bold_border_guid ).
lo_worksheet->set_cell( ip_row = 13 ip_column = 'F' ip_value = '' ip_style = lv_style_bold_border_guid ).
" Test merge (issue)
lo_worksheet->set_merge( ip_row = 13 ip_column_start = 'B' ip_column_end = 'C' ip_row_to = 15 ).
lo_worksheet->set_merge( ip_row = 13 ip_column_start = 'D' ip_column_end = 'D' ip_row_to = 14 ).
lo_worksheet->set_merge( ip_row = 13 ip_column_start = 'E' ip_column_end = 'F' ).
" Test area with merge
lo_worksheet->set_area( ip_row = 18 ip_row_to = 19 ip_column_start = 'B' ip_column_end = 'G' ip_style = lv_style_bold_border_guid
ip_value = 'Merge cells with new area method by Helmut Bohr ' ip_merge = abap_true ).
" Test area without merge
lo_worksheet->set_area( ip_row = 21 ip_row_to = 22 ip_column_start = 'B' ip_column_end = 'G' ip_style = lv_style_bold_border_guid
ip_value = 'Test area' ).
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL13</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Merge cells</ENTRY>
<LENGTH>28</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,160 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL14
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel14.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style_center TYPE REF TO zcl_excel_style,
lo_style_right TYPE REF TO zcl_excel_style,
lo_style_left TYPE REF TO zcl_excel_style,
lo_style_general TYPE REF TO zcl_excel_style,
lo_style_bottom TYPE REF TO zcl_excel_style,
lo_style_middle TYPE REF TO zcl_excel_style,
lo_style_top TYPE REF TO zcl_excel_style,
lo_style_justify TYPE REF TO zcl_excel_style,
lo_style_mixed TYPE REF TO zcl_excel_style,
lo_style_mixed_wrap TYPE REF TO zcl_excel_style,
lo_style_rotated TYPE REF TO zcl_excel_style,
lo_style_shrink TYPE REF TO zcl_excel_style,
lo_style_indent TYPE REF TO zcl_excel_style,
lv_style_center_guid TYPE zexcel_cell_style,
lv_style_right_guid TYPE zexcel_cell_style,
lv_style_left_guid TYPE zexcel_cell_style,
lv_style_general_guid TYPE zexcel_cell_style,
lv_style_bottom_guid TYPE zexcel_cell_style,
lv_style_middle_guid TYPE zexcel_cell_style,
lv_style_top_guid TYPE zexcel_cell_style,
lv_style_justify_guid TYPE zexcel_cell_style,
lv_style_mixed_guid TYPE zexcel_cell_style,
lv_style_mixed_wrap_guid TYPE zexcel_cell_style,
lv_style_rotated_guid TYPE zexcel_cell_style,
lv_style_shrink_guid TYPE zexcel_cell_style,
lv_style_indent_guid TYPE zexcel_cell_style.
DATA: lo_row TYPE REF TO zcl_excel_row.
CONSTANTS: gc_save_file_name TYPE string VALUE '14_Alignment.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
CREATE OBJECT lo_excel.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( 'sheet1' ).
"Center
lo_style_center = lo_excel->add_new_style( ).
lo_style_center->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lv_style_center_guid = lo_style_center->get_guid( ).
"Right
lo_style_right = lo_excel->add_new_style( ).
lo_style_right->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_right.
lv_style_right_guid = lo_style_right->get_guid( ).
"Left
lo_style_left = lo_excel->add_new_style( ).
lo_style_left->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_left.
lv_style_left_guid = lo_style_left->get_guid( ).
"General
lo_style_general = lo_excel->add_new_style( ).
lo_style_general->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_general.
lv_style_general_guid = lo_style_general->get_guid( ).
"Bottom
lo_style_bottom = lo_excel->add_new_style( ).
lo_style_bottom->alignment->vertical = zcl_excel_style_alignment=>c_vertical_bottom.
lv_style_bottom_guid = lo_style_bottom->get_guid( ).
"Middle
lo_style_middle = lo_excel->add_new_style( ).
lo_style_middle->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center.
lv_style_middle_guid = lo_style_middle->get_guid( ).
"Top
lo_style_top = lo_excel->add_new_style( ).
lo_style_top->alignment->vertical = zcl_excel_style_alignment=>c_vertical_top.
lv_style_top_guid = lo_style_top->get_guid( ).
"Justify
lo_style_justify = lo_excel->add_new_style( ).
lo_style_justify->alignment->vertical = zcl_excel_style_alignment=>c_vertical_justify.
lv_style_justify_guid = lo_style_justify->get_guid( ).
"Shrink
lo_style_shrink = lo_excel->add_new_style( ).
lo_style_shrink->alignment->shrinktofit = abap_true.
lv_style_shrink_guid = lo_style_shrink->get_guid( ).
"Indent
lo_style_indent = lo_excel->add_new_style( ).
lo_style_indent->alignment->indent = 5.
lv_style_indent_guid = lo_style_indent->get_guid( ).
"Middle / Centered / Wrap
lo_style_mixed_wrap = lo_excel->add_new_style( ).
lo_style_mixed_wrap->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lo_style_mixed_wrap->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center.
lo_style_mixed_wrap->alignment->wraptext = abap_true.
lv_style_mixed_wrap_guid = lo_style_mixed_wrap->get_guid( ).
"Middle / Centered / Wrap
lo_style_mixed = lo_excel->add_new_style( ).
lo_style_mixed->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lo_style_mixed->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center.
lv_style_mixed_guid = lo_style_mixed->get_guid( ).
"Center
lo_style_rotated = lo_excel->add_new_style( ).
lo_style_rotated->alignment->horizontal = zcl_excel_style_alignment=>c_horizontal_center.
lo_style_rotated->alignment->vertical = zcl_excel_style_alignment=>c_vertical_center.
lo_style_rotated->alignment->textrotation = 165. " -75ð == 90ð + 75ð
lv_style_rotated_guid = lo_style_rotated->get_guid( ).
" Set row size for first 7 rows to 40
DO 7 TIMES.
lo_row = lo_worksheet->get_row( sy-index ).
lo_row->set_row_height( 40 ).
ENDDO.
"Horizontal alignment
lo_worksheet->set_cell( ip_row = 4 ip_column = 'B' ip_value = 'Centered Text' ip_style = lv_style_center_guid ).
lo_worksheet->set_cell( ip_row = 5 ip_column = 'B' ip_value = 'Right Text' ip_style = lv_style_right_guid ).
lo_worksheet->set_cell( ip_row = 6 ip_column = 'B' ip_value = 'Left Text' ip_style = lv_style_left_guid ).
lo_worksheet->set_cell( ip_row = 7 ip_column = 'B' ip_value = 'General Text' ip_style = lv_style_general_guid ).
" Shrink & indent
lo_worksheet->set_cell( ip_row = 4 ip_column = 'F' ip_value = 'Text shrinked' ip_style = lv_style_shrink_guid ).
lo_worksheet->set_cell( ip_row = 5 ip_column = 'F' ip_value = 'Text indented' ip_style = lv_style_indent_guid ).
"Vertical alignment
lo_worksheet->set_cell( ip_row = 4 ip_column = 'D' ip_value = 'Bottom Text' ip_style = lv_style_bottom_guid ).
lo_worksheet->set_cell( ip_row = 5 ip_column = 'D' ip_value = 'Middle Text' ip_style = lv_style_middle_guid ).
lo_worksheet->set_cell( ip_row = 6 ip_column = 'D' ip_value = 'Top Text' ip_style = lv_style_top_guid ).
lo_worksheet->set_cell( ip_row = 7 ip_column = 'D' ip_value = 'Justify Text' ip_style = lv_style_justify_guid ).
" Wrapped
lo_worksheet->set_cell( ip_row = 10 ip_column = 'B'
ip_value = 'This is a wrapped text centered in the middle'
ip_style = lv_style_mixed_wrap_guid ).
" Rotated
lo_worksheet->set_cell( ip_row = 10 ip_column = 'D'
ip_value = 'This is a centered text rotated by -75ð'
ip_style = lv_style_rotated_guid ).
" forced line break
DATA: lv_value TYPE string.
CONCATENATE 'This is a wrapped text centered in the middle' cl_abap_char_utilities=>cr_lf
'and a manuall line break.' INTO lv_value.
lo_worksheet->set_cell( ip_row = 11 ip_column = 'B'
ip_value = lv_value
ip_style = lv_style_mixed_guid ).
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL14</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Alignment</ENTRY>
<LENGTH>26</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,168 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL15
*&
*&---------------------------------------------------------------------*
*& 2010-10-30, Gregor Wolf:
*& Added the functionality to ouput the read table content
*& 2011-12-19, Shahrin Shahrulzaman:
*& Added the functionality to have multiple input and output files
*&---------------------------------------------------------------------*
REPORT zdemo_excel15.
TYPE-POOLS: abap.
TYPES:
BEGIN OF t_demo_excel15,
input TYPE string,
END OF t_demo_excel15.
CONSTANTS: sheet_with_date_formats TYPE string VALUE '24_Sheets_with_different_default_date_formats.xlsx'.
DATA: excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zif_excel_writer,
reader TYPE REF TO zif_excel_reader.
DATA: ex TYPE REF TO zcx_excel,
msg TYPE string.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab.
DATA: lv_workdir TYPE string,
output_file_path TYPE string,
input_file_path TYPE string,
lv_file_separator TYPE c.
DATA: worksheet TYPE REF TO zcl_excel_worksheet,
highest_column TYPE zexcel_cell_column,
highest_row TYPE int4,
column TYPE zexcel_cell_column VALUE 1,
col_str TYPE zexcel_cell_column_alpha,
row TYPE int4 VALUE 1,
value TYPE zexcel_cell_value,
converted_date TYPE d.
DATA:
lt_files TYPE TABLE OF t_demo_excel15.
FIELD-SYMBOLS: <wa_files> TYPE t_demo_excel15.
PARAMETERS: p_path TYPE zexcel_export_dir,
p_noout TYPE abap_bool DEFAULT abap_true.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
lv_workdir = p_path.
cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
CHANGING selected_folder = lv_workdir ).
p_path = lv_workdir.
INITIALIZATION.
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ).
cl_gui_cfw=>flush( ).
p_path = lv_workdir.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '01_HelloWorld.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '02_Styles.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '03_iTab.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '04_Sheets.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '05_Conditional.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '07_ConditionalAll.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '08_Range.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '13_MergedCells.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = sheet_with_date_formats.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '31_AutosizeWithDifferentFontSizes.xlsx'.
START-OF-SELECTION.
IF p_path IS INITIAL.
p_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
LOOP AT lt_files ASSIGNING <wa_files>.
CONCATENATE p_path lv_file_separator <wa_files>-input INTO input_file_path.
CONCATENATE p_path lv_file_separator '15_' <wa_files>-input INTO output_file_path.
REPLACE '.xlsx' IN output_file_path WITH 'FromReader.xlsx'.
TRY.
CREATE OBJECT reader TYPE zcl_excel_reader_2007.
excel = reader->load_file( input_file_path ).
IF p_noout EQ abap_false.
worksheet = excel->get_active_worksheet( ).
highest_column = worksheet->get_highest_column( ).
highest_row = worksheet->get_highest_row( ).
WRITE: / 'Filename ', <wa_files>-input.
WRITE: / 'Highest column: ', highest_column, 'Highest row: ', highest_row.
WRITE: /.
WHILE row <= highest_row.
WHILE column <= highest_column.
col_str = zcl_excel_common=>convert_column2alpha( column ).
worksheet->get_cell(
EXPORTING
ip_column = col_str
ip_row = row
IMPORTING
ep_value = value
).
WRITE: value.
column = column + 1.
ENDWHILE.
WRITE: /.
column = 1.
row = row + 1.
ENDWHILE.
IF <wa_files>-input = sheet_with_date_formats.
worksheet->get_cell(
EXPORTING
ip_column = 'A'
ip_row = 4
IMPORTING
ep_value = value
).
WRITE: / 'Date value using get_cell: ', value.
converted_date = zcl_excel_common=>excel_string_to_date( ip_value = value ).
WRITE: / 'Converted date: ', converted_date.
ENDIF.
ENDIF.
CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
lv_file = lo_excel_writer->write_file( excel ).
" Convert to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_file
IMPORTING
output_length = lv_bytecount
TABLES
binary_tab = lt_file_tab.
* " This method is only available on AS ABAP > 6.40
* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ).
* lv_bytecount = xstrlen( lv_file ).
" Save the file
cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
filename = output_file_path
filetype = 'BIN'
CHANGING data_tab = lt_file_tab ).
CATCH zcx_excel INTO ex. " Exceptions for ABAP2XLSX
msg = ex->get_text( ).
WRITE: / msg.
ENDTRY.
ENDLOOP.

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL15</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Reader</ENTRY>
<LENGTH>22</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_NOOUT</KEY>
<ENTRY>Hide output</ENTRY>
<LENGTH>19</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>24</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,133 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL16
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel16.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_drawing TYPE REF TO zcl_excel_drawing.
DATA: ls_io TYPE skwf_io.
CONSTANTS: gc_save_file_name TYPE string VALUE '16_Drawings.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
PARAMETERS: p_objid TYPE sdok_docid DEFAULT '456694429165174BE10000000A1550C0', " Question mark in standard Web Dynpro WDT_QUIZ
p_class TYPE sdok_class DEFAULT 'M_IMAGE_P',
pobjtype TYPE skwf_ioty DEFAULT 'P'.
START-OF-SELECTION.
" Creates active sheet
CREATE OBJECT lo_excel.
"Load samle image
DATA: lt_bin TYPE solix_tab,
lv_len TYPE i,
lv_content TYPE xstring,
ls_key TYPE wwwdatatab.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = 'c:\Program Files\SAP\FrontEnd\SAPgui\wwi\graphics\W_bio.bmp'
filetype = 'BIN'
IMPORTING
filelength = lv_len
CHANGING
data_tab = lt_bin
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = lv_len
IMPORTING
buffer = lv_content
TABLES
binary_tab = lt_bin
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( 'Sheet1' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Image from web repository (SMW0)' ).
" create global drawing, set position and media from web repository
lo_drawing = lo_excel->add_new_drawing( ).
lo_drawing->set_position( ip_from_row = 3
ip_from_col = 'B' ).
ls_key-relid = 'MI'.
ls_key-objid = 'SAPLOGO.GIF'.
lo_drawing->set_media_www( ip_key = ls_key
ip_width = 166
ip_height = 75 ).
" assign drawing to the worksheet
lo_worksheet->add_drawing( lo_drawing ).
" another drawing from a XSTRING read from a file
lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Image from a file (c:\Program Files\SAP\FrontEnd\SAPgui\wwi\graphics\W_bio.bmp)' ).
lo_drawing = lo_excel->add_new_drawing( ).
lo_drawing->set_position( ip_from_row = 9
ip_from_col = 'B' ).
lo_drawing->set_media( ip_media = lv_content
ip_media_type = zcl_excel_drawing=>c_media_type_bmp
ip_width = 83
ip_height = 160 ).
lo_worksheet->add_drawing( lo_drawing ).
ls_io-objid = p_objid.
ls_io-class = p_class.
ls_io-objtype = pobjtype.
IF ls_io IS NOT INITIAL.
" another drawing from a XSTRING read from a file
lo_worksheet->set_cell( ip_column = 'B' ip_row = 18 ip_value = 'Mime repository (by default Question mark in standard Web Dynpro WDT_QUIZ)' ).
lo_drawing = lo_excel->add_new_drawing( ).
lo_drawing->set_position( ip_from_row = 19
ip_from_col = 'B' ).
lo_drawing->set_media_mime( ip_io = ls_io
ip_width = 126
ip_height = 145 ).
lo_worksheet->add_drawing( lo_drawing ).
ENDIF.
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL16</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Drawings</ENTRY>
<LENGTH>25</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>POBJTYPE</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>P_CLASS</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>P_OBJID</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,53 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL17
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel17.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style_protection TYPE REF TO zcl_excel_style,
lv_style_protection_guid TYPE zexcel_cell_style,
lo_style TYPE REF TO zcl_excel_style,
lv_style TYPE zexcel_cell_style.
CONSTANTS: gc_save_file_name TYPE string VALUE '17_SheetProtection.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
PARAMETERS: p_pwd TYPE zexcel_aes_password LOWER CASE DEFAULT 'secret'.
START-OF-SELECTION.
CREATE OBJECT lo_excel.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected.
* lo_worksheet->zif_excel_sheet_protection~password = 'DAA7'. "it is the encoded word "secret"
lo_worksheet->zif_excel_sheet_protection~password = zcl_excel_common=>encrypt_password( p_pwd ).
lo_worksheet->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_active.
lo_worksheet->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_active.
lo_worksheet->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_active.
" First style to unlock a cell
lo_style_protection = lo_excel->add_new_style( ).
lo_style_protection->protection->locked = zcl_excel_style_protection=>c_protection_unlocked.
lv_style_protection_guid = lo_style_protection->get_guid( ).
" Another style which should not affect the unlock style
lo_style = lo_excel->add_new_style( ).
lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style->fill->fgcolor-rgb = 'FFCC3333'.
lv_style = lo_style->get_guid( ).
lo_worksheet->set_cell( ip_row = 3 ip_column = 'C' ip_value = 'This cell is locked locked and has the second formating' ip_style = lv_style ).
lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 'This cell is unlocked' ip_style = lv_style_protection_guid ).
lo_worksheet->set_cell( ip_row = 5 ip_column = 'C' ip_value = 'This cell is locked as all the others empty cell' ).
lo_worksheet->set_cell( ip_row = 6 ip_column = 'C' ip_value = 'This cell is unlocked' ip_style = lv_style_protection_guid ).
lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'This cell is unlocked' ip_style = lv_style_protection_guid ).
lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'This cell is locked as all the others empty cell' ).
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL17</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Sheet Protection</ENTRY>
<LENGTH>33</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>24</LENGTH>
<SPLIT>D</SPLIT>
</item>
<item>
<ID>S</ID>
<KEY>P_PWD</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,34 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL18
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel18.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lv_style_protection_guid TYPE zexcel_cell_style.
CONSTANTS: gc_save_file_name TYPE string VALUE '18_BookProtection.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
CREATE OBJECT lo_excel.
" Get active sheet
lo_excel->zif_excel_book_protection~protected = zif_excel_book_protection=>c_protected.
lo_excel->zif_excel_book_protection~lockrevision = zif_excel_book_protection=>c_locked.
lo_excel->zif_excel_book_protection~lockstructure = zif_excel_book_protection=>c_locked.
lo_excel->zif_excel_book_protection~lockwindows = zif_excel_book_protection=>c_locked.
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_cell( ip_row = 4 ip_column = 'C' ip_value = 'This cell is unlocked' ip_style = lv_style_protection_guid ).
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL18</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Book protection</ENTRY>
<LENGTH>32</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,56 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL19
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel19.
TYPE-POOLS: abap.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet.
CONSTANTS: gc_save_file_name TYPE string VALUE '19_SetActiveSheet.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
PARAMETERS: p_noout TYPE abap_bool DEFAULT abap_true.
START-OF-SELECTION.
CREATE OBJECT lo_excel.
" First Worksheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( 'First' ).
lo_worksheet->set_cell( ip_row = 1 ip_column = 'A' ip_value = 'This is Sheet 1' ).
" Second Worksheet
lo_worksheet = lo_excel->add_new_worksheet( ).
lo_worksheet->set_title( 'Second' ).
lo_worksheet->set_cell( ip_row = 1 ip_column = 'A' ip_value = 'This is Sheet 2' ).
" Third Worksheet
lo_worksheet = lo_excel->add_new_worksheet( ).
lo_worksheet->set_title( 'Third' ).
lo_worksheet->set_cell( ip_row = 1 ip_column = 'A' ip_value = 'This is Sheet 3' ).
IF p_noout EQ abap_false.
" lo_excel->set_active_sheet_index_by_name( data_sheet_name ).
DATA: active_sheet_index TYPE zexcel_active_worksheet.
active_sheet_index = lo_excel->get_active_sheet_index( ).
WRITE: 'Sheet Index before: ', active_sheet_index.
ENDIF.
lo_excel->set_active_sheet_index( '2' ).
IF p_noout EQ abap_false.
active_sheet_index = lo_excel->get_active_sheet_index( ).
WRITE: 'Sheet Index after: ', active_sheet_index.
ENDIF.
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL19</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Set active sheet</ENTRY>
<LENGTH>33</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_NOOUT</KEY>
<ENTRY>Hide output</ENTRY>
<LENGTH>19</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>26</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
<I18N_TPOOL>
<item>
<LANGUAGE>D</LANGUAGE>
<TEXTPOOL>
<item>
<ID>S</ID>
<KEY>P_NOOUT</KEY>
<ENTRY>Hide output</ENTRY>
<LENGTH>19</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>26</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TEXTPOOL>
</item>
</I18N_TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,330 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL2
*& Test Styles for ABAP2XLSX
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel2.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style_bold TYPE REF TO zcl_excel_style,
lo_style_underline TYPE REF TO zcl_excel_style,
lo_style_filled TYPE REF TO zcl_excel_style,
lo_style_border TYPE REF TO zcl_excel_style,
lo_style_button TYPE REF TO zcl_excel_style,
lo_border_dark TYPE REF TO zcl_excel_style_border,
lo_border_light TYPE REF TO zcl_excel_style_border.
DATA: lv_style_bold_guid TYPE zexcel_cell_style,
lv_style_underline_guid TYPE zexcel_cell_style,
lv_style_filled_guid TYPE zexcel_cell_style,
lv_style_filled_green_guid TYPE zexcel_cell_style,
lv_style_border_guid TYPE zexcel_cell_style,
lv_style_button_guid TYPE zexcel_cell_style,
lv_style_filled_turquoise_guid TYPE zexcel_cell_style,
lv_style_gr_cornerlb_guid TYPE zexcel_cell_style,
lv_style_gr_cornerlt_guid TYPE zexcel_cell_style,
lv_style_gr_cornerrb_guid TYPE zexcel_cell_style,
lv_style_gr_cornerrt_guid TYPE zexcel_cell_style,
lv_style_gr_horizontal90_guid TYPE zexcel_cell_style,
lv_style_gr_horizontal270_guid TYPE zexcel_cell_style,
lv_style_gr_horizontalb_guid TYPE zexcel_cell_style,
lv_style_gr_vertical_guid TYPE zexcel_cell_style,
lv_style_gr_vertical2_guid TYPE zexcel_cell_style,
lv_style_gr_fromcenter_guid TYPE zexcel_cell_style,
lv_style_gr_diagonal45_guid TYPE zexcel_cell_style,
lv_style_gr_diagonal45b_guid TYPE zexcel_cell_style,
lv_style_gr_diagonal135_guid TYPE zexcel_cell_style,
lv_style_gr_diagonal135b_guid TYPE zexcel_cell_style.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab.
DATA: lv_full_path TYPE string,
lv_workdir TYPE string,
lv_file_separator TYPE c.
DATA: lo_row TYPE REF TO zcl_excel_row.
CONSTANTS: gc_save_file_name TYPE string VALUE '02_Styles.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
" Creates active sheet
CREATE OBJECT lo_excel.
" Create border object
CREATE OBJECT lo_border_dark.
lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black.
lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin.
CREATE OBJECT lo_border_light.
lo_border_light->border_color-rgb = zcl_excel_style_color=>c_gray.
lo_border_light->border_style = zcl_excel_style_border=>c_border_thin.
" Create a bold / italic style
lo_style_bold = lo_excel->add_new_style( ).
lo_style_bold->font->bold = abap_true.
lo_style_bold->font->italic = abap_true.
lo_style_bold->font->name = zcl_excel_style_font=>c_name_arial.
lo_style_bold->font->scheme = zcl_excel_style_font=>c_scheme_none.
lo_style_bold->font->color-rgb = zcl_excel_style_color=>c_red.
lv_style_bold_guid = lo_style_bold->get_guid( ).
" Create an underline double style
lo_style_underline = lo_excel->add_new_style( ).
lo_style_underline->font->underline = abap_true.
lo_style_underline->font->underline_mode = zcl_excel_style_font=>c_underline_double.
lo_style_underline->font->name = zcl_excel_style_font=>c_name_roman.
lo_style_underline->font->scheme = zcl_excel_style_font=>c_scheme_none.
lo_style_underline->font->family = zcl_excel_style_font=>c_family_roman.
lv_style_underline_guid = lo_style_underline->get_guid( ).
" Create filled style yellow
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_filled->fill->fgcolor-theme = zcl_excel_style_color=>c_theme_accent6.
lv_style_filled_guid = lo_style_filled->get_guid( ).
" Create border with button effects
lo_style_button = lo_excel->add_new_style( ).
lo_style_button->borders->right = lo_border_dark.
lo_style_button->borders->down = lo_border_dark.
lo_style_button->borders->left = lo_border_light.
lo_style_button->borders->top = lo_border_light.
lv_style_button_guid = lo_style_button->get_guid( ).
"Create style with border
lo_style_border = lo_excel->add_new_style( ).
lo_style_border->borders->allborders = lo_border_dark.
lo_style_border->borders->diagonal = lo_border_dark.
lo_style_border->borders->diagonal_mode = zcl_excel_style_borders=>c_diagonal_both.
lv_style_border_guid = lo_style_border->get_guid( ).
" Create filled style green
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_green.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_filled_green_guid = lo_style_filled->get_guid( ).
" Create filled with gradients
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_cornerlb.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_cornerlb_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_cornerlt.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_cornerlt_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_cornerrb.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_cornerrb_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_cornerrt.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_cornerrt_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_horizontal90.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_horizontal90_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_horizontal270.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_horizontal270_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_horizontalb.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_horizontalb_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_vertical.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_vertical_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_vertical.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_vertical2_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_fromcenter.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_fromcenter_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal45.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_diagonal45_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal45b.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_diagonal45b_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal135.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_diagonal135_guid = lo_style_filled->get_guid( ).
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_gradient_diagonal135b.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_blue.
lo_style_filled->fill->bgcolor-rgb = zcl_excel_style_color=>c_white.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_gr_diagonal135b_guid = lo_style_filled->get_guid( ).
" Create filled style turquoise using legacy excel ver <= 2003 palette. (https://code.sdn.sap.com/spaces/abap2xlsx/tickets/92)
lo_style_filled = lo_excel->add_new_style( ).
lo_excel->legacy_palette->set_color( "replace built-in color from palette with out custom RGB turquoise
ip_index = 16
ip_color = '0040E0D0' ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_filled->fill->fgcolor-indexed = 16.
lv_style_filled_turquoise_guid = lo_style_filled->get_guid( ).
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( ip_title = 'Styles' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Bold text' ip_style = lv_style_bold_guid ).
lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = 'Underlined text' ip_style = lv_style_underline_guid ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'Filled text' ip_style = lv_style_filled_guid ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 6 ip_value = 'Borders' ip_style = lv_style_border_guid ).
lo_worksheet->set_cell( ip_column = 'D' ip_row = 7 ip_value = 'I''m not a button :)' ip_style = lv_style_button_guid ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'Modified color for Excel 2003' ip_style = lv_style_filled_turquoise_guid ).
" Fill the cell and apply one style
lo_worksheet->set_cell( ip_column = 'B' ip_row = 6 ip_value = 'Filled text' ip_style = lv_style_filled_guid ).
" Change the style
lo_worksheet->set_cell_style( ip_column = 'B' ip_row = 6 ip_style = lv_style_filled_green_guid ).
" Add Style to an empty cell to test Fix for Issue
"#44 Exception ZCX_EXCEL thrown when style is set for an empty cell
" https://code.sdn.sap.com/spaces/abap2xlsx/tickets/44-exception-zcx_excel-thrown-when-style-is-set-for-an-empty-cell
lo_worksheet->set_cell_style( ip_column = 'E' ip_row = 6 ip_style = lv_style_filled_green_guid ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 10 ip_style = lv_style_gr_cornerlb_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_cornerlb ).
lo_row = lo_worksheet->get_row( ip_row = 10 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 11 ip_style = lv_style_gr_cornerlt_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_cornerlt ).
lo_row = lo_worksheet->get_row( ip_row = 11 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 12 ip_style = lv_style_gr_cornerrb_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_cornerrb ).
lo_row = lo_worksheet->get_row( ip_row = 12 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 13 ip_style = lv_style_gr_cornerrt_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_cornerrt ).
lo_row = lo_worksheet->get_row( ip_row = 13 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 14 ip_style = lv_style_gr_horizontal90_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_horizontal90 ).
lo_row = lo_worksheet->get_row( ip_row = 14 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 15 ip_style = lv_style_gr_horizontal270_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_horizontal270 ).
lo_row = lo_worksheet->get_row( ip_row = 15 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 16 ip_style = lv_style_gr_horizontalb_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_horizontalb ).
lo_row = lo_worksheet->get_row( ip_row = 16 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 17 ip_style = lv_style_gr_vertical_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_vertical ).
lo_row = lo_worksheet->get_row( ip_row = 17 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 18 ip_style = lv_style_gr_vertical2_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_vertical ).
lo_row = lo_worksheet->get_row( ip_row = 18 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 19 ip_style = lv_style_gr_fromcenter_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_fromcenter ).
lo_row = lo_worksheet->get_row( ip_row = 19 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 20 ip_style = lv_style_gr_diagonal45_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_diagonal45 ).
lo_row = lo_worksheet->get_row( ip_row = 20 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 21 ip_style = lv_style_gr_diagonal45b_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_diagonal45b ).
lo_row = lo_worksheet->get_row( ip_row = 21 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 22 ip_style = lv_style_gr_diagonal135_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_diagonal135 ).
lo_row = lo_worksheet->get_row( ip_row = 22 ).
lo_row->set_row_height( ip_row_height = 30 ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 23 ip_style = lv_style_gr_diagonal135b_guid ip_value = zcl_excel_style_fill=>c_fill_gradient_diagonal135b ).
lo_row = lo_worksheet->get_row( ip_row = 23 ).
lo_row->set_row_height( ip_row_height = 30 ).
* CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
* lv_file = lo_excel_writer->write_file( lo_excel ).
*
* " Convert to binary
* CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
* EXPORTING
* buffer = lv_file
* IMPORTING
* output_length = lv_bytecount
* TABLES
* binary_tab = lt_file_tab.
** " This method is only available on AS ABAP > 6.40
** lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ).
** lv_bytecount = xstrlen( lv_file ).
*
* " Save the file
* cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
* filename = lv_full_path
* filetype = 'BIN'
* CHANGING data_tab = lt_file_tab ).
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL2</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Styles</ENTRY>
<LENGTH>25</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,193 @@
*--------------------------------------------------------------------*
* REPORT ZDEMO_EXCEL20
* Demo for method zcl_excel_worksheet-bind_alv:
* export data from ALV (CL_GUI_ALV_GRID) object to excel
*--------------------------------------------------------------------*
REPORT zdemo_excel20.
*----------------------------------------------------------------------*
* CLASS lcl_handle_events DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS:
on_user_command FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function.
ENDCLASS. "lcl_handle_events DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_handle_events IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_handle_events IMPLEMENTATION.
METHOD on_user_command.
PERFORM user_command." using e_salv_function text-i08.
ENDMETHOD. "on_user_command
ENDCLASS. "lcl_handle_events IMPLEMENTATION
*--------------------------------------------------------------------*
* DATA DECLARATION
*--------------------------------------------------------------------*
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_alv TYPE REF TO cl_gui_alv_grid,
lo_salv TYPE REF TO cl_salv_table,
gr_events TYPE REF TO lcl_handle_events,
lr_events TYPE REF TO cl_salv_events_table,
gt_sbook TYPE TABLE OF sbook,
gt_listheader TYPE slis_t_listheader,
wa_listheader LIKE LINE OF gt_listheader.
DATA: l_path TYPE string, " local dir
lv_workdir TYPE string,
lv_file_separator TYPE c.
CONSTANTS:
lv_default_file_name TYPE string VALUE '20_BindAlv.xlsx'.
*--------------------------------------------------------------------*
*START-OF-SELECTION
*--------------------------------------------------------------------*
START-OF-SELECTION.
* get data
* ------------------------------------------
SELECT *
INTO TABLE gt_sbook[]
FROM sbook "#EC CI_NOWHERE
UP TO 10 ROWS.
* Display ALV
* ------------------------------------------
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = abap_false
IMPORTING
r_salv_table = lo_salv
CHANGING
t_table = gt_sbook[] ).
CATCH cx_salv_msg .
ENDTRY.
TRY.
lo_salv->set_screen_status(
EXPORTING
report = sy-repid
pfstatus = 'ALV_STATUS'
set_functions = lo_salv->c_functions_all ).
CATCH cx_salv_msg .
ENDTRY.
lr_events = lo_salv->get_event( ).
CREATE OBJECT gr_events.
SET HANDLER gr_events->on_user_command FOR lr_events.
lo_salv->display( ).
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* ALV user command
*--------------------------------------------------------------------*
FORM user_command .
IF sy-ucomm = 'EXCEL'.
* get save file path
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = l_path ).
cl_gui_cfw=>flush( ).
cl_gui_frontend_services=>directory_browse(
EXPORTING initial_folder = l_path
CHANGING selected_folder = l_path ).
IF l_path IS INITIAL.
cl_gui_frontend_services=>get_sapgui_workdir(
CHANGING sapworkdir = lv_workdir ).
l_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator(
CHANGING file_separator = lv_file_separator ).
CONCATENATE l_path lv_file_separator lv_default_file_name
INTO l_path.
* export file to save file path
PERFORM export_to_excel.
ENDIF.
ENDFORM. " USER_COMMAND
*--------------------------------------------------------------------*
* FORM EXPORT_TO_EXCEL
*--------------------------------------------------------------------*
* This subroutine is principal demo session
*--------------------------------------------------------------------*
FORM export_to_excel.
* create zcl_excel_worksheet object
CREATE OBJECT lo_excel.
lo_worksheet = lo_excel->get_active_worksheet( ).
* get ALV object from screen
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lo_alv.
* build list header
wa_listheader-typ = 'H'.
wa_listheader-info = sy-title.
APPEND wa_listheader TO gt_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'Created by: ABAP2XLSX Group'.
APPEND wa_listheader TO gt_listheader.
wa_listheader-typ = 'A'.
wa_listheader-info =
'Project hosting at https://cw.sdn.sap.com/cw/groups/abap2xlsx'.
APPEND wa_listheader TO gt_listheader.
* write to excel using method Bin_ALV
lo_worksheet->bind_alv_ole2(
EXPORTING
* I_DOCUMENT_URL = SPACE " excel template
* I_XLS = 'X' " create in xls format?
i_save_path = l_path
io_alv = lo_alv
it_listheader = gt_listheader
i_top = 2
i_left = 1
* I_COLUMNS_HEADER = 'X'
* I_COLUMNS_AUTOFIT = 'X'
* I_FORMAT_COL_HEADER =
* I_FORMAT_SUBTOTAL =
* I_FORMAT_TOTAL =
EXCEPTIONS
miss_guide = 1
ex_transfer_kkblo_error = 2
fatal_error = 3
inv_data_range = 4
dim_mismatch_vkey = 5
dim_mismatch_sema = 6
error_in_sema = 7
OTHERS = 8
).
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "EXPORT_TO_EXCEL

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL21
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel21.
TYPES:
BEGIN OF t_color_style,
color TYPE zexcel_style_color_argb,
style TYPE zexcel_cell_style,
END OF t_color_style.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style_filled TYPE REF TO zcl_excel_style.
DATA: color_styles TYPE TABLE OF t_color_style.
FIELD-SYMBOLS: <color_style> LIKE LINE OF color_styles.
CONSTANTS: max TYPE i VALUE 255,
step TYPE i VALUE 51.
DATA: red TYPE i,
green TYPE i,
blue TYPE i,
red_hex(1) TYPE x,
green_hex(1) TYPE x,
blue_hex(1) TYPE x,
red_str TYPE string,
green_str TYPE string,
blue_str TYPE string.
DATA: color TYPE zexcel_style_color_argb,
tint TYPE zexcel_style_color_tint.
DATA: row TYPE i,
row_tmp TYPE i,
column TYPE zexcel_cell_column VALUE 1,
col_str TYPE zexcel_cell_column_alpha.
CONSTANTS: gc_save_file_name TYPE string VALUE '21_BackgroundColorPicker.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
" Creates active sheet
CREATE OBJECT lo_excel.
WHILE red <= max.
green = 0.
WHILE green <= max.
blue = 0.
WHILE blue <= max.
red_hex = red.
red_str = red_hex.
green_hex = green.
green_str = green_hex.
blue_hex = blue.
blue_str = blue_hex.
" Create filled
CONCATENATE 'FF' red_str green_str blue_str INTO color.
APPEND INITIAL LINE TO color_styles ASSIGNING <color_style>.
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_filled->fill->fgcolor-rgb = color.
<color_style>-color = color.
<color_style>-style = lo_style_filled->get_guid( ).
blue = blue + step.
ENDWHILE.
green = green + step.
ENDWHILE.
red = red + step.
ENDWHILE.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( 'Color Picker' ).
LOOP AT color_styles ASSIGNING <color_style>.
row_tmp = ( max / step + 1 ) * 3.
IF row = row_tmp.
row = 0.
column = column + 1.
ENDIF.
row = row + 1.
col_str = zcl_excel_common=>convert_column2alpha( column ).
" Fill the cell and apply one style
lo_worksheet->set_cell( ip_column = col_str
ip_row = row
ip_value = <color_style>-color
ip_style = <color_style>-style ).
ENDLOOP.
row = row + 2.
tint = '-0.5'.
DO 10 TIMES.
column = 1.
DO 10 TIMES.
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_filled->fill->fgcolor-theme = sy-index - 1.
lo_style_filled->fill->fgcolor-tint = tint.
<color_style>-style = lo_style_filled->get_guid( ).
col_str = zcl_excel_common=>convert_column2alpha( column ).
lo_worksheet->set_cell_style( ip_column = col_str
ip_row = row
ip_style = <color_style>-style ).
ADD 1 TO column.
ENDDO.
ADD '0.1' TO tint.
ADD 1 TO row.
ENDDO.
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL21</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo:</ENTRY>
<LENGTH>15</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,127 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL22
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel22.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style TYPE REF TO zcl_excel_style,
lo_style_date TYPE REF TO zcl_excel_style,
lo_style_editable TYPE REF TO zcl_excel_style,
lo_data_validation TYPE REF TO zcl_excel_data_validation.
DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog,
ls_table_settings TYPE zexcel_s_table_settings,
ls_table_settings_out TYPE zexcel_s_table_settings.
DATA: lv_style_guid TYPE zexcel_cell_style.
DATA: lv_row TYPE char10.
FIELD-SYMBOLS: <fs_field_catalog> TYPE zexcel_s_fieldcatalog.
CONSTANTS: gc_save_file_name TYPE string VALUE '22_itab_fieldcatalog.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
" Creates active sheet
CREATE OBJECT lo_excel.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( ip_title = 'PN_MASSIVE' ).
DATA lt_test TYPE TABLE OF sflight.
SELECT * FROM sflight INTO TABLE lt_test. "#EC CI_NOWHERE
" sheet style (white background)
lo_style = lo_excel->add_new_style( ).
lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style->fill->fgcolor-rgb = zcl_excel_style_color=>c_white.
lv_style_guid = lo_style->get_guid( ).
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->zif_excel_sheet_properties~set_style( lv_style_guid ).
lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected.
lo_worksheet->zif_excel_sheet_protection~password = zcl_excel_common=>encrypt_password( 'test' ).
lo_worksheet->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_active.
lo_worksheet->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_active.
lo_worksheet->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_active.
" Create cell style for display only fields
lo_style = lo_excel->add_new_style( ).
lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style->fill->fgcolor-rgb = zcl_excel_style_color=>c_gray.
lo_style->number_format->format_code = zcl_excel_style_number_format=>c_format_text.
" Create cell style for display only date field
lo_style_date = lo_excel->add_new_style( ).
lo_style_date->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_date->fill->fgcolor-rgb = zcl_excel_style_color=>c_gray.
lo_style_date->number_format->format_code = zcl_excel_style_number_format=>c_format_date_ddmmyyyy.
" Create cell style for editable fields
lo_style_editable = lo_excel->add_new_style( ).
lo_style_editable->protection->locked = zcl_excel_style_protection=>c_protection_unlocked.
lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = lt_test ).
LOOP AT lt_field_catalog ASSIGNING <fs_field_catalog>.
CASE <fs_field_catalog>-fieldname.
WHEN 'CARRID'.
<fs_field_catalog>-position = 3.
<fs_field_catalog>-dynpfld = abap_true.
<fs_field_catalog>-style = lo_style->get_guid( ).
WHEN 'CONNID'.
<fs_field_catalog>-position = 1.
<fs_field_catalog>-dynpfld = abap_true.
<fs_field_catalog>-style = lo_style->get_guid( ).
<fs_field_catalog>-scrtext_m = |Flight\r\nNumber|. " Demonstrates header on 2 lines
WHEN 'FLDATE'.
<fs_field_catalog>-position = 2.
<fs_field_catalog>-dynpfld = abap_true.
<fs_field_catalog>-style = lo_style_date->get_guid( ).
WHEN 'PRICE'.
<fs_field_catalog>-position = 4.
<fs_field_catalog>-dynpfld = abap_true.
<fs_field_catalog>-style = lo_style_editable->get_guid( ).
<fs_field_catalog>-totals_function = zcl_excel_table=>totals_function_sum.
WHEN OTHERS.
<fs_field_catalog>-dynpfld = abap_false.
ENDCASE.
ENDLOOP.
ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
ls_table_settings-show_row_stripes = abap_true.
lo_worksheet->bind_table( EXPORTING
ip_table = lt_test
it_field_catalog = lt_field_catalog
is_table_settings = ls_table_settings
IMPORTING
es_table_settings = ls_table_settings_out ).
lo_worksheet->freeze_panes( ip_num_rows = 3 ). "freeze column headers when scrolling
lo_data_validation = lo_worksheet->add_new_data_validation( ).
lo_data_validation->type = zcl_excel_data_validation=>c_type_custom.
lv_row = ls_table_settings_out-top_left_row.
CONDENSE lv_row.
CONCATENATE 'ISNUMBER(' ls_table_settings_out-top_left_column lv_row ')' INTO lo_data_validation->formula1.
lo_data_validation->cell_row = ls_table_settings_out-top_left_row.
lo_data_validation->cell_column = ls_table_settings_out-top_left_column.
lo_data_validation->cell_row_to = ls_table_settings_out-bottom_right_row.
lo_data_validation->cell_column_to = ls_table_settings_out-bottom_right_column.
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL22</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Export internal table</ENTRY>
<LENGTH>38</LENGTH>
</item>
<item>
<ID>S</ID>
<KEY>P_PATH</KEY>
<ENTRY>.</ENTRY>
<LENGTH>9</LENGTH>
<SPLIT>D</SPLIT>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,91 @@
*&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL23
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel23.
TYPE-POOLS: abap.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_hyperlink TYPE REF TO zcl_excel_hyperlink.
CONSTANTS: gc_save_file_name TYPE string VALUE '23_Sheets_with_and_without_grid_lines.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
" Creates active sheet
CREATE OBJECT lo_excel.
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( ip_title = 'Sheet1' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the first sheet with grid lines and print centered horizontal & vertical' ).
lo_worksheet->set_show_gridlines( i_show_gridlines = abap_true ).
lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet2!B2' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is a link to the second sheet' ip_hyperlink = lo_hyperlink ).
lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected.
lo_worksheet->zif_excel_sheet_properties~zoomscale = 150.
lo_worksheet->zif_excel_sheet_properties~zoomscale_normal = 150.
lo_worksheet->sheet_setup->vertical_centered = abap_true.
lo_worksheet->sheet_setup->horizontal_centered = abap_true.
" Second sheet
lo_worksheet = lo_excel->add_new_worksheet( ).
lo_worksheet->set_title( ip_title = 'Sheet2' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the second sheet with grid lines in display and print' ).
lo_worksheet->set_show_gridlines( i_show_gridlines = abap_true ).
lo_worksheet->set_print_gridlines( i_print_gridlines = abap_true ).
lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet3!B2' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is link to the third sheet' ip_hyperlink = lo_hyperlink ).
lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected.
lo_worksheet->zif_excel_sheet_properties~zoomscale = 160.
lo_worksheet->zif_excel_sheet_properties~zoomscale_pagelayoutview = 200.
" Third sheet
lo_worksheet = lo_excel->add_new_worksheet( ).
lo_worksheet->set_title( ip_title = 'Sheet3' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the third sheet without grid lines in display and print' ).
lo_worksheet->set_show_gridlines( i_show_gridlines = abap_false ).
lo_worksheet->set_print_gridlines( i_print_gridlines = abap_false ).
lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet4!B2' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is link to the fourth sheet' ip_hyperlink = lo_hyperlink ).
lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected.
lo_worksheet->zif_excel_sheet_properties~zoomscale = 170.
lo_worksheet->zif_excel_sheet_properties~zoomscale_sheetlayoutview = 150.
" Fourth sheet
lo_worksheet = lo_excel->add_new_worksheet( ).
lo_worksheet->set_title( ip_title = 'Sheet4' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'This is the fourth sheet with grid lines and print centered ONLY horizontal' ).
lo_worksheet->set_show_gridlines( i_show_gridlines = abap_true ).
lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = 'Sheet1!B2' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'This is link to the first sheet' ip_hyperlink = lo_hyperlink ).
lo_worksheet->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_protected.
lo_worksheet->zif_excel_sheet_properties~zoomscale = 150.
lo_worksheet->zif_excel_sheet_properties~zoomscale_normal = 150.
" lo_worksheet->sheet_setup->vertical_centered = abap_true.
lo_worksheet->sheet_setup->horizontal_centered = abap_true.
*** Create output
lcl_output=>output( lo_excel ).

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<PROGDIR>
<NAME>ZDEMO_EXCEL23</NAME>
<SUBC>1</SUBC>
<RSTAT>T</RSTAT>
<RLOAD>E</RLOAD>
<FIXPT>X</FIXPT>
<UCCHECK>X</UCCHECK>
</PROGDIR>
<TPOOL>
<item>
<ID>R</ID>
<ENTRY>abap2xlsx Demo: Multiple sheets with and w/o grid lines, print options</ENTRY>
<LENGTH>70</LENGTH>
</item>
</TPOOL>
</asx:values>
</asx:abap>
</abapGit>

Some files were not shown because too many files have changed in this diff Show More