SAP Knowledge Base Article - Public

2339086 - You get Error While Creating Contact via Java API With Nested Object ContactBusinessAddress.

Symptom

You are creating a contact via Java API. When trying to create an entity with nested
object, you get error from the server. However when the Nested Object ContactBusinessAddress is not present then the contact is being created fine.

ERROR:
HttpResponseProxy{HTTP/1.1 500 Internal Server Error [set-cookie: sap-usercontext=sap-client=089; path=/,
content-type: application/json, content-length: 159, sap-message:
{"code":"ODATA_ERROR",
 "message":"Error occurred during processing",
 "severity":"error",
 "target":"",
 "details":[{"code":"AP_ESI_COMMON:118 ",
 "message":"Changing Changed On not possible; field is read-only",
 "target":"",
 "severity":"error"},
{"code":"BPREL_Please enter a valid category. isn't valid.:000",
 "message":"MESSAGE",
 "target":"",
 "severity":"error"}]},
 c4c-odata-response-time: 1312 ms]}

 

Reproducing the Issue

Post Body:
{
 "CategoryCode": "1",
 "CategoryCodeText": "Person",
 "ContactName": "Sri Ram",
 "FirstName": "Sri",
 "LastName": "Ram",
 "MiddleName": "",
 "NickName": "KKY",
 "RoleCode": "BUP001",
 "MarketingLeadIndicator": false,
 "ContactBusinessAddress": [{
 "ETag": "/Date(1467268227067)/",
 "FirstLineDescription": "Address line 1",
 "PostalAddress": "Flat 103, Sriram nagar colony, Kondapur, USA",
 "PreferredCommunicationMediumTypeCode": "1",
 "SecondLineDescription": "Address line 2",
 "UUID": "29a31f53-614d-4d38-bfdf-f5e0a7d5f24f",
 "PreferredCommunicationMediumTypeCodeT ext": "1"
 }]
}

Cause

 The Entity Type Contact Collection is on Business Object Business Partner and node ROOT and the entity type Contact Business Address is on Business partner relationship and node Root. Inline Cross BO Association creation is not possible.

Resolution

Please follow the below mentioned method to maintain proper contact business address:

1. Create an corporate account .
Sample payload:
{
  "CategoryCode": "2",
  "ExternalKey": "zan_ext_key1",
  "FirstLineName": "FN_Corporate_10",
  "RoleCode": "BUP002"
}

2. Maintain proper address for the account created above.
Sample payload:
{
  "City":"Fremont",
  "CountryCode":"US",
  "POBoxAddress":"false",
  "FormattedAddress":"Fremont CA / US",
  "State":"CA"
}

3. Create a contact.
{
  "CategoryCode": "1",
  "CategoryCodeText": "Person",
  "ContactName": "Sri Ram",
  "FirstName": "Sri",
  "LastName": "Ram",
  "MiddleName": "",
  "NickName": "KKY",
  "RoleCode": "BUP001",
  "MarketingLeadIndicator": false,
}

4. Create an relationship between the account and the contact created.
{
  "AccountUUID":"00163E02-EF34-1EE1-BB93-B81042BD532D",
  "CategoryCode":"BUR001</d:CategoryCode",
  "Main":true,
  "ContactUUID":"00163E02-EF34-1EE1-BB93-B81042BDF32D",
  "DepartmentCode":"0001",
  "FunctionCode":"0002',
  "ReverseDefaultIndicator":true
}

5. Now maintain the account address as the contact business address for the corresponding contact.
{
  "FirstLineDescription": "Address line1",
  "PostalAddress": "Flat 103, Sriram nagar colony, Kondapur,USA",
  "PreferredCommunicationMediumTypeCode":"1",
  "SecondLineDescription": "Address line 2",
  "UUID":"29a31f53-614d-4d38-bfdf-f5e0a7d5f24f",
}

Note: Account address and account creation can be merged and created together inline.

 

Keywords

KBA , LOD-CRM-EMP , Employee , How To

Product

SAP Hybris Cloud for Customer add-ins 1605 ; SAP Hybris Cloud for Customer add-ins 1608 ; SAP Hybris Cloud for Customer add-ins 1611 ; SAP Hybris Cloud for Customer add-ins 1705 ; SAP Hybris Cloud for Customer add-ins 1708 ; SAP Hybris Cloud for Customer add-ins 1711