Change event to reflect the real event definition

This commit is contained in:
Uwe Klinger
2021-05-05 11:36:36 +02:00
parent c4bee1f09a
commit 902afd8a76
4 changed files with 37 additions and 23 deletions

View File

@@ -3,9 +3,9 @@ const cds = require('@sap/cds');
module.exports = cds.service.impl(function () {
const { A_BusinessPartner } = this.entities;
// TODO: Take over the original S/4 event definition
// https://api.sap.com/event/SAPS4HANACloudBusinessEvents_BusinessPartner/resource
this.after('UPDATE', A_BusinessPartner, async data => {
console.log(`>>> BusinessPartner updated ${data.BusinessPartner}`);
await this.emit("A_BusinessPartner.Changed", { businessPartners: [ data.BusinessPartner ] });
await this.emit("BusinessPartner.Changed", { BusinessPartner: data.BusinessPartner });
});
});