Skip to Content
Author's profile photo Former Member

Download MS Excel with formatting options using XSLT – Part 2

In the previous part, we discussed how to create and modify the XSL Transformation using T code XSLT_TOOL.

Part 1:

Now we are going to call this XSLT in our program.

Create a program in SE38 (ZEXCEL_DOWNLOAD). The algorithm of this program is explained below:

  • Populate the internal table.
  • Pass the internal table contents to the transformation which is created in XSLT_TOOL (Z_EXCEL_DOWNLOAD).
  • The output of the transformation will be an XML string. Put this string in an XML table.
  • CALL METHOD cl_gui_frontend_services=>file_save_dialog to open the dialog box to identify the location for saving the file.
  • Pass the XML table to GUI_DOWNLOAD. The excel sheet gets downloaded in the desired path.

16. Program.jpg

Step 7:

Execute the program.

17. Save Excel.jpg

Save the Excel sheet. Here is the output of this program:

18. Output.jpg

Please note that the conditional formatting is applied only to cell G2. If we want to extend the range for this conditional formatting, we need to make one more adjustment in the XSLT.

19. Conditional formatting code.jpg

As you can see, in the self-generated code, the conditional formatting was applied only to Row 2, Column 7. I have changed the range manually here up to 100 rows. Now the conditional formatting is applied to 100 rows. You can see the excel output below:

20. Conditional formatting excel.jpg


  • Faster download
  • Download at one shot
  • Minimal coding effort. We use auto-generatedcode and do minimal changes to it.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Joseph Fryda
      Joseph Fryda

      Hi Manikandan,

      Thank you for this weblog. Very usefull.



      Author's profile photo Miho Ayukawa
      Miho Ayukawa


      Thank you for sharing nice blog!

      Would you give us ABAP source code?


      I'm creating XSLT and call transformation from ABAP , but not working...