Skip to Content
0
Nov 30, 2022 at 06:05 AM

Executing Odata function - Unsupported collection-valued parameter

308 Views

Hi All,

I am trying to invoke Odata function which has input parameter of type array.

CDS Function definition:

function getAggregatedFields(itemIds: Array of UUID) returns AggregatedFields;

I am using following code to invoke the above function

const oContext = oReqModel.bindContext("RequisitionUIService.getAggregatedFields(...)", cartContext);
const itemIds = []; //empty array for now
oContext.setParameter("itemIds", itemIds)
.execute("$auto", false)
.then(function(data) {
console.log(`data ----------> ${data}`);
console.log(`Success!!`);
},
function() {
console.log(`Failure!!`);
});

I see following error trace in console logs:

Log-dbg.js:452 2022-11-30 10:40:49.916199 Failed to execute /Cart/RequisitionUIService.getAggregatedFields(...) - Error: Unsupported collection-valued parameter: itemIds

at h.getPathAndAddQueryOptions (https://sapui5.hana.ondemand.com/1.102.8/resources/sap/fiori/core-ext-light-3.js:117:8239)

at O.createCacheAndRequest (https://sapui5.hana.ondemand.com/1.102.8/resources/sap/fiori/core-ext-light-3.js:96:6754)

at https://sapui5.hana.ondemand.com/1.102.8/resources/sap/fiori/core-ext-light-3.js:96:3047

at https://sapui5.hana.ondemand.com/1.102.8/resources/sap/ushell/bootstrap/core-min-2.js:1942:173

How do I pass array/collection of UUID as function parameters here?