3 weeks ago - last edited 3 weeks ago
Hi everyone,
We are building a SAP CAP application where we define an action to store list data into a HANA DB after an approval step in SAP Build Process Automation (BPA).
Here is the setup.
My CAP application schema looks like this.
entity OTPDA : managed {
key userID : String;
issueDate : String;
payComponent : String;
payComponentNature : String;
amount : String;
currency : String;
unit : String;
tmu : String;
assignmentNumber : String;
comments : String;
log : String;
}
CAP action in service section
action storeOtpdaData(OtpdaDatas : array of OTPDA) returns String;
and its handler
const onStoreOtpdaData = async (req) => {
const { OTPDA } = cds.entities("db.payroll");
const tx = cds.transaction(req);
const aOtpdaDatas = req.data.OtpdaDatas;
try {
for (const entry of aOtpdaDatas) {
await tx.run(
UPSERT.into(OTPDA).entries({
userID: entry.userID,
issueDate: entry.issueDate,
payComponent: entry.payComponent,
payComponentNature: entry.payComponentNature,
amount: entry.amount,
currency: entry.currency,
unit: entry.unit,
tmu: entry.tmu,
assignmentNumber: entry.assignmentNumber,
comments: entry.comments,
log: entry.log
})
);
}
return `${aOtpdaDatas.length} record(s) stored successfully.`;
} catch (error) {
console.error("Error inserting OTPDA data:", error);
req.reject(500, "Failed to store OTPDA records.");
}
};
In SAP Build Process Automation, I have created an action using the CAP destination and mapped it accordingly. However, when BPA tries to call the CAP action, the request payload is going blank, and therefore no records are being stored.
Here is the screenshot:- The request section payload structure is array of object but the request body which BPA is sending is array of blank objects. :-
Any insights or guidance would be highly appreciated.
Thanks a lot in advance!
SAP Build Process Automation SAP Cloud Application Programming Model SAP HANA Cloud, SAP HANA database
Request clarification before answering.
When you modify the action, release and publish it, the project version is updated. Make sure to update the dependency of the project that uses the action as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
22 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.