Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
monicapimiento
Associate
Associate

This blog post will explain how to expose a CDS view as an API using developer extensibility in SAP S/4HANA Cloud Public Edition to be consumed in the SAP Business Technology Platform

Screenshot 2024-02-21 at 17.17.42.png

 

Technical Procedure

Extending our solutions allows you to differentiate yourself from the competition, simplify processes, and adapt the software according to the specific needs of your business.

In the case of SAP S/4HANA Cloud Public Edition, we have three types of extensibilities:

  • Key user extensibility through built-in capabilities
  • Developer extensibility through custom ABAP code in SAP S/4HANA Cloud Public Edition
  • Side-by-side extensibility through SAP Business Technology Platform

You can find further information about all extension offerings here

Extensibility and Integration S/4HANA Cloud Public EditionExtensibility and Integration S/4HANA Cloud Public Edition

Typically, details can be found regarding instances where the SAP S/4HANA Cloud Public Edition is extended using a single kind of extension. Here, we're dealing with developer extensibility, which, given the right configuration, can be revealed through an Identity and Access Management (IAM) application. This can then be linked to the SAP Business Application Studio as a side-by-side extension.

 

Prerequisites

  • SAP S/4HANA Cloud Public Edition system, access to the development tenant (80), and the developer role assigned to the business user: SAP_BR_DEVELOPER
  • Eclipse with ADT (ABAP Development Tools)
  • SAP Business Technology Platform with a subaccount in the Cloud Foundry environment, with access to the SAP Business Application Studio

 

Process

This blog will cover both Developer extensibility and side-by-side extensibility

Developer Extension

  1. Installing the ABAP development tools Eclipse
  2. Connecting to the SAP S/4HANA Cloud ABAP environment
  3. Finding the Object in the SAP Business Acceleration Hub
  4. CDS view
  5. Data Definition
  6. Service Definition
  7. Service Binding
  8. Consuming Services in UI

Side-by-Side Extensibility

  1. SAP S/4HANA Cloud Public Edition Communication Management Configuration
  2. Connect the SAP Business Application Studio and the SAP S/4HANA Cloud System

 

Developer Extension

1. Installing the ABAP development tools in Eclipse

After installing Eclipse, go to Help -> install new Software.

For installing the latest tools, please enter the URL https://tools.hana.ondemand.com/latest

Select ABAP Development Tools and after clicking on Next and confirming the Licenses agreements finish the installation. 

Installing new ABAP Tools in EclipseInstalling new ABAP Tools in Eclipse

More information can be found here

 

2. Connecting to the SAP S/4HANA Cloud ABAP Environment

Go to Eclipse and create a new ABAP Project. After this, you can establish a service instance connection by entering the ABAP service instance URL, for example https://my12345.s4hana.ondemand.com (without ui) and selecting Next. 

Now you will need to log on the system, please use the default browser by selecting Open Logon Page in Browser or Copy Logon URL to Clipboard to use another browser.

After correct Login, create the project by selecting Next. Then, specify the logon language and the ADT Project name and choose Finish.

New ABAP Cloud ProjectNew ABAP Cloud Project

Login into the S/4HANA Cloud Public Edition SystemLogin into the S/4HANA Cloud Public Edition System

After correct logon, the following message will appear on the browser. Now you can go back to Eclipse.

login.png

 

3. Finding the Object in the SAP Business Acceleration Hub

To review the available APIs, go to the SAP Business Acceleration Hub visiting https://api.sap.com and choose the one you need. 

After entering the page, choose the product to explore, in this case SAP S/4HANA Cloud Public Edition, then go to developer extensibility, Business Object Interface, and choose the Business Partner object. In the general information of the Business Object Interface, you will find the object ID. Copy it.

Business Partner Business ObjectBusiness Partner Business Object

Object InformationObject Information

 

4. CDS View

CDS or Core Data Service, refers to virtual data models of SAP HANA, used to define and consume semantic data models on the central database of the application server AS ABAP. A CDS Entity is basically source code in the CDS data definition, DDL or Data definition language, and DCL or Data control Language, are the base of this data models.  Further information can be found here

 

5. Data Definition

Click on the package you want to use, and go to file > New > Other

Search for the ABAP Data Definition and press Next.

After Naming the projection View and referencing the searched object: I_BUSINESSPARTNERTP_3 the projection code will be automatically generated.

Data DefinitionData Definition

 

There are various types of CDS projection views, with their own feature set and own syntax. For defining the type of view, use the syntax statement PROVIDER CONTRACT for more information please refer to the SAP Help portal.

After defining provider contract transactional_query , save and activate the changes.

 

