下面介绍一下如何在选择画面中创建下拉列表字段(drop down list box),语法使用到parameter中的as list box,如下:
下拉列表创建完毕后,使用函数VRM_SET_VALUES填入下拉列表值。
例子代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
REPORT ztest_dropdown_list. PARAMETERS:p_prtmv TYPE char25 AS LISTBOX VISIBLE LENGTH 25. INITIALIZATION. PERFORM frm_init. *&---------------------------------------------------------------------* *& Form FRM_INIT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM frm_init . DATA: l_field TYPE vrm_id, lit_listbox TYPE vrm_values, lwa_listbox LIKE LINE OF lit_listbox. * Do not print lwa_listbox-key = 'A'. lwa_listbox-text = 'Do not print'. APPEND lwa_listbox TO lit_listbox. * Print lwa_listbox-key = 'B'. lwa_listbox-text = 'Print'. APPEND lwa_listbox TO lit_listbox. * Print and move stock lwa_listbox-key = 'C'. lwa_listbox-text = 'Print and move stock'. APPEND lwa_listbox TO lit_listbox. l_field = 'P_PRTMV'. CALL FUNCTION 'VRM_SET_VALUES' EXPORTING id = l_field values = lit_listbox. ENDFORM. |
运行如下:
以上。
发表评论