Class in abap
Class:
* Class is a collection of data members and member functions.
* Data members means variables and member function means functions.
* T-code -se24 and also se38.
Syntax of class
class < class_name> definiton.
{ visibility} - public,protected,private
{ declaration} - static / instance
{ events/interfaces}
endclass.
class <class_name> implementation.
method <method_name>
endmethod
endclass.
data obj_class type refer to<class_name>
create object obj_class. or data(obj_class) = new <class_name> ().
Example in se38 - local class
REPORT ZAJAY_CL_1.
CLASS a DEFINITION.
PUBLIC SECTION.
data: text1 type string VALUE 'hello1'.
METHODS meth.
PROTECTED SECTION.
data: text2 type string VALUE 'hello2'.
PRIVATE SECTION.
data: text3 type string VALUE 'hello3'.
ENDCLASS.
CLASS a IMPLEMENTATION.
METHOD meth.
write: / text1,
/ text2 ,
/ text3.
Comments
Post a Comment