cancel
Showing results for 
Search instead for 
Did you mean: 

conversion of decimal type to big decimal

Former Member
0 Kudos

Hi

I have a input field which has a data type decimal.

But in R3 its data type is Big Decimal.

Now when i am picking the data from the context

it shows an error cannot convert float to BigDecimal.

The code is like this..

float qty=wdContext.currentContextElement().getQty();

Here Qty is of BigDecimal type..

i cant change the data type for Qty

so what should i do..

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Valery

I have used the code which u gave me but now it is showing the

error BigDecimal cannot be resolved or is not a type.

Monika

Former Member
0 Kudos

Monika,

Add the following import statement atop of your source file along with other imports:

import java.math.BigDecimal;

VS

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks Valery

The problem has been solved.

Monika

Former Member
0 Kudos

Hi Monika,

organize your imports.

kind regards

stefanie

Former Member
0 Kudos

Monika,

Try this:


final BigDecimal oQty = wdContext.currentContextElement().getQty();
float qty = oQty == null ? 0 : oQty.floatValue();

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

wdContext.currentContextElement().getQty().floatvalue();

Regards,ANilkumar