cancel
Showing results for 
Search instead for 
Did you mean: 

Records Rejection in SAP PI

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member190624
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

dear all,

In pi ,we have option is there.that is document offset.

peter_wallner2
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Peter, we are using graphical mapping. We are not using xslt or Java mapping.

Muniyappan
Active Contributor
0 Kudos

Hi,

below thread meets your requirement.

instead of B use your null value.

Regards,

Muni.

Former Member
0 Kudos

Hi Mani, does the create if node function reject whole record or it only doesn't create that particular tag in XML.

I m very new to Sap pi, plz reply by giving an example..

Muniyappan
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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.

Muniyappan
Active Contributor
0 Kudos

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.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90dcc6f4-0829-2d10-b0b2-c892473f1...

this document does not cover your example but you have to work it out for yours.

Regards,

Muni.