ABAP report toolbar is disabled

2.5k views Asked by At

I'm having trouble making the Toolbar(see image) of my SAP Report working despite having tried multiple solutions.

Current Toolbar

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.
  • 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.

2

There are 2 answers

0
Mustafa Hamit On BEST ANSWER

You must use screen code as below

PROCESS BEFORE OUTPUT.
  MODULE PBO_100.
*
PROCESS AFTER INPUT.
  MODULE PAI_100.

creating perform module and put your into pf-status

MODULE pbo_100 OUTPUT.

  SET PF-STATUS 'MAIN100'.
  set titlebar 'MAIN100'.

ENDMODULE.                             " PBO_100  OUTPUT

Note: check activeted gui status "MAIN100"

0
Diego On

Thanks to @Mustafa Hamit. I'll post what I've done baesd on @Mustafa Hamit's comment.


  • Go to the Screen object(Double click on CALL SCREEN 100).
  • Navigate to tab Flow Logic.
  • Insert MODULE PBO_100. right after PROCESS BEFORE OUTPUT..
  • Insert MODULE PAI_100. right after PROCESS AFTER INPUT..
  • Double click on PBO_100 -> Create Object
  • On the PBO_100 screen write SET PF-STATUS '{NAME OF THE STATUS}' between MODULE pbo_100 OUTPUT. and ENDMODULE.
  • Go back and create the PAI_100 object(double click on it).
  • Activate everything.
  • Two INCLUDE statements should appear on your report's code at the end of the program.
  • The Toolbar should now be enabled and functional.