cancel
Showing results for 
Search instead for 
Did you mean: 

XML Rowset Action Not Adding To Document

dan_kellackey
Explorer
0 Kudos

I am just beginning to experiment with building XML documents in a transaction.  My motivation is to retrieve SAP schedule data from a custom transaction that I do not have access to by other means.  So I build a test transaction in the workbench to call the SAP function.  The function returns several tables, and I want to save it to an XML document.  So, I use the XML Document action, create the columns in that step, and can map data from function to the document.

Where I am floundering is that I want to create multiple rowsets within the document, organizing the data seperately instead of throwing all the columns together in a single rowset.  I expected to use the Rowset action to add another rowset to the existing document, but it does not.  If I try to add a column to the rowset I added, it is not visible, and cannot be added there.  I have played around on where in the XML document to add the rowset, Output is the only place I do not get an error.  If I try to add the column to the Rowset in the link editor, it also throws an error.  Why can I not see the rowset added to my document in the link editor.  I see and empty <rowset /> element in the XML output, so I know it is being added, I just cannot figure out how to add columns to it.

Am I misunderstanding what a rowset is?  I cannot find any example transactions from other developers in our company, nor on the web.

Regards,

Dan K

Accepted Solutions (1)

Accepted Solutions (1)

dan_kellackey
Explorer
0 Kudos

Great comments, thank you all. 

I was able to successfully work thru the example in the link from Padma, and understand the basic concepts.  I believe I was getting stuck thinking that when I added a Rowset, I should see it in the XML Document, when expanding it in the Link Editor.  Instead, I am thinking that columns/rows/data items are added to the current Rowset being pointed to.  If I had two seperate tables of data to add to the document, I would add a Rowset for the first table, add the c/r/d, then create another Rowset for next table. 

I was trying to add the 2 Rowsets first, then add columns to them after creating them.  Didn't work.

One more question:  I am trying to auto-generate the column names from the function call tables, but can't figure how to loop thru the items and grab their names.

Here is the output of one Repeater loop thru the table.  In my test case, the Repeater runs 3x, so I get the data below repeated 3x.  I am trying to grab the column names, like OBJEK,OBTAB,ATINN, ect. in a loop.  I can create a seperate Column action for each, but can't figure how to loop thru the function.Response and just grab the <names> once.  I keep getting the values instead of the names.

Regards,

Dan K

[INFO] [Tracer_1]<?xml version="1.0" encoding="UTF-8"?>

<item>

<OBJEK>000000000000950573</OBJEK>

<OBTAB>EQUI</OBTAB>

<ATINN>0000001084</ATINN>

<ATNAM>Z_FILTER</ATNAM>

<ATWRT>N</ATWRT>

<ATWTB>No filter</ATWTB>

</item>

former_member204240
Active Participant
0 Kudos

Hi Dan,

Your Repeater should be in two places here, One to fetch column names and other to fetch data Item.

Well, just see this attached screen you will get an idea. First repeater gives column names and second repeater gives the data.

PS: For above Trx Repeater is repeating on Transaction input Parameter, xmlInput. (But you can repeat on your original query or RFC output or anything according to your specific requirement.)

Padma.

former_member211944
Active Participant
0 Kudos

Hi Dan,

Here is a way I came with all the column names for the XML you have mentioned.

I stored the xml in a transaction parameter and then put a repeater with this as XPath Expression:

Transaction.test1{/item/*}

test1 is my transaction parameter name.

This will iterate on all the child elements under item element

In the logger i used this XPath: Repeater_0.Item{name(/*)}

this will give you all the column names.

name() is a XPath function.

You can use these XPaths in your transaction to get the column names.

Regards,

Rohit Negi.

Answers (4)

Answers (4)

dan_kellackey
Explorer
0 Kudos

Nice to have a great community that I can reach out to for help.  Thank you all for your suggestions.

jcgood25
Active Contributor
0 Kudos

Dan,

I couldn't agree with you more - as an SAP employee it is great to be part of a community of people collaborating so passionately around a topic like MII !  We're working to cultivate this with Fiori too: 

I'm glad the pointers from the various responses helped you with your document building exercise.  One of the reasons I wanted to point you to the template examples was to see the additional value of having the document columns built in advance provided the addtional meta data and not just mirroring the BAPI response tables.  I can appreciate the desire to build the dataset dynamically, but so often the column names are quite cryptic and will always be string values in the xml, and things like DAT and TIM when put together with proper datatype converstion makes for a real DateTime field in the resultset.

Best Regards,

Jeremy

SAP Rapid Innovation Group - RIG

former_member204240
Active Participant
0 Kudos

Anyways considering Jeremy point, its really good idea to use something which is already available instead constructing everything.

jcgood25
Active Contributor
0 Kudos

If you already know the intended column names and can build the relevant meta data (data type, description, min/max) directly in the document action, then I would suggest using multiple documents, and then simply use the Union action.  I think the QM examples in the module libraries showcase this for inspection lot details (3 different tables):  http://www.sdn.sap.com/irj/scn/downloads?rid=/library/uuid/f0a4be8f-4d6e-2910-9aaa-891499a41625

Although the latest version is from 12.x, it does provide good examples of error handling and doc building.

Hope it helps!

Regards,

Jeremy Good

SAP Rapid Innovation Group - RIG

Former Member
0 Kudos

Hi Dan,

What version of MII are you using? And what is the sequence of your action blocks for 'Rowset' and 'Column' respectively?

It should be Document --> Rowset --> Column --> Row --> DataItem.

Below is a screenshot for your reference and it gives me a proper output. (I have just created a xml structure with multiple rowsets and columns for each rowset)

Output:

Hope this helps!!

Warm Regards,

Anuj

former_member204240
Active Participant
0 Kudos

Hi Dan,

Have you checked this link

http://scn.sap.com/people/adarsh.sidnoor/blog/2010/11/01/dynamically-add-columns-rows-and-data-to-il...

It works, I have tried.

What errors are you getting?

Well before that, I would like to say that you can add rowset only if you have created empty document(without any columns/fields mentioned).

Also,Can you please elaborate your requirement.

Why dont you try with IDoc to push data to MII if you want retrieve all table data from SAP. You need to create tables in MII  to hold data.

Regards,

Padma Rao