SAP Tutorials Blog


SAP Read Only in OO Abap

class class1 definition.
  PUBLIC SECTION.
  data: pernr type pa0002-pernr READ-ONLY.
  methods: constructor importing p_pernr type i.
  endclass.

  class class1 implementation.
    method constructor.
      me->pernr = p_pernr.
      endmethod.
      endclass.

START-OF-SELECTION.
  DATA: test TYPE REF TO class1.
  CREATE OBJECT test
    EXPORTING
      p_pernr = 10.
  WRITE: 'pernr:', test->pernr. 




Serkan AKKAVAK
Computer Engineer BSc
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com