Below is the step by step process to display an internal table data as a ALV List output. This is just a basic program which selects data from a DB table and displays as a List output.
Please let me know, if you have any specific logic to be built in List display. I will write the entire program and post it for you.
Well, below goes the program.
Line 6 : Report program name.
Line 8-9 : Declaring internal table to store records.
Line 11-12 : Declare internal table and work area for field catalogue this field catalogue will be used to display the output.
Line 13 : Event start-of-selection.
Line 16-18 : Select query on DB table to fill the internal table. The data in this internal table will be displayed as List output.
Line 21 – 47 : Creating field catalogue for all the fields of the internal table which will be displayed.
FIELDNAME – this will carry the field name of the internal table
SELTEXT_L = This will carry the Long text which will be displayed as Column header in the output.
TABNAME = Internal table name whose data will be displayed as output.
COL_POS = Position at which the field will be displayed.
Line 49 : FM REUSE_ALV_LIST_DISPLAY is called to display the internal table records as a List.
Line 50-52 (Exporting parameters) :
i_callback_program = program name which calls this FM.
it_fieldcat = Field catalogue name.
Line 53-54 (Tables Parameters) :
t_outtab = name of the internal table whose records will be displayed.
Line 55-57 (Exceptions) : FM will return exceptions if any error occurs while execution.
Line 58-61 : Handle exceptions with a proper error message.
Below is the program output :