GS1 Integration – SAP PI 7.1 – PART – I
One day or other you might get a chance to integrate GS1 systems.
That day shouldn’t be challenging for you 🙂 .
This Blog describes as how to exchange/create GS1 understandable messages which will let PI [7.1] to post the GS1 understandable documents and the sample use case for developing the same.
It is much painful at the initial stage to find the correct way of integrating GS1 systems via SAP PI and there is no proper SDN blog or discussions available for the same.
Hence I have shared this information based on my project learning.
It doesn’t contain any step by step for deployment or development and It describes the how to frame/create/Build the Main GS1 Document XML schema using the available GS1 standard sub schema.
It is for Intermediate PI Consultants.
Hints /Prerequisites:
- Here I have explained based on GS1 XML Business Message Standards (BMS) V 2.8.
- download the GS1 XML Business Message Standards (BMS) and Schemas, Version 2.8 GDSN Price Synchronisation
- The base business document used for this KB is GDSN Price Synchronisation. You can download all the standard sub-schemas using the given link.
- Get the sample document (here Price) output xml from the GS1 team
- Any of the The XML editing tool – Here I have used Liquid XML Studio .
- You can use any third party XML editing tool like Altova XML Spy or Styus studio etc.,
- Developed and compiled java mapping code using J2SE1.5 compiler since PI 7.1 using the older Java compiler.
Overview of GS1
- GS1 is dedicated to the design and implementation of global standards and solutions to improve the efficiency and visibility of supply and demand chains globally and across sectors. The GS1 system of standards is the most widely used supply chain standards system in the world.
- GS1 Member Organizations handle all enquiries related to GS1 products, solutions and services.
- GS1 has close to 40 years’ experience in global standards – see our timeline for more information.
- GS1 offers a range of standards, services and solutions to fundamentally improve efficiency and visibility of supply and demand chains.
- GS1 standards are used in multiple sectors and industries.
GS1 XML Business Message Standards (BMS)
GS1 Main XML message consisting of multiple segments/Layers like
- Transport
- Service
- Message
- Business document
GS1 XML Business Message Architecture
Basically we need to generate the xml in the above consolidated segments which will let us to post GS1 documents successfully.
Sample Use case
Our requirement is to post the Pricing (Add/Update) document to GS1 from ECC via PI.
This is designed as simple Asynchronous Proxy to File scenario.
Initial Steps
In order to build/frame the GS1 – XML Business Message Architecture based XML output we have to follow the following steps
Step 1:
Here I have used V2.8 of GS1- BMS
- download the GS1 XML Business Message Standards (BMS) and Schemas, Version 2.8 GDSN Price Synchronisation
Once you have downloaded the schemas , unzip it and keep in your local desktop.
The folder structure would be as follows
For e.g.,
PriceSynchronisationDocument schema is under the folder path as ean.ucc\gdsn
Step 2:
We may not directly use / import in XI to use as external definition which we have downloaded in earlier step.
We need to adjust\Edit the external definition as follows
Once you have extracted relevant schemas (.xsd) , please open the xsd and check check any relative paths specified as../../. in the xsd:import – schemaLocation.
Remove the relative paths and save.
Note :
You need to check all the schemas before you upload to XI System. Make sure that it has the proper folder path.
Sample :
<xsd:import namespace=”urn:ean.ucc:2″ schemaLocation=”../../ean.ucc/common/Document.xsd”/>
After correction it would be looking like as follows
Note :
Simple xsd import statement ../../ string replacing it’s not sufficient , once we have imported the provided standard schemas, we need to find out the issues in imported external definition ,manually edit and re-import the error-schema and dependent schema . It is applicable wherever you find issue in schema (red lines in External definition ).
Steps to be Performed in ESR
Importing external Definitions
Once you have removed all the relative paths in standard GS1 Schemas, upload all the XSD using import external definition option from ESR.
In PI 7.1 we have the option to do the mass upload of external definition
- Go to Tools –> Import external definition from ESR
Steps to be performed in XML editing tool
Step 1 :
Open the sample output xml whihc you have received from the GS1 team for the relevant Business Document
Sample would be as follows
It has all the GS1 BMS components as mentioned above.
Step 2 : Open the sample GS1 xml using XML tool
Once you import this xml, it will try to load all the corresponding linked schema for validation
Once it got successfully loaded , please click on the infer XSD Schema
It will pop up and ask you as where to store the generated schema
Select the required folder path and click on finish.
Basically it will generate 4 schemas using the sample xml file as follows
If you open the First Schema in XML tool, in this example it is GS_Example_ADD0
You can see the schema layout as follows
Now we need to adjust the schema location to actual file path .
Open GS_Example_ADD1 and change the import schema location as follows
<xs:import schemaLocation=”ean.ucc/common/DocumentCommand.xsd” />
<xs:import schemaLocation=”ean.ucc/common/Message.xsd” />
Open GS_Example_ADD2 and change the import schema location as follows
<xs:import schemaLocation=”schemapath/GS_Example_ADD1″ namespace=”urn:ean.ucc:2″ />
<xs:import schemaLocation=”ean.ucc/gdsn/PriceSynchronisationDocument.xsd” namespace=”urn:ean.ucc:gdsn:2″ />
Open GS_Example_ADD3 and change the import schema location as follows
<xs:import schemaLocation=” schemapath /GS_Example_ADD2.xsd” />
Create a folder and zip all the above files. We will call this as “Architecture Schema”.
We have to import this to ESR once you have imported all the standard schemas which you have downloaded in earlier step.
Note :
schemapath – this is the folder name in which you have zipped the schemas and upload to XI.
E.g,
In below example Source filed value ean.ucc/gdsn is theschemapath
This Covers the following
- Use cases/Building Blocks of GS1 XML Messages
- Overview of GS1 XML Business Message Standards (BMS)
- Sample use case
- How to build the GS1 Main document schema.
In next blog we are going to see how to use this in ESR to generate the expected GS1 Business Document XML.
Thank you for this blog! The usual approach for building the complete document was to add the StandardBusinessDocument and the message type together, which can only be accomplished by editing the xsd. Your approach considerably shortens the time needed to implement such a scenario. Good job!
Regards,
Mark
Thanks Mark 🙂
Regards.,
V.Rangarajan
Hello Ranga,
first of all thank you for this interesting blog that casts light on the GS1/SAP integration topic, that, as far as I know, is still a misty argument.
I had the opportunity to work on this in the past months and i followed an apporach very similar to your (import via xsd editing + proxy to file + java mapping).
For these reasons, I'd like to point out a couple of points of attention about what you reported:
Regards.
Antonio
Hi Antonio,
Thanks for your comments and inputs.
With respect to ,
Point 1.GS1 Business document type dependency: Yes . It requires lot of manual edit in schema to fit the target GS1 requirement and effort to adjust ABAP Server proxy structure. It it ends up with huge mapping effort.
Point 2.Problems in external definition import:
Yes . Simple xsd import statement ../../ string replacing it's not enough . Once we have imported the provided standard schemas, we need to find out the issues in imported external definition and manually edit , re-import the error-schema and dependent schema. Thanks for your point. I have updated the blog.
Regards.,
V.Rangarajan