on 07-04-2013 6:26 PM
Hi All,
I have scenario File to Web services.Where in via file channel we are polling files and then transfer it to webservices post mapping.
Issue : We have free text in the XML file. And The same needs to replaced by a URL.
E.g.: If in the text value is : /Kunal/PI we have to replace the same with : http://www.sap.com/Kunal/PI
And post that we have to do mapping.
Need any java class code to do the same which search the value : /Kunal/PI in the file and replace all by : http://www.sap.com/Kunal/PI
as I am not that proficient in Java : SAP PI Version : PI 7.1.
Or is there is any other way the same can be done.
As its a free text so the values are coming as paragraph/sentence so we cant use concatenate in graphical mapping as we are receiving all the free text in a single field. So we have to search for the whole free text and do the replace function as mentioned above. And post that will call mapping.
Requesting all Gurus for help in the same.
Thanks in advance.
Hi All,
The issue is fixed. We used a java module to append the missing string in the text. We cant use replace string as the free text has some HTML tags which replace string is unable to parse. Thanks all for the help/direction.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The issue here is we don't have particular field carrying the text. The field is carrying a paragraph. So we have search the value in the string and then replace all. So concat wont work as we don't have the field tag. So we have to use some Java class before the mapping.
e.g. :
<Field> This is a file sent from business for billing purpose. We have take this image from the below location. Source : \kunal\pi. Please confirm</Field>
So part highlighted needs to replaced with http://www.sap.com/kunal/pi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kunal,
Write UDF as below:
Take the field as your input paramater --> String a.
Logic:
String result = "";
return result = a.replaceAll("/kunal/pi","http://www.sap.com/kunal/pi");
/AB
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.