Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&---------------------------------------------------------------------*
- *& Report ZMENG_OBJECT
- *&---------------------------------------------------------------------*
- *&
- *&---------------------------------------------------------------------*
- REPORT zmeng_01_object.
- *&---------------------------------------------------------------------*
- *& 类定义
- *& 在ABAP对象中,类的结构包含诸如属性,方法,事件,类型和常量等组件。
- *&---------------------------------------------------------------------*
- CLASS class1 DEFINITION.
- PUBLIC SECTION.
- DATA: text1(45) VALUE 'ABAP Objects.'.
- METHODS: display0.
- METHODS: display1.
- ENDCLASS.
- *&---------------------------------------------------------------------*
- *& 类实现
- *&---------------------------------------------------------------------*
- CLASS class1 IMPLEMENTATION.
- METHOD display0.
- WRITE: / 'Hello world.'.
- ENDMETHOD.
- METHOD display1.
- WRITE:/ 'This is the Display method.'.
- ENDMETHOD.
- ENDCLASS.
- START-OF-SELECTION.
- DATA: class1 TYPE REF TO class1.
- CREATE OBJECT: class1.
- WRITE:/ class1->text1.
- CALL METHOD: class1->display0.
- CALL METHOD: class1->display1.
- *&---------------------------------------------------------------------*
- *& Output Result
- *&---------------------------------------------------------------------*
- *& ABAP Objects.
- *& Hello world.
- *& This is the Display method.
- *&---------------------------------------------------------------------*
Add Comment
Please, Sign In to add comment