SAP API development method

Time:2020-9-26

Jerry’s previous article:From SAP Leonardo to SAP data intelligenceIt has been mentioned that the machine learning API of SAP Leonardo machine learning foundation has been marked as degraded and will be replaced by SAP data intelligence, a new AI product of SAP.

SAP API development method

In the process of learning SAP data intelligence, Jerry learned a new way of API development. This paper first briefly reviews the various SAP API development methods I have been exposed to since I was engaged in SAP development for 13 years, and then introduces the API development mode in SAP data intelligence that follows the concept of low code development.

catalog

(1) ABAP function module + SOAMANAGER
(2) Manual implementation of SAP CRM OData service based on transaction code segw
(3) Automatic generation of OData service based on CDs view
(4) Creating custom OData API based on business object in SAP cloud for customer
(5) API development based on Java, springboot, node express and other web application frameworks
(6) Serverless architecture
(7) SAP Data Intelligence Graph

The API mentioned in this paper refers to the API exposed through HTTP protocol, which can be consumed directly through browser, postman, curl and other tools, as well as various programming languages. In the sap ecosystem, the most commonly encountered are web services based on soap and OData services connecting the front and back of SAP s / 4hana.

SAP API development method

(1) ABAP function module + SOAMANAGER

The oldest technology is to publish the functions in ABAP system into web service through soamanager. Although it is old, the new function development of service module in S / 4hana is still in use.

https://blogs.sap.com/2014/05…

In 2014, I also wrote an article on the steps of using soamanager, although the tool has been updated many times.

SAP API development method

(2) Manual implementation of SAP CRM OData service based on transaction code segw

This is the way I am most familiar with the implementation of SAP OData services, because I am one of the developers of SAP CRM OData services. When the CRM development team of SAP Chengdu Research Institute developed these OData services in 2014 and 2015, the predecessor of SAP Fiori elements, which was called smart template at that time, was still in the early stage of development, so we did not choose this metadata driven development method at that time.

SAP API development method

Jerry wrote an article in 2018, SAP OData programming guide, which describes this method in detail.

(3) Automatic generation of OData service based on CDs view

Later, with the maturity of CDs view and Fiori elements, we can base on [email protected] OData.publish Annotated CDs view can directly generate OData service. The specific working principle is introduced in this article:

Uncovering the mystery of annotations in SAP Fiori programming model [email protected] OData.publish Working principle analysis

In S / 4hana, in addition to manually adding CDs view in ABAP development [email protected] OData.publish In addition to annotations, there is another way to do it purely in the browser.

Use custom CDs views in S / 4hana,

SAP API development method

You can select multiple standard CDs views in S / 4hana to create a new composite view,

SAP API development method

According to your own requirements, you can select which fields of the standard view need to be included in the new composite view

SAP API development method

Finally, the OData service publishing of composite view is realized with one click.

SAP API development method

In the ABAP environment of SAP cloud platform, the creation of OData service and Fiori UI interface is completely contracted by the service definition and service binding created based on CDs view.

SAP API development method

For more information on this development approach based on restful ABAP programming model, please refer to my article30 minutes to develop a Fiori application supporting addition, deletion, modification and query with restful ABAP programming model

(4) Creating custom OData API based on business object in SAP cloud for customer

The application of custom CDs view seen in SAP s / 4hana Fiori launchpad can complete field matching and OData service publishing in the browser even if the key user is not familiar with the technology.

SAP cloud for customer also has a similar design, except that key users can choose not CDs view, but the standard business object in C4C

SAP API development method
SAP API development method

In the custom OData service application of the browser, key user can select which fields in the business object node are published to the OData service. This operation is the same as the idea of selecting standard CDs view fields in SAP s / 4hana.

SAP API development method

In C4C’s cloud application studio, web services can also be created based on standard business objects

SAP API development method

Conclusion: SAP products based on ABAP technology stack, OData or web service APIs running on it are consumed by the outside world through the ICF (Internet communication framework) of ABAP NetWeaver. By observing the call URL path, we can find the corresponding processing node in the SiCf transaction code.

CRM at the end of SAP CRM OData service URL_ For example, opportunity:

SAP API development method

The corresponding node with the same name can be found in the SiCf transaction code. We only need to bind an ABAP class to this node in SiCf. When the corresponding URL of the node is accessed through the browser, postman, or other programming languages, the ABAP ICF framework will automatically call the bound ABAP class.

SAP API development method

