Skip to Content

Events not working completely in ALV?

Hi guys

It seems in my ALV report Events are only working partially.

Not getting custom GUI Status nor Standard GUI Status, custom GUI buttons also not showing.

Only blank Top of Page area is visible.

**Same problem when not using Events internal table and passing routines to I_callback parameters.

*&      Form  DISPLAY_ALV
FORM display_alv .

*     i_callback_program                = sy-cprog
*     i_callback_pf_status_set          = 'f_pf_status'
*     i_callback_user_command           = 'f_user_cmd'
*     i_callback_top_of_page            = 'f_top_of_page'
*     i_grid_title                      = 'GRID DISPLAY'
     is_layout                         = wa_layout
     it_fieldcat                       = it_fldcat
     IT_EVENTS                         = it_event
      t_outtab                          = it_final
     PROGRAM_ERROR                     = 1
     OTHERS                            = 2
  IF sy-subrc <> 0.
* Implement suitable error handling here

ENDFORM.                    " DISPLAY_ALV

*&      Form  ALV_EVENTS
FORM alv_events.

  wa_event-name = 'TOP_OF_PAGE'.
  wa_event-form = 'f_top_of_page'.
  append wa_event to it_event.
  clear wa_event.

  wa_event-name = 'USER_COMMAND'.
  wa_event-form = 'f_user_cmd'.
  append wa_event to it_event.
  clear wa_event.

  wa_event-name = 'PF_STATUS_SET'.
  wa_event-form = 'f_pf_status'.
  append wa_event to it_event.

ENDFORM.                    " ALV_EVENTS

*&      Form  F_TOP_OF_PAGE
FORM f_top_of_page.

  DATA: it_top TYPE slis_t_listheader,
        wa_top like line of it_top.

  wa_top-typ = 'H'.
  wa_top-info = 'Material and Plant'.
  APPEND wa_top TO it_top.

      it_list_commentary       = it_top.
  ENDFORM.                    " F_TOP_OF_PAGE

*&      Form  F_PF_STATUS
FORM f_pf_status.

ENDFORM.                    " F_PF_STSTUS

*&      Form  F_USER_CMD
FORM f_user_cmd.

 data: r_ucomm like sy-ucomm,
       rs-selfiled TYPE slis_selfield.

  CASE r_ucomm.
    WHEN 'PDF'.
      PERFORM get_pdf.
    WHEN 'MAIL'.
      PERFORM send_mail.

Please help.

alv-problem.jpg (264.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 21 at 08:28 AM

    Okay. I think what you mean is that you want the ALV buttons appear between the header and the grid. That's possible with the solution 2 below, but that means these buttons won't be part of the GUI status because the GUI status buttons appear only at the top of the screen. But it's a complex solution, so I recommend to put all buttons above the header (in the "application toolbar") cf solution 1.

    Solution 1: display buttons at the top in the application toolbar, the most simple solution by far -> create a GUI status like ALV fullscreen GUI status (copy the GUI status STANDARD_FULLSCREEN of program SAPLKKBL) + add your custom buttons.

    Solution 2: display buttons between the header and the grid, you must display the grid in a so-called "container" -> use the class CL_SALV_TABLE or CL_GUI_ALV_GRID instead of function module REUSE_ALV_GRID_DISPLAY.

    Handle the header in a container above. You may display text by using the class CL_ABAP_BROWSER.

    Arrange the two containers into one via the class CL_GUI_SPLITTER_CONTAINER.

    Define a custom container element inside a dynpro screen.

    For example (in the PBO of course):

      DATA(go_custom_container) = NEW cl_gui_custom_container( 
              container_name = 'NAME_OF_YOUR_CUSTOM_CONTAINER' ).
      DATA(go_splitter) = NEW cl_gui_easy_splitter_container(
              parent      = go_custom_container
              orientation = cl_gui_easy_splitter_container=>ORIENTATION_VERTICAL ).
      " TODO: adjust height of top container (default half of screen height)
      cl_abap_browser=>show_html( html_string = `<div>Hello world</div>`
                                  check_html  = abap_false
                                  container   = go_splitter->TOP_LEFT_CONTAINER ).
              r_container  = go_splitter->BOTTOM_RIGHT_CONTAINER
              r_salv_table = go_salv
              t_table      = it_final[] ).
      " TODO: handle SALV events for buttons, define layout, etc.
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 20 at 07:50 PM

    In debug, does it stop in your subroutines?

    What about entering the subroutines names in upper case in the IT_EVENTS parameter?

    Did you activate your GUI status? (more precisely the User Interface of the program)

    Add comment
    10|10000 characters needed characters exceeded

    • Thank you.

      Debugger is going into subroutines.
      Entered sub routines in upper case in IT_EVENTS.

      Activated all objects in SE80, and activated GUI Status separately.

      But same problem, no change.

  • Apr 21 at 12:56 PM

    I used LIST Display FM with the same code now getting, ALV output first (without Application toolbar buttons & Top of Page content) and when I click Back button then getting Top of Page and GUI Status.

    Please find the images.

    alv-events.jpg (88.5 kB)
    alv-output.jpg (323.9 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • Thank you very much Rossi.

      You really took an effort to help me with my problem.

      The problem is resolved now, I've been using PERFORM statements for ALV events also, that's what causing the problem.

      Also entering "form names" in upper case in IT_EVENTS helped.

      Thank you very much, and keep up the good work helping people.