on 03-21-2007 3:13 PM
Hi,
I want to convert content of a file with the following structure:
KD1234567890
NUM345
QTY010
NUM489
QTY001
NUM555
QTY100
ENDX
Where KDxxx is a customer Number
NUM and QTY are Materialnumber and Quantity
END
So KD is head, END is End, both ocurr one time. NUM/QTY is body and have no boundary
I want to convert them to a XML-Structure like this
<Order>
<Head>1234567890<Head/>
<Pos>
<Num>345<Num/>
<Qty>010<Qty/>
<Pos/>
<Pos>
<Num>489<Num/>
<Qty>001<Qty/>
<Pos/>
<Pos>
<Num>555<Num/>
<Qty>100<Qty/>
<Pos/>
<END>X<END/>
<Order/>
I tried a lot, and read a lot of blogs but I do not get what I want.
Does anybody now, how to manage this?
Regards
Volker
Hi,
then isnt it what u want??
i was talking abt ur mail id (like gmail or yahoo).
but i think u got what u wanted.
but if u need any help just give ur email ID here(in this thresd).
Thanks,
Maheshwari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
in forum itself (in this thread) write down ur id.
Have u tried with given content conversion?
Thanks,
Maheshwari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
this is my latest result:
<?xml version="1.0" encoding="utf-8" ?>
- <OrderUK>
- <Record>
- <Kopf>
<key>KD</key>
<customer>1234567890</customer>
</Kopf>
- <Art>
<key>NUM</key>
<nummer>345</nummer>
</Art>
- <Qty>
<key>QTY</key>
<menge>010</menge>
</Qty>
</Record>
- <Record>
- <Art>
<key>NUM</key>
<nummer>489</nummer>
</Art>
- <Qty>
<key>QTY</key>
<menge>001</menge>
</Qty>
</Record>
- <Record>
- <Art>
<key>NUM</key>
<nummer>555</nummer>
</Art>
- <Qty>
<key>QTY</key>
<menge>100</menge>
</Qty>
- <Ende>
<key>END</key>
<wert>X</wert>
</Ende>
</Record>
</OrderUK>
I'll try out to map this with target structure.
Is S0000356996 the ID you need?
Volker
Hi,
Try this :
just change ur input data type slightly to suit following settings.
<b>Recordset Structure : Kopf,1,Pos1,,Pos2,,Ende,*</b>
<b>Key Field Name : key</b>
Kopf.keyFieldValue : KD
Kopf.fieldNames : Key,Value
Kopf.fieldFixedLengths : 2,10
Kopf.endSeparator : 'nl'
Pos1.keyFieldValue : NUM
Pos1.fieldNames : Key1,Num
Pos1.fieldFixedLengths : 3,3
Pos1.endSeparator : 'nl'
Pos2.keyFieldValue : QTY
Pos2.fieldNames : Key2,Qty
Pos2.fieldFixedLengths : 3,3
Pos2.endSeparator : 'nl'
Ende.fieldNames : ende,wert
Ende.fieldFixedLengths : 3,1
Ende.endSeparator : 'nl'
ignoreRecordsetName : true
this works... check it... if u dont get give me ur id i will send u screen shots.
Thanks,
Maheshwari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Volker,
<Order>
<Head>1234567890<Head/>
<Pos>
<Num>345<Num/>
<Qty>010<Qty/>
<Pos/>
<Pos>
<Num>489<Num/>
<Qty>001<Qty/>
<Pos/>
<Pos>
<Num>555<Num/>
<Qty>100<Qty/>
<Pos/>
<END>X<END/>
<Order/>
You cant get this structure using your input. May be you can get this structure
<Order>
<Head>1234567890<Head/>
<Pos>
<Num>345<Num/>
</Pos>
<Pos1>
<Qty>010<Qty/>
</Pos1/>
<Pos>
<Num>489<Num/>
</Pos>
<Pos1>
<Qty>001<Qty/>
<Pos1/>
<Pos>
<Num>555<Num/>
</Pos>
<Pos1>
<Qty>100<Qty/>
<Pos1/>
<END>X<END/>
<Order/>
The reason is you can not group NUM and QTY to a single structure.
An alternative is to change the input file slightly.
KD1234567890
<b>NUM345QTY010
NUM489QTY001
NUM555QTY100</b>
ENDX
If you can change your input file like this, then it is possible to get the structure you want.
Regards,
Jai Shankar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
>>the structure I have to deal with comes from my customer
and he is used to this structure and won't change it.
Then, I beleive you have to use the structure I have shown in my first reply and process the msg in your mapping.
I dont think there is an alternative to this via content conversion. But, if some one proves me wrong, I would be happy to learn a new thing.
Regards,
Jai Shankar
Hi,
In the data type create an extra field say <b>Id</b> in Kopf, Pos and Ende
In the content conversion parameter
Recordset Structure : Kopf,1,Pos,,Pos1,,Ende,1
Keyfield Name : Id
Kopf.fieldNames: Id,value
Kopf.keyFieldValue: KD
Kopf.fieldFixedLengths: 2,10
Kopf.endSeparator: 'nl'
Pos.keyFieldValue: NUM
Pos.fielNames: Id,matnr
Pos.fieldFixedLengths: 3,3
Pos.endSeparator: 'nl'
Pos1.keyFieldValue: QTY
Pos1.fielNames: Id,menge
Pos1.fieldFixedLengths: 3,3
Pos1.endSeparator: 'nl'
Ende.fieldNames: Id, wert
Ende.keyFieldValue: END
Ende.fieldFixedLengths: 3,1
Ende.endSeparator: 'nl'
@Maheshwari
Can you have different key field names? In your conversion paramters, you have different keyfields for kopf,pos1,pos2 and ende.
Regards,
Jai Shankar
Hi,
There are many blogs for File Content Conversion. Some of them are listed hereunder:-
/people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
/people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
/people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
/people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
/people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
You may also check the FCC documentation for Sender and Receiver:-
http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
Regards.
manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Volker,
You can not use the fieldSeapartor value as 'nl' or a , in your case.
Reason :
Consider an example
NUM345
QTY010
Here actually, there are not just 2 field values. But 4
NUM
345
QTY
010
So, the first 2 fields are separated by fixed lengths and the 1,2 and 3,4 are separated with a 'nl'.
Hope you got what I meant.
Regards,
Jai Shankar
Hi,
can you please give ur input file once again.
is it KD1234567890 or KD <b>, </b>1234567890?
Thanks,
Maheshwari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you look at a weblog such as this one:
/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
It shows how to do flat file conversion. However the trick with your scenario is that your flat file is not delimited by a comma, but instead each field is seperated by the newline character. So your communication channel config would be something more like:
Row.fieldSeperator = 'nl'
Right now if you use a method that has been developed for csv files then XI will think that each newline is a new record, and not map the data correctly. So you will need to change that as well as change the Row.endSeperator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
create three structres in data type.
1. Header occurance 1to1. under it create header fields
2. Details occurance 1to unbounded. create Qty and Number fields
3. End occurances 1to 1. endx field.
in sender file adapter in RecordsetStrucure: Header,1,Details,*,End,1
in contentconversion
Header.
Details.
End.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
thanks for your hints.
If I do what you proposed I get
<?xml version="1.0" encoding="utf-8" ?>
- <OrderUK>
- <Record>
- <Kopf>
<key>KD</key>
<value>1234567890</value>
</Kopf>
- <Ende>
<ende>END</ende>
<wert>X</wert>
</Ende>
</Record>
</OrderUK>
That's what I expect for head (Kopf) and end (Ende), but where are the position data?
The Configuration of the Communication Channel is like this.
I did :
xml.keyFieldName:order
xml.keyFieldType:CaseSensitiveString
xml.recordsetStructure: Kopf,1,Pos,*,Ende,1
Kopf.fieldNames: key,value
Kopf.keyFieldValue: KD
Kopf.fieldFixedLengths: 2,10
Pos.fielNames: matnr,menge
Pos.keyFieldValue: NUM
Pos.fieldSeparator: nl
Pos.endSeparator: nl
Ende.fieldNames: ende, wert
Ende.keyFieldValue: END
Ende.fieldFixedLengths: 3,1
Where's the problem?
Volker
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.