ALV Checkbox 单行灰显
来源:互联网 发布:冰川网络最新国战手游 编辑:程序博客网 时间:2024/04/28 05:12
用 Function Module REUSE_ALV_GRID_DISPLAY 处理 ALV Checkbox 时,只能整列灰显Checkbox。
而用 Function Module REUSE_ALV_GRID_DISPLAY_LVC 以及 OO 的方法才能实现特定行的灰显Checkbox。
OO 方法实现可参考程序: BCALV_EDIT_05。
用 Function Module REUSE_ALV_GRID_DISPLAY_LVC 的示例如下:
FORMfrm_output_data .
DATA: lv_repid LIKE sy-repid.
DATA: lt_fieldcat TYPE lvc_t_fcat.
DATA: lv_fieldcat TYPE lvc_s_fcat.
DATA: lv_layout TYPE lvc_s_layo.
DATA: lt_events TYPE slis_t_event.
DATA: wa_grid_set TYPE lvc_s_glay.
DEFINE p1f.
if lt_fieldcat[] is initial.
lv_fieldcat-col_pos = 1.
else.
add 1 to lv_fieldcat-col_pos.
endif.
lv_fieldcat-fieldname = &1.
lv_fieldcat-tabname = 'IT_OUT'.
lv_fieldcat-scrtext_l = &2.
lv_fieldcat-outputlen = &3 .
if lv_fieldcat-fieldname = 'BOX'.
lv_fieldcat-edit = 'X'.
lv_fieldcat-checkbox = 'X'.
else.
clear lv_fieldcat-checkbox.
clear lv_fieldcat-edit.
endif.
lv_fieldcat-fix_column = ''.
append lv_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
"mark items that already exist in the table as pink,
"and grey out the checkbox of items that already exist in the table or quantity equal zero.
PERFORM display_color.
lv_repid = sy-repid.
lv_layout-info_fname = 'COLOR'. " identify the field of color setting
lv_layout-stylefname = 'IT_STYLE'. " identify the sub internal table of style setting.
REFRESH lt_fieldcat.
*Populatestructure of ALV field category
p1f 'BOX' '' 2.
p1f 'MATNR' 'Material No.' 18.
p1f 'MAKTX' 'Material Description' 40.
p1f 'WERKS' 'Plant' 4.
p1f 'LGORT' 'Storage Location' 4.
p1f 'SERNR' 'Serial No.' 18.
p1f 'SOBKZ' 'Special Stock' 1.
p1f
而用 Function Module REUSE_ALV_GRID_DISPLAY_LVC 以及 OO 的方法才能实现特定行的灰显Checkbox。
OO 方法实现可参考程序: BCALV_EDIT_05。
用 Function Module REUSE_ALV_GRID_DISPLAY_LVC 的示例如下:
FORM
*Populate