Keep a short work queue in memory

A packing station has two parcel codes waiting for attention. An internal table is a program’s in-memory collection of rows; it is useful for temporary work, but it does not automatically save those rows to a database.

Define a row collection

TYPES ty_parcels TYPE STANDARD TABLE OF string WITH EMPTY KEY.

DATA(parcels) = VALUE ty_parcels(
  ( 'PK-204' )
  ( 'PK-205' )
).

The table contains rows of type string. VALUE constructs the table; each parenthesized item is one row. WITH EMPTY KEY makes clear that this simple example does not need a primary table key.

Check its size

DATA(result) = lines( parcels ).

lines( ) returns the number of rows in this internal table. It gives 2 here. Use the function for a row count rather than manually maintaining a second counter when all you need is the current table size.

Practice

Define ty_parcels, initialize two sample codes, and set result from lines( parcels ). Add output for your selected program context. The checker checks the key structure but does not execute ABAP.

Version note: Constructor expressions and inline declarations are modern syntax; availability depends on release and language version.

Sources

Developer practice · ABAP

Practice: initialize a queue of parcels

Define a simple table type and initialize two parcel codes using VALUE. Keep the table in parcels and assign the number of rows to result.

Choose your ABAP environment

This choice changes the output pattern checked here: WRITE belongs in a classic executable report, while out->write( ) uses the supplied output reference in an ABAP Cloud class-run method. It does not switch the language version of the other code; check release and API availability in your target system.

Complete the task and include the output statement shown for your selected environment. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.

0 required structures detected · 0 checks