Optimizing BLS performance of large XML process with XSLT
After having read the nice article from Saha Dipankar about performance problem with large XML process in BLS (see http://scn.sap.com/people/dipankar.saha3/blog/2011/05/03/optimizing-bls-performance-for-xml-handling-in-sap-mii ), I decided to go deeper as we were encountering almost the same scenario, and so I develop a new solution with XSLT process…
First, our scenario… We have POD (production operator dashboard) on the floor, linked to SAP ME system through MII with BLS transactions exposed a web services. One of this web services was really struggling with performance on some machine and did almost cause the servers to crash…
This web service was used to show all the BOM (build of materials) for all materials that are in the production line of the machine, with all revisions (or almost). This could mean a lot of data’s (for example, 60 Boms and around 1000 items).
Example of data retrieved :
The goal here is to group all Item by pair Bom, Bom_revision (so we had a key in first column to manage this in a easiest way).
Structure of the output XML is :
<?xml version=”1.0″ encoding=”UTF-8″?>
When I applied the “classic” way to do it, using local XML template, looping into the query result with grouping by bom, revision, doing assignments, like the third scenario described in Saha’s article, the performance could be very poor, sometimes more than one minute… Which is not acceptable for a shop floor system.
So I did apply an XSLT action block… As I was not really a XSLT expert, it took me some time to design it. Especially due to the fact that MII (12.1.9 in our case) is not supporting XSLT 2.0 and the powerfull commande “for-each-group”… But after some trials and errors steps, I finally find a good way to achieve this (based on this article : http://www.jenitennison.com/xslt/grouping/muenchian.html )
The result in term of performance was really great, dividing the process times by around 10 times less…