Hello Neha,
when you have a DDIC structure for your data table you can put this structure name to the reuse function (this is the better way).
When your data table is a part of a DDIC structure, you can create the fieldcat with the function module
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = structurename
CHANGING
ct_fieldcat = fieldcatalog
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
After this, you can modify the table and after this you can put the table to the alv function modul.
When you don't have the DDIC structure, you can create the fieldcat with this coding.... (not the best way)
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = g_repid
i_internal_tabname = 'IT_MAT'
i_client_never_display = 'X'
i_inclname = xxxxxxxTOP'
CHANGING
ct_fieldcat = gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
You must create the table with headerline....
BEGIN OF it_mat OCCURS 0,
END OF it_mat.
Best regards
Thomas