其他分享
首页 > 其他分享> > ABAP选择屏幕添加按钮

ABAP选择屏幕添加按钮

作者:互联网

在选择屏幕上声明按钮

最多可声明五个按钮

*选择屏幕按钮
SELECTION-SCREEN: FUNCTION KEY 1,
                  FUNCTION KEY 2,
                  FUNCTION KEY 3.
* 其他字段
SELECT-OPTIONS: s_werks FOR marc-werks,
                s_matnr FOR marc-matnr,
                s_fevor FOR marc-fevor,
                s_mtart FOR mara-mtart.

在 INITIALIZATION 中定义按钮的文本和图标

INITIALIZATION.
PERFORM frm_init_sel_screen.

FORM frm_init_sel_screen .
DATA: lv_functxt TYPE smp_dyntxt.
DATA: lt_exclude TYPE TABLE OF sy-ucomm.

lv_functxt-icon_id   = icon_change.
lv_functxt-icon_text = '手工维护'.
sscrfields-functxt_01 = lv_functxt.

lv_functxt-icon_id   = icon_xls.
lv_functxt-icon_text = '数据导入'.
sscrfields-functxt_02 = lv_functxt.

lv_functxt-icon_id   = icon_xxl.
lv_functxt-icon_text = '导入模板下载'.
sscrfields-functxt_03 = lv_functxt.

lt_exclude = VALUE #( ( 'ONLI' ) ).

CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
  p_status  = sy-pfkey
TABLES
  p_exclude = lt_exclude.
ENDFORM.

图标的选择可以通过事务代码icon查询

在AT SELECTION-SCREEN中定义按钮响应函数

AT SELECTION-SCREEN.
PERFORM frm_excue_button.
FORM frm_excue_button .

  CASE sscrfields-ucomm.
    WHEN 'FC01'.
        MESSAGE e053(zmm)  WITH 'FC01'.

    WHEN 'FC02'.
      MESSAGE e053(zmm)  WITH 'FC02'.
      
    WHEN 'FC03'.

    WHEN OTHERS.
  ENDCASE.
ENDFORM.

标签:FUNCTION,sscrfields,functxt,lv,ABAP,按钮,屏幕,icon
来源: https://www.cnblogs.com/fanlili/p/16549375.html