cancel
Showing results for 
Search instead for 
Did you mean: 

Quantity field

praveenreddy_bk
Participant
0 Kudos

: With quantity field as a positive value, the quantity has 4 decimal places.

The fourth decimal provided in the input quantity is 9 (greater than 5)

The third decimal will be rounded up to 7.

The quantity value input provided = “143.3469”

The quantity field value is rounded as = “143.347”.

give me code in UDF

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You don't required any UDF.

Use standard function FormatNumber.

In number format put 000.000

decimal separator is .(dot)

This will solve your both problems of less than and greater than 9.

Regards,

Rohit

Reward points if helpful.

Former Member
0 Kudos

Hi Praveen,

Check this It may Help you.

String app="";

if(value.length()>3)

{

app ="-";

}

BigDecimal test = new BigDecimal(value.substring(0,3));

test = test.setScale(2,BigDecimal.ROUND_HALF_UP);

String ret = ""test""+app;

return ""ret"";

https://forums.sdn.sap.com/click.jspa?searchID=11385102&messageID=5058989

Regards,

Ramesh.

praveenreddy_bk
Participant
0 Kudos

When the fourth decimal provided in the quantity is 3 which is less than 5, the third decimal will be rounded down.

Input quantity = 143.3433

Entry_qnt = 143.343

Former Member
0 Kudos

Hi,

You may need to

Use .ROUND_HALF_DOWN

Instead of ROUND_HALF_UP

Regards,

Ramesh.