In other words, application developers only need to implement business logic in ABAP class. ABAP developers don’t have to worry about how the instance of this class runtime is called by ICF and how to initialize and destroy life cycle management.

For more information on ABAP ICF, please refer to my article:A 13 year old ABAP veteran’s advice: understanding these basic knowledge will benefit ABAP development without any harm

(5) API development based on Java, springboot, node express and other web application frameworks

The ecosystem adopting this kind of development mode is the largest and most active group in the world, with mature and stable technology and rich relevant documents and teaching materials. Newer and more advanced development frameworks are also evolving. Developers usually complete the development locally, and then deploy the application to the server to run. You can also package applications into container images and run them on physical servers or sap cloud platforms, AWS, Google cloud platform, azure and other clouds. After the number of containers reaches a certain scale, kubernetes can be used for scheduling management.

This article introduces an example:Deploying and running docker application on SAP cloud platform

SAP API development method

Jerry’s previous projects also consumed SAP commerce’s Web Service: how to use API to consume SAP commerce cloud’s order service.

(6) Serverless architecture

A popular word in the cloud computing industry, serverless architecture, does not mean that after adopting this architecture, the server will no longer be needed. Instead, it means that application developers do not need to care about how the developed applications are deployed to the server, and do not need to consider the operation and maintenance issues such as the running status of the server. Consider what kind of traditional development method Jerry needs to adopt before deploying on the cloud server.

SAP API development method

There is no API deployment step in API / service development based on serverless architecture. Taking the lambda function on SAP kyma introduced by Jerry as an example, the code of API function itself is completed on the cloud. Once saved, the API is called as long as the trigger conditions maintained by the API are met (event trigger or URL trigger).

The following is a lambda function I wrote in SAP kyma using nodejs

SAP API development method

I set it to be called via HTTPS:

SAP API development method

Access the HTTPS endpoint in the browser and lambda function is executed immediately.

SAP API development method

From this perspective, Jerry thinks that ABAP developers have been enjoying the convenience brought by the serverless architecture when developing APIs. Because the development of ABAP field, whether through sapgui, ABAP development tool or various key user tools, is essentially connected to ABAP NetWeaver, which is a server integrating application development and operation. Therefore, there is no application deployment in traditional Java / nodejs development.

For more information on how to use lambda functions to implement APIs, please refer to Jerry’s article:

  • From SiCf of ABAP NetWeaver to lambda function of SAP kyma
  • Zhou Botong’s Kongming fist, Minos’ Stardust puppet line, SAP kyma’s serverless

(7) SAP Data Intelligence Graph

Strictly speaking, this method is also based on serverless. Users can log in to the SAP data intelligence console through the browser to conduct graph modeling. When it is started, graph runs directly on the kubernetes infrastructure of the sap cloud platform.

SAP API development method

The reason why this method is introduced separately is that it has the characteristics of low code development.

Take a concrete example.

Suppose I want to implement an API that supports crud. Consumers can read, insert and delete a record in the database through HTTP get, post and delete requests.

Low code development platform usually provides graphical user interface, which provides users with the way of drag and drop components and model driven development, combined with a small amount of code to quickly create applications or APIs

Access SAP data intelligence launchpad and enter modeler:

SAP API development method

Like children building blocks, we drag HTTP server and several JavaScript handlers from the left toolbox to the edit page.

SAP API development method
SAP API development method

How can these building block like components work together to support the API function of adding, deleting, modifying and querying? Due to the space, Jerry’s follow-up articles will be introduced, please continue to pay attention.

More reading

  • SAP OData Programming Guide
  • 30 minutes to develop a Fiori application supporting addition, deletion, modification and query with restful ABAP programming model
  • A 13 year old ABAP veteran’s advice: understanding these basic knowledge will benefit ABAP development without any harm
  • Deploying and running docker application on SAP cloud platform
  • How to use API to consume order service of SAP commerce cloud
  • From SiCf of ABAP NetWeaver to lambda function of SAP kyma
  • Zhou Botong’s Kongming fist, Minos’ Stardust puppet line, SAP kyma’s serverless
  • From SAP Leonardo to SAP data intelligence

For more original articles on Jerry, please pay attention to the official account of “Wang Zixi”:
SAP API development method

Recommended Today

Explain idea git branch backoff specified historical version

scene When I submitted this modification to the local and remote branches, I found that there were still some changes missing in this submission, or this modification was totally wrong, but I also pushed it to the remote repository. How to go back? problem How can the content that has been submitted to the repository […]