Application Development 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: 

itab cannot be converted to character-type field

Former Member
0 Kudos

Hi All,

We have a program not working in ECC 6.0.

data: begin of itab occurs 0.

include structure rku01ja.

data: end of itab.

loop at itab.

write 😕 itab.

endloop.

Now it says itab cannot be converted to character-type field

Please help

6 REPLIES 6

Former Member
0 Kudos

You can WRITE each field individually.

Rob

0 Kudos

I thought the same Rob, but its a really long structure.

0 Kudos

You can use FIELD-SYMBOLS.

A better approach might be to decide which fields you really want to see and print only those.

Rob

0 Kudos

Thanks Rob, I was thinking of fetching all the fields of the structure included and then loop through those and print individual element...Something like dynamic table..

uwe_schieferstein
Active Contributor
0 Kudos

Hello Reena

Apparently you cannot WRITE a structured variable under Unicode. Instead you need to move the structured contents to an unstructured C-container, e.g.:


data: begin of itab occurs 0.
include structure rku01ja.
data: end of itab.

DATA: ld_string    TYPE string.
DATA: ls_record   LIKE LINE OF itab.

loop at itab INTO ls_record.

  CALL METHOD cl_abap_container_utilities=>fill_container_c
    EXPORTING
      im_value               = ls_record
*    IMPORTING
*      ex_container           = ld_string
*    EXCEPTIONS
*      illegal_parameter_type = 1
*      others                 = 2
          .
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

write 😕 ld_string.
endloop.

Regards

Uwe

0 Kudos

And now I will try Uwe's code