cancel
Showing results for 
Search instead for 
Did you mean: 

Executing Odata function - Unsupported collection-valued parameter

11-30-2022 7:05 AM
1544 views 2 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

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?

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

0 Likes

Hi Krishna

currently it is not possible see documentation for class sap.ui.model.odata.v4.ODataContextBinding --> create.

you can use common ajax.call instead !!

0 Likes

Hi Chrisoph,

Thank you for the answer

Answers (0)