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