The column is inserted through the field catalog of the ALV Table. It is set during the method call FACTORY ().
Step1: Extend the structure either locally or globally through the Transaction SE11 with the additional field.
TYPES: BEGIN OF ty_contact.
INCLUDE STRUCTURE ztt_db_table2.
TYPES: contact_age TYPE ZDE_contact_age.
END OF ty_contact.
DATA lt_contact TYPE STANDARD TABLE OF ty_contact.
It is always recommended to use an unique Data element for the fields of the structure, so that the column heading text can be easily maintained.
Step2: Call the Factory() Method of class CL_SALV_TABLE
CALL METHOD cl_salv_table => factory
IMPORTING
r_salv_table = lr_alv_object
CHANGING
t_table = lt_contact.
Through the field catalog of the ALV Table, a new column can be inserted or deleted.
There is a method REMOVE_COLUMN() for the column class ‘CL_SALV_COLUMN_TABLE’. But it is protected. Therefore the inheritance is needed to remove the column.