cancel
Showing results for 
Search instead for 
Did you mean: 

Create RAP Business Events from standard table in an On-Premise system

TillHeinen
Participant
0 Kudos

Hi,

I want create an event when the ISU Contract (SAP table EVER) is changed. To then trigger Event Mesh etc. But for this SAP standard table, I can also not find an API in the API HUB.

Therefore I was trying to create a RAP Business Object from the table EVER (not a Z_ copy, but the SAP Standard table)

When trying to do this by the ADT function 'Generate ABAP Repository Object', I always get this:

Error Message:

Add "local last changed" admin field ( ABP_LOCINST_LASTCHANGE_TSTMPL,ABP_LOCINST_LASTCHANGE_UTCL ) and "last changed" admin fields (ABP_LASTCHANGE_TSTMPL, ABP_LASTCHANGE_UTCL ) to the reference table.'

After generating the BO, I want to proceed with the Event Behaviour etc and to this to the outbound bindings.

Can you help me on that case? How is this covered in RAP Business Events?

I also posted under this blog, because this is my starting point: https://blogs.sap.com/2023/01/25/how-to-create-rap-business-events-in-s-4hana-on-premise-2022/

Best wishes

Till

Accepted Solutions (1)

Accepted Solutions (1)

Muthuraja
Active Participant
0 Kudos

Hello Till,

For ADT function 'Generate ABAP Repository Object', You will have to append these two admin fields always so that RAP generator can able to generate all the RAP Objects automatically.

local_last_changed type ABP_LOCINST_LASTCHANGE_TSTMPL
last_changed type ABP_LASTCHANGE_TSTMPL

Append above fields with mentioned type in your db table.

Thanks a lot.

Best Regards,

Muthu

TillHeinen
Participant
0 Kudos

Great Thank you Muthu!

TillHeinen
Participant
0 Kudos

HI Muthu,

thanks it worked well.

But how can I fill these fields now? Or trigger my event from it?

When I change a contract from the Fiori its working fine, an event is triggered and Lastchanged is filled.

When I do so from Backend ES21, the Lastchanged is not filled and also no event is triggered.

Can I fix it by adding an etag or change the mapping (I cut the mapping because its 1:1)

Thanks !!

beahviour class

managed with additional save implementation in class ZBP_I_EVER unique;
strict ( 2 );
with draft;
define behavior for ZI_EVER alias Contract
persistent table ever
draft table ZRAP_EVER_D
etag master LocalLastChanged
lock master total etag LastChanged
authorization master( global )
{
field ( mandatory : create )
Vertrag;
field ( readonly )
LastChanged,
LocalLastChanged;
field ( readonly : update )
Vertrag;

create;
update;
delete;
draft action Edit;
draft action Activate;
draft action Discard;
draft action Resume;
draft determine action Prepare;
event ContractChanged parameter ZEVENT_D_CONTRACT_CHANGED;
mapping for EVER
Muthuraja
Active Participant
0 Kudos

Hello Till,

There is no relation between Tcode ES21 & RAP BO you have created. So the admin fields will not be updated.

You can create/update values either from the Fiori UI or even you can create API and consume from other systems.

TillHeinen
Participant
0 Kudos

hi muthu,

Thanks again.

Ok sure I got that point.
when I got the logic right, whenever EVER is touched, the entry will also be ‚copied‘ with the mapping to ZI_EVER. But the event is triggered from a change in LastChanged (Etag). And than runs into my derived lcl_handler method.

How can my event get triggered by from gui eg tcode ES21.
can I use another field as trigger eg. AEDAT ( change date)

I’m searching for a consistent way to trigger the event whenever a contract is changed (fiori or gui)

Best w

Muthuraja
Active Participant

Hello Till,

You cannot trigger RAP BO event from gui until you place your custom enhancement logic in the tcode end.

I don't know any other way is there, may be you can check with experts here by raising a new question.

Thanks!

Answers (0)