2023 Jun 05 10:28 AM
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)
2023 Jun 05 11:15 AM
Usually conversion of quantity fields related to unit of measure is performed with following FM
Which ones did you already check, which type of data did you use (QUAN, packed, decimal) did you fill the rounding parameter (ROUND_SIGN)
2023 Jun 05 11:53 AM
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
2023 Jun 07 9:57 AM
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