Description:
A table expression consists of an internal table (itab) followed immediately by a row (itab_line) enclosed in square brackets [ ].
- You can add a chain like -comp|[ … ]|->comp to this row. The expression search for the specified row in the internal table.
- If no chaining is used, the entire row is returned with its full row type.
- To avoid dumps while fetching data with table expressions, use OPTIONAL keyword.
Syntax:
itab[ itab_line ][-comp|[ ... ]|->comp] ...
Example:
"Data Declarations
DATA: lt_vbak TYPE SORTED TABLE OF vbak WITH NON-UNIQUE KEY auart.
"Fetch data
SELECT * FROM vbak
INTO TABLE @lt_vbak
WHERE erdat > '20201107'.
IF sy-subrc = 0.
“Table Expressions
DATA(ls_vbak) = lt_vbak[ auart = 'ZYOR' ].
DATA(ls_auart) = lt_vbak[ 1 ]-auart.
ENDIF.
Thanks for visiting!
Sangeeta Singh

Leave a Reply