Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&---------------------------------------------------------------------*
- *& Report ZBC401_09_MAIN
- *&---------------------------------------------------------------------*
- *&
- *&---------------------------------------------------------------------*
- REPORT zbc401_09_main.
- "Create Local Class EXC 2
- CLASS lcl_airplane DEFINITION.
- PUBLIC SECTION.
- "Define public instANCE METHOD uses "methods"
- METHODS: set_attribute
- IMPORTING iv_name TYPE string
- iv_planetype TYPE saplane-planetype.
- METHODS: display_attributes.
- "Defining a static method uses class-method
- CLASS-METHODS DISPLAY_N_O_AIRPLANES.
- PRIVATE SECTION.
- "define variables, these are private attributes
- DATA: mv_name TYPE string,
- mv_planetype TYPE saplane-planetype.
- "Creates static attribute uses class-data syntax
- CLASS-DATA: gv_n_o_airplanes TYPE i.
- ENDCLASS.
- CLASS lcl_airplane IMPLEMENTATION.
- "implementation must have method and endmethod
- "implementation method for set_attribute
- METHOD set_attribute.
- "assign instance attribute to the importing parameters
- MV_NAME = IV_NAME.
- MV_PLANETYPE = IV_PLANETYPE.
- "increment the gv_n_o_airplanes counter by 1
- gv_n_o_airplanes = gv_n_o_airplanes + 1.
- ENDMETHOD.
- "implementation method for display_attributes
- METHOD display_attributes.
- "Output these two instances in an abap list
- "basically just write out the statement
- WRITE: /'Name of airplane is ', MV_NAME.
- WRITE: /'Type of airplane is ', MV_PLANETYPE.
- ENDMETHOD.
- "implementation method for display_no_o_planes
- method display_n_o_airplanes.
- "display the counter number
- write: gv_n_o_airplanes.
- ENDMETHOD.
- ENDCLASS.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement