‎2007 Jan 23 11:23 AM
‎2007 Jan 23 11:35 AM
Hallo Ramesh,
Classes, their instances (objects), and access to objects using reference variables form the basics of ABAP Objects. These means already allow you to model typical business applications, such as customers, orders, order items, invoices, and so on, using objects, and to implement solutions using ABAP Objects.
syntax :
INTERFACE <intf>.
...
ENDINTERFACE.
Example :
TABLES ZVIJIRANK.
DATA IT LIKE TABLE OF ZVIJIRANK WITH HEADER LINE.
INTERFACE I1.
METHODS : GETDATA.
ENDINTERFACE.
CLASS CL1 DEFINITION.
PUBLIC SECTION.
INTERFACES I1.
ENDCLASS.
CLASS CL2 DEFINITION.
PUBLIC SECTION.
INTERFACES I1.
ENDCLASS.
CLASS CL1 IMPLEMENTATION.
METHOD I1~GETDATA.
SELECT * FROM ZVIJIRANK INTO TABLE IT.
ENDMETHOD.
ENDCLASS.
CLASS CL2 IMPLEMENTATION.
METHOD I1~GETDATA.
SELECT * FROM ZVIJIRANK INTO TABLE IT WHERE REG_NO = '101'.
ENDMETHOD.
ENDCLASS.
DATA: OBJ1 TYPE REF TO CL1,
OBJ2 TYPE REF TO CL2.
START-OF-SELECTION.
CREATE OBJECT: OBJ1 , OBJ2.
CALL METHOD OBJ1->I1~GETDATA.
LOOP AT IT.
WRITE : / IT-REG_NO , IT-NAME , IT-BRANCH.
ENDLOOP.
CALL METHOD OBJ2->I1~GETDATA.
LOOP AT IT.
WRITE : / IT-REG_NO , IT-NAME , IT-BRANCH.
ENDLOOP.
If you have doubt means go through the following links.
http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
‎2007 Jan 23 11:30 AM
Hi,
Check this link for concepts and examples in OOPS
http://www.henrikfrank.dk/abapuk.html
http://www.sapgenie.com/abap/OO/eg.htm
http://www.sapgenie.com/abap/OO/syntax.htm
http://www.sapgenie.com/abap/OO/index.htm
http://www.sapgenie.com/abap/OO/defn.htm
these links
http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
‎2007 Jan 23 11:35 AM
Hallo Ramesh,
Classes, their instances (objects), and access to objects using reference variables form the basics of ABAP Objects. These means already allow you to model typical business applications, such as customers, orders, order items, invoices, and so on, using objects, and to implement solutions using ABAP Objects.
syntax :
INTERFACE <intf>.
...
ENDINTERFACE.
Example :
TABLES ZVIJIRANK.
DATA IT LIKE TABLE OF ZVIJIRANK WITH HEADER LINE.
INTERFACE I1.
METHODS : GETDATA.
ENDINTERFACE.
CLASS CL1 DEFINITION.
PUBLIC SECTION.
INTERFACES I1.
ENDCLASS.
CLASS CL2 DEFINITION.
PUBLIC SECTION.
INTERFACES I1.
ENDCLASS.
CLASS CL1 IMPLEMENTATION.
METHOD I1~GETDATA.
SELECT * FROM ZVIJIRANK INTO TABLE IT.
ENDMETHOD.
ENDCLASS.
CLASS CL2 IMPLEMENTATION.
METHOD I1~GETDATA.
SELECT * FROM ZVIJIRANK INTO TABLE IT WHERE REG_NO = '101'.
ENDMETHOD.
ENDCLASS.
DATA: OBJ1 TYPE REF TO CL1,
OBJ2 TYPE REF TO CL2.
START-OF-SELECTION.
CREATE OBJECT: OBJ1 , OBJ2.
CALL METHOD OBJ1->I1~GETDATA.
LOOP AT IT.
WRITE : / IT-REG_NO , IT-NAME , IT-BRANCH.
ENDLOOP.
CALL METHOD OBJ2->I1~GETDATA.
LOOP AT IT.
WRITE : / IT-REG_NO , IT-NAME , IT-BRANCH.
ENDLOOP.
If you have doubt means go through the following links.
http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm