Here, we create a new custom RAP event from an SAP standard event. This event type is called a Derived Event.
Identify the relevant standard Event –
First, Go to the https://api.sap.com, Click on S/4 hana private cloud.
In S/4 hana private cloud , you can search the “business Partner event” as above.
SAP Business Accelerator Hub provides a wide list of SAP S/4 HANA private cloud Event Objects. You can see the payload and header of standard event here.
For example, looking at the event references of Business Partner.
Find out the business object of Business Partner.
Next step is to identify the Business Object of Business Partner.
Go to sap.com https://api.sap.com/
In SAP Business Accelerator Hub – On Stack Extensibility in Business Object Interface area, look your topic of interest, let us say ‘Business Partner’
Here, in General Information Section, you will find the name of the Extensible Interface BO.
Go to the ABAP development tool.
Press Ctrl + Shift + A then It will open the ‘Open ABAP Development Object’
Enter the BO Interface Name:Bussiness Partner Business Object ( I_BUSINESSPARTNERTP_3 ) as below screen .
Select the behavior Definition – I_BusinessPartnerTP_3
Click on Behavior definition ,
Here, Behavior definition can be extensible. Navigate to the Base behavior definition – Event can be find out. You can navigate to the Base CSD view .
Create a new CDS as below.
CDS Name – Z_DEMO_BP_003
create a data definition by referenced Object – I_BusinessPartnerTP_2
Remove other fields and activate the CDS – Z_DEMO_BP_003 . I have included the normal fields that are including the out of the box event.
Create a New Behavior Extension
Go and extend the behavior definition – i_businesspartnertp_2.
New extension name is ‘ Z_DEMO_BP_003’
Add 2 events as below.
managed event z_create_demo001 on Created parameter Z_DEMO_BP_003 ;
managed event z_change_demo001 on Changed parameter Z_DEMO_BP_003 ;
Creating an event binding
Go to ‘ABAP Repository Object’ and type ‘event’ and then select the ‘Event Binding’
Event name must start with “z”. Event binding name is ZEVB_DEMO_CREATE
Press “Add” and
Create an event for change as above.
Create a Channel ,
Go to the T Code – /n/IWXBE/CONFIG in S4 Hana system.
Press on “via Service Key -> Default” and create a Channel Configuration
You need an instance service key to create the channel in S/4. After channel created, check connection and activate the Channel.
Select Outbound binding in Channel configuration and add the topic’s .
Testing
Now go to the T Code and change the BP for testing event.
Go to the T Code – /nbp for changing the Business Partner.
Check Payload in S4.
Go to the T Code – /n/iwxbe/event_monitor in S4 Hana and select the channel name then Execute .
Click on ‘Undelivered’ then Event ID data is populated.
Click on Event ID, then Payload will load as below
Data is available for Custom event.
Adding custom fields and filters.
Go to the CDS ‘Z_DEMO_BP_003’ and add new fields as below. Activate the CDS again.
The custom extension attribute name must start with “xsap” and can contain only lower case letters.
The custom extension attribute name must start with “xsap” and can contain only lower-case letters. For filtering , Add the line 17 -> @event.context.attribute: ‘xsapsalesorg’ .
If it is not working with custom fields and filtering. Then go to the TCode – /n/IWXBE/CONFIG and delete the attached Topic. Attach the Topic again.
Then go to the TCode – /n/IWXBE/CONFIG and Press filtering.
Filtering field is available.
Summary
In this blog post, I explain how one can create a RAP custom event based on an SAP standard event type. This new event is triggered by the corresponding released SAP event.
Further reading –
https://www.youtube.com/watch?v=E32dwoxnEHY&t=301s
https://www.youtube.com/watch?v=Q4H0LNZi7Dg
Here, we create a new custom RAP event from an SAP standard event. This event type is called a Derived Event.Identify the relevant standard Event – First, Go to the https://api.sap.com, Click on S/4 hana private cloud. In S/4 hana private cloud , you can search the “business Partner event” as above.SAP Business Accelerator Hub provides a wide list of SAP S/4 HANA private cloud Event Objects. You can see the payload and header of standard event here.For example, looking at the event references of Business Partner.Find out the business object of Business Partner.Next step is to identify the Business Object of Business Partner.Go to sap.com https://api.sap.com/In SAP Business Accelerator Hub – On Stack Extensibility in Business Object Interface area, look your topic of interest, let us say ‘Business Partner’Here, in General Information Section, you will find the name of the Extensible Interface BO.Go to the ABAP development tool.Press Ctrl + Shift + A then It will open the ‘Open ABAP Development Object’Enter the BO Interface Name:Bussiness Partner Business Object ( I_BUSINESSPARTNERTP_3 ) as below screen .Select the behavior Definition – I_BusinessPartnerTP_3Click on Behavior definition ,Here, Behavior definition can be extensible. Navigate to the Base behavior definition – Event can be find out. You can navigate to the Base CSD view .Create a new CDS as below.CDS Name – Z_DEMO_BP_003create a data definition by referenced Object – I_BusinessPartnerTP_2 Remove other fields and activate the CDS – Z_DEMO_BP_003 . I have included the normal fields that are including the out of the box event.Create a New Behavior Extension Go and extend the behavior definition – i_businesspartnertp_2.New extension name is ‘ Z_DEMO_BP_003’ Add 2 events as below. managed event z_create_demo001 on Created parameter Z_DEMO_BP_003 ;managed event z_change_demo001 on Changed parameter Z_DEMO_BP_003 ;Creating an event binding Go to ‘ABAP Repository Object’ and type ‘event’ and then select the ‘Event Binding’Event name must start with “z”. Event binding name is ZEVB_DEMO_CREATE Press “Add” and Create an event for change as above.Create a Channel ,Go to the T Code – /n/IWXBE/CONFIG in S4 Hana system. Press on “via Service Key -> Default” and create a Channel ConfigurationYou need an instance service key to create the channel in S/4. After channel created, check connection and activate the Channel.Select Outbound binding in Channel configuration and add the topic’s .Testing Now go to the T Code and change the BP for testing event.Go to the T Code – /nbp for changing the Business Partner.Check Payload in S4.Go to the T Code – /n/iwxbe/event_monitor in S4 Hana and select the channel name then Execute .Click on ‘Undelivered’ then Event ID data is populated.Click on Event ID, then Payload will load as belowData is available for Custom event.Adding custom fields and filters.Go to the CDS ‘Z_DEMO_BP_003’ and add new fields as below. Activate the CDS again.The custom extension attribute name must start with “xsap” and can contain only lower case letters. The custom extension attribute name must start with “xsap” and can contain only lower-case letters. For filtering , Add the line 17 -> @event.context.attribute: ‘xsapsalesorg’ .If it is not working with custom fields and filtering. Then go to the TCode – /n/IWXBE/CONFIG and delete the attached Topic. Attach the Topic again.Then go to the TCode – /n/IWXBE/CONFIG and Press filtering.Filtering field is available. SummaryIn this blog post, I explain how one can create a RAP custom event based on an SAP standard event type. This new event is triggered by the corresponding released SAP event.Further reading –https://community.sap.com/t5/technology-blogs-by-sap/derived-events-how-to-trigger-custom-event-from-an-sap-standard-event/ba-p/13955193https://community.sap.com/t5/technology-blogs-by-sap/add-custom-context-attributes-for-sap-released-event-types/ba-p/13940929https://www.youtube.com/watch?v=E32dwoxnEHY&t=301shttps://www.youtube.com/watch?v=Q4H0LNZi7Dg Read More Technology Blogs by Members articles
#SAP
#SAPTechnologyblog