02-15-2010 3:40 PM
Hello,
Can anyone help me out with conversion String to QUAN, INT1 and UNIT?
Are there FMs available for this standard conversion?
Thanks.
Regards,
Chris Bogers
02-15-2010 3:54 PM
For QUAN fields like MARA-NTGEW that have a unit like MARA-GEWEI assigned you can use:
WRITE mara-ntgew TO s UNIT mara-gewei.
This formats the number in the correct formatting as defined in unit customizing and user settings.
Same for integer (here i):
WRITE i TO s.
Regards Jack
02-15-2010 3:54 PM
For QUAN fields like MARA-NTGEW that have a unit like MARA-GEWEI assigned you can use:
WRITE mara-ntgew TO s UNIT mara-gewei.
This formats the number in the correct formatting as defined in unit customizing and user settings.
Same for integer (here i):
WRITE i TO s.
Regards Jack
02-15-2010 4:02 PM
Hi Jack,
When I write the string to QUAN field I got the following message:
Field "UNIT" is unknown. It is neither in one of the specified tables
nor defined by a "DATA" statement. "DATA" statement.
CODE:
WRITE str2 TO UNIT lw_zchapter-arbei.
Thanks & Regards,
Chris
02-15-2010 4:37 PM
Hello Chris,
Just insert a local data before the reserved word "UNIT". (data:lv_temp type mara-gewei).
CODE should be :
data:lv_temp type mara-gewei
WRITE str2 TO lv_temp UNIT lw_zchapter-arbei.
Syntax:
[UNIT unit]
Good Luck,
Boaz
02-15-2010 5:37 PM
Sorry for reading your question not correctly. When I read it better a solution might be:
DATA tabfield TYPE tabfield.
tabfield-tabname = 'MARA'.
tabfield-fieldname = 'NTGEW'.
CALL FUNCTION 'RS_CONV_EX_2_IN'
EXPORTING
input_external = '1.222,333'
table_field = tabfield
IMPORTING
output_internal = mara-ntgew.
My user number format is set to 1.234.567,89
Regards Jack
02-16-2010 7:41 AM
Hello guys,
Both instructions are not working.
Table: /IDEO/ZCHAPTER
Field: ARBEI
Data Element: ARBEIT
Data Type: QUAN
Length: 7
Decimal: 1
Any other ideas because ít's not working.
Thanks & Regard,
Chris Bogers
02-16-2010 8:17 AM
I solved the issue by using the following code:
SELECT SINGLE dcpfm "Decimal notaion
FROM usr01 "User master record (runtime data)
INTO l_user_decimal
WHERE bname EQ sy-uname.
CASE l_user_decimal.
WHEN ' '. " Decimal point is comma: N.NNN,NN
TRANSLATE str USING '. '.
TRANSLATE str USING ',.'.
WHEN 'X'. " Decimal point is period: N,NNN.NN
TRANSLATE str USING ', '.
WHEN 'Y'. " Decimal point is N NNN NNN,NN
TRANSLATE str USING ',.'.
ENDCASE.
CONDENSE str NO-GAPS.
amount = str.
Thanks & Regards,
Chris