cancel
Showing results for 
Search instead for 
Did you mean: 

How to set one of the lookup value to null in the Customer record

Former Member
0 Kudos

Hi Experts,

I was trying to set one of the lookup values to NULL in the Customer record if I don't get a lookup record id. I am just setting a empty string to the value as below, but it is giving an exception.

try{

StringValue strSOV = new StringValue("");

recCustomer.setFieldValue(repSchema.getFieldId("Customers", "Sales_Organization_View"), strSOV);

It is giving the following exception.

Exception:Type mismatch. Can not set new value of type 'STRING' to field 'F1222-889' which type should be 'LOOKUP'

Please let me know how to resolve this, and give some links to get some knowledge on this.

Thanks in advance

-Sai

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Sai Sunkavelli

The exception is due to the code trying to set a StringValue to a filed of type LookUp.

Based on your use case/logic, use NullValue(). It's in com.sap.mdm.valuetypes.NullValue.

-Wing

Former Member
0 Kudos

Hi Wing,

Yes, I tried MDM Null value and it worked. I was trying java null and StringValue for empty string...etc. Thanks for your reply.

-Sai

Answers (0)