Skip to Content

Creating basic/interface views in Open Core Data Services

0 %
Creating basic/interface views in Open Core Data Services
// Explore More Tutorials

Creating basic/interface views in Open Core Data Services

20 min.
Creating basic view in Open Core Data Services also know as interface view

You will learn

  • How to create a basic view on top of data content in the demo table SCARR from ABAP system

Step 1: Prepare the ABAP perspective

To prepare the ABAP perspective, make sure that your Eclipse framework from the S/4HANA instance is opened in the ABAP perspective:

Basic view from the ABAP perspective

With the ABAP Eclipse perspective displayed, make sure you are in the Project Explorer tab. Here you will create in the TMP-SHA Package a new repository ABAP object for type DDL source.

Select the package TMP-SHA. Right-click on the selected package, select New and then select Other ABAP Repository Object. In the opened ABAP Repository Object window scroll down to the folder Core Data Services. Expand the folder, select DDL Source and click Finish.

 Basic viewBasic view

In the new DDL Source (Specify a value for field Name) window, confirm that the values for Project and Package are as shown in the table below.

Field Name Value
Project S4H_100_sha_en
Package $TMP
Basic view

Enter the values for Name and Description then click Finish

Field Name Value
Description Northwind OData Service
Basic view
Step 2: Change data source

In the New DDL Source (Templates Select one of the available templates) window, select Define View and click Finish.

Basic view

Code for the newly created view named ZXSHI_AIRLINE is generated:

Basic view

At line 5 of the generated code, replace data source name with the ABAP table scarr. To achieve this, delete the text data source name and then enter sca followed by the combination Ctrl + Space bar. A window will appear when you will select scarr-data.

Basic view
Step 3: Edit table

Open the ERP System (by clicking the SAP Log On icon) S4H Client 100.
Enter the User and Password values below and click Enter.

Field Name Value
Name sha
Description Welcome1
Basic view

In the next window enter the ABAP transaction se16, then click Enter.

Basic view

In the next window enter scarr as the Table Name and click the Table Contents icon.

Basic view

The content of the table scarr will be displayed. Confirm that the table has 18 entries.

Basic view
Step 4: Insert columns

Now switch back to the project explorer view of the Eclipse ABAP perspective. You will now enhance the code by inserting the columns of the table scarr. To achieve this, position the mouse pointer before the bracket near the table name scarr, press Ctrl + Space bar. Within the displayed window select Insert all elements and click Enter.

Basic view

All the columns of the table scarr are now inserted in the previous code. Enhance each column with an Alias as following:

Line number Value
Line 6: scarr.carrid as Airline,
Line 7: scarr.currcode as AirlineLocalCurrency
Line 8: scarr.url as AirlineURL

Expand the folder $TMP-SHA in the left panel, then expand its subfolder Core Data Services. You will see in the Data Definitions subfolder the newly created basic view named ZXSHI_AIRLINE.

Basic view
Step 5: Check view

To display the content of the basic view ZXSHI_AIRLINE, in the left panel, select and right-click on the view ZXSHI_AIRLINE and select Open With > Data Preview.

Basic view

In the newly opened window, the content of the basic view ZXSHI_AIRLINE is displayed , showing 18 rows in three columns.

Basic view
Step 6: Edit fields

Switch back to the generated code of the basic view. There you will alter the lines marked in blue in the image below.

Basic view

In the code area, replace text as follows:

Line number Value
Line 1: sql_view_name with ZXSHIAIRLINE
Line 4: Airline, private.. with Airline

After Airline, insert a new annotation as follows:

Basic viewBasic viewBasic viewBasic view

After line 5, insert line 6 with a new annotation:

@Analytics: DataCategory: #DIMENSION
Basic viewBasic viewBasic view
Step 7: Insert annotations

Insert two new annotations as follows:

  • After the line including scarr.carrid as Airline insert @Semantics.currencyCode: true (see number 1 in the following screenshot).
  • After the line including scarr.currcode as AirlineLocalCurrency insert @Semantics.url: true (see number 2 in the following screenshot).
Basic view

In line 3 of the code, replace CHECK with NOT_REQUIRED, as shown here.

Basic view
Step 8: Check complete code

In the right panel, select and right-click on the view ZXSHI_AIRLINE, select Open With > Data Preview

Basic viewBasic view

Note: You can copy this content from here and paste it to the code editor of your ABAP perspective as well instead of enhancing the generated code on your own:

@AbapCatalog.sqlViewName: 'ZXSHIAIRLINE'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Airline'
@VDM.viewType: #BASIC
@Analytics.dataCategory: #DIMENSION
define view ZxshI_Airline as select from scarr{
key scarr.carrid as Airline,
@Semantics.currencyCode: true
scarr.currcode as AirlineLocalCurrency,
@Semantics.url: true
scarr.url as AirlineURL    


Although SAP offers trial editions for free you will still have to cover the costs for running these trial editions on AWS. This tutorial is part of the S/4HANA Core Data Services. More information can be found in these documents.

Next Steps

Back to top