cancel
Showing results for 
Search instead for 
Did you mean: 

How to skip a record using XSLT based on a particular plant value

Former Member
0 Kudos

Hi Friends

How can we skip a record based on a particular plant value with XSLT mapping.

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

check out the link http://www.w3schools.com/xsl/xsl_for_each.asp

you will have to use the not equal operation on that field you want to skip

Filtering the Output

We can also filter the output from the XML file by adding a criterion to the select attribute in the <xsl:for-each> element.

ex. 
<xsl:for-each select="catalog/cd[artist='Bob Dylan']">

Legal filter operators are:

    =  (equal)
    != (not equal)
    &lt; less than
    &gt; greater than

Former Member
0 Kudos

Hi Shabarish, great to find you answer , still in Wipro? remember we had a chat once.

My problem is for a plant value 3062 the record should be skipped , so how do we achieve it with XSLT , the output of thye xslt program will be fed into the message mapping right?I am working on XSLT for first time , maybe if you could help me a bit more.It is a file to idoc scenario , the file will be sending multiple records at a time.

Shabarish_Nair
Active Contributor
0 Kudos

why cant you do it with normal graphical mapping?

in any case, when you use for each and put a condition like the below, it will ignore the records for that particular condition

<xsl:for-each select="mynode/node[plant!='3062']">

rest of the logic

Former Member
0 Kudos

refer this:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/000ee4d0-be91-2d10-8aaf-ff8045bdd...

in addition to previous reply u can chk this option also


<xsl:for-each select="MT_Name/row">
< xsl: if test=u201Dplant != 3062u201D>
ur logic
</xsl:if>
</xsl:for-each>

Former Member
0 Kudos

The scenario already contains a graphical mapping which is being used so this XSLT mapping will be used before the graphical mapping right?

Former Member
0 Kudos

this is the sample source file

<?xml version="1.0" encoding="UTF-8"?>

<CEVAStockMovement xmlns:ns0="urn:bp:xi:dwn:lu:warehouse3rd:Logistics:100">

<Header>

<TRANDATE>07052009</TRANDATE>

<TRANTIM>235000</TRANTIM>

<IFTYP>DRSTM</IFTYP>

<IFSEQNO>004937</IFSEQNO>

</Header>

<Detail>

<MVT_DATE>20090507</MVT_DATE>

<MVT_TYPE>223</MVT_TYPE>

<REF_NBR>0000014567</REF_NBR>

<MVT_REASON/>

<MATNR>108908</MATNR>

<PLANT>3025</PLANT>

<BATCH>NBM</BATCH>

<STG_LOC>PLCL</STG_LOC>

<STK_RC/>

<QTY>00000002.000</QTY>

<MATNR_TO>108908</MATNR_TO>

<PLANT_TO>3025</PLANT_TO>

<BATCH_TO>NBM</BATCH_TO>

<STG_LOC_TO>DAMA</STG_LOC_TO>

<STK_RC_TO/>

</Detail>

<Trailer>

<RECCOUNT>000001</RECCOUNT>

</Trailer>

</CEVAStockMovement>

from this an idoc will be created , so graphical mapping is used .

Former Member
0 Kudos

u can use XSLT before graphical mapping....i guess Shabarish has already replied u for the same...

same question why dont u handle ur req using graphical mapping only??

Former Member
0 Kudos

Customer wants it this way , maybe they have plans to include more features later on to be brought into this xslt.

Answers (0)