简体   繁体   中英

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) 在此处输入图像描述

  2. Reference the script in the integration flow在此处输入图像描述

  3. Import the enumeration and use it (it's a script function used in message mapping) 在此处输入图像描述

  4. Simulate the mapping (which works if i copy enum to mapping script as well) 在此处输入图像描述

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM