Pankaj check below code.
I have created another reference type for same table.just name changed.
report ZTESTING.
data : w_tabname TYPE w_tabname,
w_dref TYPE REF TO data,
w_dref1 TYPE REF TO data,
w_grid TYPE REF TO cl_gui_alv_grid.
FIELD-SYMBOLS <ITAB1> TYPE STANDARD TABLE.
FIELD-SYMBOLS <ITAB2> TYPE STANDARD TABLE.
PARAMETERS: p_record type i.
PARAMETERS : p_table(50) TYPE C. "Taking Standard table from Selection Screen say "MARA"
BREAK-POINT.
w_tabname = p_table. " Getting the table name from Selection screen
CREATE DATA w_dref TYPE TABLE OF (w_tabname).
CREATE DATA w_dref1 TYPE TABLE OF (w_tabname).
ASSIGN w_dref->* TO <ITAB1>.
ASSIGN w_dref1->* TO <ITAB2>.
* Populating Dynamic internal table
SELECT * FROM (w_tabname) UP TO 20 ROWS INTO TABLE <ITAB1>. "Values are comming in <ITAB1> without any problem
APPEND LINES OF <ITAB1> FROM 1 TO 10 TO <ITAB2> .
*******************************
Note:as per your requirement mention from ** to ** records.
or put loop with condition.
Regards,
Sandeep.