Skip to Content

XML Rowset Action Not Adding To Document

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    Nov 21, 2013 at 04:09 PM

    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>

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Nov 21, 2013 at 03:06 AM

    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-illumdocument-in-mii

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 22, 2013 at 02:20 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 21, 2013 at 05:54 AM

    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


    Add comment
    10|10000 characters needed characters exceeded

  • Nov 21, 2013 at 02:42 PM

    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

    Add comment
    10|10000 characters needed characters exceeded