ABAP 选择屏幕下拉框-listbox

主要代码:


*------------------------------------------------------------------------------*
*                             SELECTION-SCREEN                                 *
*------------------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BWART TYPE RESB-BWART AS LISTBOX VISIBLE LENGTH 20 OBLIGATORY,
            P_WERKS TYPE RESB-WERKS OBLIGATORY DEFAULT '2000'.

SELECT-OPTIONS: S_MATNR FOR RESB-MATNR,
                S_RESNUM FOR RESB-RSNUM NO-EXTENSION NO INTERVALS ,
*                S_.                    NO-EXTENSION NO INTERVALS ,  "领用单号-自建表
                S_BDTER FOR RESB-BDTER.
SELECTION-SCREEN END OF BLOCK blk1.

*------------------------------------------------------------------------------*
*                             INITIALIZATION                                 *
*------------------------------------------------------------------------------*

*------------------------------------------------------------------------------*
*                             AT SELECTION-SCREEN                              *
*------------------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BWART.
  PERFORM P_SET_SELECTION.
*------------------------------------------------------------------------------*
*                             START-OF-SELECTION                               *
*------------------------------------------------------------------------------*
START-OF-SELECTION.
  PERFORM P_GET_DATA.
  PERFORM P_DISPLAY.

下拉框填数:

*&---------------------------------------------------------------------*
*&      Form  P_SET_SELECTION
*&---------------------------------------------------------------------*
*       设置移动类型搜索帮助
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM P_SET_SELECTION .
  TYPES :BEGIN OF TY,
   COL1 TYPE CHAR3 ,
   COL2  TYPE CHAR20 ,
  END OF TY.
  DATA ITAB TYPE TABLE OF TY.
  ITAB = VALUE #(
                  ( COL1 = 'Z09' COL2 = '成本中心领用')
                  ( COL1 = 'Z11' COL2 = '线边退料')
                  ( COL1 = 'Z13' COL2 = '成品工废、料废订单消耗领用')
                  ( COL1 = 'Z15' COL2 = '成品返工领用')
                  ( COL1 = 'Z16' COL2 = '项目领用')
                  ( COL1 = 'Z18' COL2 = '废品消耗领用' )
                  ( COL1 = 'S61' COL2 = '备件消耗领用' ) ).


CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
  EXPORTING
*   DDIC_STRUCTURE         = ' '
    RETFIELD               = 'COL1'
*   PVALKEY                = ' '
   DYNPPROG               = SY-REPID
   DYNPNR                 = SY-DYNNR
   DYNPROFIELD            = 'COL1'
*   STEPL                  = 0
   WINDOW_TITLE           = 'WINDOW--TITLE'
*   VALUE                  = ''
   VALUE_ORG              = 'S'"C表示cell,S表示structure
*   MULTIPLE_CHOICE        = 'X'"多项选择,用于SELECT-OPTIONS
*   DISPLAY                = 'F'"C则只能显示,不能选择
   CALLBACK_PROGRAM       = sy-repid
*   CALLBACK_FORM          = ' '
*   MARK_TAB               =
* IMPORTING
*   USER_RESET             =
  TABLES
    VALUE_TAB              = ITAB
*   FIELD_TAB              = FIELD_TAB
*   RETURN_TAB             =
*   DYNPFLD_MAPPING        =
 EXCEPTIONS
   PARAMETER_ERROR        = 1
   NO_VALUES_FOUND        = 2
   OTHERS                 = 3
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.


效果:

ABAP 选择屏幕下拉框-listbox_第1张图片

你可能感兴趣的:(ABAP,abap下拉框,listbox)