cancel
Showing results for 
Search instead for 
Did you mean: 

Export XML to Excel format

Former Member
0 Kudos

hi,

i need to export / convert data from XML file to Excel format thru BLS transaction. how to do this?

regards

senthil

Accepted Solutions (0)

Answers (5)

Answers (5)

jan_krohn
Active Participant
0 Kudos

Hi Senthil,

you could convert your XML file to an Excel XML file. Whereas CSV can contain only data, with Excel XML you'd have many advantages, as you can use any Excel function with it (like formulas, date conversions, VBA, charts etc.)

Try the following: Open any Excel file, go to file - save as - choose "Excel XML". Open the new file in an XML editor.

By reverse engineering, you can find out how to build your own Excel XML file.

Then you can integrate the whole process in SAP using an XSLT transformation.

Best wishes,

Jan

Former Member
0 Kudos

Hi,

You use action block XLS Transformation and link with IllumTable.xsl I'm not remenber correct name the XLS.

http://help.sap.com/saphelp_xmii115/helpdata/en/Business_Logic_Services/xsltransformation.htm

In Transaction you save ActionBlock->TextOutput file temp in directory the project.

Bye

Former Member
0 Kudos

Just as a different take on this, in case you are not sending this to a user but perhaps parsing data between one system to another. For instance sending data from a ordering system to a laser cutter that can only take CSV files. Or if the XML file is not a standard xMII query template output.

I've had to do many many of these. Of course it depends on the structure of the XML file. The concept I use is that I read through each "row" of the xml file then through each "column" Depends on your XML structure. The idea is is to loop through each column of each row, building a string, for that row. Then writing it.

Normally in this case I would use the Xml Loader action, then put in a repeater to loop through rows of the xml file, under the left side of that repeater, I'll put in another repeater to loop through each column. You'll need to create a Local property, of string type as a holder for the string you will be building.. Basically you want to loop for each row in the xml doc, then for each column. I use assignments to build a string with a comma separator, If you nest your repeaters, it will look something like this.

Local.BuildString & u201C,u201D & repFileRow.Output{/Row/[#repFileCol.Output{/Row/ColName}]#}

When the row is finished, I use a write file using the append method until the document is done. Donu2019t forget to remove the leading comma youu2019ll get as a result of the string building repeater you use.

I recommend nested repeaters instead of using fixed column number because just incase your source XML file changes, you don't have to change your BLS transaction. It can make the xpath statements a little long, But if you are careful its not to bad. If you are really good with xpath, you can sometimes avoid repeaters completely. But 95% of the time I use them, unless my transaction has performance issues.

These are just outline steps but should point you in the direction you need. Of course my method may not be the optimal so feel free to try others or your own.

Former Member
0 Kudos

Hi Senthil,

as Rick said, you can save the XML-Data as a CSV list in a file and for example use FTP to transfer the file to your user. You may create an Excel file with a macro that automatically imports the CSV file. So everytime the user opens the Excel file, the newest CSV file is automatically imported.

Michael

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Excel supports CSV format, which is already supported nearly everywhere in MII (applets, servlets, BLS).