Skip to Content
author's profile photo Former Member
Former Member

convert char field value into currecy field ?

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 01: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).

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.