Skip to Content
Technical Articles

How To Use Core Data Services For Enhanced ABAP Development

SAP HANA introduced a new way of managing data called the Core Data Services (CDS) that ABAP can now utilize to interface with data structures for SAP HANA. In the past, SAP NetWeaver incorporated data management tools in the form of ABAP data dictionary (DDIC) which stored the definitions of usable data objects, like tables or views. CDS goes one step further, pushing that layer of processing downwards, away from the SAP windows and into the database, making for a more efficient execution of code. How CDS operates is slightly different to the DDIC method, because of the way it stores data. It bases its processing on entity types and then links those via relationships built off of a very sophisticated SQL-like system. In order to use CDS, we’re going to have to start working with Eclipse, where the DDL editor for entities that CDS will be using exists.

STEP 1: Starting Eclipse in ABAP

If there’s no existing Eclipse installation, we can install a fresh copy of Eclipse (current version Mars) to the desktop. The Eclipse plugins for SAP are available from their update site ( To begin using ABAP in Eclipse, we’re going to start by opening the Eclipse project explorer and select the ABAP development environment. We’re going to have to establish a connection in order to build new ABAP objects (like CDS artifacts). We’ll first create an ABAP project which will create our connection. Inside that object we can create local artifacts which would be stored on the $TMP directory. Alternatively, for the purpose of explanation, we could use the ZDEV201 package which is a standard package available for ABAP development.

STEP 2: Using a CDS View

We’ll right click on ZDEV201 and select New-> Other ABAP Repository Object. In the resulting popup, check for the New DDL Source editor and select it to create the New DDL Source definition window. We’re going to start off by defining the basic properties associated with this view. We’ll define the technical name as ZDDLS_E2E_INV_COUNT_201 which will automatically fill in the project name for us (ZDEV201), and fill out the Description into something that best describes our view, in this case, Open Invoice Counting using CDS.

STEP 3: Transport Requests

As we click the Next button, we’ll be presented with a window asking us to select a transport request. We can either pick one that already exists or create a new one. These transport requests are used to log the progress of development tasks. The transport request can be collated with other transport requests from different devs and can finally be used in testing and production. The transport of CDS artifacts doesn’t need a deep dive into the database, but are managed at ABAP level.

STEP 4: Choosing a Template

The next window we’ll met is the template selection window which encourages us to define a basic layout for the view. While there exist complex layouts available for views with advanced concepts as joins and association, we’re only going to be focusing on the basic view for this example. the templates provide a basic framework for future development in ABAP that will be filled in as we proceed in order to get the system looking and functioning how we want.

STEP 5: Completing the Template

The selected template will offer us a few placeholders in javascript that we need to define. To do this, we’re going to open the DDL editor and select an ABAP specific repository name for the view, in this case we’ll be using ZV_INVCNT_201. Other fields like the text name and the view name are added automatically from these defined entries in the definition of the view. The target source for our invoice count will come from a table named sepm_sddl_so_invoice_header, but thanks to DDL’s code-completion, we only need to remember the first element or two elements in the name for the system to complete filling it out for us. To look at the specific elements making up a view, we can simply press F2 at any time.

STEP 6: Adding Necessary Associations

In order for the system to pick up on open invoices, it needs to have information such as the Customer ID, and the buyer and name associated with it. To add an association, it’s a simple matter of typing the name of the invoice header table variable and a dot, allowing us to access the elements that make up the available attributes. This syntax is similar to C-type languages in order to access data stored in data structures or classes. In this case, we’re going to add buyer as an association. After buyer, we’re going to type another dot and then get the attributes: company_name, busines_partner_id, and address_key.

STEP 7: Code Execution

In order to run our code, we can simply hit F8. The results are then presented to us in a browser. We can further refine the views into more relevant data sets if we so wish under aggregations or hierarchies. CDS allows us to utilize these functions to make for more easily digestible results as well as to create more easily definable artifacts.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.