ABAP - Dynamic Internal Tables Using OOPS Concept

REPORT z_test .


TYPE-POOLS: slis.


DATA: it_fieldcat TYPE lvc_t_fcat,

is_fieldcat LIKE LINE OF it_fieldcat.


DATA: new_table TYPE REF TO data.


DATA: new_line TYPE REF TO data.


FIELD-SYMBOLS: TYPE ANY TABLE,

TYPE ANY,

TYPE ANY.



PARAMETERS: p_table TYPE dd02l-tabname.


* Build fieldcat

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = p_table

CHANGING

ct_fieldcat = it_fieldcat[].



* Create a new Table

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = it_fieldcat

IMPORTING

ep_table = new_table.


ASSIGN new_table->* TO .


* Create Work Area

CREATE DATA new_line LIKE LINE OF .

ASSIGN new_line->* TO .



Serkan AKKAVAK

Computer Engineer

SAP Department Deputy Manager

Contact : serkurumsal@yandex.com