SAP Cloud Platform Integration (CPI) Part 14 – CPI Event Mesh Connectivity and Setup

In this post, we will explore CPI Event Mesh Connectivity and Setup and learn how to send events from the S/4HANA on-premise system to Event Mesh. We will also cover how to capture these events in a CPI IFlow for further processing.

Overview of this blog series: CPI Event Mesh Connectivity and Setup

1. SAP CPI Introduction
2. SAP BTP tools and features overview (BTP, Global Account, Sub-Account, Entitlements, Connectivity, Security)
3. SAP CPI Web IDE overview
4. Registering a trial account and enrolling to SAP CPI service
5. Deep dive into Cloud Integration features with real world scenario example
6. Use cases of palette functions
7. Event Mesh Configuration and Connectivity
8. Using Cloud connector for connecting to backend SAP systems
9. Overview on API Management & Open Connectors
10. Integration using Open Connectors with real world example

In short, below is the content we will elaborate in this tutorial:

1. What are events and how does it work
2. Subscribing the Event Mesh service in SAP BTP
3. Connectivity setup in S4 to Event Mesh
4. Configuration in Event Mesh service
5. Fetching the events in CPI from event mesh


1. What are Events and how does it work ?

Events in an event mesh architecture refer to data messages that are produced and consumed by different applications or services. An event mesh is a networking approach that connects and routes events between applications and services in a scalable, reliable, and secure manner. In SAP CPI, CPI Event Mesh Connectivity and Setup can be utilized to build event-driven integration flows that exchange events between different systems or applications in a loosely coupled and scalable way. SAP CPI uses the Apache Kafka messaging system as the underlying messaging backbone to implement the event mesh architecture. Events in SAP CPI can be produced and consumed by various integration flows or external applications and exchanged through topics or channels.

A point is a named channel that permits occasions to be traded between various applications or administrations. Points are the central structure blocks of the occasion network engineering, and they give a way to applications or administrations to distribute and buy into occasions in light of their inclinations.

Occasion set off from S4 HANA framework will arrive at the occasion network. The occasion network perceives the occasion and stores it. The manner in which it perceives the occasion depends on the point referenced in occasion network. Thus, applications or administrations can distribute occasions to a particular subject by sending them to the informing spine, which then courses the occasions to every one of the bought in buyers in view of their membership standards. Likewise, applications or administrations can consume occasions from a particular subject by buying into it and afterward handling the got occasions.

The design in the occasion cross section will be:

Message Clients

Lines

Line Membership

Point

Prior to moving to the design and network part, we should grasp about Line.

In SAP occasion network, a line is an information structure that is utilized to store and cradle occasions for utilization by at least one purchasers. A line is related with a particular point, and it goes about as a support between the makers and purchasers of occasions. At the point when an occasion is created by an application, it is shipped off a particular subject, which is related with a line. The informing spine then, at that point, stores the occasion in the line until it is consumed by at least one shoppers. Customers can consume occasions from the line in a consecutive request, in light of the request in which they were created.

Lines are significant in SAP occasion network since they give a method for decoupling the creation and utilization of occasions. They permit makers to send occasions to a point without stressing over whether any shoppers are accessible to consume them, and they permit customers to consume occasions at their own speed, without influencing the development of occasions.

As well as giving decoupling among makers and buyers, lines likewise give adaptation to non-critical failure and burden adjusting. At the point when an occasion is delivered, it is put away in the line, regardless of whether no buyers are at present accessible to consume it. This guarantees that the occasion isn’t lost in the event of a disappointment or free time of a shopper. Likewise, various shoppers can consume occasions from a similar line, empowering load adjusting and expanding the general throughput of the occasion network.

2. Subscribing the Event Mesh service in SAP BTP

To make an occasion of SAP Occasion Cross section in SAP BTP, you really want to follow these means:

  • Sign in to your SAP BTP record and open the SAP BTP Cockpit.
  • Explore to the “Occurrences” tab and snap on the “New Case” button.
  • From the rundown of accessible administrations, select “Occasion Cross section” and pick the area and plan that you need to utilize.
  • Enter a name for the occurrence and design any extra settings as required, like the quantity of parcels and the maintenance time frame.
  • Audit the rundown data and snap on the “Make” button to make the example. When the case is made, you can see its subtleties and deal with its settings from the “Occasions” tab in the SAP BTP Cockpit.
  • You can then make memberships to subjects inside the Occasion Cross section case, arrange the memberships, and execute the shopper applications that will consume the occasions from the bought in points.

3. Connectivity setup in S4 to Event Mesh

For getting to the occasion based exchange codes in S4, explore to SPRO – > ABAP Stage – > Endeavor Occasion Enablement – > Organization – > Channel Association Settings

