Skip to Content
avatar image
Former Member

Conversion of char to internal representation

I am extracting a field of char40 and creating a file out of it. The problem I have is

A99\260 Z1 50000700 SPECIFIC GRAVITY @ 15.6 C 1.0600

A99\260 Z1 50000751 BLOT (PASS) Clean

A99\260 Z1 50000757 CLARITY (CLEAR) Slight Haze Pass

A99\260 Z1 50000761 COLOR 3.0 typical L 0.5

A99\260 Z1 50000731 VISCOSITY @ 40 C, CST 69.00

A99\260 Z1 50000725 VISCOSITY @ 100 C, CST 8.300

As you can see the field values after the char field are been placed based on the actual length of the char field. I need to convert it to 40 chars so I can write the rest of the fields following it as a tabbed distance away. My file format gets whacked if one of the values is blank. How to fill them? Thanks

Message was edited by:

Megan Flores

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 17, 2007 at 08:12 PM

    How do I display the entire length of the field. This is my code.

    TYPES: BEGIN OF t_qualitydata,
             matnr      TYPE char18,
             charg      TYPE char10,
             verwmerkm  TYPE char8,
             char_descr TYPE char40,
             kurztext   TYPE char40,
             mean_value TYPE char22,
           END OF t_qualitydata.
    
    LOOP AT i_qualitydata INTO wa_qualitydata.
      CONCATENATE wa_qualitydata-matnr
                  wa_qualitydata-charg
                  wa_qualitydata-verwmerkm
                  wa_qualitydata-char_descr
                  wa_qualitydata-kurztext
                  wa_qualitydata-mean_value INTO gv_row SEPARATED BY space.
      TRANSFER gv_row TO c_file.
    ENDLOOP.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Megan,

      The tab is represented as CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB in Unicode system.

      Changed your code as follows.

      LOOP AT i_qualitydata INTO wa_qualitydata.

      CONCATENATE wa_qualitydata-matnr

      wa_qualitydata-charg

      wa_qualitydata-verwmerkm

      wa_qualitydata-char_descr

      wa_qualitydata-kurztext

      wa_qualitydata-mean_value INTO gv_row SEPARATED BY <b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.</b>

      TRANSFER gv_row TO c_file.

      ENDLOOP.

      Thanks,

      Vinay

  • avatar image
    Former Member
    Aug 17, 2007 at 08:10 PM

    Try to display the full length of the field.

    Thanks,

    SKJ

    Add comment
    10|10000 characters needed characters exceeded