See above link will be helpful for you, only for preparing the final internal table(Which we pass for ALV FM or Class).
Before that you can create the general structure or required fields structures.
And update the same structure or internal table with the data from the tables. Later pass the required fields into the dynamic internal table.
In parameter, you can pass the table name.
you can provide the column name based upon the fields you create for final internal table.
With regards,
SKR