There are three steps to connect to event mesh application.
1. Create an RFC connection between S4 and Event mesh

Make a HTTP association with type G that interfaces with an outside server.

2. OAuth2.0 authentication setup

OAuth2.0 client arrangement will be finished by Premise group where they will specify the oauth token approval and token URL

3. Manage channels and parameters

Another channel must be made with above choices to be filled. Convention AMQP is naturally chosen. Objective ought to be the RFC objective which you made in the initial step. Namespace ought to be given here, which will be kept up with in the occasion network application while making lines and subjects.

OAuth2.0 Arrangement name will be the design name which we made/said in sync 2. Click on SAVE once finished.

Association test should be possible by tapping on the “Actually take a look at Association” button. We will perceive how to add the outbound ties which will set off occasion to Drain Occasion network.

Select the channel detail and snap on Outbound ties.

At first it would be unfilled where there wouldn’t be any ties.

Click on Make symbol and select the point (occasion which you need to set off). For my situation, I need to set off Gear make and change occasion. At the point when there is a gear creation/change is occurring, there ought to be an occasion set off to Drain Occasion Lattice.

You can either choose Hardware/* which will set off all gear related occasions (for this situation, just make and change is there, assuming that erase is there it will likewise get set off). Be that as it may, the prescribed methodology is to make reference to the particular point, as make and change. Once chose, click on SAVE.

This point ought to be referenced in the SAP Occasion network – > Message clients – > Line – > Line Memberships – > Subject.

Exception handling:

If there should arise an occurrence of mistake caught in S4 and not conveyed to Occasion network, then, at that point, underneath TCode will be valuable. /n/iwxbe/eee_support – Occasion Screen

Select the sort of occasion, outbound or inbound. Also, select the channel made.

You can see the occasions undelivered to occasion network here. Additionally you will actually want to re-send the occasion from this exchange.

4. Configuration in Event Mesh service

In the occasion network administration occurrence in BTP, click on the 3 dabs – > Go to Application/View Dashboard. You can see the SAP Occasion Cross section outline screen as underneath:

Click on the message client where you can see the rundown of lines made.

Click on the queues tab -> Create Queue.

Give line name and rest of the fields are discretionary to change. Click on Make once finished. Genuine line will be prefixed with namespace consequently once you click on make, as displayed underneath.

When the line is made, click on the activities dropdown toward the end and select QUEUE SUBSCRIPTIONS.

Give the subject name, which we chose in the S4 Outbound ties area. This can be replicated from the Outbound ties area in S4. The subject name ought to be appropriately given. There are rules for giving this subject. The namespace ought to be prefixed with the point name. This namespace we characterized while making the direct in S4 (stage 3). This standard is characterized in the standard descriptor. Under the Assistance Descriptor tab, the JSON payload will be given.

As you can find in the subject principles hub, under the publishFilter, the namespace/* is given.

Presently the occasion network is arranged and prepared to acknowledge occasions from S4.

5. Fetching the events in CPI from event mesh

Make an IFlow with shipper connector AMQP.

Under the associations tab, in the host field, give the hostname of the informing framework, port, way. These subtleties you can duplicate it from RFC objective which we made in S4.

Intermediary type – Web

Validation – Oauth2 Client Certifications

Under the handling tab, notice the line name. Determine the name of the line or subject membership to consume from. The line name ought to be in underneath design:

queue:{namespace}/{queue_name}

Better to duplicate the line name from occasion network application.

When you save and convey the IFlow, you are prepared to acknowledge the Occasions from Occasion network application. At this point, I don’t approach hardware related exchanges, consequently, I will show you how the occasion payload will seem to be:

JSON:

{
    "type": "sap.s4.beh.equipment.v1.Equipment.Created.v1",
    "specversion": "1.0",
    "source": "/default/sap.s4.beh/{systemname_client}",
    "id": "0022485b-61cb-1eed-a8dd-04c3582d879e",
    "time": "2023-02-02T10:55:47Z",
    "datacontenttype": "application/json",
    "data": {
        "Equipment": "10010583"
    }
}

As you can see the hardware type is given, which separates Make or Change process. Likewise, which hardware is made or changed, that gear number is additionally given in the payload.

This is all the data we receive for event triggers. With this information, we need to retrieve the hardware fields from any OData API through a GET call. Proper CPI Event Mesh Connectivity and Setup is essential to ensure smooth communication and data retrieval between the systems.


That is supportive of today. Blissful Learning!!!

YOU MAY BE INTERESTED IN

A Comprehensive Guide to SAP ABAP Training Online

Analysis Of Algorithm In DAA-2024

Core Data Services in ABAP for HANA

WhatsApp WhatsApp us