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

abap objects

Former Member
0 Likes
592

what is the advantage of deffered when defining class?

5 REPLIES 5
Read only

Former Member
0 Likes
555

Hi

It can be useful in making the friendhip with other classes.

using the friendhip u can access even the private components oi that class.

reward points if it is useful.

Regards,

Satish.

Read only

former_member480923
Active Contributor
0 Likes
555

Hi,

The Statement

class: lcl_locl type ref to lcl_local_class  DEFINITION DEFERRED.

In general, you define and use a class within the same context. A context is the common environment of a set of classes and interfaces, for example, the set of local classes in a program. However, you may need to refer to a class using the REF TO addition before it has been defined (for example, if two classes refer to each other). In this case, you can declare the class before you define it using the variant CLASS class DEFINITION DEFERRED.

Hope that Helps

Anirban M.

Read only

0 Likes
555

use of differed is you can use the class before you implemeted

Read only

Former Member
0 Likes
555

Actually it's simple.

In Plain English

If you code say this at the start of your program

CLASS LCL_HANDLE_EVENTS DEFINITION DEFERRED.

You can then in your DATA section code this before you have defined or loaded the CLASS LCL_HANDLE_EVENTS .

DATA: GR_EVENTS TYPE REF TO LCL_HANDLE_EVENTS,

Normally if the class hasn't yet been defined or loaded this statement would give you a syntax error.

You often need these type of variables referring to a class that you haven't defined or loaded yet.

Cheers

jimbo

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
555

Hi,

Look at this links:

<a href="https://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3e59b790-0201-0010-88aa-bc8a7f95f6fb">Why use ABAP Objects</a>

<a href="https://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/37c5db90-0201-0010-3a9b-d0a5288f3c15">Eight Reasons Why Every ABAP Developer Should Give ABAP Objects a Second Look</a>

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2503f09c-0801-0010-dc89-80bab376e4b8">Object Oriented ABAP - Local and Global classes</a>

For more informations look at:

<a href="http://https://wiki.sdn.sap.com/wiki/display/ABAP/ABAPObjectsGetting+Started">ABAP Objects Getting Started</a>

<a href="/people/dirk.feeken/blog/2007/07/06/abap-trial-version-for-newbies-part-17--your-first-abap-object Trial Version for Newbies: Part 17 - Your first ABAP Object</a>

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b17cf">ABAP Code Sample for Objects</a>

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47">ABAP Code Sample to Learn Basic Concept of Object-Oriented Programming</a>

<a href="https://media.sdn.sap.com/public/eclasses/teched04/ABAP151_files/Default.htm#nopreload=1">ABAP Objects for Java Developers</a>

<a href="https://wiki.sdn.sap.com/wiki/display/ABAP/ABAP+Objects">ABAP Objects</a>

Regards.

Marcelo Ramos