ABAP in SAP S/4HANA: Report Creator
In this blog series, the goal is to focus on comparing older ABAP language features with a detailed explanation of the new ABAP syntax. The full posts were originally published on the SAP Community Network.
Oftentimes, access to SE16 or SE16n is not granted to SAP end-users. This program would allow an analyst to configure their own reports by pointing to existing CDS Views, Views or SAP Tables without writing code. They configure selection screens by importing an Excel spreadsheet. Lastly, create an SAP Transaction code which points to the report and assign certain users’ authorization to the new transaction. This program is suitable for those SAP installs with HANA.
In my previous blog, we combined an Excel upload, Dynamic Select Option generation, displayed on a Popup Screen and showed the results in ALV IDA created for HANA. To fully understand this Blog, it is recommended that you first read the above blog. However, if you want to skip the details, just go to the “Program Walkthrough” section below, see how it works, then get the code.
In this blog, we will enhance this program from the above blog, to make it re-runnable without re-importing the Excel file each time. We will also add a new column, where you may specify a Transaction Code, to allow the program to dynamically generate the report based on the Transaction Code entered and store many reports in your configuration table.
This Blog is organized as follows:
- Program Overview
- Original Program Flow Diagram
- New Program Flow Diagram
- Excel File Format
- New Enhancements
- New Z Table
- New Methods and Code
- Program Walkthrough
- Initial Setup
- Running the Report
- Complete Program
- SAP S/4HANA (SAP_BASIS 752, SAP_ABA 75C)
- SAPGUI Version 750
- Eclipse Version: Oxygen.3a Release (4.7.3a)
- Microsoft Excel (.xlsx capable)
Original Program Flow Diagram
New Program Flow Diagram
Excel File Format
The Excel file will contain either a Table, View or CDS View with the fields that you’d like to appear as Select-Options on your popup window. As an enhancement to the previous program, we will add a new row for a Transaction Code. This will allow us to execute the report via transaction code, without re-loading an Excel spreadsheet each time. In addition, we can store the configuration settings for many reports and their corresponding transaction codes.
Example Excel file with 3 reports:
Column A will contain 3 labels for each report:
- Transaction Code
- Table, View or CDS View Name
- Selection Fields
Column B contains the actual Transaction Code, Table/View/CDS View name and a list of the fields you want to be included as Select Options on the Popup window.
For example, the first report:
- B1 = The Custom SAP Transaction Code
- B2 = Table, View or CDS View Name
- B3+ = List of fields to be included as Select Options
For the CDS View “S_BOOKINGS”, include the fields CARRIERID, FLIGHTDATE, CUSTOMERID, LOCALCURRENCYAMOUNT on the popup window as Select-Options whenever we execute the custom SAP Transaction code ZBOOKINGS.
The popup window for the above, would look like the following:
This is just the first section of this blog. To continue reading, please head to the full piece on SAP Community Network. For any further questions regarding moving to SAP S/4HANA, please contact /N SPRO.