簡體   English   中英

如何 select ALV OO 中的所有行?

[英]How to select all rows in ALV OO?

我已經使用標准 PBO/PAI 創建了一個帶有CL_GUI_ALV_GRID的 ALV,但是當我使用該方法時,我通過這種方式修改布局以包括每一行的復選框:

g_layout-zebra        = 'X'.
g_layout-cwidth_opt   = 'X'.
g_layout-cwidth_opt   = 'X'.
g_layout-sel_mode     = 'D'.
gv_variant-report     = sy-repid.
gv_variant-username   = sy-uname.

在此處輸入圖像描述

它默認顯示為未選中,我怎樣才能 select 所有行? 是否有可能 select 超過一行單擊復選框?

手動方式到select所有行

  1. 單擊 header 行中的第一個按鈕。 這將 select 所有行。
  2. Select 帶有按鈕的第一行,滾動到最后並Shift+Click最后一行的 select 按鈕

通過ABAP

使用set_selected_rows方法。 喜歡

lo_alv->set_selected_rows(
  it_row_no = VALUE #( FOR i = 1 THEN i + 1 WHILE i <= lines( lt_sflight ) ( row_id = i ) )
).

(假設顯示的表是lt_sflight

可以在此處找到其他文檔。

您可以像這樣使用set_selected_rows方法。

  data: lr_selections type ref to cl_salv_selections,
        lt_rows       type salv_t_row,
        lv_count      type i.

  describe table gt_table lines lv_count.
  do lv_count times.
    append sy-index to lt_rows.
  enddo.

  lr_selections = gr_alv->get_selections( ).
  lr_selections->set_selected_rows( lt_rows ).

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM