Chinaunix首页 | 论坛 | 博客
  • 博客访问: 197033
  • 博文数量: 98
  • 博客积分: 1435
  • 博客等级: 上尉
  • 技术积分: 1955
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-04 15:01
文章分类

全部博文(98)

文章存档

2012年(1)

2011年(1)

2009年(95)

2008年(1)

我的朋友

分类: IT职场

2009-03-12 16:56:16

<一>
 
本例使用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.
 
 
 
<二>
 
CONTROL:ZPLM
屏幕结构:STR    
LISTBOX:STR-DOKAR
内表数据:ITAB
利用PROCESS ON VALUE-REQUEST来给LISTBOX赋值
 
REPORT ZTEST.
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:BEGIN OF WA,
         DOKAR  TYPE DOKAR,
     END OF WA,
   ITAB1 LIKE STANDARD TABLE OF WA.
***屏幕结构
DATA:STR LIKE ITAB.
***取数
SELECT DOKNR INTO TABLE ITAB FROM DRAW UP TO 10 ROWS.
SELECT DOKAR INTO TABLE ITAB1 FROM TDWA.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MAIN'.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  READ_TABLE  INPUT
*&---------------------------------------------------------------------*
MODULE READ_TABLE INPUT.
  MODIFY ITAB FROM STR INDEX ZPLM-CURRENT_LINE.
ENDMODULE.                 " READ_TABLE  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
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
*---------------------------------------------------------------------*
*  MODULE SET_LISTBOX INPUT
*---------------------------------------------------------------------*
MODULE SET_LISTBOX INPUT.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD        = 'DOKAR'
      VALUE_ORG       = 'S'
    TABLES
      VALUE_TAB       = ITAB1
    EXCEPTIONS
      PARAMETER_ERROR = 1
      NO_VALUES_FOUND = 2
      OTHERS          = 3.
ENDMODULE.                    "SET_LISTBOX INPUT
 
100屏幕的逻辑流
PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.
  LOOP AT ITAB INTO STR WITH CONTROL ZPLM.
  ENDLOOP.
PROCESS AFTER INPUT.
  LOOP AT ITAB.
    MODULE READ_TABLE.
  ENDLOOP.
  MODULE USER_COMMAND_0100.
PROCESS ON VALUE-REQUEST.
  FIELD STR-DOKAR MODULE SET_LISTBOX.
阅读(3435) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~