on 03-21-2007 2:17 PM
Hi,
I have requirment where third party system sends the value in double but SAP BAPI need in float format. Can any explain how can we do using the UDF.
Thanks,
Venkat
Hi Venkat,
do below in UDF - Take input argument String a - write below in UDF:
Double d = new Double(a);
float f = Double.floatValue(d);
return Float.toString(f);
Thanks,
Rajeev Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rajeev,
Getting following error when I try,,can you please help me..in resolving..
Source code has syntax error: /usr/sap/XD1/DVEBMGS21/j2ee/cluster/server0/./temp/classpath_resolver/Mapcf401390d7bf11dbc695001125392936/source/com/sap/xi/tf/_test_.java:70: cannot resolve symbol symbol : method floatValue (java.lang.Double) location: class java.lang.Double float f = Double.floatValue(d); ^ 1 error
Hi Venkat,
in graphical mapping do below:
source field ->MapWithDefault->UDF->Output field
double click MapWithDefault and specify 0......just check your source data is having valid data for double field.........
use below code for UDF:
Double d = new Double(a);
float f = d.floatValue();
return Float.toString(f);
Thanks,
Rajeev Gupta
Message was edited by:
RAJEEV GUPTA
Try this
Float floatVal = new Float(doubleVal);
float num = floatVal.floatValue();
Hope this help
Francesco
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use the constructor directly Float f = new Float(double value)..
If the value is a double object, then you can get the double value as
double d = "your entered Double Object".doubleValue()
Another way is to type cast Float f = (Float) double value...
Hope this helps..
Regards
Kiran..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
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.