cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PO 7.5: XSLT - Java enhancements

peter_wallner2
Active Contributor

Dear experts,

We are currently moving from PI 7.3 to PO 7.5.
We have a few XSLT maps that are using Java functions.
The Java functions are in a custom Java class. For example we call date functions in order to format date values:

<xsl:stylesheet
xmlns:date="com.edi.eai.xslthelper.date.DateTransform"
...>

<DATUM>
    <xsl:value-of select="date:getCurrentDate('yyyyMMdd')"/>
</DATUM>

</xsl:stylesheet>


My question now is: we want to avoid using our custom Java class on PO 7.5, we would like to get rid of it. Are there SAP standard Java classes that we could use to implement such enhancements from XSLT maps?

Thank you for your help.

Best regards,
Peter

Accepted Solutions (1)

Accepted Solutions (1)

PRAGSMATIC
Participant

If it is about XSLT and date formatting use it like below , we are using it in PI like below.

Declare this namespace :

xmlns:java="http://xml.apache.org/xslt/java"

and define these variable in xslt,

<xsl:variable name="currentDateTime" select="java:java.util.Date.new()"/> <xsl:variable name="messageDateTime" select="java:format(java:java.text.SimpleDateFormat.new('yyyy-MM-dd HH:mm:ss.SSSSSSS'), $currentDateTime)"/>
peter_wallner2
Active Contributor

Hello Anurag Gupta,

Thank you, that works.

Best regards, Peter

Answers (2)

Answers (2)

PRAGSMATIC
Participant
0 Kudos

I am glad that it worked 🙂

JaySchwendemann
Active Contributor
0 Kudos

Just out of curiosity : Did you come up with a solution?

I was thinking along the lines of using stuff from the PI / PO Javadoc

But I am not sure if you be able to call stuff from the standard J2EE Server

Cheers

Jens

peter_wallner2
Active Contributor
0 Kudos

Hello Jens,

No, I could not find a solution for this and we are still using our internal "xslthelper" Java archive. I don't know if it is possible to call the PO Mapping API from XSLT. I have not investigated it further either.

Best regards, Peter