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

Convert character to packed

Dear Friends,

how do i convert a character value like '0,0000' to

packed,because if i directly assign i get a dump.

kind regards

kaushik hegde

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on May 03, 2005 at 08:13 AM

    Hi kaushik,

    try:

    translate char_field using ',.'.

    move char_field to p_field.

    regards Andreas

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi everyone,

      I would also use Andreas' answer, but with this tiny generalization:

        CLEAR: usr01.
        SELECT SINGLE *
          FROM usr01
          WHERE bname = sy-uname.
      
        CASE usr01-dcpfm.
          WHEN space.
            TRANSLATE char_field USING '. ,.'.
          WHEN 'X'.
            TRANSLATE char_field USING '.., '.
          WHEN 'Y'.
            TRANSLATE char_field USING '. ,.'.
          WHEN OTHERS.
        ENDCASE.
        CONDENSE char_field NO-GAPS.
      
        move char_field to p_field.
      

      Hope it helps. BR,

      Alvaro

  • author's profile photo Former Member
    Former Member
    Posted on May 03, 2005 at 08:12 AM

    use statement 'PACK'

    :

        pack w_field to _w_field_packed .

    Hope this helps.

    Erwan.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 03, 2005 at 08:21 AM

    Hi,

    Try this out

    DATA: i_p(10) type c,

    o_p type p .

    i_p = '10000'.

    CALL FUNCTION 'CHAR_PACK_CONVERSION'

    EXPORTING

    input = i_p

    IMPORTING

    DECSTRING = o_p.

    write: / o_p.

    <b>One more thing to be noted is the maximum length allowed for type P is 16</b>.

    Thanks & Regards,

    Judith.

    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.