6

Here is one for you.

Why does the following piece of code not end with a short dump GETWA_NOT_ASSIGNED and instead return type C with length 2?

FIELD-SYMBOLS: <fs_any> TYPE any.

DESCRIBE FIELD <fs_any>
  TYPE DATA(l_type)
  LENGTH DATA(l_length) IN BYTE MODE
  DECIMALS DATA(l_decimals).

I could not find anything in the ABAP documentation about this behaviour.

EDIT:

It looks like the short dump is never to be expected. I tried it also with

FIELD-SYMBOLS: <fs_any> TYPE i.

and

FIELD-SYMBOLS: <fs_any> TYPE but000.

so vwegert's answer looks to be plausible, because declaring a variable without any type like that DATA: var. defaults it to c with length 1.

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
Jagger
  • 10,350
  • 9
  • 51
  • 93

1 Answers1

5

Personal opinion, not backed by documentation either: Since DATA foo. will create a variable of TYPE C LENGTH 1 implicitly, this is what DESCRIBE FIELD does return in this case. You're probably on a Unicode system - on my system, it returns length 1. I'd say you've triggered some undocumented behavior, maybe even a bug. I'd strongly suggest NOT to rely on this - I suppose it might be changed at any time.

vwegert
  • 18,371
  • 3
  • 37
  • 55