cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CPI: Help needed with XSLT code !

das_sappo
Participant
0 Kudos
905

Hi Experts,

Could you please help me with the below condition ?

If E1EDK01[QUALF=012]/BELNR is nill then map E1EDK01[QUALF=002]/BELNR with target.

Regards,

Arvik

Accepted Solutions (1)

Accepted Solutions (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Arvik,

This solution presupposes the renaming that I have mentioned in my comment.

<xsl:choose>
<xsl:when test=“exists($nodes_in/BELNR_012)”><xsl:value-of select="$nodes_in/BELNR_012“/></xsl:when>
<xsl:otherwise><xsl:value-of select="$nodes_in/BELNR_002”/></xsl:otherwise>
</xsl:choose>

Regards,

Ryan Crosby

Answers (1)

Answers (1)

YayatiEkbote
Contributor
0 Kudos

Try this one -

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="//E1EDK01[QUALF=012]/BELNR">
				<S_REF>
					<D_128><xsl:value-of select="'Qulifier'"/></D_128>
					<D_127><xsl:value-of select="//E1EDK01[QUALF=012]/BELNR"/></D_127>
				</S_REF>
			</xsl:when>
			<xsl:otherwise>
				<S_REF>
					<D_128><xsl:value-of select="'Qulifier'"/></D_128>
					<D_127><xsl:value-of select="//E1EDK01[QUALF=002]/BELNR"/></D_127>
				</S_REF>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>

Regards,

Yayati

das_sappo
Participant
0 Kudos

Hi Yayati,

Thanks for your reply.

Not able to simulate MAG with this code as giving error on XSLT.