此博客为原创博客,都是个人工作经历所得,转载请注明出处

ABAP DEMO 下拉框

效果展示:

 

 

 

*&---------------------------------------------------------------------*
*& Report YCX_020
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ycx_020.
TABLES: mcha.

DATA: ls_id   TYPE vrm_id,
      lt_list TYPE vrm_value OCCURS 0,
      ls_list LIKE LINE OF lt_list.
DATA: ps_t(10) TYPE c.

DATA: BEGIN OF str_charg,
        matnr LIKE mcha-matnr,
        werks LIKE mcha-werks,
        charg LIKE mcha-charg,
      END OF str_charg.
DATA: lt_charg LIKE str_charg OCCURS 0,
      ls_charg LIKE str_charg.

PARAMETERS:p_matnr LIKE mcha-matnr DEFAULT '000000000000000098',
           p_werks LIKE mcha-werks DEFAULT '1701'.
PARAMETERS p_charg AS LISTBOX VISIBLE LENGTH 10.

SELECT-OPTIONS: s_charg FOR mcha-charg.



AT SELECTION-SCREEN OUTPUT.
  ls_id = 'P_CHARG'.


  REFRESH lt_list.
  LOOP AT lt_charg INTO ls_charg.
    ls_list-key  = ls_charg-charg.
    ls_list-text = 'Line 1'.
    APPEND ls_list TO lt_list.
  ENDLOOP.

  ls_list-key  = '10000000001'.
  ls_list-text = 'Line 1'.
  APPEND ls_list TO lt_list.
  CLEAR: ls_list.
  ls_list-key  = '10000000002'.
  ls_list-text = 'Line 2'.
  APPEND ls_list TO lt_list.
  CLEAR: ls_list.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = ls_id
      values = lt_list.

 

posted @ 2019-12-03 23:04  Rainystuday  阅读(360)  评论(0编辑  收藏  举报