Skip to Content
Technical Articles
Author's profile photo Andre Fischer

Generating SAP Fiori table maintenance dialogs using the RAP Generator

Introduction

Since there is no SAPGUI access to the ABAP Environment of SAP Business Technology platform the classic table maintenance using transaction SM30 and SM31 cannot be used.

Instead it is possible to create SAP Fiori UI’s as a maintenance UI for a customizing table. This process is called Business Configuration for SAP Cloud Platform ABAP Environment 

and has been nicely described by Thomas Schneider in the following blog post Business Configuration for SAP Cloud Platform ABAP Environment .

With the latest version 2108 of the ABAP environment we have now all the bits and pieces that are needed to create table maintenance dialogs that offer the following:

  • Draft support for convenient data maintenance
  • Multi Inline capabilities that allow to edit several lines of your table at once
  • An enhanced transport API that provides a nice “Transport request” button in your SAP Fiori app
  • A single point of entry, that lists all your table maintenance apps, the so called Maintain Business Configurations App

But … how to create SAP Fiori UI based on one table or a table with a second table that contains some texts with the above described features is not self explaining and the information is scattered across multiple locations.

On the one hand you have to develop an appropriate RAP business object as described in the following set of tutorials Create a Factory Calendar Business Object with SAP BTP, ABAP Environment | Tutorials for SAP Developers.

On the other hand you have to implement additional business logic to implement the multi inline edit capabilities as described in the SAP Online Help Developing Transactional Apps with Multi-Inline-Edit Capabilities – SAP Help Portal

The process of creating an app is also shown in this animated gif.

Generating table maintenance apps

A while ago I published my RAP Generator that is able to generate a RAP business object based on one or more tables.

With the latest update of my generator there is now support for all the features needed to generate a SAP Fiori app that supports multi-inline capabilities, self registration in the Business Configuration App and code generation so that changes are automatically recorded in customizing transports.

And all of this (beside the support of transport requests) can now also be tested in the trial systems !

 

Prerequistes

You have to use an ABAP environment system in SAP BTP where you have to install the RAP Generator as described here:

https://github.com/SAP-samples/cloud-abap-rap/blob/main/README.md#download-and-installation

Please note that in the SAP BTP ABAP Environment Trial systems the RAP Generator is already installed for your convenience.

How to section

In this section I will describe how to generate the same app as described in the above mentioned tutorials that allows to maintain data for a holiday factory calendar alongside with description texts.

In addition this app is registered in the Business Configuration App and muti-inline support is added.

Last not least the code for persisting your changes to a transport request can be generated as well.

This however cannot be tested in the trial systems.

 

Step 1 – Create a package

We start by creating a package Z_DEMO_BUSINESS_CONF with ZLOCAL as the superpackage. Don’t forget to check the Add to favorite packages check box

Step 2 – Create a class

Now we have to create a class ZCL_RAP_GENERATOR_BUSI_CONF by creating a copy of the sample console application /DMO/CL_RAP_GENERATOR_CONSOLE that is part of the package that contains the RAP Generator.

Please note:

You will find the latest version of the RAP Generator in the package /DMO/RAP_GENERATOR in each trial system.

 

Step 3: Edit the JSON file

In the class you will find a method get_json_string( ) where you have to copy and paste the JSON file shown below:

In this JSON file you have to maintain appropriate values for the following properties:

“package” : “Z_DEMO_BUSINESS_CONF”  This parameter contains the name of the package that we have created before.

 

The name of our entity will be Holiday with a child entity HolidayText.

 

The important parameters that tell the RAP Generator to generate a table maintenance dialog app are the following:

“dataSourceType”:”table”   tells the RAP Generator that the datasource is of type table.

“multiInlineEdit”:true  lets the RAP Generator add a singleton as the root node of our RAP business object

“isCustomizingTable”: false  Since we are working on the trial systems we have to set this parameter to false. In a licensed ABAP Environement system you would want to set this parameter to true.

“addBusinessConfigurationRegistration”: true tells the RAP Generator to register the service binding of your RAP business object using the business configuration API so that it will be listed in the Business Configuration App.

“implementationtype”: “managed_semantic” Customizing tables are tables with a semantic key. The implementation type is managed and the key will be provided when entering the data in your table.

“bindingType”: “odata_v4_ui” The multi edit capability and the option to be registered in the Business Configuration app requires an OData V4 UI service binding.

 

