Video Lesson 5.2: SAP Data Retrieval Using A Select Loop

Video Lesson 5.2: SAP Data Retrieval Using A Select Loop

This lesson shows how to use the ABAP statement SELECT-ENDSELECT to create a loop and retrieve multiple entries from a transparent table.

  • You can use the SELECT loop to read several rows of a database table into the program in succession.
  • The database delivers the data to the database interface of the application server in packages.
  • The specified processing block then copies the records to the target area row-by-row for processing.
  • The return value should be queried after the SELECT loop (that is, after the ENDSELECT statement).
  • You can use the INTO TABLE addition to copy the selected part of the database into an internal table directly instead of doing so row-by-row.
  • This technique is called an array fetch.
  • Since an Array Fetch is not a type of loop processing, no ENDSELECT statement is required or allowed.
  • The Array Fetch must be structured left-justified just like the field list.
  • If an internal table does not meet this prerequisite, you have to use the INTO CORRESPONDING FIELDS OF TABLE addition instead of INTO TABLE.
  • With the array fetch, the content that might be in the internal table is overwritten.
  • If you want to append rows instead, you can use the APPENDING TABLE addition.