If you have a requirement to show some detailed data in an ALV Grid, there are two ways of doing it. You can create your dialog container and assign the grid to the dialog container.
SAP has made the job easier for us by giving a class
CL_RS_ALV_GRID_POPUP
, which does exactly the same. Now, all you have to do, is to create the field catalog, create the Grid object and call the method SHOW_DATA. You can even specify the coordinates as to where the grid should appear.
However, the toolbar will NOT appear for this grid but you can have the layout and can chang the way you want it.
Here is the Class
The difference is, here you will have to pass the field catalog / structure which will have the column details, while creating the GRID object as against to doing it while displaying the data in the traditional CL_GUI_ALV_GRID class.
You can also specify the starting coordinates of the grid and width and height of the grid.
And here, while displaying the data, all you have to do is to pass the table, which has the data.
So, now we don't have to bother about creating a dialog container for showing a ALV grid as popup.
Here is a sample code for the same. I am calling this in the double click event of a MAIN ALV GRID.
-CARRID.
ELSE.
EXIT.
ENDIF.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'ALV_T_T2'
CHANGING
CT_FIELDCAT = T_FIELDCAT1
.
IF SY-SUBRC <> 0.
ENDIF.
CREATE OBJECT W_POPUP_GRID
EXPORTING
I_T_FIELDCATALOG = T_FIELDCAT1
I_S_LAYOUT =
I_CAPTION =
I_REPID =
I_DYNNR =
I_LEFT = 10
I_TOP = 10
I_HEIGHT = 300
I_WIDTH = 300
.
CALL METHOD W_POPUP_GRID->SHOW_DATA
EXPORTING
I_T_DATA = T_DATA1.
.
ENDFORM. " SHOW_DETAILS
</textarea>
Well, nothing exceptional, but definitely a handy one to reduce coding.