SAP Knowledge Base Article - Public

3666858 - Groovy Script With Number Range Object Fails To Import

Symptom

Unable to import groovy script with number range object.

Environment

  • Cloud Integration
  • SAP Integration Suite

Reproducing the Issue

Attempt to import groovy script and it fails with error:

Error Details

javax.script.ScriptException: java.lang.Exception: java.lang.RuntimeException: Groovy Script Failed: d != java.lang.String@ line 86 in script.groovy, cause: java.util.IllegalFormatConversionException: d != java.lang.String

Cause

In the groovy script, the number range is being retrieved and stored in a variable. It will be treated as string not an integer. Consequently, when you attempt to format it using String.format, it leads to a type mismatch issue.

Resolution

Modify the script as follows:

def formattedSequentialNumber = String.format("%03d", Integer.parseInt(sequentialNumber))

See Also

SAP Community: SAP Cloud Integration Community

SAP Help: SAP Cloud Integration

Keywords

"d != java.lang.String@ line 86 in script11.groovy"; "java.util.IllegalFormatConversionException: d != java.lang.String", "script11.groovy", "CPI", "Cloud Integration", "import", "groovy script",  "d != java.lang.String" , KBA , LOD-HCI-PI-RT-B2B , B2B Adapter , Problem

Product

SAP S/4HANA Cloud Public Edition 2508