Creating classic reports in ABAP Objects
Page 1 of 1
Creating classic reports in ABAP Objects
REPORT z_13.
*----------------------------------------------------------------------*
* CLASS c1 DEFINITION
*----------------------------------------------------------------------*
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS: get_data, append_data, display_data, refresh_data.
EVENTS: is_initial.
PRIVATE SECTION.
DATA: it_ekpo TYPE STANDARD TABLE OF ekpo.
DATA: wa_ekpo TYPE ekpo.
ENDCLASS. "c1 DEFINITION
*----------------------------------------------------------------------*
* CLASS c1 IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD: get_data.
SELECT * FROM ekpo INTO TABLE it_ekpo UP TO 10 ROWS.
ENDMETHOD. "GET_DATA
METHOD: append_data.
wa_ekpo-ebeln = '12345'.
APPEND wa_ekpo TO it_ekpo.
ENDMETHOD. "APPEND_DATA
METHOD: display_data.
IF it_ekpo IS NOT INITIAL.
LOOP AT it_ekpo INTO wa_ekpo.
WRITE: / wa_ekpo-ebeln.
ENDLOOP.
ELSE.
RAISE EVENT IS_INITIAL.
ENDIF.
ENDMETHOD. "DISPLAY_DATA
METHOD: refresh_data.
REFRESH it_ekpo.
ENDMETHOD. "REFRESH_DATA
ENDCLASS. "c1 IMPLEMENTATION
*----------------------------------------------------------------------*
* CLASS C1_HANDLER DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS c1_handler DEFINITION.
PUBLIC SECTION.
METHODS: handle_initial FOR EVENT is_initial OF c1.
ENDCLASS. "C1_HANDLER DEFINITION
*----------------------------------------------------------------------*
* CLASS C1_HANDLER IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS c1_handler IMPLEMENTATION.
METHOD: handle_initial.
WRITE: / 'EVENT ''IS_INITIAL'' IS TRIGGERED'.
ENDMETHOD. "HANDLE_INITIAL
ENDCLASS. "C1_HANDLER IMPLEMENTATION
START-OF-SELECTION.
DATA: o1 TYPE REF TO c1.
CREATE OBJECT o1.
DATA: o2 TYPE REF TO c1_handler.
CREATE OBJECT o2.
* REGISTERING EVENTS WITH CLASS
SET HANDLER o2->handle_initial FOR o1.
CALL METHOD o1->display_data.
CALL METHOD o1->get_data.
CALL METHOD o1->display_data.
CALL METHOD o1->append_data.
CALL METHOD o1->display_data.
CALL METHOD o1->refresh_data.
CALL METHOD o1->display_data.
Similar topics
» Creating multiple Objects in ABAP Objects
» Creating Interface in ABAP Objects with example
» Creating multilevel inheritance in ABAP Objects
» Assigning object reference and creating objects in ABAP
» Difference between Procedural ABAP and ABAP Objects
» Creating Interface in ABAP Objects with example
» Creating multilevel inheritance in ABAP Objects
» Assigning object reference and creating objects in ABAP
» Difference between Procedural ABAP and ABAP Objects
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Mon Aug 20, 2012 4:37 pm by Admin
» Difference between Type and Like
Thu Jun 07, 2012 2:40 pm by Admin
» How to handle table control fields in Module Pool program?
Wed May 09, 2012 2:41 am by govind
» Three tables inner join in SAP
Thu May 03, 2012 4:47 pm by Uma_ABAP
» Creating table type in ABAP
Sat Apr 28, 2012 9:03 pm by Uma_ABAP
» Creating user defined types and structures in ABAP
Sat Apr 28, 2012 8:55 pm by Uma_ABAP
» Creating Dynamic Internal Table and Dynamic Field catalog in SAP-ABAP
Fri Apr 27, 2012 11:00 am by Admin
» Copy Custom PF-Status from Standard program to Custom Program in ALV
Thu Apr 26, 2012 9:52 pm by Uma_ABAP
» Calculate/find number of working days between two dates in SAP
Tue Apr 24, 2012 2:06 pm by Uma_ABAP