on 02-17-2015 11:14 AM
Hi experts,
in a sender communication channel I receive a flat file like this:
UNA:+.? 'UNB+UNOC:2+I20114T:01'DTM+137:20150206:102'RFF+ON:5100001679'....
Segment are UNA, UNB, DTM, RFF....
They comes in a single line separated by ' (apostrophe).
If I use UNA.endSeparator= '
UNB.endSeparator= '
......
it throws me an error, it seems that system doesn't recognize the ' as endSeparator,
How to convert this?
Thanks
Fabio
Problem not solvable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fabio
The file you have posted looks like a EDI file or an eancom file.
Normally those files are converted to xml using see burger adapter in SAP PI.
Using FCC , it is almost impossible to generate the xml because this will have more than 4 levels of hierarchy in the structure.
Thanks,
Indrajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghu,
thank you for helping me.
A strange things happens:
Every separator that I use is not recognized by the system as endseparator.
It seems that system needs always a new line to separate segments.
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fabio,
" ' works as fieldSeparator, but not as endSeparator. "
Please use below FCC parameters. This will split input file for each ' and put it in an element (eachFiled).
NameA.fieldSeparator '
NameA.fieldNames eachField
NameA.endSeparator 'nl'
Output of FCC
<?xml version="1.0" encoding="utf-8"?>
<ns:Document_Name xmlns:ns="Document_Namespace">
<ns:Reocrdset_Name xmlns:ns="Recordset_Namepace">
<NameA>
<eachField>UNA:+.? </eachField>
</NameA>
<NameA>
<eachField>UNB+UNOC:2+I20114T:01</eachField>
</NameA>
<NameA>
<eachField>DTM+137:20150206:102</eachField>
</NameA>
<NameA>
<eachField>RFF+ON:5100001679</eachField>
</NameA>
</ns:Reocrdset_Name>
</ns:Document_Name>
In message mapping, map eachField element to target, you can use startsWith function to check if it's start with UNA, UNB.
Fabio,
NameA.fieldNames eachField OR
NameA.fieldNames asdf_anything.
It is a single field.
In message mapping, map "eachField" OR "asdf_anything" element to target, you can use startsWith function to check if it's start with UNA, UNB.
If it does not work.
Read each line into element of FCC and perform split in message mapping.
Hi Raghu,
my input file is:
UNA:+.? 'UNB+UNOC:2+I20114T:01+05113870967T:ZZZ+150210:1631+35315+XX:XX+++0++0'UNH+35315+ORDRSP:D:96A:UN'BGM+231+8103097714'DTM+137:20150206:102'RFF+ON:5100001679'DTM+2:20150129:102'NAD+SU+F021550::92'NAD+BY+DE11::92'NAD+DP+0000100068::92++NIVOLA STYLE SRL "B"+VIA NUOVA CIRCONVALLAZIONE 27+RIMINI++47900+IT'LIN+10+5+8019227214888:EN'PIA+1+49040663A:IN'PIA+1+2148800:SA'QTY+21:10:PCE'QTY+113:10:PCE'DTM+2:20150129'RFF+ON:5100001679:00001'SCC+1'QTY+113:10:PCE'UNS+S'UNT+19+35315'UNZ+1+35315'
all in a single line.
I have created this structure:
DT_PurchaseOrderResponse_Pirelli
RecordSet 0..1
DetailRecord 0....unbounded
DataString 0....1
In channel I have specified:
If I start communication channel it raise an error:
Conversion of file content to XML failed at position 0: java.lang.Exception: ERROR converting document line no. 1 according to structure 'DetailRecord':java.lang.Exception: ERROR in configuration / structure 'DetailRecord.': More elements in file csv structure than field names specified!
What I have done wrong?
Fabio,
Can you please try
NameA.fieldSeparator 'nl'
NameA.fieldNames DataString
NameA.endSeparator '0x03'
This one will read each line into DataString element (I can see there is only one line in input file).
NameA.endSeparator 0x03 is End of File, if it does not work, try 'nl' OR '0x0A' (Line Feed).
Hi,
now is like that:
- <RecordSet>
</DetailRecord>
</DetailRecord>
I I think it works, but my next question is:
I I have to map DataString to an IDOC with multiple segments with different occurrences.
How is it possible?
Hi Raghu,
thanks.
For me is not clear how to map field DataString that comes in unbounded Detail Record to for example IDOC header segment EDI_DC40 that comes with occurrence 1.
For example:
I have to map a field of UNH segment (that comes in the third occurrence of DetailRecord) with EDI_DC40, but if I try PI reads always the first occurrence of DetailRecord.
Any hints?
Thanks
Fabio
Fabio,
First let's be sure that all FCC parameters are set correctly.
1)
As shown in attached screenshots, create an input file, FCC and let us know, you got same output as shown in attachments.
2)
Then,
change the input file. Replace all , with '.
change FCC. NameA.fieldSeparator ' OR '0x27'
Let us know, the output.
3)
If above solution does not work. Then read entire line into an element of XML and the write a UDF in message mapping to split string. I can guide you with splitting logic.
NameA.fieldSeparator 'nl'
NameA.fieldNames eachLine
NameA.endSeparator 'nl'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fabio,
Use key field as UNA, UNB, DTM, RFF....
and endSeparator as '0x27'(including the quotation marks).
Regards,
Soumyadip
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Soumyadip,
thanks but it doesn't work.
Also if I use a simple example file:
UNA:+.? 'UNB+UNOC'
with endSeparator = '0x27'
and keyFields
it doesn't work.
error is ='converting document line no. 1 according to structure 'UNA':java.lang.Exception: ERROR in configuration / structure 'UNA.': More elements in file csv structure than field names specified!'
It seems that system thinks that there only UNA structure.
Fabio
Hi boni,
Which version of PI you are using? If it is older version then please use hexadecimal value of ' for separator.
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.