关于abap:abap-类简单复习1

50次阅读

共计 854 个字符,预计需要花费 3 分钟才能阅读完成。

*&---------------------------------------------------------------------*
*& Report zlcl_class_local
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zlcl_class_local.

CLASS zlcl_class_local DEFINITION.
  PUBLIC SECTION.
    DATA:
        mv_value TYPE string.
    CLASS-DATA:
    gv_cl_value TYPE string.

    METHODS:
      set_value IMPORTING iv_value TYPE string,
      display_value.
ENDCLASS.

CLASS zlcl_class_local IMPLEMENTATION.
  METHOD display_value.
    WRITE:/ 'Class Instance Attribute:', mv_value.
    WRITE:/ 'Class Static Attribute:', gv_cl_value.
  ENDMETHOD.

  METHOD set_value.
    mv_value = iv_value.
  ENDMETHOD.
ENDCLASS.


START-OF-SELECTION.
  DATA(lo_class_local) = NEW zlcl_class_local( ).
  CALL METHOD lo_class_local->set_value
    EXPORTING
      iv_value = '<sap abap oop>'.

  zlcl_class_local=>gv_cl_value = 'IT Book Press'.

  CALL METHOD lo_class_local->display_value.

正文完
 0