cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to Handle Missing Source Values and Default to Empty String in SAP CPI Mapping?

NS50207929
Explorer
0 Kudos
1,844

I’m working on an integration in SAP CPI where I need to handle missing or null values in the mapping. Specifically, I want to ensure that when there is no value for a specific source field, the target JSON payload includes "value": "". (see attached picture for current mapping). 

Original Problem:

We are encountering the following error in the flow:

"Error occurred during custom_attributes processing. The responsibilities_employee attribute code doesn't have a value set. Enter the value and try again."

The current payload looks like this:
{
"attribute_code": "responsibilities_employee"

The requirement is that when there is no value for the attribute (e.g., responsibilities_employee), we need the output to include:

{
"attribute_code": "responsibilities_employee",
"value": ""

I have tried the following:

  1. I used the exists function to check if the input field exists.
  2. I connected it to an ifS function to return either the source value (if it exists) or "" (empty string) if it does not.
  3. I passed this output to a concat function to join the values (GivenName and FamilyName), with a space as a delimiter.

Here’s the simplified flow I’ve been building:

  • GivenName → ifS → concat
  • FamilyName → ifS → concat
  • concat → value

However, it’s still not working as expected, and when the source value is missing, the value tag is missing entirely in the output payload instead of defaulting to "".

How can adjust the mapping in order for it to work?

For the sake of clarity. When the field is populated it looks like this:
{
"attribute_code": "responsibilities_employee",
"value": "John Doe"
},

Accepted Solutions (1)

Accepted Solutions (1)

maik_bosch
Contributor

Answers (0)