
You can enhance the code based on your requirement. I have hardcoded the fields for code simplicity. GenerateXML Method converts the object to the XML format. GetListNodes creates an array of objects with each PO and associated Items together. Lines array is split based on the commas and stored in List(rows). GetRows Method splits each line and store it in a array(lines). In the CSV_XML Converter, i have added the Groovy script mentioned below. csv file into an XML File as shown in the output File.īelow groovy script can be used to achieve this requirement. Received multiple purchase Orders from the client as shown in Input File. In this scenario I get a Purchase Order and multiple Line Items associated to it. In the below scenario, I have taken a sample XML file and converted that to an output XML file using Groovy script in SAP CPI. This blog explains about the Groovy script used to convert a CSV structure to Nested XML file. In that case we need to use of either Groovy Script or third-party conversion agents or inbuilt graphical mapping by using intermediate structures and user defend functions. This free tool makes it easy to convert XML files to the Excel XLSX format even if you don't have Microsoft Excel installed. Method 2 Using an Online Converter 1 Go to in a web browser.


IF we are receiving a complex/nested csv files from third party system, then standard CSV converters in SAP CPI would not help us. You can choose any of the formats in the list, including CSV (Comma Delimited). Standard Conversion methods in SAP CPI allow you to convert the incoming CSV file to flat XML structures only i.e., only one level of nesting is possible.

Many times, we are required to convert CSV structures to deeply nested XML structures. This blog helps you solve most common requirement to convert nested CSV structure to an XML in SAP CPI.
