Skip to Content

We’re happy to celebrate 200 members in the abap2xlsx project:

image

This blog provides the background story why I’ve created this code sample. If you just want the code then directly open GitHub Repository: SAP CRM Web Client UI Export to Spreadsheet with abap2xlsx.

Limitations of the standard Export to Spreadsheet functionality

According to the WebClient UI Framework documentation on Setting Up the System a XML export is only possible with Microsoft Internet Explorer with  ActiveX, and one a version of Microsoft Excel versions under Windows.  But I think today as Firefox (Version 2.0 and 3.0 according to the Product Availability Matrix ) is also a supported Browser for SAP CRM and other office products support the Open Office XML that limitation should be removed. Thanks to my new SAP Mentor colleague Ivan Femia who started the abap2xlsx last year this is now also possible.

Internationalization problems with the XML export

It started two month ago when I got a call from one of our SAP CRM users in Switzerland. He told me that he has a problem using the Export to Spreadsheet function. The problem occurred in value columns exported from the Opportunity search result list. I’ve connected to his machine and saw the problem.The columns containing the Opportunity value where not recognized as a number. Instead they where displayed as text. So i.e. no calculation of the total was possible.

That was caused by that fact that the machines “Regional and Language Options” where set to “German (Switzerland)”. The main difference to “German (Germany)” is that Numbers are displayed as 123’456’789.00 instead of 123.456.789,00. As SAP doesn’t support this decimal notation (Defaults in SU01 or SU3) the export as 123.456.789,00 was used.

Way to the solution

As I already thought about replacing the standard Export to Spreadsheet functionality with abap2xlsx. The call from Switzerland was the last kick I’ve needed to start it. As the Export to Spreadsheet is a generic functionality of the WebClient UI Framework I first searched for a way to provide the replacement without any modification. The trick is to create an external alias in transaction SICF which uses path of the standard functionality but replaces it with the custom one.

From that point it was straight forward. Inspired by the functionality of the standard handler class CL_CHTMLB_CONFIG_TAB_EXCEL_EXP I’ve created the class ZCL_CHTMLB_TAB_EXCEL_EXPORT using abap2xlsx to create the .XLSX file. It was a bit tricky to provide the fields to abap2xlsx in the right format. But with the code completion in NetWeaver 7.02 I found the needed method.

Sow now you can check out the solution at GitHub Repository: SAP CRM Web Client UI Export to Spreadsheet with abap2xlsx.

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. Ivan Femia
    Thank you Gregor.
    This is an awesome addition to abap2xlsx project! My CRM Colleagues are really enthusiastic about this.

    See you soon in Milan 🙂

    Ivan

    (0) 
  2. Nicolas Busson

    Hi Gregor,

    I arrived in Switzerland, and just faced this issue wiht numbers converted to text when exporting opportunities to Excel from SAP CRM WebUI result list. It’s amazing to see you solved this problem 5 years ago already. Kudos.

    You’re always many steps ahead. It’s becoming frustrating 😉

    Cheers,

    Nick.

    (0) 
    1. Gregor Wolf Post author

      Hi Nick,

      great that this post is helpful to you. Be aware that the export have some issues with GUID based elements. Perhaps it’s a good time to start a project on GitHub where everyone can contribute corrections. Do you want to kick it off and give ABAPGit a try?

      Best regards

      Gregor

      (0) 
      1. Nicolas Busson

        Hi Gregor,

        I started to make a few changes to your ABAP class ZCL_CHTMLB_TAB_EXCEL_EXPORT in order to get the same look and feel in the file generated out of abap2xlsx as the one we’ve got with SAP standard class. So as promised I’m about to create a new project in Github… but as 99% fo the coding is yours, don’t you want to create the repository yourself and grant me access to commit my changes?

        Cheers,

        Nick.

        (0) 

Leave a Reply