在屏幕的 PBO 期间(对于选择屏幕,PBO 代码在事件块内定义AT SELECTION-SCREEN OUTPUT
),您必须调用功能模块VRM_SET_VALUES
,传递字段名称和值列表。
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE altitle1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (30) alcont4 FOR FIELD l1.
PARAMETERS: l1 AS LISTBOX VISIBLE LENGTH 20 MODIF ID aod.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.
INITIALIZATION.
alcont4 = 'Choose the country'(001).
AT SELECTION-SCREEN OUTPUT.
DATA: lt_value TYPE vrm_values,
ls_value TYPE vrm_value.
ls_value-key = 'DE'.
ls_value-text = 'Germany'.
APPEND ls_value TO lt_value.
ls_value-key = 'FR'.
ls_value-text = 'France'.
APPEND ls_value TO lt_value.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'L1'
values = lt_value
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
执行:
T005T
有关信息,您可以通过将条目传输到中间内部表来从国家/地区的数据库表中获得相同的结果:
DATA: lt_t005t TYPE TABLE OF t005t,
ls_t005t TYPE t005t.
SELECT * FROM t005t
INTO TABLE lt_t005t
WHERE spras = 'E' " English names of countries
AND land1 IN ('FR','DE').
LOOP AT lt_t005t INTO ls_t005t.
ls_value-key = ls_t005t-land1.
ls_value-text = ls_t005t-landx50.
APPEND ls_value TO lt_value.
ENDLOOP.
您可以在 SAP 库中找到更多信息(解释适用于所有类型的屏幕,示例仅适用于经典屏幕,但它们可能很容易适应选择屏幕):http ://help.sap.com/saphelp_470/ helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/frameset.htm