Skip to Content
avatar image
Former Member

conversion

Hi experts.

I need to convert technical type P to string and convert back to P.

I have a given a example at below.

Data : val(12) type p decimals 2 value '192.68'.

I need to convert to string so i can add (192.68).

Later i need to convert back to P and updated into a internal table.

Thank you very much.

regards,

saravannan.s

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 10, 2008 at 02:03 AM

    data: amt_c(20) type c.

    parameters amt type p decimals 2.

    write amt to amt_c.

    write:/ amt_c.

    clear amt.

    move amt_c to amt.

    write:/ amt.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      where are you using the amt type p? in display? if yes use the type c in displaying report. but if in calculation no way you can use this because you'll be encountering run-time.

  • avatar image
    Former Member
    Sep 10, 2008 at 02:24 AM

    1. For conversion of P to string you can simply move the value P to char field.

    2. For converting char field back to P use FM RRBA_CONVERT_PACKED_NUMBER. Pass I_DECIMALS - No. of decimals you need, I_DECIMAL_MARK as default decimal notation( for EU users decimal notation is usually a Comma so be careful).

    Hope this helps.

    Amandeep

    Add comment
    10|10000 characters needed characters exceeded