Skip to Content
0

CSV to XML Conversation in SAP HCI

Apr 11, 2017 at 02:09 PM

625

avatar image

Dear Experts,

I’m expecting a XML structure as output for my CSV input. However I’m getting XML structure whereas the line items in sub-hierarchy are missing.
Please read the below explanation for further information.
Please correct me if the CSV input I’ve given is incorrect.

All helpful replies will be appreciated.

Explanation:

Working in HCI on a iflow, in which input is a CSV file. So in the iflow, i put a SFTP server to get the file, then a converter step for CSV to XML converter.

In the csv file, the data is something like:

Header 1 2 3

LineItems 12 3 4

LineItems 12 3 4

Header 1 2 3

LineItems 12 3 4

LineItems 12 3 4

Meaning multiple records header and Line items is sub hierarchy.

Created XSD for the above XML manually or from online tool like freeformatter.com and I can see the structure of the file in hierarchy as:

Then imported that XSD in the integration project in HCI where the above iflow is created.

Then path to target element in XSD : /root/row

Record marker in csv - empty

Field separator in csv – comma

Regards,
Md Thouheed.

1.png (18.9 kB)
2.png (33.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Sriprasad Shivaram Bhat Apr 11, 2017 at 02:34 PM
0

Hello Mohammed,

It would be great if you can mention some logical input(CSV where we can differentiate fields and lines ),expected output(try to put the values from CSV mentioned) and what output you are currently getting.

Regards,

Sriprasad Shivaram Bhat

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello sriprasad,

In the CSV file, input data is something like:

'm getting output XML structure like:

I’m expecting a XML structure as output:

Please correct me if the CSV input I’ve given is incorrect.

Then path to target element in XSD : /root/row

3.png (23.1 kB)
4.png (11.8 kB)
5.png (7.1 kB)
6.png (23.5 kB)
0
Sriprasad Shivaram Bhat Apr 12, 2017 at 04:25 AM
0

Hello Mohammad ,

Its not possible to generate the output in the format you have given using Standard CSV to XML convertor.

You have to write Groovy Script to achieve the same[ You can use freely available package like OpenCSV ].

Regards,

Sriprasad Shivaram Bhat

Share
10 |10000 characters needed characters left characters exceeded
Mohammad Thouheed Apr 12, 2017 at 05:06 AM
0

Hello Sriprasad,

Can you please send me few links to understand open CSV.

I will try to get help to work on groovy srcipt.

Thanks for your time.

Share
10 |10000 characters needed characters left characters exceeded
Sriprasad Shivaram Bhat Apr 12, 2017 at 06:38 AM
0
Share
10 |10000 characters needed characters left characters exceeded