FORM frm_user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
"应用方法将修改ALV的数据保存到内表中
DATA lr_grid TYPE REF TO cl_gui_alv_grid.
DATA l_tabix LIKE sy-tabix. "系统参数 行号
"此处代码将用户输入读入内表(这一步不可少)
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' "自动刷新数据
IMPORTING
e_grid = lr_grid.
CALL METHOD lr_grid->check_changed_data.
rs_selfield-refresh = 'X'. "此处代码阻止'REUSE_ALV_GRID_DISPLAY创建新的屏幕,造成屏幕多层
rs_selfield-row_stable = 'X'. "保证行、列位置在自动刷新时不变
rs_selfield-col_stable = 'X'.
CASE r_ucomm.
WHEN 'ALL'.
LOOP AT gt_data INTO gw_data.
gw_data-sel = 'X'.
MODIFY gt_data FROM gw_data.
ENDLOOP.
WHEN 'SAL'.
LOOP AT gt_data INTO gw_data.
gw_data-sel = ''.
MODIFY gt_data FROM gw_data.
ENDLOOP.
ENDCASE.
ENDFORM.
完整代码
TYPES:BEGIN OF ty_data,
sel TYPE char1,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
END OF ty_data.
DATA gt_data TYPE TABLE OF ty_data.
DATA gw_data TYPE ty_data.
** Layout 变量定义
DATA gs_layout TYPE lvc_s_layo.
** Fieldcat 变量定义
DATA:gt_fieldcat TYPE lvc_t_fcat,
gs_fieldcat LIKE LINE OF gt_fieldcat.
** FieldCat的宏
DATA gv_pos TYPE i.
DEFINE %%add_fieldcat.
gv_pos = gv_pos + 1.
gs_fieldcat-col_pos = gv_pos.
gs_fieldcat-fieldname = &1.
gs_fieldcat-scrtext_m = &2.
CASE &1.
WHEN 'SEL'.
gs_fieldcat-checkbox = 'X'. "当做选择框显示
gs_fieldcat-edit = 'X'. "该字段可以编辑
ENDCASE.
APPEND gs_fieldcat TO gt_fieldcat.CLEAR gs_fieldcat.
END-OF-DEFINITION.
START-OF-SELECTION.
SELECT ekpo~ebeln "采购订单抬头数据- 采购单号
ekpo~ebelp "采购订单明细数据- 采购订单行号
INTO CORRESPONDING FIELDS OF TABLE gt_data
FROM ekpo
UP TO 20 ROWS.
** Fieldcat字段映射处理
%%add_fieldcat:'EBELN' '采购单号', "( 前面字段值不可变 后面字段描述可变 每一行都是)
'EBELP' '采购订单行号',
'SEL' '选择'.
** Layout布局处理
gs_layout-cwidth_opt = 'X'. "自动优化列宽 (可以使用**在一行代码面前注释掉 看看ALV会有什么效果)
gs_layout-zebra = 'X'. "斑马纹输出
** 调用FunctionALV需要传入的参数:展示数据,FieldCat,Layout,Status
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'FRM_SET_STATUS'
i_callback_user_command = 'FRM_USER_COMMAND'
is_layout_lvc = gs_layout
it_fieldcat_lvc = gt_fieldcat
TABLES
t_outtab = gt_data[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM frm_set_status USING p_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD'.
ENDFORM.
FORM frm_user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
"应用方法将修改ALV的数据保存到内表中
DATA lr_grid TYPE REF TO cl_gui_alv_grid.
DATA l_tabix LIKE sy-tabix. "系统参数 行号
"此处代码将用户输入读入内表(这一步不可少)
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' "自动刷新数据
IMPORTING
e_grid = lr_grid.
CALL METHOD lr_grid->check_changed_data.
rs_selfield-refresh = 'X'. "此处代码阻止'REUSE_ALV_GRID_DISPLAY创建新的屏幕,造成屏幕多层
rs_selfield-row_stable = 'X'. "保证行、列位置在自动刷新时不变
rs_selfield-col_stable = 'X'.
CASE r_ucomm.
WHEN 'ALL'.
LOOP AT gt_data INTO gw_data.
gw_data-sel = 'X'.
MODIFY gt_data FROM gw_data.
ENDLOOP.
WHEN 'SAL'.
LOOP AT gt_data INTO gw_data.
gw_data-sel = ''.
MODIFY gt_data FROM gw_data.
ENDLOOP.
ENDCASE.
ENDFORM.
在Simulink中使用ROS2控制无人机进入Offboard模式起飞悬停并在Gazebo中可视化 系统架构Matlab官方例程Control a Simulated UAV Using ROS 2 and PX4 Bridge运行所需的环境配置PX4&Simulink&Gazebo联合仿真实现方法建立Simulink模型并完成基本配置整体框架各子系统实现…