ABAP in SAP S/4HANA®: Dynamic Selection Screen with ALV IDA and Excel

When SAP created SAP S/4HANA®, it looked to combine and simplify a number of transactions and processes from previous versions like SAP Business Suite and SAP ECC. Changes also came to ABAP, the underlying development language on which SAP S/4HANA is built, as well.

I’ve recently published a series of blogs on the SAP Community Network (SCN) that details the ABAP changes in SAP S/4HANA from a Consumer Industries perspective, but many of the updates across other industries. In these blogs, I am going to walk you through some technical aspects of using ABAP in SAP S/4HANA. The goal will be to focus on comparing older ABAP language features with a detailed explanation of the new ABAP syntax and SAP S/4HANA features.

Below is a preview of the first of this series, where we combine an Excel upload, Dynamic Select Option generation, display on a Popup Screen and show the results in ALV IDA created for HANA. The complete post can be found on SCN, with plenty of screenshots and code snippets to help you understand just how ABAP has transitioned from legacy SAP systems to SAP S/4HANA.

This blog is organized as follows:

  1. Program Overview
    1. Program Flow Diagram
    2. Excel File Format
  2. Program Walkthrough
  3. HANA and CDS Views
  4. Method Tutorial
    1. Method Chaining and NEW
    2. Read Excel Data
    3. Build Select Options
    4. Popup Selection Screen
    5. ALV IDA
  5. Complete Program
  6. References

Software Versions discussed in this blog include:

  • 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 S/4HANA ABAP code update

New Program Flow Diagram

SAP S/4HANA excel program flow ABAP

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.

Here is an example Excel file with 3 reports:

SAP S/4HANA ABAP EXCEL file format

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:

SAP S/4HANA ABAP Excel File Format
This is just the first section of this blog. To continue reading, please head to the full piece on SCN. For any further questions regarding moving to SAP S/4HANA, please contact /N SPRO. 

By | 2019-03-26T11:37:45-04:00 March 26th, 2019|Categories: Blog|Tags: , |0 Comments

Leave A Comment