Today, it is very common business request to exchange data between different external systems. It can be a problem that those systems usually store their data in incompatible formats. To make this exchange process much easier, it’s usual to use a plain text format such as XML. XML provides a standardized format, so a result those systems can communicate with each other in only one specified language, what everybody easily understands.
Since the XML is a well-known markup language, most of the programming languages are capable to process XML files and provide various tools to transform their content to an internal format of the given system. If you want to learn more about XML, visit the website: www.w3schools.com
Now, I want to share you a surprisingly easy solution that I often use to parse XML documents in ABAP. It’s not that simple as in C# using LINQ expressions, but you will see that it’s still enough easy.
The Business Request
Let’s imagine that our company has a subsystem where we store the information of our customers locally. The management decided that they want to see the information of our customers in our centralized ERP database.
So, I was asked to migrate certain data from our external system. Since the subsystem store its data in XML format, I have not too much to do. Our task is to develop a simple XML file interface between this subsystem and our SAP system. Here is the sample XML file that we are going to import to an SAP database table:
The task is complex, so I broke down the entire task into smaller parts to make it clearer. First, we are going to create ABAP Dictionary objects in SE11, then we are going to construct a Simple Transformation in the transaction STRANS, and at last we are going to build a framework program in SE38. Then later, we will satisfy some other new requirements also, such as processing XML attributes.