Thursday, January 19, 2012

Generic UDF for ThrowException in Graphical Mapping


3 input variables.
Input
msg1
msg2.

___________________________________________________________
public String Generic_ThrowException(String input, String Msg1, String msg2, Container container) throws StreamTransformationException{
int length = input.length();

if( length <= 0 )
{

throw new RuntimeException("Error :  " + Msg1 + msg2);
}
else
{
return input;
}
}
___________________________________________________________

Thursday, March 24, 2011

Generic XSLT code to remove namespaces from XML

Generic XSLT Code to Remove ALL Namespaces from XML.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" version="1.0" encoding="UTF-8" />
        <xsl:template match="*">
                <xsl:element name="{local-name()}" >
                        <xsl:apply-templates select="@* | node()"/>
                </xsl:element>
        </xsl:template>
</xsl:stylesheet>

Generic XSLT Code to Remove Namespaces EXCEPT namespace="urn:sap-com:document:sap:rfc:functions"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" version="1.0" encoding="UTF-8" />
        <xsl:template match="*">
                <xsl:element name="{local-name()}" namespace="urn:sap-com:document:sap:rfc:functions">
                        <xsl:apply-templates select="@* | node()"/>
                </xsl:element>
        </xsl:template>
</xsl:stylesheet>