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: 

convert char field value into currecy field ?

Former Member
0 Kudos

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.

2 REPLIES 2

Former Member
0 Kudos

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

Former Member
0 Kudos

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).