converting CL_SALV_TABLE into CL_GUI_ALV_GRID

converting CL_SALV_TABLE into CL_GUI_ALV_GRID
1 (20%) 3 votes

I know the post header does not make enough sense. However this is an expalantion for the solution of a problem that i come across recently, and i believe it will be very useful for such cases.
Firstly my design was consisting of three SALV grid attached to different splitter containers. In each of these SALV grids, I added different custom buttons to their toolbars.Now my problem comes. In user command of these buttons, there was an already written code snippet which is referencing CL_GUI_ALV_GRID. Because of this, i need to get reference of each different CL_GUI_ALV_GRID.

In summary, i should have converted SALV into CL_GUI_ALV_GRID. Multiple SALV in the same screen makes the problem complicated because if there were just one SALV i could have used GET_GLOBALS_FROM_SLVC_FULLSCR which returns me the only ALV reference in the screen. For conversion i needed to implement a local sub class for CL_SALV_MODEL because R_CONTROLLER attribute of CL_SALV_TABLE is defined as protected.

Below i am sharing required code for conversion of CL_SALV_TABLE into CL_GUI_ALV_GRID. So that you can use OOPS ALV functionality with SALV events.

 

You may also like