11-29-2007 11:41 PM
Hi,
Can any one tell me how to validate and convert char field value into currency field value?
I have a currency field which has char data element, so if I we pass the currency value in that field I need to validate that field value? (like it should be in the format of 101.22 regular currency format, and if any thing other than that then I need to send error message.
For example if the field value has - 101..22 or 101. 4 or any other format i need to send the message.
Can any one help me on this issue?
Thanks.
Venkat.
11-30-2007 12:19 AM
Hi Venkat,
Try this
parameters : val(30) type c.
data : final(30) type c,
cnt type i,
v type c,
v1 type c,
n type i.
cnt = strlen( val ).
do cnt times.
move val+cnt(1) to v.
if v ca '.0123456789'.
if v1<> v.
move v to final+n(1).
endif.
if v = '.'.
v1 = v.
endif.
endif.
enddo.
condense final no-gaps.
write:/ final .
Regards,
Satish
11-30-2007 1:21 AM
Hi,
Try the FM 'CHAR_FLTP_CONVERSION'. Assign the value to field 'STRING'. leave the rest of the import parameters as default. If the input value is correct, you can find the value in 'FLSTR' (export parameter).