Register Login

Select/ Endselect loop in SAP

Updated Jan 22, 2024

The SELECT/ENDSELECT in SAP ABAP functions as a loop used to fetch a single record during each iteration. Essentially, it operates like a client cursor, potentially leading to increased network traffic and communication overhead between the application server and the database server.

Note: SAP does not recommend using SELECT ENDSELECT statement because of the performance of the loop.

Instead, use SELECT...INTO TABLE...+ LOOP AT TABLE statement

How to Exit a Select/ Endselect loop?

Use the Exit statement as shown in the example below:

Example:

Data: recnr type i.

select * from ska1.

recnr = recnr + 1
if recnr > 10.
exit.
endif.

 


×