on 02-28-2006 11:11 AM
Hi All,
I am having one scenario where source is IDOC and Target is file.The file will contain one header record and several Items.I want the file to be like one header and Items to be sorted depending on 2 feilds.Can any one come across this type of scenario where Item records are sorted depending on more than one field.
Thanks in Advance,
Chandra.
Hi chandra,
there are two solutions to your problem,
1)use java mapping/XSLT mapping.
2)if you have used graphical mapping for IDOC to file scenario,then do not change it,go to the receiver communication channel,in the parameter tab fill in the usual file adapter details;go to module tab;in the processing sequence area uwill find a default module name localejbs/CallSapAdapter;add one row and copy that first row details to the second row;in the first row do the following
==>in the modulename text box type: localejbs/AF_Modules/MessageTransformBean
==>in the type combo box choose "Local Enterprise Bean"
==>If you are using paches < SP15 then type some key name;
(in SP15 you will not find that so dont worry)
==>go to the Module Configuration area after selecting the first row in the processing sequence area (this is important since module configuration corresponds to individual rows of parameter sequence)
==>in the module configuration area
==>in the first row
in parameter name text box type :Transform.Class
in parameter value text box type : com.sap.aii.messaging.adapter.XSLTConversion
==> in the second row
in parameter name text box type : XSLTConversion.XSLTFileName
in parameter value text box type : the location of the XSL file name for example
system1\dir1\sort.xsl;
write this XSL as others said;yo can write this XSL to fabricate your XML in any format ex:you can sort;for writing xsl refer W3schools.
now save the receiver communication channel;
if you run the scenario you can see the output in the format you have specified in the XSl;
cheers,
Sundar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandra,
dont try to sort in graphical mapping.....just do normal mapping in graphical mapping....i.e assigning correct values to the target.....oce its done.....u know the o/p xml structure...write an XSL to sort the XML file..(go to w3schools and see how to use sort)....once its done...kindly refer my previous post in the thread how to import that xsl...and activate the scenario......if ur still not clear kindly mention which part u r not clear so that i may say it in a way u could understand.....
cheers,
Sundar.
Hi Chandra sekhar,
This is possible using iether JAVA or XSLT mapping. I dont think this can be done using your normal Graphical Mapping.
For info on java mapping, I would suggest that your go through this link,
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
For XSLT,
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandra,
this is possible with several mapping languages, very easy with xsl:sort or message mapping function "sort".
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandra,
This link deals with the XSL SORT element along with an example code.
http://www.w3.org/TR/xslt20/#sorting
Hope this helps,
Regards,
Bhavesh
PS DO award points for useful answers
Hi Chandra,
a simple source xml:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<field value1="A" value2="2">first</field>
<field value1="B" value2="1">second</field>
<field value1="A" value2="1">third</field>
</root>
A style, what is sorting the output on attributes first value1, second value2:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<outputdata>
<xsl:for-each select="root/*">
<xsl:sort select="./@value1" order="ascending" />
<xsl:sort select="./@value2" order="ascending" />
<output>
<xsl:value-of select="."/>
</output>
</xsl:for-each>
</outputdata>
</xsl:template>
</xsl:stylesheet>
Regards,
Udo
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.