Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unicode - error - how to replace? *need help*

Former Member
0 Likes
752

Hi,

I have a report that I have to migrate into an unicode-system and there are some errors. With one of these errors I have aproblem because I don't know how to solve the problem and how to replace the logic so that is unicode-compatible.

Here is the form-routine, that has the error:



FORM init_packed_fields CHANGING cp_str TYPE zstr_test_bapi.

  TYPE-POOLS: sydes.

  CONSTANTS: co_hex_20   TYPE x VALUE '20'.
  DATA: lt_nametab              TYPE sydes_desc.
*--------------------------------

* Workareas
  DATA: BEGIN OF lwa_nametab_type.
  DATA:  l_type TYPE sydes_typeinfo.
  DATA: END OF lwa_nametab_type.

  DATA: BEGIN OF lwa_nametab_name.
  DATA:  l_name TYPE sydes_nameinfo.
  DATA: END OF lwa_nametab_name.
*-----------------------------------------

  DATA: l_fieldname LIKE dd03l-fieldname,
        l_tabix LIKE sy-tabix,
        l_typ(1) TYPE c,
        l_no_of_components TYPE i.
*----------------------------------

  FIELD-SYMBOLS: <f1> TYPE ANY.
*-----------------------------

* Packed fields
  CLEAR lt_nametab-types.
  CLEAR lt_nametab-names.
  REFRESH lt_nametab-types.
  REFRESH lt_nametab-names.
  DESCRIBE FIELD cp_structure INTO lt_nametab.
  LOOP AT lt_nametab-types INTO lwa_nametab_type
                           WHERE type = 'P'.
    l_tabix = lwa_nametab_type-l_type-idx_name.
    READ TABLE lt_nametab-names INTO lwa_nametab_name
               INDEX l_tabix.
    SHIFT lwa_nametab_name-l_name.
    CONCATENATE 'cp_str'
                '-'
                lwa_nametab_name-l_name
                INTO l_fieldname.
    ASSIGN (l_fieldname) TO <f1>.
    IF <f1> CO co_hex_20.                      " <--- here is the error
      CLEAR <f1>.
    ENDIF.
  ENDLOOP.

The error message is:

"CO_HEX_20" must be a character-type data object (data type C, N, D, T, or STRING)

It would be really great if you can give me hints and/or solutions. What should the coding do concretly?

Thanks a lot

Kind regards

Max

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
684

Hi,

Just do this.

data: co_hex_20  TYPE c VALUE cl_abap_char_utilities=>cr_lf.

Refer this thread -

https://forums.sdn.sap.com/click.jspa?searchID=18732916&messageID=2088832

Regards,

Anversha

Edited by: Anversha s on Nov 16, 2008 5:29 PM

3 REPLIES 3
Read only

anversha_s
Active Contributor
0 Likes
684

Hi,

Just change like this.

data : co_hex_20   TYPE string.

Regards,

Anversha

Read only

0 Likes
684

Is that then the same logic????

I think '20' in type HEX (X) stands for SPACE, isn't it?

Read only

anversha_s
Active Contributor
0 Likes
685

Hi,

Just do this.

data: co_hex_20  TYPE c VALUE cl_abap_char_utilities=>cr_lf.

Refer this thread -

https://forums.sdn.sap.com/click.jspa?searchID=18732916&messageID=2088832

Regards,

Anversha

Edited by: Anversha s on Nov 16, 2008 5:29 PM