Skip to Content
0
Oct 29, 2008 at 04:07 PM

Calling ALV grid in class method

1219 Views

Is it possible to call a ALV grid display in a class~method.

I thought, I would call a screen and make a ALV grid display using the control frame work,it is no possible to call screen inside a method.

Then i tried to avoid calling the screen..

data: dockingleft type ref to cl_gui_docking_container,
        alv_left    type ref to cl_gui_alv_grid,
        repid type syrepid.

  repid = sy-repid.


  check dockingleft is initial.

  create object dockingleft
              exporting repid     = repid
                        dynnr     = sy-dynnr
                        side      = dockingleft->dock_at_left
                        extension = 1700.

  create object alv_left
                exporting i_parent = dockingleft .

  call method alv_left->set_table_for_first_display
      exporting
           i_structure_name       = 'SMESG'
      changing
           it_outtab       = TSMESG[]
  EXCEPTIONS
      INVALID_PARAMETER_COMBINATION = 1
      PROGRAM_ERROR                 = 2
      TOO_MANY_LINES                = 3
      others                        = 4.

This doesn't seem to invoke the ALV grid. Any suggestions ?