{
    "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json",
    "namespace": "Z",
    "package": "Z_###_YOUR_PACKAGE",
    "dataSourceType": "table",
    "multiInlineEdit": true,
    "isCustomizingTable": false,
    "addBusinessConfigurationRegistration": true,
    "implementationtype": "managed_semantic",
    "bindingType": "odata_v4_ui",
    "prefix": "##_",
    "suffix": "_##",
    "draftenabled": true,
    "hierarchy": {
        "entityName": "Holiday",
        "dataSource": "/dmo/fcal_holi",
        "objectId": "holiday_id",
        "localInstanceLastChangedAt": "local_last_changed_at",        
        "etagMaster": "local_last_changed_at",
        "children": [
            {
                "entityName": "HolidayText",
                "dataSource": "/dmo/fcal_holi_t",
                "objectId": "holiday_id",
                "localInstanceLastChangedAt": "local_last_changed_at",
                "etagMaster": "local_last_changed_at"
            }
        ]
    }
}

 

Step 4 – Copy the JSON file into the ABAP source code and run your class

After you have maintained the JSON file and have copied its content in the string that is returned by the method get_json_string( ) you can simple hit F9 to run it.

The RAP Generator will provide a list of messages (typically some warnings) that you will also see when you open the generated code in ADT.

 

Step 6 – Check the generated repository objects

When you open the package you will see the whole list of repository objects that have been generated.

 

 

Step 7 – Publish the service binding locally

Open the generated service binding ZUI_AF_HOLIDAY_S_01_O4 and press the Publish button.

You will now see that the service contains four entities

Holiday – which contains the holdiday days

HolidayText – which contains the language dependend descriptions

Holiday_S – which is the Singleton entity that has been generated in order to enable the multi inline edit feature. The RAP Generator simply takes the name of the actual root entity and adds a “_S” which denotes “Singleton” to the name it.

Language – The RAP Generator adds an entity Language as a value help if a field of type SPRAS is part of any of your entitites. Likewise it would add an entity for Currency or Unit of Measure if needed.

 

Step 8 – Test your service

You can start the Business Configuration App simply from whithin ADT. For this you have to right-click on your project and select Properties.

 

On the following screen click on ABAP Development and there on the URL that is denoted as System URL.

 

 

By clicking on this URL the SAP Fiori Launchpad of your ABAP environment opens. Here you have to select the tile Maintain Business Configuration.

 

 

This now opens the Business Configuration App where you should see the app Holiday_S_01 maintenance that you have just generated and published.

Please note:
When you do not see the app listed here please check if you have published your service locally. By publishing the service locally the appropriate authorizations for viewing it are added to the business catalog that is part of your Developer role.

When clicking on the list entry a SAP Fiori Elements app (similar to the preview app) will be started. But since multi edit is enabled it automatically will skip the “virtual” entity Holiday_S which is based on the singleton entity.

Here you can add mulitple rows to the Holiday entity. All the data you enter is saved automatically as a Draft. And it is possible to download the data as an Excel and paste multiple new values from such a Excel template back into your system.

Paste multiple entries

Pasting multiple entries works as follows.

  1. Select the data from your Excel
  2. Press the button Paste.
  3. This opens the following dialogue
  4. Paste the selected data using Ctrl+V

 

Save data to a customizing transport

When you have chosen the parameter

“isCustomizingTable”: true

in your JSON configuration file you will see a button in your app that will allow you to select a customizing transport request.

 

 

 

