cancel
Showing results for 
Search instead for 
Did you mean: 

graphical mapping issue

Former Member
0 Kudos

Hi guys,

sender field = amount

length = 18

value = -5720.53

Reciever field = amount

length = 12

Mapping

sender field(18)>substring(0,12)->reciever field(12).

For the above logic, i am getting error as,

/ns0:MT_GLACCOUNT_SI2_SAP_FILE/RECORD/amount. The message is: Exception: java.lang.StringIndexOutOfBoundsException: String index out of range: 12] in class com.sap.aii.mappingtool.flib3.TextFunctions method substring -5720.53, com.sap.aii.mappingtool.tf3.rt.Context@6b6cc80d]

Any idea...where am going wrong....

santosh.....

Edited by: santosh koraddi on Aug 23, 2010 10:15 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

U R trying to substring the length of 12, but actual value length in runtime is 8 ( for value -5720.53).

try to use UDF. Check the input amount length. If exceeds 12, then substring, else then pass the value as it is...

Former Member
0 Kudos

try this...

String AmtSubStr = "";

if amount.length > 12 {

AmtSubStr = amount.substring(0,12);

}

else

{

AmtSubStr = amount;

}

return AmtSubStr;

let me know...

Yallabandi

Answers (3)

Answers (3)

Former Member
0 Kudos

Substring is Text Function , ............. Which u trying on Numeric value which has decimal in it and -sign also ....

this is the proble

I guess what you want is , Rounded off the value to 12 chararcter ..........

Am i right , Please correct me if i am wrong ....

regards

Prabhat Sharma,

Former Member
0 Kudos

Thanks everyone & Especially to Mr yallabandi.....

hv implemented your code in udf,

Giving below mentioned error though.........

pls suggest the solution......(sorry for querying small issues, i come frm abap background)

Source code has syntax error: D:/usr/sap/XIQ/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map19f9d8f5afb511dfc7a8005056a47072/source/com/sap/xi/tf/_MM_GLACCOUNT_ITAS_TO_SAP_.java:89: cannot resolve symbol symbol : variable length location: class java.lang.String if ( amount.length > 12 ) { ^ 1 error

String AmtSubStr = "";

if (  amount.length  >  12 )  {
AmtSubStr = amount.substring(0,12);
}
else
{
AmtSubStr = amount;
}

return AmtSubStr;

Former Member
0 Kudos

Thanks a lot to everyone.

I was able to implement the above functionality using standard functions.......

Former Member
0 Kudos

Use Format number function with 18 zeros between source and Substring.

it will work

Smile

Edited by: jayan477 on Aug 24, 2010 10:49 AM

Former Member
0 Kudos

Hi.

You can use UDF or modify your logic on graphical mapping like this



field(18)-->substring(0,12)--->reciever field(12).-------------------> then 

field(18)---Length------------------greather than
                              ---------------------------------------> if
---------------------------------------Constant (12)
---------------------------------------------------------------------------------->Target
Amount--------------------------------------------------------------> else

Regards