Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

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, on the application server or even send it as an email attachment. And you might want to do it in the coming 10 Minutes or less before your coffee gets cold.

 

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

 

You've got those packages? Let's get started. Download the attached files, create 3 Simple Transformations and 1 Class. That's it. You can 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 this 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.

Viewing all articles
Browse latest Browse all 943

Trending Articles



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