Error trying to screen an internal table abap

Viewed 62

I´m learning ABAP and I keep trying to write that internal table and show it. There's syntax error message at line WRITE: / I_EJSEIS:

"I_EJSEIS" cannot be converted to a character-like value

I just don't understand it.

TYPES: S_EJSEIS LIKE SPFLI.
DATA: I_EJSEIS  TYPE TABLE OF S_EJSEIS WITH HEADER LINE,
      WA_EJSEIS TYPE S_EJSEIS.


SELECT FLTYPE
  FROM SPFLI
  INTO TABLE I_EJSEIS
  WHERE CARRID = 'LH'.

LOOP AT I_EJSEIS.
  WRITE: / I_EJSEIS.
ENDLOOP.
1 Answers

According to the ABAP documentation of WRITE dobj:

For dobj, those data types are allowed that are grouped under the generic type simple:

  • All flat data types; flat structures are handled like a data object of type c and can only contain any character-like components.
  • The data types string and xstring
  • enumerated types; the name (maximum three characters) of the enumerated constant is used in uppercase letters, which defines the current enumerated value.

In your case, I_EJSEIS is a (flat) structure containing at least one non-character component (e.g. fltime, distance, period), so it doesn't fall in any of the categories above.

The workaround is to display the fields individually:

WRITE: / I_EJSEIS-FLTYPE, I_EJSEIS-FLTIME.
Related