Appearance
SAP S/4HANA Extensibility
If you have to extend a SAP S/4HANA system, the following content will help you to understand the possible extension methods and point out the relevant APIs, that are important for the integration with the SAP Business Technology Platform.
Read more...
Overview
In-App extension and Side-by-Side extension
First, SAP S/4HANA has two major extension methods. As shown in the figure below, it is an In-App extension that is an extension within SAP S/4HANA, and a Side-by-Side extension that is an extension that uses SAP Business Technology Platform.
The basic concept is not to extend using only one of them, but to use them according to your requirements. This keeps SAP S/4HANA clean and provides a more flexible and rich choice of development and execution infrastructure in the cloud so that you can continue to benefit from the added features of SAP S/4HANA release upgrades.
In other words, In-App extension is performed by means such as parameter setting and key user extension that has a small effect on upgrade, and Side-by-Side extension is used for add-ons, mobile, IoT, machine learning, chatbots, integration, and the scenario that it is difficult to implement by only SAP S/4HANA. From the perspective of the target users, it is suitable for deploying applications in the cloud that are used by not only employees but also partner companies and consumers and can take advantage of the benefits of a cloud environment that continuously provides scalable resources and new functions.
SAP Extensibility Explorer for SAP S/4HANA Cloud
Explore SAP S/4HANA Cloud Extensibility options by leveraging the sample scenarios from SAP.
How to find the right Extensibility Option?
With the availability of the on-stack ABAP runtime, the classic extension takes place primarily in the on-stack environment, although simpler requirements can also be solved via InApp Extensibility (KeyUser).
If the solution includes external user groups, identity provisioning is usually carried out by the UDINA BTP in the form of SAP Customer Identity and Access Management (CIAM) or Microsoft Entry ID.
Offering solutions across platforms, possibly with the option that customers can even subscribe to them from their BTP account, then we are talking about SaaS and SAP BTP (CAP), as multi-tenancy solutions.
The following sequence diagram can help to find the right S/4HANA Extensibility option depending on the use case:
Preference
The more closely the solution is integrated with SAP S/4HANA and the data is to be used across the board, the greater the advantages for on-stack development. This will become even more important in the future with the further development of the ABAP cloud stack.
APIs and events
The important thing in Side-by-Side extension is APIs and events of SAP S/4HANA. The API includes RFC-based BAPI of SAP proprietary protocol that has been provided conventionally, SOAP, and REST-based OData API provided by SAP S/4HANA. OData is becoming the center of the API for SAP solutions, and SAP Fiori, the new user interface for SAP S/4HANA, also uses OData. SAP S/4HANA can also trigger events according to actions (registration, modification, deletion) on business objects (sales, purchases, product masters, etc.), and by receiving those events on SAP Cloud Platform, It is possible to achieve tightly coupled extension while being architecturally decoupled. (The figure below is an example of event integration)
SAP Solution API and Event Catalog Site
As a comprehensive catalog site for APIs and events for these SAP solutions, we have published a website called SAP API Business Hub. This site also includes information on APIs for SaaS solutions such as SAP SuccessFactors as well as SAP S/4HANA and the predefined contents of SAP Cloud Platform mentioned at the beginning of this blog. Also, since the API is published in the Open API format (Swagger), you can also test from this site. This makes it easy to find and test the API without having to log in to each system. We will introduce the details of this SAP API Business Hub in the next blog post, How to Find API. In addition, SAP is also developing a new service called SAP Graph that provides a single API endpoint that focuses on business objects, without being aware of each backend of SAP solutions such as SAP S/4HANA, SAP C/4HANA, and SAP SuccessFactors. (Currently in beta)
SAP Cloud SDK to improve development efficiency
The SAP Cloud SDK is also provided as a development kit that actually improves coding efficiency. (Provided for Java and Node.js) By using this SDK, you can handle APIs of SAP S/4HANA as a virtual data model (VDM), and write code that guarantees the data type and call OData easily and efficiently. And also you can focus to write business logic so that this SDK provides some features such as abstraction of authentication with the external system in the source code with the destination service of SAP Cloud Platform. Read more inside Developers.
Required skillset
In terms of application development, SAP S/4HANA development skills (ABAP language and various extension frameworks) are of course necessary for In-App extension. On the other hand, in the case of Side-by-Side extension, open technology development skills such as Java are required. Having an API catalog like the above SAP API Business Hub makes it possible to proceed with development by separating the skill set from the backend SAP solution. However, depending on the requirements, there are cases where BAPI, which is an API unique to SAP, or the connection method is used. In these cases, you may need to work with an SAP S/4HANA application consultant or technology consultant.
It is also helpful to have knowledge of both SAP and open technologies when designing the overall architecture.
The following table is a reference for developer skills for In-App and Side-by-Side extensions.
Skill | In-App Extension | Side-by-Side Extension |
---|---|---|
Platform | SAP NetWeaver | Cloud Foundry |
Dev. Language | ABAP | Node.js, Java, ABAP, etc. |
Hardware | – | – |
Database | SAP HANA | SAP HANA, PostgreSQL, Mongo DB, SQLite, etc. |
UI | Fiori, SAPUI5 | Fiori, SAPUI5, Vue, Angular, React, etc. |
Dev. Framework | Exit, BAdI, Key User Extensibility, ABAP CDS, etc. | CAP, RAP, Extension Factory, Spring, etc. |
API | OData, SOAP, BAPI | OData, SOAP, REST, BAPI |
DevOps | TMS, ABAP Workbench | Jenkins, Git, etc. |
IDE | ABAP Workbench, Eclipse (ADT) | Web IDE, Business Application Studio, VS Code, Eclipse (ADT), etc. |
API Exploration
Currently the most common and latest APIs of SAP S/4HANA are based on OData or SOAP.
API Types
Protocol | Description |
---|---|
OData | Open Data Protocol based on standard REST-protocol. Previously promoted mainly by Microsoft, it became the OASIS standard in 2014. Most APIs of SAP S/4HANA as of now are based on OData V2. Since it is a REST protocol, CRUD (Create, Read, Update, Delete) of each OData API supports HTTP POST, GET, PUT/PATCH, DELETE, while some Odata APIs are only for read-only. Most of the latest S/4HANA APIs are OData based ones, so it’s a good idea to look for OData APIs first. |
SOAP | Simple Object Access Protocol that was popular in the 2000s and is still used today. Once it was heavily used as a core technology of SOA (Service Oriented Architecture), and there are many SOAP-based APIs in S/4HANA. It is the same as OData in that it is based on HTTPS, but it is necessary to have an XML container called SOAP Envelope in the HTTP Body, and to put the XML (SOAP Body) that is the content in it. In many cases, SOAP Client is generated with a metadata file called as WSDL (Web Service Description Language). |
BAPIs | Business Application Programming Interface together with IDocs are the legacy APIs that have long been used since the era of SAP R/3 and SAP ECC. These are not listed in SAP API Business Hub, and it is necessary to check them in the system of each S/4HANA and/or online help. BAPI (abbreviation of Business Application Programming Interface) is a legacy API implemented in the form of functions called SAP Function Modules. It is possible to be called from outside using SAP’s own protocol called RFC (Remote Function Call). If you want to call BAPI from Java, you can use the wrapper library called as JCo (Java Connector, pronounced as Jay-co) and you can use .Net Connector (= NCo) for .Net based apps . BAPI is logically defined as a method of Business Object * ( the objects such as sales order good receipts, material masters, etc. that are defined in S/4HANA such as documents and masters). * This Business Object is not relevant to BI Tools SAP Business Objects. |
IDoc | Intermediate Document (Abbreviation). Originally, IDoc was a technology that defines an intermediate file format to support various EDI formats. Thus we have realized data exchange by converting from IDoc data formats to the ones used by business partners with external middleware or vice versa. Therefore, IDocs are still widely used in B2B scenarios such as ordering even today. IDoc technology has been gradually expanded from the conventional file-based technology, and has evolved to allow direct data export and import using RFC, SOAP, and plain HTTP. In particular, the technology that connects ABAP based SAP systems with RFC was called ALE (Application Link Enabling). Since we originally assumed a fixed-length data format, the data structure has some quirks. Nowadays it is often used in conjunction with SAP Process Integration or SAP Cloud Platform Integration because it basically requires format mapping. |
Finding an ODATA or SOAP API
Let’s access to the SAP API Business Hub to find the information.
In the SAP API Business Hub, there is API information for various applications including Cloud LoB solutions such as SAP Concur and SAP SuccessFactors as well as SAP S/4HANA.
You can search API, check information, test, etc. on this site. However, SAP API Business Hub is basically developed for Cloud Solution, we only offer a limited information or functionalities for the On-Premise systems.
Note
SAP API Business Hub is basically developed for Cloud Solution, and currently only limited information are offered for the On-Premise systems. SAP S/4HANA APIs are not currently on the SAP API Business Hub but will be available in an upcoming release. There is a BETA version available.
Categories
You can see that many APIs end with service categories, for details see Abbreviations in SOA.
Type | Description | Usage |
---|---|---|
A2A | Application to Application | Exchange data from system to system within a company |
B2B | Business to Business | Exchange data from one system to another |
A2X | Application to X user or Application to Cross Application | API to get the application to be used via UI etc. |
Although it is technically possible to use the OData API for data exchange between systems, it is often the A2X category because it is easier to use directly from the UI compared to SOAP. There are many APIs that do not have any category.
Test OData and SOAP API
To check if the API really meets our requirements, we also need to go into the actual S/4HANA system and check it.
Go to t-code /IWFND/MAINT_SERVICE
to get the list of OData API.
If there is no corresponding service, add it from the Add Service button at the top.
From the Call Browser button at the bottom left, you can check with a browser if it is only a query system. To update document such as POST / PUT / PATCH, it is necessary to use SAP Gateway Client or an external tool such as POSTMAN or the Visual Studio Code REST Client for the testing.
Finding a BAPI or IDoc API
For BAPI
If the OData API for create/update does not exist, it may be necessary to check if the corresponding BAPI exists. In this case, you will go into the actual system and access the BAPI Explorer using t-code BAPI
.
In BAPI Explorer, BAPI can be searched in the form associated with Business Object.
For IDoc
The ALE scenarios are organized by what I looked for in the Online Help Library of ALE Business Processes. This mainly contains information on SAP ERP (SAP R/3) fellowship scenarios (such as master data distribution).
Type information of IDoc type can be confirmed on t-code WE60
.
IDoc integration with other systems is also included in the content of SAP Cloud Platform Integration.
Conclusion
As we have seen, in SAP S/4HANA On-Premise, there are relatively new APIs such as OData and SOAP, as well as the API that have existed since the SAP R/3 era, BAPI and IDoc.
If you want to build a UI or application on SAP Cloud Platform to connect with S/4HANA, I would recommended to check if OData API is available first. As we will explain in a subsequent blog, OData API is consumable with a library called SAP Cloud SDK, it is very easy to use. And because OData API can be regarded as a JSON-based REST service, it is easy to consume from the UI as well as server side logic.
If the standard OData API does not exist, it is possible to develop custom OData API in SAP S/4HANA. But in that case, in order to update the SAP standard object, BAPI must be used in the ABAP logic inside of the ABAP logic.
SOAP APIs are generally used by server-side applications rather than the direct consumption from the UI. Since it is possible to generate SOAP Client (Stub) with WSDL, you can develop an application that runs on SAP Cloud Platform Cloud Foundry in Java etc. and send a SOAP message to the SAP S/4HANA OP system.
IDoc was originally developed for EDI and is intended for asynchronous data communication, so it is often used with SAP Cloud Platform Integration.
API Usage
In addition, according to the extension guideline (SAP Note 2920697) of SAP S/4HANA Cloud EX (former STE) updated on May 1, 2020, the extension way using APIs and events published in SAP API Business Hub has become a high priority.
Main API usage patterns from applications
There are mainly the following development patterns that use API in the extended development of SAP S/4HANA.
In the above pattern, the correspondence to each API is as shown in the table below.
Prot. | SAP Cloud SDK | Cloud Platform Integration (CPI) | Cloud Application Programming Model (CAP) | SAPUI5 |
---|---|---|---|---|
OData | Yes (VDM) | Yes (OData Adapter) | Yes | Yes (OData Model) |
SOAP | Yes (VDM) | Yes (SOAP Adapter) | No | Yes (XML Model) |
BAPI | Yes (VDM, only Java) | Yes (RFC Adapter) | No | No |
IDoc | No | Yes (IDoc Adapter) | No | No |
The above four patterns are not options in the same row but have different development layers, so we need to use them according to the development requirements and choice of development technology. Among them, SAP Cloud SDK is a tool that can call SAP S/4HANA API very efficiently in the development of server-side applications.
Event Integration
If we want to trigger some action externally when an object of SAP S/4HANA is created or changed? It is still technically possible to check the object creations or changes by polling API calls at regular intervals, but the real-time integration may not be achievable with that. Event-based integration comes up here.
SAP Enterprise Messaging is a fully-managed cloud service that allows applications to communicate through asynchronous events and seamlessly extend your digital core. Create responsive applications that work independently and participate in event-driven business processes inside your company and across your business ecosystem for greater agility and scalability.
An event in SAP S/4HANA will trigger an external logic in SAP Cloud Platform to be executed.
By using this method, it is possible to start an external logic or start data/process integration when the SAP S/4HANA object is created.
In past, you would have updated the data with EXIT or BADI of SAP S/4HANA. You may be able to achieve the similar thing with the event-driven fashion with this.
Event Driven Architecture
Event-driven architecture in general is offering a lot of advantages like decoupling or the avoiding of polling. The Architecture looks like this and is following the CloudEvents standard.
Events that occur in S/4HANA are sent to SAP Cloud Platform Enterprise Messaging. It is also possible to broadcast from Enterprise Messaging to multiple runtimes.
Enterprise Event Enablemant
Enterprise Event Enablemant is a technical component on SAP S/4HANA. This framework enables the exchange of events across different platform for seamless event-driven communication.
You can publish events triggered from SAP S/4HANA applications and consume these events in the apps built on SAP Cloud Platform Cloud Foundry using SAP Cloud Platform Enterprise Messaging. SAP Cloud Platform Enterprise Messaging is the messaging service, which provides real-time messaging capabilities.
Now available for SAP ECC
The Add-On SAP NetWeaver, add-on for event enablement (ASANWEE) is available for NetWeaver 7.31 and higher (Documentation) and is based on an ABAP Add-On from the partner company ASAPIO, but adapted for the usage with the SAP Cloud Platform. Event-driven architecture – now available for SAP ECC users
Finding Events
You can use the SAP API Business Hub to search for content-type Events.
For example searching for Business Object Sales Order events, you will find the corresponding Sales SAP S/4HANA Cloud Business Events, supporting Changed, Created and Deleted events.
Event Usage
An Application can send events, or subscribe to external events.
Events generally do not pass the entire data of the business object for the event messaging. The payload of the event only includes the type of business object (Purchase order, Sales Order etc.), key information, and action (creation, change, or deletion).
An example payload looks like this:
json
{
"eventType":"BO.OutboundDelivery.Changed",
"cloudEventsVersion":"0.1",
"source":"https://sap.corp",
"eventID":"QgEKigAJHuqn0laStiBciA==",
"eventTime":"2020-05-25T14:19:12Z",
"schemaURL":"https://sap.corp/sap/opu/odata/IWXBE/BROWSER_SRV/",
"contentType":"application/json",
"data":{
"KEY":[{"OUTBOUNDDELIVERY":"0080000005"}]
}
}
We get to know, that this is en event of Outbound Delivery Change and the document number is "00800005".
Free content for learning
We have introduced the basic information on the concept of SAP Cloud Platform and the extended development of SAP S/4HANA so far. Once you understand the basics of integration with SAP Cloud Platform, you just learn how to use the rich services provided by SAP Cloud Platform and combine open technologies.
Nowadays, SAP provides a lot of free technical information to assist consultants, engineers, and developers. Above all, there is a wealth of information for SAP Cloud Platform, and tutorials for each service and learning steps for each technical field are also provided, so I will introduce the following contents that are very useful for skill expansion.
SAP Discovery Center
Learn how to adopt SAP Business Technology Platform and turn data into business value
openSAP
Online video training. SAP offers a wealth of courses, with one course often updated over four weeks of content, with students taking weekly step-by-step content and validation tests. You can also ask questions about the course during the distribution period. It is possible to take courses after the distribution period, so you can use it at your convenience. This is a very useful training as it takes some time to finish one course.
SAP Tutorial Navigator
Mainly step-by-step tutorial content for SAP Cloud Platform and platform products. This provides content for beginners, intermediate players, and advanced users for each product and service. It is full of useful information from initial setup to practical implementation examples.
SAP Community
Community site for SAP consultants and developers. SAP product management members post the latest information on each product and how to implement it, and consultants and developers who are involved in the implementation of SAP solutions share tips and ideas as a blog. In addition, questions are actively exchanged in the community, so please use it as well.
SAP Q&A
Just ask a question for a specific SAP topic and get feedback from the community and SAP.
Learning Journeys
A summary site that covers learning steps for each field. For example, the learning path is shown for extension development topics for SAP S/4HANA, first, learn the outline of SAP Cloud Platform with openSAP, then learn the extension concept of SAP S/4HANA and SAP Cloud SDK with TechED online video content. If you decide on the topic you want to learn, the curriculum you need is provided, so you can definitely improve your skills.
SAP Help Portal
A standard help site for product technical information. All product and configuration information can be found here. If you don’t know how to use or set about certain services, please try searching SAP Help Portal first. It covers Tips information, code samples, and detailed definition information. Recently, there are many Japanese pages.
The above is the overview of SAP S/4HANA extension in SAP Cloud Platform. How was it? Of course, SAP Cloud Platform also provides a free trial environment, so please give it a try together with the above learning contents.