Sunday, September 2, 2012

ABAP creating table type


To define something like a[] as an class attribute is so trivial in other languages. In ABAP:


TYPES: city type spfli-cityfrom,
       spfli_type TYPE STANDARD TABLE OF spfli WITH DEFAULT KEY.

DATA: wa_city  TYPE city,
      wa_spfli TYPE spfli_type.

...
SELECT SINGLE cityfrom FROM spfli
                       INTO wa_city
                       WHERE carrid = 'LH' AND connid = '400'.

...
SELECT * FROM spfli INTO TABLE wa_spfli.

To create something like a[] where a is a class,

in "Local Types",

TYPES:  a_type type ref to class_a,
              a_list_type type STANDARD TABLE OF a_type.

No comments:

Post a Comment