Skip to Content

Validations using Java for those not having PI7.1

         Message validations in XI has always been a matter of concern for developers. Especially for those who are even refrained from using BPM’s.        I always wondered so as to why the ‘Details’ part is provided in the data type creation? As there is no check on the incoming message based on these details! Even though you provide the ‘Details’ say like ‘maxLength=8′ the XI will still accept the data which exceeds this ‘maxLength’ there was no API which can stop this from happening. But for those who want this functionality they have two options: ** Stay on the current version of XI and find a way out. Well here is one of the way outs: Using a validation program in Java Mapping. image   *Step1:*Mention the Details about the fields in the DT(Data Type) image *Step2:*Export the XSD(Schema) of the MT(Message type) created using this DT and place it at a location in server image
You must be Logged on to comment or reply to a post.
  • The shortfall of the above mentioned code is that it can not show all the records with errors, it will give up when the first error occurs; rest all errors will be found only when this one is removed.
    And there sems to be no way to stop the SAP from throwing an exception and read/collect more errors and then give up.
    For this there is only one way to handle and that is designing our own parser and handling the exceptions thrown by it.
    • You’re right in the description, but it’s not a limitation of SAP. Standard SAX & DOM parser implementations have this limitation, as you can see in programs such Altova XMLSpy.


      • Thanks Henrique,
        Yes you are right, it is not SAP’s limitation its the parsers that have a limit.
        Lets consider this case:
        there is one message containing say 10 records and one field in all the records is vulnerable to errors.
        Now whenever this message is processed thru the mapping logic it will throw an exception mentioning only the first occurence of the error- in short it will show me the error in the field in the record which comes first in all the 10 records.Of course it is implicite to check all the such vulnerable fields for correction but this is an option for suitable for only few records-consider the case for huge data.
        So it is always helpful to throw an exception which clearly says that “Fieldxx of Record xxx has xxx error”.
        All this if would have been possible to do-then I think I would be writing some code before the Exception is thrown and in that I would have collected the list of such possible errors.
        Well to my question the answer from SAP is a simple No!
        So in all even though there is an option of generating an alert for an exception(which is not very detailed one) we fall short of resource.
        Well this is apart from our discussion to the above blog.

        Concerned to the above blog let me write one more which will remove this “Shortfall”.(of course it will have my own parsing technique so please bear with the performance 🙂 )