"先做的准备:在程序中定义好一个全局变量,data: l_switch(45).建立动态按钮的时候,选动态文本,关联程序中的字段:l_switch.就可以了.
report z_barry_test no standard page heading .
type-pools: slis.
data: itab type table of zstu with header line.
data: l_switch(45).
select * into corresponding fields of table itab from zstu.
data: lt_fieldcat type slis_t_fieldcat_alv,
ls_fieldcat type slis_fieldcat_alv.
call function'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_structure_name = 'ZSTU'
i_bypassing_buffer = 'X'
i_buffer_active = ''
changing
ct_fieldcat = lt_fieldcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_pf_status_set = 'ALV_STATUS'
i_callback_user_command = 'ALV_COMMOND'
it_fieldcat = lt_fieldcat
tables
t_outtab = itab.
*&---------------------------------------------------------------------*
*& Form ALV_STATUS
*&---------------------------------------------------------------------*
form alv_status using rt_extab type slis_t_extab."
set pf-status 'M100'.
if l_switch = '申请解锁' or l_switch is initial.
l_switch = '申请加锁'.
elseif l_switch = '申请加锁' .
l_switch = '申请解锁'.
endif.
endform. "ALV_STATUS
*&---------------------------------------------------------------------*
*& Form frm_salv_commond
*&---------------------------------------------------------------------*
form alv_commond using p_ucomm like sy-ucomm rs type slis_selfield.
case p_ucomm.
endcase.
endform. "frm_salv_commond
评论