When an internal table is not structured
2012-02-27
When you want to select some lines in an internal table you normally do something like this:
DATA: BEGIN OF itbl,
campo1 TYPE c,
campo2 TYPE c,
END OF itbl.
READ TABLE itbl WITH KEY campo1 = 'X' campo2 = 'Y'.
LOOP AT itbl WHERE campo1 = 'X' and campo2 = 'Y'.
COISO.
ENDLOOP.
But what if the table is not structured and you want to search on the line as a whole? Well in this case here’s a tip. Use the special word TABLE_LINE :
DATA: itbl TYPE STANDARD TABLE OF string,
wa LIKE LINE OF itbl.
READ TABLE itbl WITH KEY table_line = 'X'.
LOOP AT itbl INTO wa WHERE table_line = 'X'.
COISO.
ENDLOOP.
(Thanks to Aaron Escobar for the photo.)
Greetings from Abapinho.