IN MESSAGE MAPPING in SAP PI/PO

One of the things that really can get me up the red field is when I get an <null> element when working with a SAP PI mapping. Or I would say rather debugging, because of some strange incoming data. Why not give me something that I can us in way mapping to check for. The <null> gives a lot of issues for figuring out if the values work.

I’m not sure what causes this to be like it is. It may be a null string or something like it.

The build in function “isNil” delivered this result. I guess it checks if the values is XSI:Nil. I would have guess that this delivered a false value for this input.

 

 

So I had to create my own function to check for this.

The isNull function that I created looks like this

for(int i=0;i<var1.length;i++){

if (var1[i]==null){

result.addValue(“true”);

}else{

result.addValue(“false”);

}

}

 

If I then want to do an OR function after this, where on input can be null then it does not solve my problem. false or <null> does give <null>. Dam. So I cannot use the function that I wanted.

So I just have to build in the length check into my null function, so it does support the extra function. I could also build an OR function to support this extra features, but that will not add a lot of extra value. I’m only using this

 

 

So the new function looks like this.

for(int i=0;i<var1.length;i++){

 String tmp  = var1[i]; 

if (tmp == null){

   result.addValue(“false”);

}else{

 

  result.addValue(tmp.length()>0);

 
 

}

}

 

 

I do hope that you find this helpful and it solve some of your problems. I’m working on creating a course around how to use SAP PI/PO. I have created some free videos around creating your first scenario that you can get on http://picourse.com

Related Posts:

  • No Related Posts