cancel
Showing results for 
Search instead for 
Did you mean: 

getValueFromMap doesn't work as expected

shaji_chandran
Participant
773

Hi Friends,

This is related to the Map variable in SAP MII. I have created a Map variable and assigned a value with a particular key. After that I try to get the value from Map using function getValueFromMap it gives me some error. Please have a look at the error message pasted below. At Tracer_7 I am printing the map. At Tracer_8 I am trying to retrieve the value using getValueFromMap which gives the error.

Any help on this very much appreciated.

SAP MII Version 15.1 (SP5)

[INFO] [Tracer_7]Local.TankMap->{T8132=[string:120.414268493652]}

[ERROR] Invalid link expression in action [Tracer_8]: getValueFromMap(Local.TankMap,"T8132") [ERROR] For Transaction : Default/SC/BLS_DynamicPCoQry[Tracer_8] Link ('Tracer_8.Message' [Assign] from "getValueFromMap(Local.TankMap,"T8132")") execution threw an exception. Exception: [while trying to invoke the method com.sap.lhcommon.expressioneval.Expression.evaluate(com.sap.lhcommon.expressioneval.ActionObjects, com.sap.lhcommon.common.NamedSet) of a null object loaded from field com.sap.xmii.bls.executables.links.AssignLink.expr of an object loaded from local variable 'this'] [WARN] [Tracer_8] Rolling back "Tracer_8.Message" to [[string:]] For Transaction : Default/SC/BLS_DynamicPCoQry [ERROR] For Transaction : Default/SC/BLS_DynamicPCoQry[Tracer_8] Action: Runtime threw an exception. Exception: [while trying to invoke the method com.sap.lhcommon.expressioneval.Expression.evaluate(com.sap.lhcommon.expressioneval.ActionObjects, com.sap.lhcommon.common.NamedSet) of a null object loaded from field com.sap.xmii.bls.executables.links.AssignLink.expr of an object loaded from local variable 'this'] [ERROR] Uncaught exception from Tracer_8, while trying to invoke the method com.sap.lhcommon.expressioneval.Expression.evaluate(com.sap.lhcommon.expressioneval.ActionObjects, com.sap.lhcommon.common.NamedSet) of a null object loaded from field com.sap.xmii.bls.executables.links.AssignLink.expr of an object loaded from local variable 'this'

Thanks

Shaji

Accepted Solutions (1)

Accepted Solutions (1)

former_member185280
Active Contributor

In addition to the F I think the V is lower case as well:

getvaluefromMap(map,key)

At least thats what the Functions helper in the link editor has it as on the box I have access too.

Regards,

Christian

shaji_chandran
Participant

Thanks Christian,

You are right. v is small case. But in the documentation it is written as getValuefromMap.

See the attachment

mii-help-screenshot.png

agentry_src
Active Contributor

Hi Christian,

That was one combination I did not try in figuring out the case sensitivity.

Thanks for the help and clarification.

Cheers, Mike

Answers (4)

Answers (4)

agentry_src
Active Contributor

Hi Shaji,

All the Expression Editor functions are case-sensitive. You have a capital 'F' where you should have a lower case 'f' in the function name, so MII does not recognize the function.

Cheers, Mike

PS I compliment you on a well written and sufficiently detailed question. Well worth my time to analyze your problem. It is also fairly rare. Keep up the good content!

shaji_chandran
Participant
0 Kudos

Mike,

Thanks for your quick response. I have corrected for case sensitivity and still it gives same error.

[INFO] [Tracer_7]Local.TankMap->{T8132=[string:120.414268493652]}

[ERROR] Invalid link expression in action [Tracer_8]: getValuefromMap(Local.TankMap,"T8132") [ERROR] For Transaction : Default/SC/BLS_DynamicPCoQry[Tracer_8] Link ('Tracer_8.Message' [Assign] from "getValuefromMap(Local.TankMap,"T8132")") execution threw an exception. Exception: [while trying to invoke the method com.sap.lhcommon.expressioneval.Expression.evaluate(com.sap.lhcommon.expressioneval.ActionObjects, com.sap.lhcommon.common.NamedSet) of a null object loaded from field com.sap.xmii.bls.executables.links.AssignLink.expr of an object loaded from local variable 'this'] [WARN] [Tracer_8] Rolling back "Tracer_8.Message" to [[string:]] For Transaction : Default/SC/BLS_DynamicPCoQry [ERROR] For Transaction : Default/SC/BLS_DynamicPCoQry[Tracer_8] Action: Runtime threw an exception. Exception: [while trying to invoke the method com.sap.lhcommon.expressioneval.Expression.evaluate(com.sap.lhcommon.expressioneval.ActionObjects, com.sap.lhcommon.common.NamedSet) of a null object loaded from field com.sap.xmii.bls.executables.links.AssignLink.expr of an object loaded from local variable 'this'] [ERROR] Uncaught exception from Tracer_8, while trying to invoke the method com.sap.lhcommon.expressioneval.Expression.evaluate(com.sap.lhcommon.expressioneval.ActionObjects, com.sap.lhcommon.common.NamedSet) of a null object loaded from field com.sap.xmii.bls.executables.links.AssignLink.expr of an object loaded from local variable 'this'

swapnil_mohite
Explorer
0 Kudos

Hi Shaji,

syntax: getvaluefromMap(map, key)

Gets the value from the map by providing the map and the key as the parameter.

e.g.

getValue(Name=[String:john], ”Name”) returns John

Please try it and let me know if it works.

agentry_src
Active Contributor
0 Kudos

Well, apparently the help document from SAP has some errors in it. I have made some progress in testing the item, but instead of getValuesfromMap, I had to use getvalue(Local.TankMap{T8132}) which seems to execute. But then it throws a different error. 'Unable to find variable '120.414268493652'. Not sure why it thinks it is a variable. I even tried it as a type double. Still comes back with the same error.

However, I think there is a basic misunderstanding on how the Map works. It appears to want to the key to point to some item in another dataset as far as I can tell. Try running the expression I show to see if you can figure out a little more.

Cheers, Mike

agentry_src
Active Contributor
0 Kudos

Hi Shaji,

Kind of odd, but can you evaluate the expression in the Expression Editor window for the Tracer (either one)? Also can you provide a screenshot of your Map for this particular record as well as a few other records? Have you tested it with a different record? Same results? It looks like Tracer 7 works properly. What does that expression look like?

Been a long time since I worked with a Map, but it looks like it does not like/recognize something in Tracer 8's Message. Can you provide the entire expression as it is written in the Expression Editor?

Regards, Mike

shaji_chandran
Participant
0 Kudos

mii-expression-screenshot.png

Thanks again for spending time on this. I hope the attached screenshot helps you. I have not testing with other records yet.

Thanks

Shaji