04-20-2019 7:18 PM
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 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* 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
TABLES
t_outtab = it_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
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.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_top.
ENDFORM. " F_TOP_OF_PAGE
*&---------------------------------------------------------------------*
*& Form F_PF_STATUS
*&--------------------------------------------------------------------*
FORM f_pf_status.
SET PF-STATUS 'NEWGUI'.
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.
ENDCASE.
ENDFORM.
Please help.
Thanks.
04-21-2019 9: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 ).
cl_salv_table=>factory(
EXPORTING
r_container = go_splitter->BOTTOM_RIGHT_CONTAINER
IMPORTING
r_salv_table = go_salv
CHANGING
t_table = it_final[] ).
" TODO: handle SALV events for buttons, define layout, etc.
04-20-2019 8: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)
04-21-2019 8:21 AM
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.
04-21-2019 8:20 AM
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.
04-21-2019 8:38 AM
Hello David Akuveedu,
could you please active ps status or click on status and try to edit it.
otherwise write ur code.
04-21-2019 9: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 ).
cl_salv_table=>factory(
EXPORTING
r_container = go_splitter->BOTTOM_RIGHT_CONTAINER
IMPORTING
r_salv_table = go_salv
CHANGING
t_table = it_final[] ).
" TODO: handle SALV events for buttons, define layout, etc.
04-21-2019 12:23 PM
I did copy Standard_Fullscreen from SE41 and and renamed it, added 2 custom buttons in Application Toolbar section and activated it.
Not looking get the buttons between header and the grid.
I'm writing the code entirely in Procedural ALV.
Header space is allocated to Top_of_page event, but the content is not displaying.
Thanks.
04-21-2019 12:34 PM
My bad, I didn't explain well enough (answer corrected). Solution 1 is to put the buttons above the header (in the "application toolbar"). Solution 2 is what you want but is much more complex.
04-21-2019 12:24 PM
I copied Standard_Fullscreen from SE41 and renamed it, added 2 custom buttons in Application Toolbar section and activated it.
Header space is allocated to Top_of_page event, but the content is not displaying.
Thanks.
04-21-2019 1: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.
04-21-2019 5:18 PM
I took your original code, added some minimum glue for missing parts (declarations, PERFORMs), had to add parameters to ALV event subroutines (cf SAP documentation which gives you the subroutine parameters), it's required to enter "form names" in upper case in IT_EVENTS, and I get this result for ALV list and for ALV grid:
04-21-2019 7:46 PM
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.