cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in SAP Build Process Automation action sending empty list payload to SAP CAP action.

sk8869
Discoverer
0 Kudos
255

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. :-

sk8869_0-1745736344055.png


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 




Accepted Solutions (0)

Answers (1)

Answers (1)

MioYasutake
Active Contributor
0 Kudos

@sk8869 

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.

 

sk8869
Discoverer
0 Kudos
@MioYasutake, i updated the dependency of the project but still had the same issue.
MioYasutake
Active Contributor
0 Kudos
@sk8869 In your process, have you mapped any values to the input parameters of the action?
sk8869
Discoverer
0 Kudos
@MioYasutake, yes i have mapped the input in action used in process and then released and deployed the process