The select command is the most fundamental function of writing ABAP programs allowing the retrieval of data from SAP database tables. Below is an example of how to retrieve data using the SELECT..ENDSELECT command.
REPORT ZSELECTCOMMAND. *Select... endselect command data: it_ekko type STANDARD TABLE OF ekko, wa_ekko like line of it_ekko, it_ekpo type standard table of ekpo, wa_ekpo like line of it_ekpo. SELECT ebeln BUKRS BSTYP BSART FROM ekko INTO wa_ekko. APPEND wa_ekko TO it_ekko. ENDSELECT. write:/ 'SELECT... endselect command'. loop at it_ekko into wa_ekko. write:/ wa_ekko-ebeln. endloop.