SAP ABAP 7.40 - Table Expressions to Read & Modify Internal Table.


Using the table expressions (made available for after SAP 7.40), it becomes easy to read and modify internal tables without using any temporary work area or variables. This can be achieved by using ABAP Table Expressions.

Table expressions are a new way of accessing table lines in operand positions. One can view a table expression simply as a short form of a READ TABLE statement. The result of a table expression is a single table line.

If a table line is not found, the exception CX_SY_ITAB_LINE_NOT_FOUND is raised. Since it involves operands hence no SY-SUBRC from table expressions.

In Simple words think of the Table Expressions as the short form for the READ TABLE statement. It basically consists of an internal table, followed by a row specified in square brackets [ ].

For syntax refer this screenshot.



READING FIRST INDEX OF INTERNAL TABLE



READING  INTERNAL TABLE WITH KEY

Old Way of reading data from Internal table.


New way of reading internal table using table expressions.


NOTE: There is no SY_SUBRC check while reading data from internal table using table expressions. if the read is not a success exception CX_SY_ITAB_LINE_NOT_FOUND is raised which has to be handled. (as shown above)


Comments

Also Read...