cancel
Showing results for 
Search instead for 
Did you mean: 

Quantity automatically rounds off to two decimals..

Former Member
0 Kudos

Hi experts,

I have inventory UoM of boxes. When goods are returned, i receive them back in pieces (I cannot have the UoM in pieces). I created a UDF in the item master (data type: Quantity) and have set the decimal places in General settings as 4 decimals.

In the AR credit memo, I have created a UDF to capture the quantity in Pieces (Data type: Quantity). Also, I have assigned a FMS in the quantity field (which would be computed as Pieces returned/ No of pieces per Box). When I run the FMS, it rounds off to 0.125 to 0.13. However, when I manually key in 0.125 in qunatity field, the value is accepted.

Please advise as to how I can prevent this automatic rounding off in FMS. This is my FMS

SELECT CASE $[RIN1.U_OtherUOM]

WHEN 'Boxes' THEN (SELECT $[RIN1.U_QtyUOM] / T0.U_Boxes)

WHEN 'Pcs' THEN (SELECT $[RIN1.U_QtyUOM] / T0.U_Pcs)

When 'Kgs' then (SELECT $[RIN1.U_QtyUOM] / T0.U_Kgs)

ELSE (SELECT $[$38.11.N,6])

END

FROM OITM T0

WHERE T0.ItemCode=$[$38.1.0]

FOR BROWSE

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

former_member187989
Active Contributor
0 Kudos

hi,

Try this

CAST('0.125' as nvarchar) as 'deci'

Replace 0.125 with select query.

Jeyakanthan

Answers (3)

Answers (3)

Former Member
0 Kudos

i tried both cast and str function.it doenst work out. can u please explain the root cause of this problem.

With Regards,

G.Shankar Ganesh

Former Member
0 Kudos

Interesting problem. Not knowing your full set up it's hard to isolate the problem. You need something that would effectively do:

qty_variable_formatted = FormatNumber(qty_variable,4)

This is basic code to format a numeric variable so it has 4 decimal places. However I'm not sure how you could integrate this with SAP. Someone else on here will know.

The first place I would look is at all other variables that are interacting with the quantity calculation - one of them (perhaps a total field) is formatted to 2 decimal places and therefore overriding any changes you are making. Make sure all numeric variables are all 4 decimal places or more.

former_member583013
Active Contributor
0 Kudos

Have you tried executing the FMS manually. The way this could be done is..

1. Remove any auto refresh setting you may have for the formatted search.

2. When the Cursor is on Quantity field on CM rows..Go to Toos > Queries > User Queries > ...select and open your query.

Now you could see all the values interpreted and assigned, try to change the CAST/CONVERT options and make sure you see 0.125 and not 0.13

If you are seeing 0.125, you should have the same value in the quantity column as well.

Also check the database table by running a query in SQL Server.

Regards

Suda

former_member187989
Active Contributor
0 Kudos

hi sankar,

Remove FMS already applied,apply it once again newly in UDF.

Jeyakanthan

Former Member
0 Kudos

Dear jayakandan,

Thanks for your reply i have tried the cast function too..still the problem exists.

With Regards,

G.Shankar Ganesh

former_member204969
Active Contributor
0 Kudos

Try to replace

(SELECT $[RIN1.U_QtyUOM] / T0.U_Boxes)

with

str($[RIN1.U_QtyUOM.Number] / T0.U_Boxes,8,4)

and similarly the others.