cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Set Transaction Map Property

Former Member
0 Likes
800

I have a Map property in a transaction that I would like to set a key's value to.

I first check that the key is there using containskey(map,value)

If it doesn't exists I assign the value using put(map, key, value)

If it does exists I can't get it to assign the value to a certain key.

I am using an Assignment action:

Target XPath = Local.TestMap{"#Dynamic Variable#"}

Expression = "Test"

I am running MII version 12.1.7.50

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Likes

Thanks Diana,

I found another route using XPath and MII Documents.

I think I will stear clear of map properties from now on.

Jasper

Former Member
0 Likes

Yes, that is correct.

Former Member
0 Likes

Hi Jasper,

I've tested this scenario on a higher service pack level (12.1.8) and it seems to be working without a problem. You could enter a ticket in the SAP Support system so they can take a look at how your transaction is set up, in case I missed something.

Kind Regards,

Diana

Former Member
0 Likes

Thanks Diana,

I tried doing multiple puts and it works the first time but the second time I get this error:

[ERROR] [Assignment_0] Link ('Local.TestMap' [Assign] from "put(Local.TestMap, Transaction.testmatgroup, For_Next_Loop_0.CurrentItem)") execution threw an exception. Exception: [The first parameter for the 'put' function must be a map type. [The first parameter for the 'put' function must be a map type.]]

[ERROR] [Assignment_0] Action: Runtime threw an exception. Exception: [The first parameter for the 'put' function must be a map type. [The first parameter for the 'put' function must be a map type.]]

I also tried changing the Key to make sure it didn't like the duplicates and it still gave me this error. And yes Local.TestMap is a Map property.

Former Member
0 Likes

Ok Jasper - so in your put function example, Transaction.testmatgroup holds the name of the key, correct?

- Diana

Former Member
0 Likes

Hi Jasper,

I've been doing some experimenting, and I cannot make an assignment that way, even without a dynamic reference. However, I did find that I could assign a new value to an existing key by using the put function. For example, where Local.myKey holds the name of the key I want to assign a new value, in this case, of type string:

Source: put(Transaction.myMap, Local.myKey, "Sugar")

Destination: Transaction.myMap

Let me know if this works for you.

Warm Regards,

Diana Hoppe