Sebi
Sebi

Reputation: 3979

How to access Groovy script from SAP CPI Script Collection in another Script?

I try to access a groovy script from a script collection in another script (SAP CPI). The script from the script collection contains an enumeration and I want to access this enumeration in a message mapping script. So I do the following:

  1. Create the script in the script collection (same package as the iFlow) enter image description here

  2. Reference the script in the integration flow enter image description here

  3. Import the enumeration and use it (it's a script function used in message mapping) enter image description here

  4. Simulate the mapping (which works if I copy enum to mapping script as well) enter image description here

Runtime exception during processing target field mapping /ns1:Messages/ns1:Message1/PerPhone/PerPhone/phoneType. The root message is: Exception:[com.sap.aii.mappingtool.tf7.rt.BehaviorInvocationException: groovy.lang.MissingPropertyException: No such property: BonusScheme for class: Script29] in class com.sap.aii.mappingtool.tf7.ScriptHandler method addPicklistValue[[Ljava.lang.String;@1e57ab7f, [Ljava.lang.String;@29c56946, [Ljava.lang.String;@11ba6ab8, [Ljava.lang.String;@3d2f6b53, [Ljava.lang.String;@1e0033da, com.sap.aii.mappingtool.tf7.rt.ResultListImpl@1c8de605, com.sap.xi.mapping.camel.impl.MappingContextImpl@470ff907, com.sap.aii.mappingtool.tf7.rt.Context@5e20a086] on the exchange: Exchange[ID-ff2d2c8d-4286-4e5a-5b75-1556-1657430698694-1068-1]

Seems that my enumeration isn't known and therefore can't be referenced. I'm just asking myself - why? It's everything deployed. Someone has an idea?

Upvotes: 1

Views: 1396

Answers (1)

coochiman
coochiman

Reputation: 13

I think You cannot reference a Script from Script Collection in a Messaging Mapping. Even if you want to reuse a Common Script like getHeaders or getProperties Script as Custom Function from a Script Collection, You cannot. it's just the way it was built.

Upvotes: 0

Related Questions