Table maintenance in S/4HANA on premise or private cloud
Adding data to a custom table is a common task. Data should be transported into production instead of letting the customer insert it there directly. For the “old” SAP ERP world there is the table maintenance tool. This tool is also available in S/4HANA on premise / private cloud. In S/4HANA, there is also a Fiori app available that allows to maintain business data. This approach is based on the ABAP RESTful Application Programming Model. Both get the job done, but when there is a Fiori app available, why use the SAP Gui alternative? In this post I’ll show how to create table maintenance for SM30 and the Business Configuration Maintenance App.
Sample table
For the example, I’ll use a simple table for storing event data. The table consist only of a few fields with no reference to other tables.
The delivery class type is C and table maintenance is allowed.
The table field location points to a domain with pre-defined values.
To enable consultants to provide customize data, SAP Gui can be used. For this, a table maintenance dialog is created.
The wizard asks for some needed information.
The parameters are explained at SAP Help:
With a click on create, the dialog is created. The created objects are listed in the function group provided earlier (here: ZSM30_FUGR_LOC).
To enter the data into the table, the consultant calls transaction SM30 and enters the table name.
Custom data can be entered, deleted, changed and later transported to production.
Note: the possible values for location are taken from the domain and shown as a dropdown.
S/4HANA: Business Configuration Maintenance
Maintaining custom table data is also possible in S/4HANA. With S/4HANA you get the option to use the custom business configurations app (BCMA). While maintaining the data via SM30 still works, when you get the option to use RAP and a nice Fiori app to maintain data, why still use SAP Gui? Let’s use BCMA as the new preferred standard.
The documentation on how to use the app and what is needed on the developer side is hidden in the SAP Help documentation for “Creating Business Configuration Apps with ABAP RESTful Application Programming Model and Custom Business Configurations App”. Two parts are needed to make the magic work: a business configuration maintenance object (BCMO) and the business configuration maintenance app. The first is a RAP object created around your custom table, the app is delivered by SAP.
Good news: ADT comes with a wizard to create the BCMO for your custom table.
Requisites
A BCMO comes with a few prerequisites:
- Service binding: OData V4 – UI
- CDS root entity with draft
- Supported tree structures
- Only client-dependent table
The ADT wizard lists additional prerequisites like:
- Client key field
- Delivery class C
- Allow data maintenance
- Timestamp field: ABP_LASTCHANGE_TSTMPL
The ADT wizard requirements regarding ABP_LASTCHANGE_TSTMPL is optional. The table used in the previous example can be used without adjustments. However, a workaround will be used. It is better to add some timestamp fields.
Business Configuration Maintenance Object
Generate the business configuration maintenance object. Select the table in ADT and open the context menu. Select Generate ABAP Repository Objects.
Select Maintenance Object.
The wizard will show what will be created and the names used. If you want to change anything here, do it now.
The information needed later for activating the service is the service binding.
Normally there is no need to change anything. Accept the values and be aware that several objects are going to be created!
In ADT you can see that the folders are now filled with all the objects.
Note: In ADT you can see that the folders are now filled with all the objects. These are already many objects that are “only” needed to provide data for a table. If you now do the same for more tables, you’ll get more objects. Adding the RAP objects needed for your main projects, it can get very confusing. You might think of putting your table maintenance objects into a separate package. Maybe even one package per table.
Service activation
The wizard creates everything needed to expose the RAP BO as a OData v4 UI service. It is however not exposing the service.
This must be done manually. And no: not in ADT. Trying to publish the service created in ADT results in an error.
Log on to your S/4HANA system via SAP Gui, run transaction /n/IWFND/V4_ADMIN.
Select “Publish Service Groups”
Inform the system alias and the service group ID. In my case: ZUI_EVENTTABLERAP_O4
Load the service groups by clicking on “Get Service Groups”. Select the item and publish the service group.
Back in ADT the service is now published.
One of those cases where the I in ADT stands for integrated.
Business Configuration Maintenance App
The above steps configured the RAP BO for the BCMO and published the OData v4 UI service. The app can be opened e.g. via preview, but this won’t help as there is not edit option included.
Adding the BCMA to the FLP as described in the app documentation gives access to the app tile.
Opening the application shows an entry for the event table.
Note: the BMCA uses the language of the current logged on user to load the name and description. In case your language is DE, but the BCMO was created in EN: you will see nothing. Just an empty line. The app contains no fallback to a different language. In case you have e.g. 30 BMCO in EN created, and your consultants are logged in with DE: this will create problems. Maintain these languages or ensure the languages match.
Selecting the entry opens the detail page for the table. The table entry will be listed. As nothing is yet added, the table is empty.
The BMCA offers an edit button. Activating the edit mode allows to add data.
Editing is done using drafts. That’s a nice feature. Mass upload is possible. For instance, using Excel, the data can be created in Excel and pasted from clipboard to the app.
Copy data from Excel
Use the past option to insert the values.
Save draft, provide a transport and the data is persisted.
In ADT you can preview the table data and validate that the data is written to the table.
Conclusion
Table maintenance with custom data works in S/4HANA using the traditional solution, but is also possible using RAP and an app. As you can see from the sample, the BCM approach ignores the fixed values of the domain value location. There is no dropdown or value help shown in the Fiori app. You can also insert any data you like: there is no input validation against the domain values happening. If this is needed: you must adjust the RAP object. Governance is mandatory to ensure the BCMO approach works. A lot of RAP objects are created for one table. A package concept can provide help. You have to control the language of the app and users or provide a translation of the fields. Currently, the classic approach works better. Yet, the Fiori approach allows to insert data without using SAP Gui.
0 Comments