Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Rehan
Explorer
4,956

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. 

Rehan_3-1741690222262.png

In S/4 hana private cloud , you can search the “business Partner event” as above.

Rehan_0-1741680910140.png

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/

Rehan_1-1741680962649.png

In SAP Business Accelerator Hub - On Stack Extensibility in Business Object Interface area, look your topic of interest, let us say ‘Business Partner’

Rehan_2-1741681126956.png

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 .

Rehan_4-1741681301899.png

Select the  behavior Definition  - I_BusinessPartnerTP_3

Click on Behavior definition ,

Rehan_5-1741681359803.png

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 .

Rehan_6-1741681422563.png

Create a new CDS as below.

CDS Name - Z_DEMO_BP_003

create a data definition by referenced Object - I_BusinessPartnerTP_2

Rehan_7-1741681491640.png

 

Rehan_8-1741681509124.png

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’

Rehan_9-1741681632490.png

 

Rehan_10-1741681650348.png

 

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 ;

Rehan_11-1741681709003.png

Creating an event binding

Go to ‘ABAP Repository Object’  and type ‘event’ and then select the ‘Event Binding’

Rehan_12-1741681867312.png

Event name must start with "z". Event binding name is ZEVB_DEMO_CREATE

Rehan_13-1741681917115.png

 

Press “Add” and

Rehan_14-1741681960820.png

 

Rehan_15-1741681975726.png

 

Create an event for change as above.

Rehan_16-1741681996837.png

Create a Channel ,

Go to the T Code - /n/IWXBE/CONFIG in S4 Hana system.

Rehan_17-1741682019083.png

 

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 .

Rehan_18-1741682046220.png

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 .

Rehan_19-1741682073404.png

Click on ‘Undelivered’ then Event ID data is populated.

Click on Event ID, then Payload will load as below

Rehan_20-1741682140487.png

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.

Rehan_21-1741682191524.png

 

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.

Rehan_22-1741682237469.png

Filtering field is available.

Rehan_23-1741682257002.png

 

Rehan_24-1741682265720.png

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://community.sap.com/t5/technology-blogs-by-sap/derived-events-how-to-trigger-custom-event-from...

https://community.sap.com/t5/technology-blogs-by-sap/add-custom-context-attributes-for-sap-released-...

https://www.youtube.com/watch?v=E32dwoxnEHY&t=301s

https://www.youtube.com/watch?v=Q4H0LNZi7Dg

 

 

 

 

 

 

2 Comments