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:

  1. Program Overview
    1. Original Program Flow Diagram
    2. New Program Flow Diagram
    3. Excel File Format
  2. New Enhancements
    1. New Z Table
    2. New Methods and Code
  3. Program Walkthrough
    1. Initial Setup
    2. Running the Report
  4. Complete Program
  5. References

Software Versions:

  • SAP S/4HANA (SAP_BASIS 752, SAP_ABA 75C)
  • SAPGUI Version 750
  • Eclipse Version: Oxygen.3a Release (4.7.3a)
  • Microsoft Excel (.xlsx capable)

Program Overview

Original Program Flow Diagram

SAP program flow diagram

New Program Flow Diagram

SAP 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. 

By | 2019-08-07T10:58:26-04:00 August 7th, 2019|Categories: Blog|Tags: , |0 Comments

About the Author:

Leave A Comment