Assigned tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Pankaj Yadav
      Pankaj Yadav

      Hi Andre Fischer

      It's very much needed information. Thanks for this blog.

      My concern/question is ... when we have this maintenance table working in FIORI launchpad of ABAP... Does it make sense to give access of this to a business user(not a developer) so that he/she can maintain entries?.. i mean this all functionality is relevant for developers only or for any other users as well.

      Please suggest.

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      I think it depends on who is doing the customizing settings in your system. But the Maintain Business Configuration App is not a replacement for the SAP Fiori Launchpad.

      So you deploy SAP Fiori Apps for End Users on the Fiori Launchpad (either on the ABAP Environment System or on BTP) and the Business Configuration App will be used to list all this kind of apps that are not used frequently to perform customizing.

       

      Author's profile photo Pankaj Yadav
      Pankaj Yadav

      Thanks Andre for your answer.

      My requirement is giving customizing option for tables which are not frequently changed. For example: like maintaining regions in a table. So, as per your view, business config app will be fine for this. Do you have any further suggestions?

      Author's profile photo Suresh Babu
      Suresh Babu

      Hi Andre

      Thanks for the nice Blog. Infact this will be very useful to replace GUI based table maintenance generator for cloud ready deployments.

      We can also use In-App extension option of Custom Business Objects to generate Fiori App for this scenario. However, we should start the process for newly created DB tables. This approach mentioned here can be used for existing tables.

      @Pankaj Yadav: As Andre mentioned configuration can be used by business user or any type of user based on your requirement. You may assign the newly created app to catelaog/group/Roles which you can assign to the user groups that you want to provide access to.

      Kind Regards

      Suresh

      Author's profile photo David Wirawan
      David Wirawan

      Hi Andre

      Thank you for the nice blog. I try to download and follow the step in this Blog. But seems the class /DMO/CL_RAP_GENERATOR has error or on development progress?

      Thank you

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      Which URL do you use to download it and in which kind of system do you try to install it.

      The scenario here only works in an SAP BTP ABAP Environment system. The process of download and installation is described in the GitHub repository readme file

      https://github.com/SAP-samples/cloud-abap-rap/blob/main/README.md#download-and-installation

      Syntax errors can occur

      a) when you try to install the main branch (which is meant to be used in cloud) in an on premise system because there the XCO library does not contain the latest features that are available in the cloud.

      b) when you try to install the on premise version in an cloud system because there the use of the on premise version of the XCO libraries is not permitted.

      If you just want to try it out you can also do so in the ABAP environment of SAP BTP Trial.

      It’s Trial Time for ABAP in SAP Business Technology Platform | SAP Blogs

      Kind regards,

      Andre

       

       

      Author's profile photo David Wirawan
      David Wirawan

      Hi Andre

       

      Thank you, downloaded the correct path, it's working fine.

      Author's profile photo SURYAPRAKASH REDDY YARABOLU
      SURYAPRAKASH REDDY YARABOLU

      Hi Andre,

       

      Thank you for the nice blog. I am developing an object by fallowing your blog.

      may i know what is this Schema and how it works here.

      No internet connection to my sap system, will this work in that case?

      "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json",

       

      Regards,

      Surya

      Author's profile photo Gabby Isidro
      Gabby Isidro

      Hey Andre,

      Thanks for the blog, few questions.

      1. Can i just confirm that this only works at Cloud Platform with ABAP 2108 currently? and so is there a chance to implement this on-prem ABAP 2020? or the ABAP version must be at 2108 also? and we shall wait for the on-prem RAP Generator 2108...

      2. If we implement FIORI Table maintenance on our current version ABAP 2020, we can just manually do managed RAP, so my question is how to tag it to a Transport?

      Author's profile photo Umut Yazici
      Umut Yazici

      Hi Andre Fischer , thanks for this very useful blogpost.

      But I can't use my ZTABLE in your RAP generator. How can we use our Z tables with this logic?

      Note: I'm trying on S/4Hana On Premise 2020 FPS01.

      Error:

      PUT operation failed.
      Class name:
      CX_XCO_GEN_PUT_EXCEPTION
      Source position:
      Line 25 of IF_XCO_CP_GEN_D_O_PUT~EXECUTE in CL_XCO_CP_GEN_O_PUT
      Additional messages:
      DDLS ZUYI_RAPCUSTOMERMAST: Use of Database Table ZCUSTUSERMAST is not permitted.
      DDLS ZUYC_RAPCUSTOMERMAST: The data source "ZUYI_RAPcustomermast" does not exist or is not active
      DDLS ZUYI_RAPCUSTOMERMAST: DDLS ZUYI_RAPCUSTOMERMAST was not activated
      DDLS ZUYC_RAPCUSTOMERMAST: DDLS ZUYC_RAPCUSTOMERMAST was not activated

       

      Author's profile photo Ishita Shah
      Ishita Shah

      Hi Andre,

      Thank you for the blog. I tried the same steps in my on-premise platform to create table maintenance and could generate the same. But I have few questions:

      1. Is the "multiInlineEdit":true option available in on-premise? Because when i tried the BO gave the error of multiInlineEdit not available.
      2. Also  if my customizing table has BUKRS as field then, how can i get search help on the same while creating new entry to the table through RAP Generator.
      3. I donot have the class  /DMO/CL_RAP_GENERATOR_CONSOLE  in my /DMO/RAP_GENERATOR package hence i used cl_xco_cp_adt_simple_classrun to generate the BO. Does that make any difference?

      Thanks

      Ishita

      Author's profile photo Paul McFarling
      Paul McFarling

      Is there anything similar for on premise? Custom Business Objects doesn't seem to be it. Still slugging away building view clusters.