cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Cloud SDK : SDK Custom Field not update through Custom OData Service

Former Member
0 Kudos

Hi Experts,

I am working on Custom OData service for Individual Customer and I am using standard business object called "Customer" I am using (Beta) Administrator work center -> Service Explore -> Custom OData Service to create custom odata.

I have created custom OData Service from standard BO "Customer" and added some fields from Customer BO and Save Activate.

I have also tested newly created custom OData Service using GET , POST , PATCH method for Query , Create and Update Individual Customer via Custom OData service and its working fine.

Now We are using Partner Development System to create this  custom OData Service and I have checked we can not able to add Extension Fields from KUT (Adapt) mode. ( Note 1873094:Cannot change Field Extensions in Adaption Mode in a Partner Development Tenant …).

We have added custom fields(TID) with EXTENDED_TEXT data type in Customer BO via SDK and added Process Extension scenario and add that fields in standard OData Service.

Now from Beta Administrator in Customer BO i can able to see that SDK fields in standard OData and I have added into custom OData Service.

When we are try to update or create that custom field TID I can not able to update.

Please anyone have idea why custom fields created via SDK and added into OData is not create or update.

If anyone need more information I will provide you

Regards,

Mithun

Accepted Solutions (0)

Answers (1)

Answers (1)

victorsilva
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Mithun,

I've already used OData with Custom fields and it has worked.

Are you receiving any error? Are you using POST or PATCH? What is your request payload?

Are you able to receive the values from your custom fields on a GET?

Best regards,

Victor Silva

Former Member
0 Kudos

Hi Victor Silva,

I am using PATCH method with below payload

<?xml version="1.0" encoding="utf-8"?>

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"

xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/zonecustomer/">

<atom:category term="cust.ONECustomer"

scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

<atom:content type="application/xml">

<m:properties>

<d:ObjectID>00163E04B6021ED2B6E362D75E99395E</d:ObjectID>

<d:onenotes>ONE Note 1</d:onenotes>

<d:onetid>ONET1</d:onetid>

<d:zonetid>ZONET1</d:zonetid>

</m:properties>

</atom:content>

</atom:entry>

Here in above highlighted fields I have added using  SDK and added into Customer BO and I can able to see in OData Service.

Error Message : The Data Services Request could not be understood due to malformed syntax.

When i update any standard fields than I can able to see changes in front -end but when i try to update custom fields as mentioned above i am getting error as above.

Let me know if you need more details :

Regards,

Mithun

victorsilva
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Mithun,

It seems that your payload is not correct, there may not be a problem with the field itself.

I usually prefer to use JSON, it is usually easier to understand.

The URL should be something like:

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/zonecustomer/{BusinessObjectNode}Collection(00163E04B6021ED2B6E362D75E99395E)


Payload would be something like:

{

   'onenotes': 'ONE Note 1',

   'onetid': 'ONE1',

   'zonetid': 'ZONET1'

}


Make sure all fields you need are selected on the OData definition.

Also, make sure you inform the correct Content-Type on the request header (json, application/xml).


A good path for testing is to use a GET response as base for the POST request.


Best regards,

Victor Silva

Former Member
0 Kudos

Hi Victor Silva,

I am using below xml payload to update fields

<?xml version="1.0" encoding="utf-8"?>

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"

xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/cust/v1/zoneindcustomer/">

<atom:category term="cust.ZONECustomer"

scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

<atom:content type="application/xml">

<m:properties>

<d:ObjectID>00163E10B4621EE5B2CF4349BF36CE0D</d:ObjectID>

<d:Email>sample@gmail.com</d:Email>

<d:onetid>ONET1</d:onetid>

</m:properties>

</atom:content>

</atom:entry>

Now i can able to update Email field (Standard Field from Customer BO) but when i check onetid field (Custom field added into Customer BO) via SDK) not getting updated via same payload.

Also I am working on Partner Development system and if when we create Extension field via KUT than may be I can able to update fields from OData but this fields I have created via SDK.

Regards,

Mithun

victorsilva
Product and Topic Expert
Product and Topic Expert
0 Kudos

Is the field onetid selected on the OData? Do you receive it if you execute a GET?

Former Member
0 Kudos

Yes,

I can able to see field in Custom OData service.

I have added using Process Extension Scenario. after that I have created new custom OData via standard BO Customer  and Under Common node I can able to see that custom field called onetid.

Regards,

Mithun

victorsilva
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Mithun,

Is your field selected on Create/Update column?

Former Member
0 Kudos

Hi Victor Silva,

Yes Its selected both.