2019-12-26 查询PIR - 1 选择条件

选择条件:

image.png

选择界面特别点:

1:当点击“Show Expired PIR” 时,显示并可输入 VALID FROM/TO 区间.

CHECKBOX(复选框)要向实现按钮功能,在定义的时候必须每个按钮都加上USER-COMMAND XX. 否则不起作用. 如果复选框与单选按钮没有设置Function Code,则它们就会像普通的输入框一样,即使状态发生了改变,也不会触发PAI事件. 对话屏幕中的按钮、复选框、单选按钮、下拉框的Function Code都是通过屏幕元素 attributes来设置的;选择屏幕中的FunCode则通过USER-COMMAND选项来设置

PARAMETERS: C_DUE AS CHECKBOX USER-COMMAND CDUE.
PARAMETERS: C_DEL AS CHECKBOX.
PARAMETERS :C_CUR AS CHECKBOX USER-COMMAND CCUR.
PARAMETERS :C_HIS AS CHECKBOX USER-COMMAND CHIS.

如下在一行上显示VALID FROM/TO 区间,同时每一个显示的元素都MODIF ID DUE

 SELECTION-SCREEN BEGIN OF LINE.    
    SELECTION-SCREEN:  POSITION 1,
                      COMMENT 1(10) TEXT-003 MODIF ID DUE.  " Valid From
    SELECTION-SCREEN:  POSITION 33.
    PARAMETERS: P_DATAB TYPE A017-DATAB MODIF ID DUE.
    SELECTION-SCREEN:  POSITION 50,
                      COMMENT 50(8) TEXT-004 MODIF ID DUE.    " Valid To
    SELECTION-SCREEN:  POSITION 58.
    PARAMETERS: P_DATBI TYPE A017-DATBI MODIF ID DUE.
SELECTION-SCREEN END OF LINE.

如下在一行上显示CNY,并设置MODIF ID CUR

" only display currency = CNY if show lowest PIR
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN:  POSITION 1,
                    COMMENT 1(15) TEXT-005 MODIF ID CUR.
    SELECTION-SCREEN:  POSITION 33.
    PARAMETERS : P_CUR TYPE  EINE-WAERS DEFAULT 'CNY' MODIF ID CUR.
    SELECTION-SCREEN END OF LINE.

如图:


image.png

然后在PBO部分对SCREEN进行检查GROUP1:

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN .
    CASE screen-group1 .
      WHEN 'DUE'.
        IF  c_due  = 'X'.              
          screen-active = 1 .
        ELSE.
          screen-active = 0 .
        ENDIF.
      WHEN 'CUR'.
        IF c_cur = 'X'.
          screen-active = 1 .
        ELSE.
          screen-active = 0 .
        ENDIF.
      WHEN  OTHERS.
    ENDCASE.
    MODIFY SCREEN .
  ENDLOOP.

2: 在屏幕上可设置ALV 显示变式并按F4可选择变式

SELECTION-SCREEN BEGIN OF BLOCK bk3 WITH FRAME TITLE text-006.
PARAMETERS : p_layout  TYPE disvariant-variant.
SELECTION-SCREEN END OF BLOCK bk3.

在这个AT SELECTION-SCREEN事件里响应的是屏幕上选择条件中的事件,例如CHECKBOX的选择与否,RADIOBUTTON的选择,LISTBOX的选择等等。
所以分为以下几个方面:

  1. ... ON field :在PARAMETER变化时触发的事件,对于选择屏幕某字段输入的PAI事件,当该字段的值被传递给程序时被触发,可以应用于改字段本身的正确性检查,如可系统提示错误,则可以在该字段中重新输入,此时其他元素呈灰色,不接受输入
  2. ... ON END OF sel :SELECT-OPTION触发的事件,用于整个选择表输入结束后各行的检查
  3. ... ON VALUE-REQUEST FOR psel_low_high :当光标位于某屏幕字段时,选择的帮助(F4)
  4. ... ON HELP-REQUEST FOR psel_low_high :当光标位于某屏幕字段时,选择的帮助(F1)
  5. ... ON RADIOBUTTON GROUP radi :单选按钮事件,必须进行整体输入检查
  6. ... ON BLOCK block :框架的触发事件
  7. ... OUTPUT :响应屏幕上的事件,修改选择屏幕的唯一方法
TOP-OF-PAGE .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
  PERFORM f4_for_variant.

AT SELECTION-SCREEN.
  PERFORM pai_of_selection_screen." CHANGING g_variant type disvariant.

两个子程序分别为:

FORM f4_for_variant.
  DATA:
    ls_variant TYPE disvariant,
    l_exit     TYPE char1.

  ls_variant-report = sy-repid.
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = ls_variant
      i_save     = 'A'
    IMPORTING
      e_exit     = l_exit
      es_variant = ls_variant
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    IF l_exit EQ space.
      p_layout = ls_variant-variant.
    ENDIF.
  ENDIF.
ENDFORM.

FORM pai_of_selection_screen." CHANGING g_variant.

  IF NOT p_layout IS INITIAL.
    g_variant-report = sy-repid.
    MOVE g_variant TO gx_variant.
    MOVE p_layout TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        i_save     = 'A'
      CHANGING
        cs_variant = gx_variant.
    g_variant = gx_variant.
  ELSE.
    CLEAR g_variant.
    g_variant-report = sy-repid.
  ENDIF.

ENDFORM.

你可能感兴趣的:(2019-12-26 查询PIR - 1 选择条件)