Chinaunix首页 | 论坛 | 博客
  • 博客访问: 232999
  • 博文数量: 17
  • 博客积分: 50
  • 博客等级: 民兵
  • 技术积分: 329
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-31 20:05
个人简介

linux kernal research

文章分类

全部博文(17)

文章存档

2023年(7)

2013年(10)

分类: 项目管理

2013-10-07 21:43:21

*&---------------------------------------------------------------------*
*& Report  ZBCRP5_OOALV_TONY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZBCRP5_OOALV_TONY.

DATA:BEGIN OF IT_VBAP OCCURS 0,
        VBELN TYPE VBAP-VBELN,
        POSNR TYPE VBAP-POSNR,
        MATNR TYPE VBAP-MATNR,
        KWMENG TYPE VBAP-KWMENG,
        MEINS TYPE VBAP-MEINS,
     END OF IT_VBAP.
DATA:WA_VBAP LIKE LINE OF IT_VBAP.
DATA:G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA:GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA:IT_FIELDCAT TYPE LVC_T_FCAT.
DATA:WA_FIELDCAT TYPE LVC_S_FCAT.
DATA:WA_LAYOUT TYPE LVC_S_LAYO.
DATA:OKCODE2000 TYPE SY-UCOMM.
DATA:OKCODE3000 TYPE SY-UCOMM.

CLASS EVENT_RECEIVER DEFINITION.
  PUBLIC SECTION.
  CLASS-METHODS:HANDLER_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN ES_ROW_NO.
ENDCLASS.
CLASS EVENT_RECEIVER IMPLEMENTATION.
  METHOD HANDLER_DOUBLE_CLICK.
*    BREAK-POINT.
*    MESSAGE I036(Z_DC) WITH ES_ROW_NO-ROW_ID E_COLUMN-FIELDNAME.
*     CALL TRANSACTION 'MM03'.
    READ TABLE IT_VBAP INTO WA_VBAP INDEX ES_ROW_NO-ROW_ID.
    CALL SCREEN 3000.
*    MESSAGE ' 你双击了' TYPE 'I'.
  ENDMETHOD.

ENDCLASS.

START-OF-SELECTION.
    SELECT VBELN
           POSNR
           MATNR
           KWMENG
           MEINS
      UP TO 20 ROWS
      INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
      FROM VBAP.

call SCREEN 2000.
*&---------------------------------------------------------------------*
*&      Module  STATUS_2000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_2000 OUTPUT.
  SET PF-STATUS 'PF2000'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_2000  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  EXIT2000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE EXIT2000 INPUT.
  IF OKCODE2000 'BACK'.
    LEAVE PROGRAM.
  ENDIF.

ENDMODULE.                 " EXIT2000  INPUT
*&---------------------------------------------------------------------*
*&      Module  SHOW_ALV  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE SHOW_ALV OUTPUT.

IF G_CUSTOM_CONTAINER IS INITIAL.
WA_FIELDCAT-COL_POS 1.
WA_FIELDCAT-FIELDNAME 'VBELN'.
WA_FIELDCAT-REF_TABLE 'VBAP'.
WA_FIELDCAT-REF_FIELD 'VBELN'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.

WA_FIELDCAT-COL_POS 2.
WA_FIELDCAT-FIELDNAME 'POSNR'.
WA_FIELDCAT-REF_TABLE 'VBAP'.
WA_FIELDCAT-REF_FIELD 'POSNR'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.

WA_FIELDCAT-COL_POS 3.
WA_FIELDCAT-FIELDNAME 'MATNR'.
WA_FIELDCAT-REF_TABLE 'VBAP'.
WA_FIELDCAT-REF_FIELD 'MATNR'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.

WA_FIELDCAT-COL_POS 4.
WA_FIELDCAT-FIELDNAME 'KWMENG'.
WA_FIELDCAT-REF_TABLE 'VBAP'.
WA_FIELDCAT-REF_FIELD 'KWMENG'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.

WA_FIELDCAT-COL_POS 5.
WA_FIELDCAT-FIELDNAME 'MEINS'.
WA_FIELDCAT-REF_TABLE 'VBAP'.
WA_FIELDCAT-REF_FIELD 'MEINS'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.

WA_LAYOUT-ZEBRA 'X'.
WA_LAYOUT-CWIDTH_OPT 'X'.
*WA_LAYOUT-EDIT = 'X'.

CREATE OBJECT G_CUSTOM_CONTAINER
  EXPORTING
    CONTAINER_NAME              'CONTAINER'    .

CREATE OBJECT GRID
  EXPORTING
    I_PARENT          G_CUSTOM_CONTAINER.

CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
  EXPORTING
*    I_BUFFER_ACTIVE               =
*    I_BYPASSING_BUFFER            =
*    I_CONSISTENCY_CHECK           =
*    I_STRUCTURE_NAME              =
*    IS_VARIANT                    =
*    I_SAVE                        =
*    I_DEFAULT                     = 'X'
    IS_LAYOUT                     WA_LAYOUT
*    IS_PRINT                      =
*    IT_SPECIAL_GROUPS             =
*    IT_TOOLBAR_EXCLUDING          =
*    IT_HYPERLINK                  =
*    IT_ALV_GRAPHICS               =
*    IT_EXCEPT_QINFO               =
*    IR_SALV_ADAPTER               =
  CHANGING
    IT_OUTTAB                     IT_VBAP[]
    IT_FIELDCATALOG               IT_FIELDCAT
*    IT_SORT                       =
*    IT_FILTER                     =
  EXCEPTIONS
    INVALID_PARAMETER_COMBINATION 1
    PROGRAM_ERROR                 2
    TOO_MANY_LINES                3
    OTHERS                        4
        .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

SET HANDLER EVENT_RECEIVER=>HANDLER_DOUBLE_CLICK FOR ALL INSTANCES.

ENDIF.

ENDMODULE.                 " SHOW_ALV  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_3000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_3000 OUTPUT.
  SET PF-STATUS 'STATUS3000'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_3000  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  EXIT3000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE EXIT3000 INPUT.
 IF OKCODE3000 'BACK'.
    LEAVE TO SCREEN 0.
 ENDIF.
ENDMODULE.                 " EXIT3000  INPUT
阅读(2876) | 评论(0) | 转发(0) |
0

上一篇:SAP OO定义:例题

下一篇:SAP OOALV国庆节习题

给主人留下些什么吧!~~