cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CPI:Groovy Script Errorn in Message mapping

0 Kudos
1,034

customfungroovy.txt

Hi Experts,

I am facing anissue with my one of custom function in message mapping getting the below error.

I am attaching the Groovy script which i am using inmessage mapping.

Please help me to get this solved.

Error Detailscom.sap.xi.mapping.camel.XiMappingException: Runtime exception during processing target field mapping /IdamFuture/Employee[3]/Position_Status. The root message is: Exception:[com.sap.aii.mappingtool.tf7.rt.BehaviorInvocationException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types: (Script26$_customFunc_closure2) values: [Script26$_customFunc_closure2@73be52b8] Possible solutions: is(java.lang.Object), any(), get(java.lang.String), any(groovy.lang.Closure), use([Ljava.lang.Object;), wait()] in class com.sap.aii.mappingtool.tf7.ScriptHandler method customFunc[2018-04-01T00:00:00.000, 2018-03-26T00:00:00.000, SR, com.sap.aii.mappingtool.tf7.rt.Context@542db07] No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types: (Script26$_customFunc_closure2) values: [Script26$_customFunc_closure2@73be52b8] Possible solutions: is(java.lang.Object), any(), get(java.lang.String), any...
View Entire Topic
markangelo_dihiansan
Active Contributor
0 Kudos

Hi Abdul,

The variables toDate and begin should be of Date type and not String.

        def format = new SimpleDateFormat("yyyy-MM-dd")
def toDate = format.parse(format.format(new Date()))
def begin = format.parse(startDate)
def duration, output
use(groovy.time.TimeCategory) {
duration = toDate - begin
}
if( Timetype == 'SR' && duration.days >= 28 ){
output = "Long Term Sick"
}
else if( Timetype == 'ML' ){
output = "Maternity"
}
else{
output = " "
}
return output

Hope this helps,

Mark