Quantcast
Channel: ABAP Development
Viewing all articles
Browse latest Browse all 948

ABAP to XLSX in less than 10 minutes

$
0
0

Sometimes you just want to have a simple internal table into a simple Excel. You might want to store this one on the client pc or on the application server or even send it as an email Attachement. And you might want to do it in the coming 10 Minutes or less.

 

Prerequisite: it's all based on the fine functionalities in these standard packages: CL_SXML_WRITER, SALV_BS_EXPORT, CL_OPENXML_PACKAGE.

 

You've got those packages? Let's get started. Unzip the sourceCodes.zip file, create 3 Simple Transformations and 1 Class. Then you can already start using it with the 2 demo programs.

 


  1. From the attachment simpleTransformations.txt, create these Simple Transformations in transaction STRANS:
    • ZSCN_XLSX_SHEET from the code in the ZSCN_XLSX_SHEET part.
    • ZSCN_XLSX_STYLE from the code in the ZSCN_XLSX_STYLE part.
    • ZSCN_XLSX_CUSTOM_DOC_PROPS from the code in the ZSCN_XLSX_CUSTOM_DOC_PROPS part
  2. Create and activate the class ZSCN_CL_XLSX_WRITER in Transaction SE24
    • Make sure your class builder editor is in "Source Code-Based Class Builder" mode. This makes the copy / paste much easier. You can set thist from the menu in SE24, Utilities --> Settings, then in the tab "Class Builder", check the option "Source Code-Based Class Builder", or Switch it as shown in the Video.
    • Create the class ZSCN_CL_XLSX_WRITER from the code in ZSCN_CL_XLSX_WRITER.txt
  3. Celebrate, you're done!
  4. Create a first test program in SE38 ZSCN_XLSX_WRITER_DEMO_BASIC from the source code part ZSCN_XLSX_WRITER_DEMO_BASIC in the attachment programs.txt.
  5. Create a second test program ZSCN_XLSX_WRITER_DEMO_ADV with some more functionality in SE38 from the source code part ZSCN_XLSX_WRITER_DEMO_ADV in programs.txt.

 

* Only 3 attachments are allowed. so I needed to merge some content with some old Fashion "begin of" and "end of".


Viewing all articles
Browse latest Browse all 948

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>