OO ALV 訪問保護類方法 實現欄位報錯紅框定位

Lan_dev發表於2024-04-10

參考部落格

https://www.cnblogs.com/keruigen/p/15696442.html

繼承類

CLASS lcl_gui_alv_grid DEFINITION INHERITING FROM cl_gui_alv_grid.

  PUBLIC SECTION.
    METHODS:
      m_set_error_cells IMPORTING it_err TYPE lvc_t_err.
ENDCLASS.

CLASS lcl_gui_alv_grid IMPLEMENTATION.
  METHOD m_set_error_cells.

    CALL METHOD me->set_error_cells
      EXPORTING
        cell_table = it_err.
  ENDMETHOD.
ENDCLASS.

物件定義

DATA:go_9000_container TYPE REF TO cl_gui_custom_container,
     go_9000_alv_grid  TYPE REF TO lcl_gui_alv_grid.

PBO 需要放在 ALV重新整理之後 或者不重新整理

MODULE pbo_9000 OUTPUT.

  PERFORM frm_set_status_9000.
  PERFORM frm_head_scr.  "設定
  PERFORM frm_init_alv_9000.  "初始化alv容器

  DATA:gt_err TYPE lvc_t_err.
  BREAK-POINT.
  IF gt_err IS NOT INITIAL.
    gt_err = VALUE #( ( row_id = 1 col_id = 1 ) ( row_id = 1 col_id = 2 ) ( row_id = 1 col_id = 3 )
                     ).
    CALL METHOD go_9000_alv_grid->m_set_error_cells
      EXPORTING
        it_err = gt_err.
  ENDIF.
ENDMODULE.

效果 需要知道列位置

相關文章