on 07-07-2011 8:11 PM
Hi Gurus,
In a File Content Convertion scenario, I am having an issue as next:
the sender CC will pick the file and put all data between comas in different fields. Example:
file:
data1, data2, data3
File mapped:
<field1>data1<field1>
<field2>data2<field2>
<field3>data3<field3>
But, there are some fields inside the file that are like this:
data1, "data2 (1, 2)", data3
So, what I need to do is remove comma in between double quotes.
Is this possible? How can I handle this?
Thanks!!
> So, what I need to do is remove comma in between double quotes.
Why do you want to remove the comma? You can just ignore it using enclosureSign parameter.
For more details pls check http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm .
Regards,
Sunil Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finally, the enclosure sign solved this issue.
Thanks all for your help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
there is already a standard solution available (enclosureSign) so use it - http://wiki.sdn.sap.com/wiki/display/XI/FileContentConversion
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Unless you are very sure about which field and how many times comma may come,I do not think you can resolve this problem at UDF level, after reading the file using FCC. The FCC you are using is separating the fields using comma. Thus for a data like this
data1, "data2 (1, 2)", data3
you will receive
<field1>data1<field1>
<field2>"data2 (1<field2>
<field3>2)"<field3>
<field4>data3<field4>
Now I would rather suggest you to try to change the FCC parameters in such a way that record separator is 'nl' or newline. Thus if you receive a file like this
data1, "data2 (1, 2)", data3
data1, data2, data3
After FCC you will receive data like this
<mt_record>
<row>data1, "data2 (1, 2)", data3</row>
<row>data1, data2, data3</row>
</mt_record>
Now you need to follow java mapping to get the required target structure. If you are new to java mapping follow these blogs, for PI 7.1
http://wiki.sdn.sap.com/wiki/display/XI/UsingPI7.1APIforJavamapping
If you are working in PI 7.0 you can follow
http://wiki.sdn.sap.com/wiki/display/XI/BeginnersguidetoJavamappingusingDOMparserinSAPXI
After following the FCC specified here, try doing java mapping.
regards
Anupam
Edited by: anupamsap on Jul 8, 2011 6:48 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>So, what I need to do is remove comma in between double quotes.
Yes it is possible. DO as follows.....
Use Standard text function replaceString to achieve this. It requires three input.
Example; field2 ----> 1
constant , ----> 2
constant (empty - no value)---->3
Map field2 --> replaceString --> target field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chapa,
Handle that particular field in the mapping. Use string functions (UDF) to remove the double quotes.
Best regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.