Use CL_GUI_ALV_GRID without having to create a screen
2020-03-02
![images/thumbnail.jpg - Thumbnail](/en/2020/03/usa-cl_gui_alv_grid-sem-ter-de-criar-um-ecra/images/thumbnail_hu1ba5f0c8eeb2d9837c9470a9b1ebf29e_91985_300x0_resize_q75_box.jpg)
Nowadays I rarely use CL_GUI_ALV_GRID because SALV is so much better. But when I am asked to make an editable ALV I still use it. Until very recently, I thought that, in order to use it, I needed a screen with a container. And because I’m using ABAP OO, I’d need a function group to host it and a function module to call it. Painful.
But no. It is possible to get a default container like this:
DATA(container) =
NEW cl_gui_custom_container(
parent = cl_gui_container=>default_screen
container_name = 'CONTAINER').
DATA(grid) = NEW cl_gui_alv_grid( i_parent = container ).
Wow!
I would like to thank Pedro, who taught me this in a comment on another post.
Greetings from Abapinho