cancel
Showing results for 
Search instead for 
Did you mean: 

possible with XSLT mapping?

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Babu,

your task is not easy to understand. Can you give an example including

- source

- target

both wellformed XML please.

Regards,

Udo

Former Member
0 Kudos

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.

iaki_vila
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

iaki_vila
Active Contributor
0 Kudos

Hi,

...

1234name1SAP100000~sdn

<xsl:for-each select="./HEADER1/line">

<xsl:value-of select="./@fdl7"> <xsl:value-of select="./@fdl8"> <xsl:value-of select="./@fdl9">

</xsl:for-each>

</sdn>

....

udo_martens
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

udo_martens
Active Contributor
0 Kudos

Hi Babu,

just post simple, wellformed examples for source and target, no need for original data.

Regards,

Udo

Former Member
0 Kudos

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.

udo_martens
Active Contributor
0 Kudos

good luck!

Former Member
0 Kudos

Udo,

you mean we can't achieve the structure what I wanted as the final out put?

or you still didnt understand my structure?

thank you.

udo_martens
Active Contributor
0 Kudos

Hi Babu,

you can solve that by a XSL mapping, no problem. For developing that you need a wellformed source example and a wellformed target.

Regards,

Udo

Former Member
0 Kudos

I have source structure but need to create the target structure as we need, to attain the the required flat file structure.I can create as I require in the target side.

I am trying to send my source structure at udo.martens@spring.no ,but failing to deliver .

thank you for your patience.

Babu

Former Member
0 Kudos

Hi Udo,

I solved my problem using the Multi mapping concept without going for XSLT mapping.

ref:

thank you,

Babu

iaki_vila
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Inaki,

I want to get output structured corresponding to the input strcture.if I understand correctly you might be talking about only the target structure which I am getting with FCC.and I dont have any key values for the header or line.

iaki_vila
Active Contributor
0 Kudos

Hi,

I'm talking about the source, you should to have a LABEL or group of LABELs that can use to join Header and Line for make the response.

Regards.

null