cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Null Values

itabhishek9
Participant
0 Kudos

Hi SDNites,

I am getting multiple <null> values in a field in the source structure where all other fields for that records have values.

My requirement is in case value is null (field not present in IDOC sent from SAP to PI), I would map it with default value in the target. I have tried to use mapwithdefault function but it is not recognising the null values. Also I tried to write the UDF but with in UDF when I use loop with condition input.length then this loop is not working as input.length is also not recognising the null values.

Can you please guide how can I achieve the same in SAP PI.

Regards,

Abhishek

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Abhishek,

The mapWithDefault will work.

Regards,

Praveen.

Answers (4)

Answers (4)

itabhishek9
Participant
0 Kudos

Thanks everybody for your response. It has been resolved now and have used mapwithdefaults function.

Former Member
0 Kudos

Hi Abhishek,

If the field context is set to its parent node then its not an issue. mapWithDefault will work.

If you make entire value of the field in one context that time it wont work.

Solution to handle the above situation:

Like in the above example, You can solve it source Node- mapWithDefault-removeContext-target Node

Hope this will be helpful.

Thanks

Sagarika

vicky20691
Active Contributor
0 Kudos

even more easy is use remove context , it will make all null become [] and then do splitbyvalue - each value

apu_das2
Active Contributor
0 Kudos

Hi Abhishek,

Add one more layer of validation and check-

First use exist() node function and then check whether the value is null or not null.

Thanks,

Apu