I'm having trouble making the Toolbar(see image) of my SAP Report working despite having tried multiple solutions.
My report's code:
CLASS cl_orders_alv DEFINITION.
PUBLIC SECTION.
METHODS:
on_init, on_display.
PRIVATE SECTION.
METHODS:
on_data_fetch.
DATA: ct_orders TYPE TABLE OF zordhead_str, " header itab
ct_orders_pos TYPE TABLE OF zordpos_str, " pos itab
co_orders_alvgrid TYPE REF TO cl_gui_alv_grid, " ALV Table
co_ordpos_alvgrid TYPE REF TO cl_gui_alv_grid, " ALV Table
co_orders_alvccntr TYPE REF TO cl_gui_custom_container, " Orders Head
co_ordpos_alvccntr TYPE REF TO cl_gui_custom_container, " Orders Position
cs_orders TYPE zordhead_str, " header structure
cs_orders_pos TYPE zordpos_str,
cs_orders_fieldcat TYPE slis_fieldcat_alv, " ALV Structure
ct_orders_fieldcat TYPE lvc_t_fcat, " ALV Table
cs_ordpos_fieldcat TYPE slis_fieldcat_alv,
ct_ordpos_fieldcat TYPE lvc_t_fcat.
ENDCLASS. "cl_orders_alv
CLASS cl_orders_alv IMPLEMENTATION.
METHOD on_init.
CLEAR ct_orders.
CLEAR ct_orders_pos.
CLEAR cs_orders.
CLEAR cs_orders_pos.
CREATE OBJECT co_orders_alvccntr
EXPORTING
container_name = 'ALV_CCONTAINER0'.
CREATE OBJECT co_ordpos_alvccntr
EXPORTING
container_name = 'ALV_CCONTAINER1'.
CREATE OBJECT co_orders_alvgrid
EXPORTING
i_parent = co_orders_alvccntr.
CREATE OBJECT co_ordpos_alvgrid
EXPORTING
i_parent = co_ordpos_alvccntr.
on_data_fetch( ).
ENDMETHOD. "on_init
METHOD on_display.
CALL METHOD co_orders_alvgrid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZORDHEAD_STR'
CHANGING
it_outtab = ct_orders.
CALL METHOD co_ordpos_alvgrid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZORDPOS_STR'
CHANGING
it_outtab = ct_orders_pos.
CALL SCREEN '0100'.
ENDMETHOD. "on_display
METHOD on_data_fetch.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZORDHEAD_STR'
CHANGING
ct_fieldcat = ct_orders_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZORDPOS_STR'
CHANGING
ct_fieldcat = ct_ordpos_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDMETHOD. "on_data_fetch
ENDCLASS. "CL_ORDERS_ALV IMPLEMENTATION
START-OF-SELECTION.
SET PF-STATUS 'STANDARD_FULLSCREEN'.
DATA: go_alv_gui TYPE REF TO cl_orders_alv.
CREATE OBJECT go_alv_gui.
go_alv_gui->on_init( ).
go_alv_gui->on_display( ).
This is what I have tried so far:
Copied an existing Status into my Program/Report:
- Go to Transaction
SE41
User Interface
=>Copy
=>Status...
- From:
Program
=SAPLSLVC_FULLSCREEN
;Status
=STANDARD_FULLSCREEN
- To:
Program
=ZESXDV
;Status
=STANDARD_FULLSCREEN
- Hit Ok.
- Go to Transaction
SE80
and open up your Report/Program - The
GUI Status
folder is created, inside of which there's the new copied status.
- Go to Transaction
Added the following instruction in the report's code(after
START-OF-SELECTION
):SET PF-STATUS 'STANDARD_FULLSCREEN'.
Note: I noticed that the Toolbar doesn't work only when working with ALV tables and custom ALV Containers(which both needs a Screen Object[which is called by the CALL SCREEN 'XXXX'
instruction.])
Am I missing something?
Thanks in advance for your help.
P.S.: If some info are missing let me know and I'll add them as soon as possible.
You must use screen code as below
creating perform module and put your into pf-status
Note: check activeted gui status "MAIN100"