on 06-25-2013 11:46 AM
Hi SAPian's,
I having a table having columns like PLANT,MATERIAL,FORMULA and UOM.
For each FORMULA we have to do some calculations and then get a QUANTITY value.
I have calculated the QUANTITY for all the rows of the table and have stored them into a defined Local LIST variable.
Now my requirement is to generate a XML having PLANT,MATERIAL,UOM and QUANTITY as ROW elements.
I can easily generate an XML having PLANT,MATERIAL,UOM from the table itself but my problem is how to add the Calculated Quantity values into this XML which are stored in a LIST variable.
I used String list to XML parser action block to convert it into an XML but it shows output like below for the generated XML
<Row>
<Item>[[string:305]</Item>
</Row>
<Row>
<Item> [string:-8.42]</Item>
</Row>
<Row>
<Item> [string:]</Item>
</Row>
Please help me out on this one or suggest an alternate way that can cater to my requirement.
Thanks,
Praveen.
Hi Praveen,
One Option could be storing the values of Quantity in the table in a hidden column, so that you can use that while creating the XML.
The XML which you have mentioned above is correct from the MII point of view because MII list contains the value along with the data type. That is why you are getting the values like this: [string:305].
For the work around, save Quantity values as comma separated String in String type of transaction property and then use String list to XML parser action block with Delimiter as ",".
Another work around could be Iterating on the List and then creating the XML document using SAP MII XML Output action blocks.
Regards,
Rohit Negi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot Rohit for your response!
I already managed to generate XML with the Quantity values.
Now my problem is how to combine the two XML's togather so that i can have a XML like below:
XML 1:
<Row>
<PLANT>100</PLANT>
<MATERIAL>101</MATERIAL>
<UOM>m3</UOM>
</Row>
<Row>
<PLANT>100</PLANT>
<MATERIAL>101</MATERIAL>
<UOM>m3</UOM>
</Row>
XML 2:
<Row>
<Item>305</Item>
</Row>
<Row>
<Item>118.42</Item>
</Row>
Combined XML:
<Row>
<PLANT>100</PLANT>
<MATERIAL>101</MATERIAL>
<UOM>m3</UOM>
<Item>305</Item>
</Row>
<Row>
<PLANT>100</PLANT>
<MATERIAL>101</MATERIAL>
<UOM>m3</UOM>
<Item>118.42</Item>
</Row>
Please help me out on this one with your valuable suggestions.
Thanks,
Praveen
Hi Praveen,
I would suggest two approaches:
1. If you can have a column in both of your XMLs whose value will be unique then you can use 'Joiner' action block with Inner Join which will be the most optimized way.
2.
Step 1: Assign these two XMLs to two local variables of xml type. (I have taken First and Second as two xml variables)
Step 2: Put a repeater on each row of your second xml.
Step 3: Append Repeater_0.Output{/Row/Item} to Local.First{/Rowsets/Rowset/Row[#Repeater_0.CurrentItem#]} with 'Append XML' radio button checked.
This will give the output XML the way you want it to be.
Thanks & Regards,
Anuj
Thanks a lot Anuj!
I think the second one will do it.
Its simple but didn't came to my mind but when i am tryng to do the assignment why is the append XML radio box is not getting enabled.
One more thing i used the joiner with the inner join but in my case it was giving four Rows like
<Row>
<PLANT>100</PLANT>
<MATERIAL>101</MATERIAL>
<UOM>m3</UOM>
<Item>305</Item>
</Row>
<Row>
<PLANT>100</PLANT>
<MATERIAL>101</MATERIAL>
<UOM>m3</UOM>
<Item>118.42</Item>
</Row>
<Row>
<PLANT>100</PLANT>
<MATERIAL>102</MATERIAL>
<UOM>m3</UOM>
<Item>305</Item>
</Row>
<Row>
<PLANT>100</PLANT>
<MATERIAL>102</MATERIAL>
<UOM>m3</UOM>
<Item>118.42</Item>
</Row>
Can i achieve my desired output i.e. two rows by using the Joiner anyhow.
Just a query.
Thanks,
Praveen.
Hi Praveen,
Yes the output you are getting is how it works because there is no condition which will satisfy to join both the xmls, that is why I had mentioned in my previous post that for the inner join to work properly there has to be one column common in both the XMLs and should have unique values based on which the two XMLs will be joined.
Hope I was able to clear your query 🙂
And regarding the 'Append XML' radio button, if the mapping is proper it will be enabled but once mapped it will be disabled. If you want to edit the mapping you may have to delete the old one and create a new mapping.
Best Regards,
Anuj
User | Count |
---|---|
10 | |
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.