Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

T006 : Convert the Quantity based on the decimals (ANDEC) assigned to the Units in table T006

0 Kudos
721

Hello,

Is there any Function Module which converts the quantities based on the decimals points assigned in the T006 table.
For Example :

My input is :
Menge - 3000
Meins -ST
Displayed Quantity should be 3000 ST and not 3000,000 ST (as ANDEC value in T006 is 0 for ST)

My input is :
Menge - 3000
Meins -STK
Displayed Quantity should be 3000,000 STK. (as ANDEC value in T006 is 3 for STK)

3 REPLIES 3

raymond_giuseppi
Active Contributor
642

Usually conversion of quantity fields related to unit of measure is performed with following FM

  • UNIT_CONVERSION_SIMPLE (in some versions class CL_UOM_CONVERSION)
  • MATERIAL_UNIT_CONVERSION

Which ones did you already check, which type of data did you use (QUAN, packed, decimal) did you fill the rounding parameter (ROUND_SIGN)

0 Kudos
642

Hallo Raymond,

I already checked UNIT_CONVERSION_SIMPLE but it still gives me 3000,000 ST as output whereas I want 3000 ST as output as my ANDEC value is 0 for ST.
Should I change the formatted_text TYPE to something else?
Note: I do not want to change the unit of measure. Hence, in and out unit remains same.
here:

 DATA: formatted_text TYPE c LENGTH 12,
unit TYPE t006-msehi,
decimal_value TYPE t006-andec.

SELECT SINGLE andec INTO decimal_value
FROM t006
WHERE msehi EQ ltap-meins.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = ltap-vsola
unit_in = ltap-meins
unit_out = ltap-meins
IMPORTING
decimals = decimal_value
output = formatted_text

0 Kudos
642

Solution:
I simply used this and it worked.

DATA: WA_QTY TYPE KTMNG.
WA_QTY = 100.100. WRITE WA_QTY UNIT 'ST'. " Will display 100 WRITE WA_QTY UNIT 'STK'. " Will display 100.1