0

I've been asked to change an ALV Grid report to ALV List Viewer. What I have found so far is that the only thing I need is to replace the REUSE_ALV_GRID_DISPLAY function for REUSE_ALV_LIST_DISPLAY (please correct me if I am wrong).

However, the report I need to change is using the cl_gui_alv_grid class which does not use the functions above.

What can I do to change the report using cl_gui_alv_grid? Or there is no way and I have to rewrite the code and use REUSE_ALV_LIST_DISPLAY?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Rafael
  • 555
  • 6
  • 19
  • Hmmm. What is the detsailed requirement? Usually one would not return to those function modules, if already ported/coded in OOP. But You can easily switch the output option from the sap-menu-bar. And, regarding changes to the current code, You can replace the call to cl_gui_alv_grid->set_table_for_first_display with the proper methods of cl_gui_alv_grid factory. But this will allow display only, and some minor selection and functions, if a PF_STATUS is also set properly. – icbytes May 08 '17 at 15:03
  • Possible duplicate of [Is there a setting that would let me display ALV Grid always as ALV List?](http://stackoverflow.com/questions/17537900/is-there-a-setting-that-would-let-me-display-alv-grid-always-as-alv-list) – Suncatcher May 08 '17 at 17:40

2 Answers2

1

It is impossible with cl_gui_alv_grid. You should use cl_salv_table with list-display parameter to accomplish this:

    cl_salv_table=>factory(
      EXPORTING 
        list_display = abap_true
      IMPORTING
        r_salv_table = o_alv
      CHANGING
        t_table      = lt_table ).
Suncatcher
  • 10,355
  • 10
  • 52
  • 90
0

You can invoke the 'list output'-function in the toolbar of cl_gui_alv_grid by calling set_function_code as shown below.

DATA ucomm_list_output TYPE syucomm VALUE '&RNT_PREV'.
DATA alv TYPE REF TO cl_gui_alv_grid.

...

alv->set_function_code(
  CHANGING
    c_ucomm = ucomm_list_output
).
Timo
  • 1