Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling ALV grid in class method

former_member125661
Contributor
0 Kudos

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 ?

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, use the CL_SALV_TABLE class instead. It is OO based, and you do not have to create a screen.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de49...

Regards,

Rich Heilman

7 REPLIES 7

former_member194669
Active Contributor
0 Kudos

Hi,

You need to call you custom screen with custom container like the following


  create object g_docking_container_1
    exporting
      repid     = g_repid
      dynnr     = '100'      "Place the custom container in 100
      extension = 1700
      side      = cl_gui_docking_container=>dock_at_left.

then

  call method alv_left->set_table_for_first_display

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, use the CL_SALV_TABLE class instead. It is OO based, and you do not have to create a screen.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de49...

Regards,

Rich Heilman

0 Kudos

Rich,

I think this class is not available in 4.7. We are on 4.7 and I cannot call a screen inside a method.

THanks,

Shareen

0 Kudos

yes, CL_SALV_TABLE is not available in that release, then you need to use the function module REUSE_ALV_GRID_DISPLAY in order to fire an ALV.

Regards,

Rich Heilman

0 Kudos

Hi Shareen,

In ECC 6.0 SALV concept comes into the picture. For your case Ver4.7 there is not SALV Concept.

Thanks,

Chidanand

0 Kudos

fyi,

It is also available in ECC 5.0 (NetWeaver 2004, Basis 6.40).

Cheers,

Jamie

Former Member
0 Kudos

how did u solve this Shareen ?