Skip to Content

Michal’s PI tips: XML validation – changes in 7.3

When I saw the article from my colleague (and co-author of our book from Genie Press) – Shabarish – XML / XSD Validation – An Alternative for SAP PIabout the XML validation in PI I decided that we need to sort some things out as it may start to get more and more confusing with XML validation in PI in general. As Shabarish mentioned as of PI 7.1 we have an option to use XML validation within PI but the configuration he described was only for 7.1 and 7.11 as it got changed a lot in the latest available release 7.3.

What are the changes then?

The most important one is that we no longer need to create any special XSDs nor we need to put them into any special folders of PI server. As of PI 7.3 we can use the Data Type object from Enterprise Service Repository for XML validation.

How to configure that?

Let me show you a simple XML validation data type example. The data type below needs to validate 3 fields:

a) Company code – this field needs to have always 4 chars

b) Currency – this field needs to contain 3 chars but always capital letters

c) Amount – the amount can be any integer but not more then 6 digts

Below you can find an example how the Data Type could look like.

In the second step you need to make sure the validation is switched on in the Integration Directory – the example below shows Integrated Configuration Object (ICO) but you can use a sender agreeement too of course.



Once you activate the ID object the cache with your data type used for  validation will be updated. If you do any changes in the Data Type as of  this point (regarding XML validation) you always need to reactivate the  ID part as well (so ICO object in this case).

How does it work?

Example 1

When we send the message were the company code field is too long for example we would get the error as shown below:

Example 2

When we send a message where the currency field is “EURO” instead of “EUR” we would get the following error:

Can I see which schema is being used ?

You can always check the XML validation schema in:

– – Cache monitoring

– – – mapping runtime

– – – – XML schema

as shown in the figure below.

Further options:

If you’d like to see what kind of validations you can put into the Data Type I’d suggest reading the related material from SAP first as there realy are a lot of options, starting from general facets with max, min length and finishing on much more sophisticated regular expressions – XSD Editor (Freely-Modeled Data Types)


XML validations in PI may not be perfect yet and sometimes you may still need to use other techniques like the one shown in an article from Shabarish but you need admin that it has become much easier to use than it was in the previous PI releases.

You must be Logged on to comment or reply to a post.
    • thank you, I hope this info was not posted before
      as there were so many blogs on XML validation that
      it’s becoming difficult to check 🙂

      Michal Krawczyk

      • Hi Michal,
        Nice blog. Just wanted to know,shabarish had mentioned certain invalid xmls that had flaws in the hierarchy and the structure.
        However, your example deals with the invalid format of fields. How would it validate the entire xml structure?
        Kindly let me know.
  • Hi Michal,

    This blog was very helpful to me. I am attending my first project in version 7.3 and had not yet turned on the validation of XML because it does not have access to the server folder and also because they knew about the change and I didn’t.

    I just did a test and it worked perfectly.

    BLOG came in great time.

    Thank you!!


  • Hi Michal,

    It seems, this concept is only applicable for ICO and does not work with dual stack in 7.3.

    We have to maintain the schema in the server folder for both validations by AE and IE.



    • Hi Navneet,

      did you try it in dual stack?

      this is applicable to both ico and classical scenario.

      in 7.3 we don’t have maintain the schema as we used to it in 7.11. this is the feature of 7.3.

      I have worked on 7.31 version dual stack. it was working fine.



      • Hi Marasamy,

        yes, i tried it in dual stack PI 7.3.

        I got the error for both AE and IE validation in sender agreement.


        Schema Not Available in Cache, try to validation with file system schemas. Validation With File System schemas also Failed. Schema ****.xsd not found in D:\usr\sap\DGX\****

        When I saved the schema in the folder then it worked.


  • Hi Michal,

    Thank you so much about XML Validation in PI 7.3. Its very useful whenever I use in our project. Keep up the good work.

    Advanced wishes for New year 2014 🙂


    Hari Suseelan

  • Hi Michal, nice review!, quick question, it’s possible to disable from the XML validation the part that check the exact order of the elements contained in the Node? thanks

    • Hello,

      Posting the information here if someone encounter the same problem 🙂

      The reason for the order validation is that the xsd generated from the datatype uses the “xsd:sequence” oder indicator to define the element present in a tag which describe the element in order.
      If you want to bypass the order sequence, you need to take the generated xsd, change the “xsd:sequence” into “xsd:all” and load it into PI as External Definition.

      Only problem is that the “xsd:all” indicator is not compatible with element using “unbounded” occurence 🙁

      I hope this comment will help someone someday as I struggled to find this 🙂

      Romain B.

  • Hi Michal, nice review here,

    i have activated validation but it seems to to take notice of optional fields.

    If a field is optional an dis not provided in the payload i get a validation error (Field Missing)

    Is this correct?