on 06-16-2008 3:15 PM
Hi,
In my Source structure iam getting values as
100.00- ( minus sign after the number)
and in the target structure iwant the value as
-100.00 (minus sign before the number)
is there any way we can do it in Mapping.
Thanks
Srinivas
Here is the solution without UDF
https://weblogs.sdn.sap.com/weblogs/images/17804/TestImg.JPG
replace name with your number.
regards
Sameer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Full function will be like this
Re: Message Mapping
Posted: Jun 16, 2008 4:53 PM in response to: Srinivas Manda E-mail this message Reply
function myudf(String strInput,Container container)
{
int strIndex = strInput.indexOf("-");
String newStr = "-"+ strInput.substring(0,strIndex);
return newStr ;
}
Thanks
Amit
Hi Gabriel,
when iam using ur UDF iam getting the following error
Source code has syntax error: /usr/sap/DHX/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map80938c803d5911ddc30e001125a5ce17/source/com/sap/xi/tf/_mm_ZMATMAS_to_ZMATMAS_MANAGE_DPM_.java:7029: cannot resolve symbol symbol : method subString (int,int) location: class java.lang.String ret = "-" + a.subString(0,ind); ^ 1 error
Help me inresolving this error.
Thanks
Srinivas
Thank you to all of you,
The UDF given by Gabriel and Gaurav is working.
Thanks
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
function myudf(String a,Container container)
{
String d = a.subString(a.length-1);
if (d.equals("-"))
{
String ret=null;
for(int i=0;i<a.length;i++)
if ( ! a[<i>] == '-')
ret = ret + a[<i>];
ret ="-"+ret;
return ret;
}
return a;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
u can achieve the same using graphical mapping also. If the value is lt 0. then replace - sign with space and concat the value with -.
Reward if find useful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
YOu may have to write a UDF in JAVA.
sample code:
String abc = "100.00-";
int length = abc.length;
String numberString = abc.substr(length-1);
return "-" + numberString;
Regards,
Ravi Kanth Talagana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can write a UDF as
take source as input parameter to this UDF
String StrNew = null;
for (i=0;i<strInput.length();i++){
if ( ! strInput<i> == '-')
{
Strnew = StrNew + strInput<i>;
}
StrNew = "-" + StrNew; /// to concatenate - and StrNew
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
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.