mengyuxin

Hello World

Apr 18th, 2021
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.58 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report ZMENG_OBJECT
  3. *&---------------------------------------------------------------------*
  4. *& 
  5. *&---------------------------------------------------------------------*
  6. REPORT zmeng_01_object.
  7.  
  8. *&---------------------------------------------------------------------*
  9. *& 类定义
  10. *& 在ABAP对象中,类的结构包含诸如属性,方法,事件,类型和常量等组件。
  11. *&---------------------------------------------------------------------*
  12. CLASS class1 DEFINITION.
  13.   PUBLIC SECTION.
  14.  
  15.   DATA: text1(45) VALUE 'ABAP Objects.'.
  16.  
  17.   METHODS: display0.
  18.   METHODS: display1.
  19. ENDCLASS.
  20.  
  21. *&---------------------------------------------------------------------*
  22. *& 类实现
  23. *&---------------------------------------------------------------------*
  24. CLASS class1 IMPLEMENTATION.
  25.   METHOD display0.
  26.     WRITE: / 'Hello world.'.
  27.   ENDMETHOD.
  28.  
  29.   METHOD display1.
  30.     WRITE:/ 'This is the Display method.'.
  31.   ENDMETHOD.
  32. ENDCLASS.
  33.  
  34. START-OF-SELECTION.
  35.   DATA: class1 TYPE REF TO class1.
  36.  
  37.   CREATE OBJECT: class1.
  38.  
  39.   WRITE:/ class1->text1.
  40.  
  41.   CALL METHOD: class1->display0.
  42.  
  43.   CALL METHOD: class1->display1.
  44.  
  45. *&---------------------------------------------------------------------*
  46. *& Output Result
  47. *&---------------------------------------------------------------------*
  48. *& ABAP Objects.
  49. *& Hello world.
  50. *& This is the Display method.
  51. *&---------------------------------------------------------------------*
  52.  
Add Comment
Please, Sign In to add comment