Skip to Content

Hi all,

have you ever had the problem that you have to check for null value parameters in SAP BPM mapping?

Please correct me if i did not find the right sap provided function for that but i think this is not possible?

We used to create a ejb mapping function with those generic SDOs etc. to check for null values…

But i think i found out a little gimmick to handle this null check in a “simple” expression.

Basically you have to create a own expression function (check for null string params):

nullCheckCreateFuction.png

then insert this expression:

nullCheckExpression.png

if (numeric-equal(count((toBeChecked, “”)), 1)) then true else false

This function generates a StringArray with my parameter that shall be checked and a empty string placeholder.

If any of the parameter is null, the array function will just ignore them. So if i do a count on it and the count is 1,

then this means my toBeChecked was null and i return true. Otherwise it was filled and and i return false.

This funny and sad at the sime time . Funny that it works and sad that i have no built in function for that.

Or is there any?

Have fun with it

Tobias

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Tobias Hamdorf Post author

    Hi Jocelyn,

    thanks for reply but as far as i know “isSet” only works for lists? But i will give that a try.

    I will responde if tested.

    Regards,

    Tobias

    (0) 
    1. Tobias Hamdorf Post author

      Ok i have just tested that again and it works with non list params. Thanks for that information. But i have to say that the SAP description is quite missleading:

      isSet.png

      Thank you very much. This will make things easier. But if you want a complicated way you can still use my solution 😉 .

      Regards Tobias

      (0) 
      1. Jocelyn Dart

        Thanks Tobias, I was going to say I have actually used it personally on single value fields. isSet() worked for testing empty or null values where isNilled() only worked if the value was specifically null.

        I guess the difficulty with the list params is that the list itself is set…. but it’s always good to see the other option of using expression functions to create your own tests.

        (0) 
  2. Arun Soni

    Hi Tobias,

    Thanks for sharing this blog.

    I have certain queries in context with the same –

    Let’s say “DO_Context/requesterName” is a process context variable of type “string”  on which I want to apply the “isNullString” check.

    As the Function “isNullString” expects a boolean type argument to be passed and inturn returns a boolean value, the invocation on the variable mentioned must be framed something like this-

    /wp-content/uploads/2014/11/expression_577903.jpg

    I need “Not Ready” in the case when this variable is null and “Ready” when it contains a value, but each time it so happens that it returns “Ready” in both of the cases.

    Can you please clarify the behavior of this function in this case.

    Best Regards,

    Arun

    (0) 
    1. Tobias Hamdorf Post author

      Hello Arun,

      as Jocelyn mentioned. You can use the “isSet” function. So just try

      –> isSet(DO_Context/rquesterName)

      By the way. There is a mistake in my screenshot. The param “toBeCheked” is a string ofcourse, not a boolean. So you you should change that param and use it like
      –> if(isNullString(DO_Context/rquesterName)) then “not ready” else “ready”

      Hope this helps.

      Regards,

      Tobias

      (0) 
  3. Arun Soni

    Hi Tobias,

    I tried achieving the “null” check functionality with –

    –> isSet() – It expects a list type argument to be passed, but as I mentioned the check should be on a primitive type attribute which is “string” in this case. Hence it couldn’t serve the purpose. Please refer to my earlier post on the same-

    How to handle Null Tags in SAP BPM?

    –> if(isNullString(DO_Context/requesterName)) then “Not Ready” else “Ready”

    If there is a value provided for that parameter, it gives desired result, but in the case of null value, it throws a “Null Pointer” Exception.Please refer to the following screenshot.

    null pointer.png

    Please provide your inputs on the same.

    Best Regards,

    Arun

    (0) 
    1. Tobias Hamdorf Post author

      Hi Arun,

      for me it works fine. It is even in use on productive systems without problems. I have used it on 7.31 SP5 / SP11. What is your setup? Maybe older versions do not support this?

      Regards,

      Tobias

      (0) 

Leave a Reply