Recently I had the opportunity to implement so called PunchOut functionality in a SAP Hybris Commerce solution for one of our clients.
With PunchOut for SAP Commerce B2B Accelerator, a buyer can shop a supplier’s online catalog and save the selected items as a requisition in the procurement system.
The term “PunchOut” refers to how the buyer “punches out” from his or her procurement system into the supplier site. The shopping cart is used as a basis for creating a purchase requisition, which is sent for approval within the buyer’s company. After the purchase is approved, the actual order is sent back to the supplier for processing.
How it works
The user with a purchaser role starts the “PunchOut” and the procurement system will usually open the supplier’s website, in this case the SAP Hybris Commerce storefront, and automatically login the purchaser into the storefront. The purchaser can now lookup products and add them to the shopping cart as you would normally.
Once the purchaser is done adding products to the cart, they open the cart, and instead of a ‘Proceed to checkout’ button, there now is a ‘Proceed to requisition’ button.
This button will submit the contents of the cart to the procurement system and the purchaser is also navigated back into the procurement system.
In the procurement system it is now possible to see the products with quantities and price information that were added to the cart earlier, and the requisition can be finalised.
After that finalisation in the procurement system can send the order back into the supplier’s system.
A well known procurement system of SAP is “SAP Ariba”, for more information see https://www.ariba.com.
Ariba created a protocol called cXML (http://cxml.org) in 1999, intended for communication of business documents between procurement applications, e-commerce hubs and suppliers. cXML is based on XML and provides formal XML schemas for standard business transactions, allowing programs to modify and validate documents without prior knowledge of their form.
Another protocol used in “PunchOut” is OCI, which stands for Open Catalogue Interface. A detailed description of that protocol can be found here: https://punchoutcommerce.com/docs/sap-oci-5.pdf
To meet our client’s requirements we had to do some customisation to the implementation of both protocols. One of the most important requirements was that the client wished to be able to alter the messages sent back to the procurement system.
For example, to add additional information about products or entries. And even in some cases to update existing information.
For this we developed a way that the right before the message is send back to the procurement system we pass it through an Xpath Transform Instruction processor, where on one hand it has the original message, and on the other hand a set of instructions to modify the original message. That could be instructions to add a new XML element somewhere in the tree or even update an existing XML element.
We defined an Xpath Transform Instruction as follows:
- Xpath; an xpath query to find the element to update/remove or where to insert a new element
- Action; Insert, update or remove
- Element; in case of ‘insert’ action, the name of the new element that needs to be created
- Value; the value that needs to be inserted or updated
In SAP Hybris Commerce the ‘b2bpunchoutaddon’ functions as a base for this solution, and it covers the cXML protocol implementation.
We made an override of the ‘placeRequisition’ method in the DefaultPunchoutController and passed the original cXML message through our XPath Transform Instruction processor.
And this would result in the custom cXML message that is then send back to the procurement system.
For the OCI protocol there was an extension named ‘oci’ available, but since it’s status is deprecated we didn’t want to use that one.
So we developed the OCI implementation from start, but in the same pattern as the current cXML implementation was done by SAP.
As the OCI protocol allows HTML and XML format for the messages, and we also needed a way to alter the messages, we use the XML format of OCI as a basis, and that XML message is passed through the Xpath Transform Instruction processor, and if the final output needs to be HTML, the extension is able to convert that (altered) XML document into an HTML message, conforming the OCI protocol.
The procurement system has the option to determine in which format it would like to receive the OCI message, when “punching out” from the procurement system it will redirect to a URL in the suppliers website and one of the parameters indicating what the format should be.
Want to know more ?
Are you in the process of implementing a “PunchOut” with SAP Hybris Commerce and in need of similar functionality, or just curious what the possibilities are. Feel free to contact us.