Skip to Content

PO 7.5: XSL map with Java functions

Dear experts,

We are moving to SAP PO 7.5 and have XSL maps that call java functions.

I looked at the following guidelines/threads:

I modified one of our XSL maps in the following way.
I added the namespace for xsltc from apache and also added the cast for the Tracer Class:

<xsl:variable name="traceLog">
   <xsl:value-of select="concat('TU details of product',$Matnr,' are incomplete')"/>
<!-- TRACE BEGIN -->
<xsl:variable name="__function" select="trace:warning(xsltc:cast('com.edi.eai.xslthelper.log.XSLTracer',$traceLog))"/>
<!-- TRACE END -->
<xsl:message terminate="yes">
   <xsl:value-of select="xsltc:cast('com.edi.eai.xslthelper.log.XSLTracer',$traceLog)"/>

The Java code itself looks like this:

package com.edi.eai.xslthelper.log;

import java.util.Map;

public class XSLTracer
  private static final String MAPPING_TRACE = "MappingTrace";
  private static MappingTrace trace;
  public static void initTrace(Map inputparam)
  trace = (MappingTrace)inputparam.get("MappingTrace");
  public static void warning(String logString)
  catch (Exception localException) {}

However, when I run the scenario which is an outbound MATMAS IDoc it fails because details of the material are not maintained but I do not get the expected message "TU details of product 665445 are incomplete" in the message log.

Instead I get:
Cannot convert data-type 'result-tree' to 'com.edi.eai.xslthelper.log.XSLTracer'

Please help me to find out what I am doing wrong.
Did I miss something in the XSL map?

Thank you, Peter

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Oct 21, 2017 at 07:13 AM

    I was reading the need to cast when passing the objects to the method. In your class it is just string.

    Here you are trying to convert string to type XSLtracer.can you check removing cast and pass only trace log.

    <xsl:variable name="__function" select="trace:warning($traceLog)"/>
    Add comment
    10|10000 characters needed characters exceeded