Most business users are more confident in analyzing business data using one or more spreadsheets, sometimes linked together.
The actual releases of SAP, both SAP S / 4 and on the most recent versions of SAP ECC, allow exporting the business data in Excel format. The standard feature, used in the system to generate excel spreadsheets, has a limited operation and consequently creates simple excel sheets. These spreadsheets sometimes are not ordered without professional formatting of the layouts. Moreover, it is not possible to customize the worksheets automatically set up from the ALV lists or other tools by adding complex objects such as filters, graphs or other functionalities
It was these limitations that, years ago, inspired our team in the creation of the
abap2xlsx
framework, which allows developers to generate spreadsheets evolved directly from ABAP quickly.
In the latest years, the Google Suite platform has also released some API services that allow developers to generate spreadsheets (called Google Gsheet). Based on the idea of the
abap2xlsx
framework, we decided to create a specific component that integrates directly on GSuite called ABAP2Gsheet, an Object-Oriented Framework that allows the use of the Google API.
Please note that this is the announcement of the first version, which still has many features to explore and enhance. This post is also an opportunity to collaborate with us, providing comments and feedback to enhance the code itself and adds more functionalities.
The project is available on GitHub
abap2gsheet
,
the first version supports the following functionalities:
-
Creation of a Google Sheet document
-
Creation of a new Sheet from a template
-
Fill a single cell of the Sheet with text, the number passed directly from ABAP variables
-
Apply formats to Text and Numbers, Set colors, filters, etc.
-
Protect a range of cells
-
Read a range of cells
-
Multi Sheets generation
-
Upload an XLS document to Google Drive
-
Add a Graph to Sheet
-
Synchronize GSheet with an ALV
Developers can perform these operations with few lines of code without worrying about authentication and HTTP request formatting struggles, and here follow some examples.
Some examples
The examples explained below can be found in the yabap2google_demos package available in the project's gitHub. New features, models, and demos implemented will be collected in this section.
Hello World: Creation of a basic Google Sheet filling a cell with an ABAP string
In our first example, we want to create a simple Gsheet file into the GDrive. We want to fill in the second cell of the sheet a formatted text “Hey Google... Toc... Toc..” as shown in the following image.
With just a few lines of code, we get this spreadsheet. The source code described below is divided into two sections. The first dedicated to the connection with the G-Suite and generation of the spreadsheet
And the second where we fill the text to be inserted in the specific cell of the sheet and call the API.