Former Member

### Message Mapping

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

10|10000 characters needed characters exceeded

Former Member
Jun 16, 2008 at 03:41 PM

Here is the solution without UDF

https://weblogs.sdn.sap.com/weblogs/images/17804/TestImg.JPG

regards

Sameer

10|10000 characters needed characters exceeded
• Former Member Former Member

Yes, Value is correct.

Gaurav Jain

• Former Member
Jun 16, 2008 at 02:19 PM

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

}

10|10000 characters needed characters exceeded
• Jun 16, 2008 at 02:22 PM

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

10|10000 characters needed characters exceeded
• Former Member
Jun 16, 2008 at 02:46 PM

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

10|10000 characters needed characters exceeded
• Jun 16, 2008 at 02:53 PM

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;

}

10|10000 characters needed characters exceeded
• Former Member
Jun 19, 2008 at 06:56 PM

Thank you to all of you,

The UDF given by Gabriel and Gaurav is working.

Thanks

Srinivas