Sitemap
Santhosh

Santhosh

Writing.....<3

OOABAP

1 min readNov 30, 2023

Hi I am santhosh SAP ABAP DEVELOPER here a sample code for OOABAP (INHERITANCE)

REPORT ZOOABAP.
class v_unit DEFINITION.
public SECTION.
data vw_worker(20) type c value ‘system out print’.
methods meth1.
endclass.

class r_unit DEFINITION.
public section.
data hr_worker(10) type c value ‘printf’.
METHODS meth2.
endclass.

class l_unit DEFINITION.
public SECTION.
data vr_worker(10) type c value ‘write’.
methods meth3.
endclass.

class m_unit DEFINITION.
PUBLIC SECTION.
data rx_worker(10) type c value ‘output’.
methods meth4.
endclass.

class v_unit IMPLEMENTATION.
method meth1.
write: / vw_worker.
endmethod.
endclass.

class r_unit IMPLEMENTATION.
method meth2.
write: / hr_worker.
endmethod.
endclass.

class l_unit IMPLEMENTATION.
method meth3.
write: / vr_worker.
endmethod.
endclass.

class m_unit IMPLEMENTATION.
method meth4.
write: / rx_worker.
endmethod.
endclass.

start-OF-SELECTION.
data: a TYPE REF TO v_unit,
b TYPE REF TO r_unit,
c TYPE REF TO l_unit,
d TYPE REF TO m_unit.
create OBJECT: a,b,c,d.
call METHOD: a->meth1,
b->meth2,
c->meth3,
d->meth4.

Get Santhosh’s stories in your inbox

Join Medium for free to get updates from this writer.

OUTPUT:

Press enter or click to view image in full size

THANK YOU

--

--