Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

oo abap

Former Member
0 Likes
623

hai can anyone tell me the difference between the interfaces and the class in the oo abap

hai can anyone tell me the difference between the interfaces and the class in the oo abap

3 REPLIES 3
Read only

Former Member
0 Likes
544

Classes are templates for objects. Conversely, you can say that the type of an object is the same as its class. A class is an abstract description of an object. You could say that it is a set of instructions for building an object. The attributes of objects are defined by the components of the class, which describe the state and behavior of objects.

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.

However, it is often necessary for similar classes to provide similar functions that are coded differently in each class but which should provide a uniform point of contact for the user. For example, you might have two similar classes, savings account and check account, both of which have a method for calculating end of year charges. The interfaces and names of the methods are the same, but the actual implementation is different. The user of the classes and their instances must also be able to run the end of year method for all accounts, without having to worry about the actual type of each individual account.

ABAP Objects makes this possible by using interfaces. Interfaces are independent structures that you can implement in a class to extend the scope of that class. The class-specific scope of a class is defined by its components and visibility sections. For example, the public components of a class define its public scope, since all of its attributes and method parameters can be addressed by all users. The protected components of a class define its scope with regard to its subclasses. (However, inheritance is not supported in Release 4.5B).

Interfaces extend the scope of a class by adding their own components to its public section. This allows users to address different classes via a universal point of contact. Interfaces, along with inheritance, provide one of the pillars of polymorphism, since they allow a single method within an interface to behave differently in different classes.

Check these links for more details

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm

Read only

former_member194669
Active Contributor
0 Likes
544

Hi,

Search in Abap object forum. you can find lot thread related to your query.

Read only

Former Member
0 Likes
544

Hi

Interfaces and classes are both created using SE24 tcode only.

Interfaces will have all ABSTRACT methods only

means we define the methods in interfaces and we don't implement them there.

This interface will be implemented by a class where the methods of this interface are automatically copied to that class and we write the code/implementation of those methods in class.

So classes are the places where we write all methods implementation, attributes, method parameters, types, alias,etc are defined.

see the links

chk out the links below:

General Tutorial for OOPS

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a41...

Have a look at these links for OO ABAP.

http://www.sapgenie.com/abap/OO/

http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm

http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt

http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf

http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt

http://www.allsaplinks.com/

http://www.sapgenie.com/abap/controls/index.htm

http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf

http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf

http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm

SDN Series:

https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b... [original link is broken]

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf

Basic concepts of OOPS

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c4...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20...

http://www.henrikfrank.dk/abapuk.html

http://www.erpgenie.com/abap/OO/

Regards

Anji