选择屏幕搜索帮助

在选择屏幕S_BWART移动类型里限定范围:
 
REPORT z_test.

TABLES:t156t.

DATA:  ltab_fields LIKE help_value OCCURS 0 WITH HEADER LINE,
      BEGIN OF ltab_values OCCURS 0,
         feld(40TYPE c,
      END OF ltab_values.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
        s_bwart FOR t156t-bwart OBLIGATORY DEFAULT '301'.         "移动类型
SELECTION-SCREEN END OF BLOCK blk1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bwart-low.
  PERFORM get_bwart USING s_bwart-low text-002.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bwart-high.
  PERFORM get_bwart USING s_bwart-high text-003.

*初始化选择屏幕
INITIALIZATION.

  ltab_fields-tabname    = 'T156T'.
  ltab_fields-fieldname  = 'BWART'.
  ltab_fields-selectflag = 'X'.
  APPEND ltab_fields.
  ltab_fields-tabname    = 'T156T'.
  ltab_fields-fieldname  = 'BTEXT'.
  ltab_fields-selectflag = space.
  APPEND ltab_fields.

*-- Fill values
  SELECT * FROM T156T
    WHERE SPRAS = 1  AND SOBKZ = '' AND KZBEW = '' AND KZZUG = '' AND BWART in ('301','302','303','304','305','306','311','312','313','314','315','316') .
    ltab_values-feld = T156T-BWART.
    APPEND ltab_values.
    ltab_values-feld = T156T-BTEXT.
    APPEND ltab_values.
  ENDSELECT.

START-OF-SELECTION.

END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Form  GET_BWART
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_P_BWART  text
*      -->P_TEXT_003  text
*----------------------------------------------------------------------*
FORM get_bwart  USING    p_bwart
                         p_text_003.
  CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
    EXPORTING
      fieldname                 = 'BWART'
      tabname                   = 'T156T'
      title_in_values_list      = 'Select a value'
    IMPORTING
      select_value              = p_bwart
    TABLES
      fields                    = ltab_fields
      valuetab                  = ltab_values
    EXCEPTIONS
      field_not_in_ddic         = 01
      more_then_one_selectfield = 02
      no_selectfield            = 03.
ENDFORM.                    " GET_BWART

------------------------------------------------------------------

少量固定值的下拉菜单:
  PARAMETERS: p_sobkz TYPE zyn AS LISTBOX VISIBLE LENGTH 3,
创建域ZYN,value range 中添加下拉菜单需要显示的值。
posted @ 2009-09-18 13:39  elegant  阅读(588)  评论(0编辑  收藏  举报