@EndUserText.label: 'Business Partner Projection View'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define root view entity ZXXXXXXXXXXXXX provider contract
transactional_query asprojection on I_BusinessPartnerTP_3
{


   key BusinessPartner,
   BusinessPartnerUUID,
   FullName,
   BusinessPartnerForEdit,
   BusinessPartnerGrouping,
   BusinessPartnerCategory,
   CreatedByUser,
   CreationDate,
   CreationTime,
   LastChangedByUser,
   LastChangeDate,
   LastChangeTime,
   FormOfAddress,
   FormOfAddressPerson,
   FirstName,
   LastName


}

 

6. Service Definition

A service definition refers to which CDS entities of a data model must be exposed so that a specific business service can be enable.

For creating a new service definition, go to New > Other repository objects, and search for Service Definition. Choose the package, name the new service, add a description, and choose Definition as source type. Finally, reference the object I_BUSINESSPARTNERTP_3 . The system will automatically create the service with the CDS entity. For more information, please refer to the ABAP - Keyword Documentation on help.sap.com

Now save and activate the service definition.

New Service DefinitionNew Service Definition

 

7. Service Binding

The service binding or business service binding is an ABAP repository object that connects a service definition to a client-server communication protocol.

In Eclipse, go to New > other repository object and search for Service Binding. To correctly create the binding, choose the package, add a name and description. In Binding Type, choose one of the options and link the service definition you just created by clicking on browse and searching for the correct one.

After a correct creation of the service binding, save and activate the changes, and to finish, publish it locally.

New Service BindingNew Service Binding

 

8. Consuming Services in UI

One of the needs of this example is that the service created is available for a specific type of business role, therefore, it is necessary to add this service to an IAM app, which is assigned to a business catalog. This becomes more relevant since it is only related for Identity and Access Management (IAM). You have two options: You can either assign the service to an already created IAM, or create the new IAM to add the service to it.

Procedure
  1. Creating an app
  2. Creating a business catalog
  3. Creating a business role template

To make the complete process, please follow the next SAP help link, remember to link the service you created, save, activate the changes, and publish the application.

IAM AppIAM App

 

Side-by-Side Extensibility

Side-by-side extensions are software applications that run externally to the main core application. 

These kinds of extensions provide freedom of development, including the ability to code in different programming languages such as ABAP or Java. They can also be integrated at different levels such as UI level, application logic level, or data level. The interaction of these extensions with SAP S/4HANA Cloud Public Edition is given through the standard SAP APIs. 

Side-by-side extensions can potentially run on any runtime application platform. However, the use of SAP's own platform, SAP Business Technology Platform, is recommended.

For further information visit: the SAP Extensibility Explorer for SAP S/4HANA Cloud

 

1. SAP S/4HANA Cloud Public Edition Communication Management Configuration

The SAP S/4HANA Cloud Public Edition system can be configured with three types of connections: SAML Assertion Authentication, Basic Authentication and Client Certificate Authentication. In our example, we will use SAML Assertion Authentication.

SAP S/4HANA Cloud Public Edition has the following functionalities that must be correctly configured: 

  1. Communication arrangement: Basically, this allows communication with the remote system, configuring the metadata for the service configuration.
  2. Communication system: This involves the technical information needed for communication, which includes identity, user information, and certificates.
  3. Communication user: It represents a technical user type, related to the communication system. This is created for a particular scenario.
  4. Communication scenario: The scenario defines the communication between your SAP system and external systems, connecting inbound and outbound services.

 

2. Connect the SAP Business Application Studio and the SAP S/4HANA Cloud Public Edition System

Screenshot 2024-02-21 at 17.16.57.png

 

For the step by step please follow this link 
 
To avoid common errors, make sure to configure the correct authentication type in the BTP in this case SAML and as for the SAP S/4HANA Cloud Public Edition system make sure that the service created and added to the business catalogue is assigned to the communication protocol visible from the BTP.

Don’t hesitate to leave a comment and check out our new community page to ask your questions and engage with the experts. Follow the PSCC_Enablement tag to stay up to date with our latest blog posts.

More Information on SAP S/4HANA Cloud Public Edition:

  • SAP S/4HANA Cloud, public edition, release info here
  • Product videos on our SAP S/4HANA Cloud Public Edition and SAP S/4HANA YouTube playlist
  • SAP S/4HANA PSCC Digital Enablement Wheel here
  • Early Release Webinar Series here
  • Inside SAP S/4HANA Podcast here
  • Best practices for SAP S/4HANA Cloud Public Edition, here
  • SAP S/4HANA Cloud Public Edition, Community: here
  • Feature Scope Description here
  • What’s New here
  • Help Portal Product Page here

Follow us on @SAP and #S4HANA, and myself on LinkedIn .

 

 

3 Comments
murthy_v
Employee
Employee

Very nice blog with detailed steps

Babu_Lal_Limba
Product and Topic Expert
Product and Topic Expert

Very good and a helpful blog for a beginner on the topic. Keep it up

shiva_13
Explorer

Thank you @monicapimiento, appreciating your efforts.