on 03-14-2014 11:33 AM
Hi,
I have a requirement to read a csv file and generating an one xml file as an output for all the records. But i need to apply few of the validation rules and on the basis of validation rules, i need to reject the records. Can anyone help me how to reject the records in SAP PI.
Ex- Let us assume that there is one mandatory field item no, if the value of item no is null i need to reject that record.
Hi Arun,
I don't know , i get your requirement correctly. You want to create a 1 separate xml message for each record. If yes , did you tried parameter "Recordsets per Message as 1 " in sender file communication channel FCC parameter ? you can normally(no need to maintain context ) perform validations in Message mapping only.
Thanks
Hari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
If you are using XSLT just put the condition into the match.
This would not process any "record" where the productQuantity = 0:
<xsl:template match="record[not(productQuantity='0')]">
Best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
it will reject the whole record. right now i don't have system access to provide you example.
it will look like this.
input
<root>
<record>
value
</record>
<record>
null value
</record>
<record>
value
</record>
</root>
output
<root>
<record>
value
</record>
<record>
value
</record>
</root>
if you can share your input and output xml then people can give you correct answer for you.
read this link to understand the createif function.
http://wiki.scn.sap.com/wiki/display/XI/Standard+Functions+in+PI+7.0
Regards,
Muni.
Hi Muni,
Please find the sample scenario that i will be using:-
Source records (CSV)-
2,DESC1,FG,SU,IC,BA,EX,CF
2,DESC2,FH,SU,IC,BA,EX,DF
3,DESC3,FI,SU,IC,BA,EX,EF
4,DESC4,FJ,SU,IC,BA,EX,FF
5,DESC5,FK,SU,IC,BA,EX,GF
Target XML(Each records in one line)
<?xml version="1.0" encoding="UTF-8"?> <TCRMService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="myTCRM.xsd"><Tag1>2</Tag1><Tag2>DESC1</Tag2><Tag3>FG</Tag3><Tag4>SU</Tag4><Tag5>IC</Tag5><Tag6>BA</Tag6><Tag7>EX</Tag7><Tag8>CF</Tag8>
<?xml version="1.0" encoding="UTF-8"?> <TCRMService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="myTCRM.xsd"><Tag1>2</Tag1><Tag2>DESC2</Tag2><Tag3>FG</Tag3><Tag4>SU</Tag4><Tag5>IC</Tag5><Tag6>BA</Tag6><Tag7>EX</Tag7><Tag8>CF</Tag8>
<?xml version="1.0" encoding="UTF-8"?> <TCRMService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="myTCRM.xsd"><Tag1>2</Tag1><Tag2>DESC3</Tag2><Tag3>FG</Tag3><Tag4>SU</Tag4><Tag5>IC</Tag5><Tag6>BA</Tag6><Tag7>EX</Tag7><Tag8>CF</Tag8>
<?xml version="1.0" encoding="UTF-8"?> <TCRMService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="myTCRM.xsd"><Tag1>2</Tag1><Tag2>DESC4</Tag2><Tag3>FG</Tag3><Tag4>SU</Tag4><Tag5>IC</Tag5><Tag6>BA</Tag6><Tag7>EX</Tag7><Tag8>CF</Tag8>
<?xml version="1.0" encoding="UTF-8"?> <TCRMService xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="myTCRM.xsd"><Tag1>2</Tag1><Tag2>DESC5</Tag2><Tag3>FG</Tag3><Tag4>SU</Tag4><Tag5>IC</Tag5><Tag6>BA</Tag6><Tag7>EX</Tag7><Tag8>CF</Tag8>
Note- Please note that each records will come in one line as an xml and the target file is .out file having each records in one line.
Please let me know your thought on this.
Hi,
your above input and initial questions are different.
i am not getting why output file is having below xml definition for each record.
<?xml version="1.0" encoding="UTF-8"?>
looking at your file i think you are trying to create new message for each record.
1. you can use recordsetper message to create one message for each record by giving value 1 in the FCC parameter.
2. Else you can read the whole whole file. using multimapping then you can create separate message for each record.
this document does not cover your example but you have to work it out for yours.
Regards,
Muni.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.