ABAP Cloud - Tables
What about accessing tables in ABAP Cloud? In this article, we will look at the strategy for finding alternatives.
Table of contents
In this article we will look at the use of tables in our development. What was previously considered standard is no longer the case and we have to look for alternatives.
Introduction
As an ABAP developer, you probably know almost all the tables in your module by heart and can assign each field to its meaning and purpose. Even if you don't speak German, you have gotten used to the unpronounceable names and have learned them. If we look at financial accounting, there is the BKPF table for the header and the BSEG for the positions. An important element is the BUKRS (company code), which appears in the key and is located in table T001.
Core Data Services
With ABAP Cloud we can start learning again, as we are switching from the familiar tables to the new Core Data Services. Besides the learning disadvantage, it also brings some advantages. The Core Data Services now have new and descriptive long names so that we can better assign them to their purpose and module. This turns table T001 into the Core Data Service I_CompanyCode.
The Virtual Data Model now makes it possible to create a layer that can be easily reused, while at the same time retaining the option of flexibly expanding, adapting or even replacing the tables underneath.
Search
Finding the right Core Data Service can be quite easy, or it can be very difficult. Currently, there is not a suitable Core Data Service for every old table.
Successor
The easiest way is to look at the actual table. For example, if we look at the company codes (T001), you will find the corresponding information in the C1 contract in the "Properties" view in the "API State" tab.
The "Release State" tells us that the object is not released, but that there is a successor (I_CompanyCode). About "Use in Cloud Development" You will also see that we can use the CDS view in ABAP Cloud development.
Cloudification Repository
The information is not always as easy to derive as from the properties of the object. If your S/4 HANA release is too low, then the Core Data Services may not have been released yet or the information is missing in the system. To help you find the right view, there is also the Cloudification Repository. This is a repository where you can find the latest releases.
In the repository you will also find the Cloudification Repository Viewer from SAP, where you can search for successors. Alternatively, you can also use our variant.
ABAP Test Cockpit
The Cloudification Repository can be used to activate the "Usage of Released APIs" check in your ABAP Test Cockpit and to store the URL. You can find further information on this in this article.
Field mapping
The last challenge is to map the familiar BUKRS to the new field, because in addition to the long names for the tables, there are now also new and descriptive long names in the Core Data Services. So how do you get the relevant information?
BSEG
As an example, let's look at the CDS view "I_OperationalAcctgDocItem", which is the successor to the BSEG. There are three levels up to the actual table. So is our BUKRS from the database really behind the field called CompanyCode? In this example it is very likely, but a field is not always easy to assign.
CDS Field Mapping
We would therefore like to introduce you to the new application "CDS Field Mapping". This is an extract from the system which takes the released Core Data Services from the Cloudification Repository, checks the hierarchy and maps the current Core Data Service field to the database field. The evaluation checks each level and only shows fields that can actually be assigned. You can search for entities and/or fields in the tool.
Fields that cannot be clearly assigned are left empty and you will only find the field from the Core Data Service. The mapping is stored as a JSON file in the GitHub repository, where you will also find further information about the extractor. We would like to present the project again in an additional article.
Hint: This is currently a beta version and the extractor may still have minor bugs, especially when it comes to CDS functions in the hierarchy. This means that more fields remain empty than could actually be mapped.
Use
In ABAP Cloud, the use of Core Data Services for SAP standard tables is mandatory, as the classic tables are no longer released for reading. For the reasons stated above, Core Data Services are used. Changing content of standard tables only works via provided RAP objects or, in the case of TIER-2, via released BAPIs. At the same time, authorization checks are also delivered with CDS views, so that you as a developer no longer have to remember to implement a check and the user only sees what he has authorization for.
You should also use Core Data Services for customer-specific tables, especially if you want to share the views with other software components via a C1 contract. You can make changes directly to the table as usual or via a RAP object on the table.
Conclusion
Until we have learned all the Core Data Services and fields again, the various tools such as the ABAP Development Tools, the Cloudification Repository or the CDS Field Mapping will help us find the right objects.