on 06-25-2012 4:35 AM
Hi all,
I have got data from RSAQ_REMOTE_QUERY_CALL in xml data. I need to format that data in grid view. In that <LINE> tag gives column value and <FDESC> tag gives Feild description respectively Below i have mentioned my xml data.
<?xml version="1.0" encoding="UTF-8" ?>
<RSAQ_REMOTE_QUERY_CALL>
<INPUT>
<DATA_TO_MEMORY>X</DATA_TO_MEMORY>
<DBACC>0</DBACC>
<EXTERNAL_PRESENTATION>X</EXTERNAL_PRESENTATION>
<QUERY>ZVBAP</QUERY>
<SKIP_SELSCREEN>X</SKIP_SELSCREEN>
<USERGROUP>SYSTQV000048</USERGROUP>
<VARIANT>VAR</VARIANT>
<WORKSPACE />
</INPUT>
<OUTPUT>
<LISTTEXT>REPORT PROG PRAC</LISTTEXT>
<LIST_ID>G00</LIST_ID>
<PROGRAM>AQTGSYSTQV000048ZVBAP=========</PROGRAM>
<USED_VARIANT>VAR</USED_VARIANT>
</OUTPUT>
<TABLES>
<FPAIRS>
<item>
<INDEX_A>0007</INDEX_A>
<INDEX_U>0008</INDEX_U>
<TYPE>E</TYPE>
</item>
</FPAIRS>
<LDATA>
<item>
<LINE>002:OR,004:0001,002:01,007:SCEM_02,000:, 002:PC;/</LINE>
</item>
</LDATA>
<LISTDESC>
<item>
<FADD />
<FDESC>Sales Organization</FDESC>
<FNAME>VBAK-VKORG</FNAME>
<FCOL>SOrg.</FCOL>
<FNAMENEW>VBAK-VKORG</FNAMENEW>
<FNAMEINT>VKORG</FNAMEINT>
<FKEY />
<FGTYP />
<FNZERO />
<FSUM />
<FSONLY />
<FSORT>00</FSORT>
<FSODS />
<FSUBT />
<FLPOS>0002</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT />
<FNOSUM />
<FSONP />
</item>
<item>
<FADD />
<FDESC>Distribution Channel</FDESC>
<FNAME>VBAK-VTWEG</FNAME>
<FCOL>DChl</FCOL>
<FNAMENEW>VBAK-VTWEG</FNAMENEW>
<FNAMEINT>VTWEG</FNAMEINT>
<FKEY />
<FGTYP />
<FNZERO />
<FSUM />
<FSONLY />
<FSORT>00</FSORT>
<FSODS />
<FSUBT />
<FLPOS>0003</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT />
<FNOSUM />
<FSONP />
</item>
<item>
<FADD />
<FDESC>Division</FDESC>
<FNAME>VBAK-SPART</FNAME>
<FCOL>Dv</FCOL>
<FNAMENEW>VBAK-SPART</FNAMENEW>
<FNAMEINT>SPART</FNAMEINT>
<FKEY />
<FGTYP />
<FNZERO />
<FSUM />
<FSONLY />
<FSORT>00</FSORT>
<FSODS />
<FSUBT />
<FLPOS>0004</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT />
<FNOSUM />
<FSONP />
</item>
<item>
<FADD />
<FDESC>Sold-to party</FDESC>
<FNAME>VBAK-KUNNR</FNAME>
<FCOL>Sold-to pt</FCOL>
<FNAMENEW>VBAK-KUNNR</FNAMENEW>
<FNAMEINT>KUNNR</FNAMEINT>
<FKEY />
<FGTYP />
<FNZERO />
<FSUM />
<FSONLY />
<FSORT>00</FSORT>
<FSODS />
<FSUBT />
<FLPOS>0005</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT />
<FNOSUM />
<FSONP />
</item>
<item>
<FADD />
<FDESC>Material Number Used by Customer</FDESC>
<FNAME>VBAP-KDMAT</FNAME>
<FCOL>Customer Material Number</FCOL>
<FNAMENEW>VBAP-KDMAT</FNAMENEW>
<FNAMEINT>KDMAT</FNAMEINT>
<FKEY />
<FGTYP />
<FNZERO />
<FSUM />
<FSONLY />
<FSORT>00</FSORT>
<FSODS />
<FSUBT />
<FLPOS>0006</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT />
<FNOSUM />
<FSONP />
</item>
<item>
<FADD />
<FDESC>Net Weight of the Item</FDESC>
<FNAME>VBAP-NTGEW</FNAME>
<FCOL>Net weight</FCOL>
<FNAMENEW>VBAP-NTGEW</FNAMENEW>
<FNAMEINT>NTGEW</FNAMEINT>
<FKEY />
<FGTYP />
<FNZERO />
<FSUM />
<FSONLY />
<FSORT>00</FSORT>
<FSODS />
<FSUBT />
<FLPOS>0007</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT />
<FNOSUM />
<FSONP />
</item>
</LISTDESC>
<SELECTION_TABLE />
</TABLES>
</RSAQ_REMOTE_QUERY_CALL>
I need get output as like below format.
Output:
Sales Organization | Distribution Channel | Division | Sold-to party | Material Number Used by Customer | Net Weight of the Item |
OR | 0001 | 01 | SCEM_02 | null | PC |
Please suggest me how to get this grid format from my xml data. Please reply as soon as possible.
Thanks in advance:)
Regards,
Glory
Hi Glory,
Is your Header is fixed? i.e Sales Organization, Distribution Channel, Division.... only six fields are there?
Regards,
Aravinth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Glory,
Pls refer the below figure, these are all the action blocks I have used
1. In document action, I have created 6 fields like Organization, Distribution Channel, Division....
2.Then I used STRING LIST TO XML PARSER action block to extract the values in LINE node, because it is comma separated. I referred this thread http://scn.sap.com/thread/1246762
3.Now map the string list to xml parser output to a repeater
4. Then I have created two local properties. First one is of type integer , this is for increment purpose and second one is of type XML, this is to store the extracted values from XML parser in line wise. My XML structure is like this,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Rowset>
<Row/>
<Row/>
<Row/>
<Row/>
<Row/>
<Row/>
</Rowset>
5. Now I have used assignment action block to assign extracted value to the local XML. Refer the below pic
In this block, I used the below expression to assign incremented value to my local property. Ins is my local property name.
Local.Ins+1
And I used the below expression to assign values to local XML, we need to remove 002:... from extracted value, so I used string functions to do the same.
stringright(Repeater_1.Output{/Row/Item}, stringlength(Repeater_1.Output{/Row/Item})-stringindexof(Repeater_1.Output{/Row/Item},":"))
In target Xpath I have used
Local.String{/Rowset/Row[#Local.Ins#]}
String is my local XML property name
6. Finally I used Row action block to assign these values to the Document. For this we need to mention the row numbers in expression like this
Local.String{/Rowset/Row[1]}
And last value in LINE node is 002:PC;/, we removed only 002: from this value, but last two characters are ;/. To remove this, I used
stringleft(Local.String{/Rowset/Row[6]}, stringlength(Local.String{/Rowset/Row[6]})-2)
I am getting the following output from this transaction,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Rowsets DateCreated="2012-06-26T19:16:22" EndDate="2012-06-26T14:30:49" StartDate="2012-06-26T14:30:49" Version="12.2.3 Build(182)">
<Rowset>
<Columns>
<Column Description="" MaxRange="1" MinRange="0" Name="Sales_Org" SQLDataType="1" SourceColumn="Sales_Org"/>
<Column Description="" MaxRange="1" MinRange="0" Name="Dist_Ch" SQLDataType="1" SourceColumn="Dist_Ch"/>
<Column Description="" MaxRange="1" MinRange="0" Name="Division" SQLDataType="1" SourceColumn="Division"/>
<Column Description="" MaxRange="1" MinRange="0" Name="Sold_to_Party" SQLDataType="1" SourceColumn="Sold_to_Party"/>
<Column Description="" MaxRange="1" MinRange="0" Name="MatNo" SQLDataType="1" SourceColumn="MatNo"/>
<Column Description="" MaxRange="1" MinRange="0" Name="Net_Weight" SQLDataType="1" SourceColumn="Net_Weight"/>
</Columns>
<Row>
<Sales_Org>OR</Sales_Org>
<Dist_Ch>0001</Dist_Ch>
<Division>01</Division>
<Sold_to_Party>SCEM_02</Sold_to_Party>
<MatNo/>
<Net_Weight>PC</Net_Weight>
</Row>
</Rowset>
</Rowsets>
If I missed anything in this post, kindly let me know.
Regards,
Aravinth
Hi Glory,
While adding field in Document action, space is not allowed, so use underscore "_" instead of space.
I created one local parameter of type XML and copied your XML structure there. Then I mapped my local parameter's LINE node to STRING LIST TO XML PARSER. In your case, if you are getting that XML output from any BAPI or RFC, map that output to string list to XML parser action.
Note: As you told, your field header is 9 and it is fixed. So I created all field (Field names) in Document action and you are having line items(values) in LINE node as comma seperated. For that reason I used STRING LIST TO XML PARSER to extract values in line wise.
Regards,
Aravinth
Hi,
Am getting error in Assignment Action block as follows
"
[ERROR] [Assignment_0] Link ('Local.String{/Rowset/Row[#Local.Ins#]}' [Assign] from "stringright(Repeater_0.Output{/Row/Item}, stringlength(Repeater_0.Output{/Row/Item})-stringindexof(Repeater_0.Output{/Row/Item},":"))") execution threw an exception. Exception: [No nodes found in variable 'Local.String' and xpath: "/Rowset/Row[#Local.Ins#]" XML was:] "
Hi Aravinth,
This is my xml structure with nine feilds, this only i have given in local XML structure..
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<RSAQ_REMOTE_QUERY_CALL>
<INPUT>
<DATA_TO_MEMORY>X</DATA_TO_MEMORY>
<DBACC>0</DBACC>
<EXTERNAL_PRESENTATION>X</EXTERNAL_PRESENTATION>
<QUERY>ZVBAP</QUERY>
<SKIP_SELSCREEN>X</SKIP_SELSCREEN>
<USERGROUP>SYSTQV000048</USERGROUP>
<VARIANT>VAR</VARIANT>
<WORKSPACE/>
</INPUT>
<OUTPUT>
<LISTTEXT>REPORT PROG PRAC</LISTTEXT>
<LIST_ID>G00</LIST_ID>
<PROGRAM>AQTGSYSTQV000048ZVBAP=========</PROGRAM>
<USED_VARIANT>VAR</USED_VARIANT>
</OUTPUT>
<TABLES>
<FPAIRS>
<item>
<INDEX_A>0007</INDEX_A>
<INDEX_U>0008</INDEX_U>
<TYPE>E</TYPE>
</item>
</FPAIRS>
<LDATA>
<item>
<LINE>002:OR,004:0001,002:01,002:01,007:SCEM_02,000:,007:590,000,002:KG,002:PC;/</LINE>
</item>
</LDATA>
<LISTDESC>
<item>
<LID>G00</LID>
<FPOS>01</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>C</FTYP>
<FLEN>008</FLEN>
<FDEC>00</FDEC>
<FOLEN>004</FOLEN>
<FCUR/>
<FADD/>
<FDESC>Sales Document Type</FDESC>
<FNAME>VBAK-AUART</FNAME>
<FCOL>SaTy</FCOL>
<FNAMENEW>VBAK-AUART</FNAMENEW>
<FNAMEINT>AUART</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0001</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
<item>
<LID>G00</LID>
<FPOS>02</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>C</FTYP>
<FLEN>008</FLEN>
<FDEC>00</FDEC>
<FOLEN>004</FOLEN>
<FCUR/>
<FADD/>
<FDESC>Sales Organization</FDESC>
<FNAME>VBAK-VKORG</FNAME>
<FCOL>SOrg.</FCOL>
<FNAMENEW>VBAK-VKORG</FNAMENEW>
<FNAMEINT>VKORG</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0002</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
<item>
<LID>G00</LID>
<FPOS>03</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>C</FTYP>
<FLEN>004</FLEN>
<FDEC>00</FDEC>
<FOLEN>002</FOLEN>
<FCUR/>
<FADD/>
<FDESC>Distribution Channel</FDESC>
<FNAME>VBAK-VTWEG</FNAME>
<FCOL>DChl</FCOL>
<FNAMENEW>VBAK-VTWEG</FNAMENEW>
<FNAMEINT>VTWEG</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0003</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
<item>
<LID>G00</LID>
<FPOS>04</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>C</FTYP>
<FLEN>004</FLEN>
<FDEC>00</FDEC>
<FOLEN>002</FOLEN>
<FCUR/>
<FADD/>
<FDESC>Division</FDESC>
<FNAME>VBAK-SPART</FNAME>
<FCOL>Dv</FCOL>
<FNAMENEW>VBAK-SPART</FNAMENEW>
<FNAMEINT>SPART</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0004</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
<item>
<LID>G00</LID>
<FPOS>05</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>C</FTYP>
<FLEN>020</FLEN>
<FDEC>00</FDEC>
<FOLEN>010</FOLEN>
<FCUR/>
<FADD/>
<FDESC>Sold-to party</FDESC>
<FNAME>VBAK-KUNNR</FNAME>
<FCOL>Sold-to pt</FCOL>
<FNAMENEW>VBAK-KUNNR</FNAMENEW>
<FNAMEINT>KUNNR</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0005</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
<item>
<LID>G00</LID>
<FPOS>06</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>C</FTYP>
<FLEN>070</FLEN>
<FDEC>00</FDEC>
<FOLEN>035</FOLEN>
<FCUR/>
<FADD/>
<FDESC>Material Number Used by Customer</FDESC>
<FNAME>VBAP-KDMAT</FNAME>
<FCOL>Customer Material Number</FCOL>
<FNAMENEW>VBAP-KDMAT</FNAMENEW>
<FNAMEINT>KDMAT</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0006</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
<item>
<LID>G00</LID>
<FPOS>07</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>P</FTYP>
<FLEN>008</FLEN>
<FDEC>03</FDEC>
<FOLEN>019</FOLEN>
<FCUR>M</FCUR>
<FADD/>
<FDESC>Net Weight of the Item</FDESC>
<FNAME>VBAP-NTGEW</FNAME>
<FCOL>Net weight</FCOL>
<FNAMENEW>VBAP-NTGEW</FNAMENEW>
<FNAMEINT>NTGEW</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0007</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
- <item>
<LID>G00</LID>
<FPOS>08</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>C</FTYP>
<FLEN>006</FLEN>
<FDEC>00</FDEC>
<FOLEN>003</FOLEN>
<FCUR>E</FCUR>
<FADD/>
<FDESC>Weight Unit</FDESC>
<FNAME>VBAP-GEWEI</FNAME>
<FCOL>WUn</FCOL>
<FNAMENEW>VBAP-GEWEI</FNAMENEW>
<FNAMEINT>GEWEI</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0008</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
<item>
<LID>G00</LID>
<FPOS>09</FPOS>
<FCONT>0</FCONT>
<FCURPOS>000</FCURPOS>
<FGRAF/>
<FTYP>C</FTYP>
<FLEN>006</FLEN>
<FDEC>00</FDEC>
<FOLEN>003</FOLEN>
<FCUR/>
<FADD/>
<FDESC>Sales unit</FDESC>
<FNAME>VBAP-VRKME</FNAME>
<FCOL>SU</FCOL>
<FNAMENEW>VBAP-VRKME</FNAMENEW>
<FNAMEINT>VRKME</FNAMEINT>
<FKEY/>
<FGTYP/>
<FNZERO/>
<FSUM/>
<FSONLY/>
<FSORT>00</FSORT>
<FSODS/>
<FSUBT/>
<FLPOS>0009</FLPOS>
<FNUMB>98</FNUMB>
<FNUMBT/>
<FNOSUM/>
<FSONP/>
</item>
</LISTDESC>
<SELECTION_TABLE/>
</TABLES>
</RSAQ_REMOTE_QUERY_CALL>
Kindly upload ur links images for those three action blocks
Regards
Glory
Hi,
This is not correct. In my previous post refer 4th point. Copy the below structure to your local XML parameter. As I told you before, i tested for 6 fields, but you add three more Row
in it.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Rowset>
<Row/>
<Row/>
<Row/>
<Row/>
<Row/>
<Row/>
</Rowset>
Regards,
Aravinth
Hi Aravinth,
Thanks for ur valuable posts I have add xml structure with 9 row tags in local String parameter.
but then also while executing am getting following error "
Please solve this issue
Regards
Glory
Hi,
I hope you are using second XML structure(XML having 9 field names), did you notice your LINE node in that XML
<LINE>002:OR,004:0001,002:01,002:01,007:SCEM_02,000:,007:590,000,002:KG,002:PC;/</LINE>
it contains 10 values. Please make sure, only 9 values should be there. Pls revert back.
Regards,
Aravinth
Hi Aravinth,
I dint find error in this evaluate action. But while executing it is showing error.
Finally i have added xml saver action block to save document output in that am not getting correct data as output. Below i have shown ouput from XML Saver Action Block
<?xml version="1.0" encoding="UTF-8" ?>
</Columns>
</Row>
</Rowset>
</Rowsets>
I have marked X for wrong values in xml..
Please solve this issue
Regards,
Glory
Hi Glory and Aravinth,
When you have mixed delimiters with content (comma is your delimiter but is also the decimal separator), you can either switch to a different delimeter such as a tilda (~) or you can do a laborious stringpart extraction for the entire <LINE> field into each of the XMII XML Document row items. (I lean towards using a different delimiter in the BAPI, but have used both methods successfully).
Regards, Mike
Hi Glory,
If you do not have the option of changing the delimiter in the BAPI, then learn how to extract the pieces of LINE using stringpart in the Expression Editor for the Assignment part of the Add Row action block.
I would also recommend that you download some of the MII projects available from SCN. The techniques that Aravinth has been so patiently explaining are in many of the example transactions. Or take a MII training course. Most of this is basic skills which you would be learning there.
Regards, Mike
Glory, Did you ever take a look at the document on the xMII wiki that deals with this interface? I think I mentioned it in one of your threads a few weeks ago. If memory serves me right I am pretty sure it more or less lays out a step by step solution to the requirement you have been struggling with for several weeks now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Loop through your output table LDATA\Items and delimit your comma separated string using string functions. Convert to MII XML format by Loading data into 'document' action block by the way explained by Seng.
Thanks
Hari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you have to transform xml file you have to XMII XML format. To do this, you can use Document and Row Action blocks (under SAP MII XML Output). See MII help file for more detail.
In short;
-you define your fields using Document actionblock.
-using Row action block, you can assign the value in the fields you defined in Document.
all the best
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
6 | |
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.