Skip to Content
0
Nov 29, 2016 at 01:35 PM

Inline Internal Table Declaration

2234 Views

Hi all,

I'm looking for any ABAP techniques to do more of an 'inline' (or even in just less lines) of declaring internal tables.

In many languages (javascript, python, etc) we can declare arrays in a single line as such:

pets = ["cat", "dog", "duck", "fish", "turtle"]

And then perhaps go on to work that list in a loop or something similiar.

Is there an equivalent declaration method with abap? Or must I always write (in ABAP):

DATA: gt_pets TYPE TABLE OF string,

gs_pets LIKE LINE OF gt_pets.

gs_pets = 'cat'.

APPEND gs_pets TO gt_pets.

gs_pets = 'dog'.

APPEND gs_pets TO gt_pets.

(and so on)

Even if it's not "standard" ABAP, i'd be very interested in learning about it!

Thanks all!

Chris