ABAP 报表工具栏被禁用

ABAP report toolbar is disabled

尽管尝试了多种解决方案,但我无法使我的 SAP 报告的工具栏(参见图片)正常工作。

我的报告代码:

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( ).

这是我目前尝试过的方法:

注意:我注意到工具栏仅在使用 ALV 表和自定义 ALV 容器时不起作用(它们都需要屏幕对象[由 CALL SCREEN 'XXXX' 指令调用。])

我是不是漏掉了什么?

在此先感谢您的帮助。

P.S.: 如果缺少某些信息请告诉我,我会尽快添加。

感谢@Mustafa Hamit。我会 post 我根据@Mustafa Hamit 的评论所做的事情。


  • 转到屏幕对象(双击 CALL SCREEN 100)。
  • 导航到选项卡 Flow Logic
  • PROCESS BEFORE OUTPUT. 之后插入 MODULE PBO_100.
  • PROCESS AFTER INPUT. 之后插入 MODULE PAI_100.
  • 双击 PBO_100 -> Create Object
  • PBO_100 屏幕上,在 MODULE pbo_100 OUTPUT.ENDMODULE 之间写入 SET PF-STATUS '{NAME OF THE STATUS}'
  • 返回并创建 PAI_100 对象(双击它)。
  • 激活一切。
  • 程序末尾的报告代码中应出现两个 INCLUDE 语句。
  • 工具栏现在应该已启用并且可以正常工作。

您必须使用如下屏幕代码

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

正在创建执行模块并将您置于 pf-status

MODULE pbo_100 OUTPUT.

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

ENDMODULE.                             " PBO_100  OUTPUT

注意:检查激活的 gui 状态“MAIN100”