Have a look at this snippet. It creates a data reference of table type specified by user, and then uses a select query to populate 10 records of that database table to data reference via field symbol.
PARAMETERS tabname TYPE dd02l-tabname OBLIGATORY DEFAULT 'MARA'.
DATA dref TYPE REF TO data.
CREATE DATA dref TYPE STANDARD TABLE OF (tabname).
FIELD-SYMBOLS <fs> TYPE ANY TABLE.
ASSIGN dref->* TO <fs>.
SELECT * FROM (tabname) INTO TABLE <fs> up to 10 rows.