on 09-04-2007 3:36 PM
Hi,
I have source xml structure of format
<Header fld1 fld2 fld3
fld4 fld5 fld6 ><line fld7 fld8 fld9 </line></header>
Header occurence is 1---unbounded
and line occurence is 0---unbounded
and line items can exist or not for some header items.for some headers items can be single or multiple.
I get xml files on sender side and need to convert to flat files ,so I am using sender file CC on sender and receiver file CC with FCC on the receiver side.
I am able to get with receiver file FCC ,I know FCC can support two level heirarchies only.
header1
header2
header3
.....
header n
line x
line y
line z
....
line n
so i dont know to which header values the item values belong to.I need to get
this structure
header1....(if no items)
header2....(let say 2 items)
linex
liney
header3...(no items)
header4....(one item)
linez
header n.....(again no items)
so I have another Xi guy,he told me that we can achieve this by using a XSLT mapping rather than gaphical mapping which I am using now.
so can we get the structure what I wanted with XSLT mapping or is it nothing with mapping and it is with adapter?(I think its nothing with mapping)
I know we may get the required output structure by writing a module program and call that in the receiver file adapter.
suggestions please.
thank you,
regards,
Babu
Hi Babu,
your task is not easy to understand. Can you give an example including
- source
- target
both wellformed XML please.
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
udo,
sorry if I put in confusion with my structures of both source and target.I am trying to give little eloberate
I have source xml data like this.
<Header1 fld1=1234 fld2="name1" fld3='SAP1"
fld4='000" fld5=0 fld6="sdn1"</header>...............no line items here
<Header2 fld1=123 fld2="name" fld3='SAP"
fld4='00" fld5=0 fld6="sdn" ><line fld7=value1 fld8=value2 fld9=value3 /line><line fld7=value4 fld8=value5 fld9=value6 /line></header>.....two line items here
<Header3 fld1=123 fld2="name" fld3='SAP"
fld4='00" fld5=0 fld6="sdn" ><line fld7=value7 fld8=value8 fld9=value9 /line></header>......one line item here
Header4 fld1=12345 fld2="name2" fld3='SAP2"
fld4='0006" fld5=01 fld6="sdn2"</header>.......no line items here
I want target flat file structure like this considering "~" (tild)as delimiter
1234name1SAP100000~sdn1 ...................> flatfile values for header1(no item values for this header1)
123nameSAP000~sdn..........................> flat file values for hader2
value1value2value3...........................>line item values for header2
value4value5value6...........................>line item values for header2(two line item values for this header2)
123nameSAP000~sdn..........................>values for hader3
value7value8value9...........................>line item values for header3(one item values for this header3)
12345name2SAP2000601~sdn2..................>values for header4(no item values for this header4)
....................
................... like for n header values.
if i understand:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="your namespace" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
1234name1SAP100000~sdn1
<xsl:value-of select="./PATH TO HEADER1/LINE">
</sdn1>
...
</xsl:template>
</xsl:stylesheet>
Can you change the atributes fld7, fdl8... for nodes?
It'more easy in this way.
Message was edited by:
Iñaki Vila
I cant change anything in the source side structure cos thats the structure I am getting from our vendor.so not possible to change the attributes to nodes in the source structure.
top of all can I get the required file structure with XSLT?whichI am not getting with File adapter with FCC and cos of FCC limitation?
thank you.
Hi Babu,
i asked you for <b>wellformed</b> xml source and <b>target</b>. You must find out, how your XML target should look like, read the responding chapter at SAP library: <a href="http://help.sap.com/saphelp_nw70/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm">Converting File Content in the Receiver Adapter</a>. Your source is unfortunately not well wellformed. If you dont have a XML Spy, just copy the XML content into a textfile and open that with Internet Explorer, to check if it is wellformed. If you give me wellformed source and target, i can give you a stylesheet or a good tip, how to solve the mapping task.
Regards,
Udo
Udo,
I have been given single xml data file ,it has data in it ,so i am little hesitent to copy it here. I converted that to xsd using XMLSpy and imported into XI as source strcture and target structure I have to create in XI, but I need flat file format.
I can explain more if you dont mind if I send you an email to your email.
mine is sdn.babu@gmail.com
thank you.
let me try if I can explain you with the help provided strcture.
Source:
<root>...
<nameA value1=value1 value2=value2 value3=value3/>
<nameA value1=value4 value2=value5 value3=value6
/><line value1=lineA value2=lineB value2=lineC value3=lineD />
<line value1=lineE value2=lineF value3=lineG/></nameA>
<nameA value1=value7 value2=value8 value3=value9/>
<nameA value1=value10 value2=value11 value3=value12
/><line value1=lineH value2=lineI value3=lineJ /></nameA>
.....</root>
Target flat file structure:
Flat file Structure not xml structure.
value1value2value3
value4value5value6
lineAlineBlineC~lineD
lineElineFlineG
value7value8value9
value10value11value12
lineHlineIlineJ
hope got better ...
thank you.
Hi,
If you want the header x has line a..z you should have a value into header x and line x..z in order to make the join. Example:
<HEADER_X>
<KEY>A</KEY>
< . . .>
</...>
<HEADER X>
<LINE_A>
<KEY>A</KEY>
< . . .>
</...>
You can use the tag KEY to join.
If you don like too much XSLT you can do this with ABAP Mapping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.