Skip to Content
0
Mar 15, 2021 at 01:17 PM

CAP CDS v4 put calls clearing data

51 Views Last edit Mar 15, 2021 at 01:42 PM 3 rev

I recently upgraded from CDS v3 to the latest v4 release ("@sap/cds": "^4.6.4").

I have a simple CDS entity definition:

entity NumberRange {
	key UUID	: UUID;
	ID		: String(60);
	Low		: Integer;
	High		: Integer;
	LastUsed	: Integer;
	Length		: Integer;
	Locked		: Boolean;
	tenantID	: UUID;
}

Since I upgraded to v4, data is being wiped though my application after updating entitys. Here is one example:

//CDS v4 seems to require that I pass all fields of an entity or they are nulled..
//var oPayload = {};
//oPayload.UUID = uuid;
//oPayload.ID = response.ID;
//oPayload.Low = response.Low;
//oPayload.High = response.High;
//oPayload.Length = response.Length;
//oPayload.tenantID = response.tenantID;
//oPayload.LastUsed = parseInt(lastUsed);
			
//CDS v3 Payload was able to update a single field
var oPayload = {"UUID": uuid, "LastUsed": parseInt(lastUsed)};
			
var sURL = "/odata/v4/CatalogService/NumberRanges(" + uuid + ")";
			
//Update Last Used
await this.axios.put(sURL, oPayload)
.catch(function (err) {
	var error = err;
});

Im I correct to assume that we should not have to populated every value in an object before updating?

2021-03-15-14h15-40.png

SAP support has said that custom coding is a consulting request. Therefore, I would like to show the same issue with CDS 4.6.4 when updating an entity through postman:

2021-03-15-14h40-13.png

Attachments