Advertisement
Guest User

Untitled

a guest
Mar 14th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.71 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report ZBC401_09_MAIN
  3. *&---------------------------------------------------------------------*
  4. *&
  5. *&---------------------------------------------------------------------*
  6. REPORT zbc401_09_main.
  7.  
  8. CLASS lcl_airplane DEFINITION.
  9.   PUBLIC SECTION.
  10.     "Define public instANCE METHOD uses "methods"
  11.     METHODS: set_attribute
  12.       IMPORTING iv_name      TYPE string
  13.                 iv_planetype TYPE saplane-planetype.
  14.  
  15.     METHODS: display_attributes.
  16.  
  17.     "Defining a static method uses class-method
  18.     CLASS-METHODS DISPLAY_N_O_AIRPLANES.
  19.  
  20.   PRIVATE SECTION.
  21.     "define variables, these are private attributes
  22.     DATA: mv_name      TYPE string,
  23.           mv_planetype TYPE saplane-planetype.
  24.  
  25.     "Creates static attribute uses class-data syntax
  26.     CLASS-DATA: gv_n_o_airplanes TYPE i.
  27.  
  28. ENDCLASS.
  29.  
  30. CLASS lcl_airplane IMPLEMENTATION.
  31.   "implementation must have method and endmethod
  32.  
  33.   "implementation method for set_attribute
  34.   METHOD set_attribute.
  35.     "assign instance attribute to the importing parameters
  36.     MV_NAME = IV_NAME.
  37.     MV_PLANETYPE = IV_PLANETYPE.
  38.  
  39.     "increment the gv_n_o_airplanes counter by 1
  40.     gv_n_o_airplanes = gv_n_o_airplanes + 1.
  41.  
  42.   ENDMETHOD.
  43.  
  44.   "implementation method for display_attributes
  45.   METHOD display_attributes.
  46.     "Output these two instances in an abap list
  47.     "basically just write out the statement
  48.     WRITE: /'Name of airplane is ', MV_NAME.
  49.     WRITE: /'Type of airplane is ', MV_PLANETYPE.
  50.  
  51.   ENDMETHOD.
  52.  
  53.   "implementation method for display_no_o_planes
  54.   method display_n_o_airplanes.
  55.     "display the counter number
  56.     write: gv_n_o_airplanes.
  57.   ENDMETHOD.
  58. ENDCLASS.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement