ABAP-选选择屏幕(SELECTION-SCREEN)上添加按钮并响应

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-t02.
SELECTION-SCREEN BEGIN OF LINE.
"全选
SELECTION-SCREEN PUSHBUTTON 5(15) but1 USER-COMMAND bt1.
"全选全选
SELECTION-SCREEN PUSHBUTTON 25(15) but2 USER-COMMAND bt2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.

INITIALIZATION.
  "设置图标和按钮描述
  PERFORM frm_set_button.

AT SELECTION-SCREEN.
  "屏幕事件响应
  PERFORM frm_ucomm.
FORM frm_set_button .

  CALL FUNCTION 'ICON_CREATE'
    EXPORTING
      name                  = icon_select_all
      text                  = '全选'
      info                  = '全选'
    IMPORTING
      result                = but1
    EXCEPTIONS
      icon_not_found        = 1
      outputfield_too_short = 2
      OTHERS                = 3.

  CALL FUNCTION 'ICON_CREATE'
    EXPORTING
      name                  = icon_deselect_all
      text                  = '取消全选'
      info                  = '取消全选'
    IMPORTING
      result                = but2
    EXCEPTIONS
      icon_not_found        = 1
      outputfield_too_short = 2
      OTHERS                = 3.

ENDFORM.
FORM frm_ucomm .

  CASE sscrfields-ucomm.
    WHEN 'BT1'.
      PERFORM frm_set_checkbox USING 'SEL'.
    WHEN 'BT2'.
      PERFORM frm_set_checkbox USING 'DELSEL'.
    WHEN OTHERS.
  ENDCASE.

ENDFORM.

 

SELECTION-SCREEN XXX.
SELECTION-SCREEN BEGIN OF BLOCK  XXX WITH FRAME TITLE t1. "选择屏幕块
 

PARAMETERS: p_carrid TYPE s_carr_id,
            p_cityfr TYPE s_from_cit.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
 SELECTION-SCREEN PUSHBUTTON 7(20) but1 USER-COMMAND bt1. " BT1作为按钮驱动事件码(如下按钮操作响应代码所示)
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
t1 = '输入栏名称'.
"but1 = '按键'.
  CALL FUNCTION 'ICON_CREATE' " 给按钮添加图标和文本
    EXPORTING
      name   = ICON_SEARCH   " 按钮的图片的名字
      text   = '功能名称'                   "按钮的文本
      info   = '功能'
    IMPORTING
      RESULT = but1
    EXCEPTIONS
      OTHERS = 0.

 

*在单击时驱动
AT SELECTION-SCREEN.
      case sscrfields-ucomm.
        when 'BT1'.
           MESSAGE  '您单击了自定义按钮'  TYPE 'S'.
          ENDCASE.

 

转载自:http://blog.sina.com.cn/s/blog_6ffd503d01011ffw.html

http://wfly2004.blog.163.com/blog/static/117642720116591650812/

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值