cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting multiple records - SAP MDK

EacostaJh
Explorer
0 Kudos
108

Hi experts,
I want to delete the records of an entity by passing it a QueryOptions but I get the following error

delete entity error Params: {"service":{"entitySet":"Prueba","queryOptions":"$filter=idPrueba%20eq%20'f0deb6df'"}} Error: The query should have returned only one entity. It returned 2

View Entire Topic
bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

In MDK delete entity only acts on a single entity.  You will need to use a rule and loop over the list of items calling delete entity for each one.

EacostaJh
Explorer
0 Kudos

I have this error when I delete one by one
error running action propagating error Action.Type.ODataService.DeleteEntity.0: Error: [-10125] Cannot delete this entity instance because another entity instance is dependent on it.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos
In that case you need to check your odata model and possibly modify it to support Cascade Deletes if that is an option or you have to first delete the dependent items before you can delete this one.