Skip to Content
avatar image
Former Member

Value assignment

Hi,

I have a currency field and i want to assign it to a variable of type char. is this possible? if yes, plz tell me how

Regards,

Prasy

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Dec 07, 2007 at 12:17 PM

    Hi,

    Data:CURR Type NETWR .

    Data:CHAR(10) Type c.

    CURR = '1234'.

    WRITE CURR To CHAR.

    WRITE:/ CHAR.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      This is working for me.

      data: l_ansal LIKE q0008-ansal,
            line(80) type c.
      
      l_ansal = '1234567890.12'.
      
      line = l_ansal.
      replace '.' in line with ''.
      write line.

      Regards,

      Satish

  • avatar image
    Former Member
    Dec 07, 2007 at 12:19 PM

    DATA : Cur TYPE CHAR16.

    cur = itab-curr . " Currency field...

    WRITE :/ cur.

    that's all..

    in more detail..

    DATA : text type char18.

    text = itab-kwmeng. "field with value 1,0000.00

    REPLACE ALL OCCURRENCES OF ',' IN text

    WITH ' '.

    CONDENSE text.

    WRITE :/ text.

    Or also:

    For Converting currency field in char type, Just do

    DATA : ZCHAR(20) TYPE C.

    MOVE CURRENCY TO ZCHAR.

    Reward points if found helpfull.....

    Cheers,

    Chandra Sekhar.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 07, 2007 at 12:13 PM

    Hi,

    Data: curr(10) type p decimals 2,

    char(10) type c.

    curr = '12334.56'.

    char = curr.

    replace '.' in char with '' .

    write char.

    Regards,

    Satish

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 07, 2007 at 12:14 PM

    Hi..

    you can do this.

    see the following code it will help you

    data : val(10) type char.

    **now you want to assign a currency field to this val and the value must be in rupees or something else.

    val = val * ekko-umrez / ekko-umren.

    with this statement the charecter field value can be converted into cureency field

    now you can use the same val in any where of your object.

    regards,

    swaminath reddy

    Add comment
    10|10000 characters needed characters exceeded