‎2009 Aug 27 7:42 PM
Hi All,
In SAP Transaction VT02N, there is a tab for Additional Data. There is an input field 'Text 3' where the user will enter Gross Weight. I need to validate that the gross weight entered is in US Format.
The issue is that the input field is of type char where the user will enter a quantity.
US format is 123,456.000 i.e After the decimal 3 points and a comma after every 3 digits.
In case the value has 1 digit, 2 digits, 3 digits there is no comma. For 5 digits, 6 digits there will be 1 comma. For 7 digits, there will be 2 commas and so on.
I have already found the user exit.
Can someone suggest how should i validate that there is a comma after every 3 digits. Also input field should only contain '0,1,2,3,4,5,6,7,8,9 , and . '
Thanks,
Vanessa
‎2009 Aug 27 10:45 PM
try HRCM_STRING_TO_AMOUNT_CONVERT to validate the input. If it's valid, write the number back to a string by preceding it with SET COUNTRY 'US' (don't forget to reset it right after the write), check that the result equals the initial input.
‎2009 Aug 28 12:36 AM
This would be a permanent and fool proof solution.
SELECT SINGLE dcpfm
FROM usr01
INTO lv_decf
WHERE bname = sy-uname.
IF lv_decf EQ space OR lv_decf EQ 'Y'.
REPLACE ',' IN v_c WITH '.'.
ENDIF.