cancel
Showing results for 
Search instead for 
Did you mean: 

Practical Use of Interface

Former Member
0 Kudos

Can anybody please let me know the practical use of Interfaces in abap objects.

Currently i am undergoing traning in abap objects and really confused with the concept why SAP has provided with interfaces.

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hello Vinkant,

User interface means end users can see the screen an do the work.

What are the user visble work area called user interface

nothing but GUI

Graphical user interface.

This is basic Funda of User Interface

User Interface use is diffrenet Application just like DOT net , Java , ABAP Etc .

and SAP all are User Unterface.

Regards

Sachin

Former Member
0 Kudos

thanks a lot to everyone.

You all have helped me to understand this concept.

Former Member
0 Kudos
Former Member
0 Kudos

Hi,

I am sending you basic Fundametal of User Interface in ABAP Objects. Ist you have to read the concept of OOPS stand for object oriented Programming concept after that you can understand basically what is Use of User Interface ?

Now below down I have mention the Exaple of User Interface

I Hope it will be help full

REPORT z_parameter_passing.

CLASS demo DEFINITION CREATE PRIVATE.

PUBLIC SECTION.

CLASS-METHODS main.

PRIVATE SECTION.

METHODS: meth1 IMPORTING value(idx) TYPE i,

meth2 IMPORTING reference(idx) TYPE i.

With strings and internal tables, the disadvantage in terms of performance of pass

by value compared with pass by reference can even be compensated for by the

integrated Copy-on-Write semantics (the concept of sharing, see Section 5.1.7).

This is the case for input parameters in particular, provided that they are not

changed.

DATA msg TYPE string.

ENDCLASS.

CLASS demo IMPLEMENTATION.

METHOD main.

DATA oref TYPE REF TO demo.

CREATE OBJECT oref.

DO 2 TIMES.

oref->meth1( sy-index ).

oref->meth2( sy-index ).

ENDDO.

ENDMETHOD.

METHOD meth1.

DO 3 TIMES.

msg = idx.

CONCATENATE `meth1: ` msg INTO msg.

MESSAGE msg TYPE 'I'.

ENDDO.

ENDMETHOD.

METHOD meth2.

DO 3 TIMES.

msg = idx.

CONCATENATE `meth2: ` msg INTO msg.

MESSAGE msg TYPE 'I'.

ENDDO.

ENDMETHOD.

ENDCLASS.

START-OF-SELECTION.

demo=>main( ).

In the main method, two methods are called with an identical implementation

in a DO loop. The first method, meth1, outputs the content

of sy-index , which is passed by value, three times as expected, in

other words, “1”, “1”, “1” during the first call, and “2”, “2”, “2” during

the second call. The second method, meth2, outputs “1”, “2”, “3”

during both calls. The DO loop in meth1 and meth2 sets the global system

field sy-index and thus also the formal parameter idx (passed by

reference) in meth2.

Regards

Sachin

Former Member
0 Kudos

read the below content

Like classes, you can define interfaces either globally in the R/3 Repository or locally in an ABAP program. For information about how to define local interfaces, refer to the Class Builder section of the ABAP Workbench Tools documentation. The definition of a local interface <intf> is enclosed in the statements:

INTERFACE <intf>.

...

ENDINTERFACE.

The definition contains the declaration for all components (attributes, methods, events) of the interface. You can define the same components in an interface as in a class. The components of interfaces do not have to be assigned individually to a visibility section, since they automatically belong to the public section of the class in which the interface is implemented. Interfaces do not have an implementation part, since their methods are implemented in the class that implements the interface.

Implementing Interfaces

Unlike classes, interfaces do not have instances. Instead, interfaces are implemented by classes. To implement an interface in a class, use the statement

INTERFACES <intf>.

in the declaration part of the class. This statement may only appear in the public section of the class.

When you implement an interface in a class, the components of the interface are added to the other components in the public section. A component <icomp> of an interface <intf> can be addressed as though it were a member of the class under the name <intf~icomp>.

The class must implement the methods of all interfaces implemented in it. The implementation part of the class must contain a method implementation for each interface method <imeth>:

METHOD <intf~imeth>.

...

ENDMETHOD.

Interfaces can be implemented by different classes. Each of these classes is extended by the same set of components. However, the methods of the interface can be implemented differently in each class.

Interfaces allow you to use different classes in a uniform way using interface references (polymorphism). For example, interfaces that are implemented in different classes extend the public scope of each class by the same set of components. If a class does not have any class-specific public components, the interfaces define the entire public face of the class.

Addressing Objects Using Interface References

To create an object of the class <class>, you must first have declared a reference variable <cref> with reference to the class. If the class <class> implements an interface <intf>, you can use the following assignment between the class reference variable <cref> and an interface reference <iref> to make the interface reference in <iref> point to the same object as the class reference in <cref>:

<iref> = <cref>

If the interface <intf> contains an instance attribute <attr> and an instance method <meth>, you can address the interface components as follows:

Using the class reference variable <cref>:

To access an attribute <attr>: <cref>-><intf~attr>

To call a method <meth>: CALL METHOD <cref>-><intf~meth>

Using the interface reference variable <iref>:

To access an attribute <attr>: < iref>-><attr>

To call a method <meth>: CALL METHOD <iref>-><meth>

As far as the static components of interfaces are concerned, you can only use the interface name to access constants:

Addressing a constant <const>: < intf>=><const>

For all other static components of an interface, you can only use object references or the class <class> that implements the interface:

Addressing a static attribute <attr>: < class>=><intf~attr>

Calling a static method <meth>: CALL METHOD <class>=><intf~meth>

reward if usefull

regards

Giridhar

Former Member
0 Kudos

hI

Interfaces only describe the external point of contact of a class (protocols), they do not contain any implementation.

Interfaces are usually defined by a user. The user describes in the interface which services (technical and semantic) it needs in order to carry out a task.

The user never actually knows the providers of these services, but communicates with them through the interface.

In this way the user is protected from actual implementations and can work in the same way with different classes/objects, as long as they provide the services required. This is known as polymorphism with interfaces.

Separation of external point of contact

interface) and implementation (class)

The client defines the protocol, the server implements it

Former Member
0 Kudos

Hi,

Please checkout these previous postings

Regards,

ABY

Former Member
0 Kudos

Hi again,

<b>for interfaces

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm</b>;

For Materials:

1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291

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

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

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

5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt

6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf

7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt

😎 http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8

OO ABAP links:

1) http://www.erpgenie.com/sap/abap/OO/index.htm

2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm

+++++

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

http://www.geocities.com/victorav15/sapr3/abap_ood.html

http://www.brabandt.de/html/abap_oo.html

Check this cool weblog:

/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql

/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql

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

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

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

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.sap-img.com/

http://www.sapgenie.com/

http://help.sap.com

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

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

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://www.sapgenie.com/abap/OO/index.htm

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

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

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

Thanks, ABY