REPORT ztest_oo_alv.
*----------------------------------------------------------------------*
* CLASS lcl_report DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_report DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE erdat,
auart TYPE auart,
kunnr TYPE kunnr,
END OF ty_vbak.
DATA: t_vbak TYPE STANDARD TABLE OF ty_vbak.
DATA: o_alv TYPE REF TO cl_salv_table.
METHODS:
get_data,
generate_output.
ENDCLASS. "lcl_report DEFINITION
START-OF-SELECTION.
DATA: lo_report TYPE REF TO lcl_report.
CREATE OBJECT lo_report.
lo_report->get_data( ).
lo_report->generate_output( ).
*----------------------------------------------------------------------*
* CLASS lcl_report IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS lcl_report IMPLEMENTATION.
METHOD get_data.
SELECT vbeln erdat auart kunnr
INTO TABLE t_vbak FROM vbak UP TO 20 ROWS.
ENDMETHOD. "get_data
METHOD generate_output.
DATA: lx_msg TYPE REF TO cx_salv_msg.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = o_alv
CHANGING
t_table = t_vbak ).
CATCH cx_salv_msg INTO lx_msg.
ENDTRY.
o_alv->display( ).
ENDMETHOD. "generate_output
ENDCLASS. "lcl_report IMPLEMENTATION
阅读(1346) | 评论(0) | 转发(0) |