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.

ABAP-选选择屏幕(SELECTION-SCREEN)上添加按钮并响应_第1张图片

 

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/

 

 

你可能感兴趣的:(SCN,+,SEL_SCN,+,S_HELP)