本例使用FM:VRM_SET_VALUES来给LISTBOX赋值
REPORT ZTEST_002.
TYPE-POOLS VRM.
CONTROLS:ZPLM TYPE TABLEVIEW USING SCREEN '0100'.
***内表
DATA:BEGIN OF ITAB OCCURS 0,
DOKNR TYPE DOKNR,
DOKAR TYPE DOKAR,
END OF ITAB.
***屏幕结构
DATA:STR LIKE ITAB.
***取数
SELECT DOKNR INTO TABLE ITAB FROM DRAW UP TO 10 ROWS.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module READ_TABLE INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE READ_TABLE INPUT.
MODIFY ITAB FROM STR INDEX ZPLM-CURRENT_LINE.
ENDMODULE. " READ_TABLE INPUT
*&---------------------------------------------------------------------*
*& Module SET_LISTBOX OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE SET_LISTBOX OUTPUT.
DATA:LS_ID TYPE VRM_ID,
LS_VALUE TYPE VRM_VALUE,
LS_VALUES TYPE VRM_VALUES.
LS_ID = 'STR-DOKAR'.
REFRESH LS_VALUES.
SELECT DOKAR FROM TDWA INTO LS_VALUE-KEY.
LS_VALUE-TEXT = LS_VALUE-KEY.
APPEND LS_VALUE TO LS_VALUES.
CLEAR LS_VALUE.
ENDSELECT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = LS_ID
VALUES = LS_VALUES
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
ENDMODULE. " SET_LISTBOX OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
DATA:OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE OK_CODE.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
屏幕100的逻辑流
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE SET_LISTBOX.
LOOP AT ITAB INTO STR WITH CONTROL ZPLM.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB.
MODULE READ_TABLE.
ENDLOOP.
MODULE USER_COMMAND_0100.
阅读(818) | 评论(0) | 转发(0) |