Sie sind auf Seite 1von 3

Re: CREATING METHODS AND CLASS Reply

Posted: Jan 23, 2008 12:40 PM in response to:


santhosh kumar
hi,

The Class Builder allows you to create and maintain global ABAP
classes and interfaces. Both of these object types, like global data
types, are defined in the ABAP Repository, thus composing a central
class library. Together, they form a central class library and are
visible throughout the system. You can display existing classes and
interfaces in the class library using the Class Browser.

Features
Use the Class Builder to:
· Display an overview (in the Class Browser) of global object types
and their relationships.

· Maintain existing global classes or interfaces.

· Create new global classes and interfaces.

· Implement inheritance between global classes

· Create compound interfaces

· Create and specify the attributes, methods, and events of global


classes and interfaces.

· Define internal types in classes.

· Implement methods.

· Redefine methods

· Maintain local auxiliary classes.

· Test classes or interfaces in a simulated runtime environment.

To create a new class from the initial screen of the ABAP


Workbench:
Enter the name of the new class according to the naming
conventions under Object type.
Choose Create.
The Create Class dialog box appears with the name of the class:

Enter the following details for the subclass definition:

• Class

Name of the new class.

Create Inheritance

When you choose this function, the Inherits from dialog box appears.
You can define the inheritance relationship here by specifying the
name of the superclass.
You can define the superclass as any class from the class library
that is not defined as final.

• Description
Re: CREATING METHODS AND CLASS Reply
Posted: Jan 23, 2008 12:43 PM in response to:
santhosh kumar
hi,
T-code for class builder is se24
Methods describe how an object behaves. You implement them
using functions defined within classes. They are operations that
change the attributes of a class or interface. There are instance-
and static methods. Instance methods refer to a certain class
instance, whereas static methods are common to all the class
instances. Static methods can only address static attributes.

The special methods include constructors and class constructors.


Constructors (class constructors) need not be created explicitly if
they are not to be implemented.

Prerequisites

You must already have created the class or interface. It is useful if


you have already created the attributes of the class, since you
can branch directly from a method definition in the Class Builder
to its implementation.

Procedure
To create methods for classes and interfaces:
Change to the Class Editor.
Choose Methods.
To create a method, make the following entries:

• Methods

Define a unique name with which the method is identified.


Type
Specifies the type as an instance method or a static method (not
instance-specific).

• Visibility

Define the visibility of methods for the user of the class. Public
assigns the method to the public area of the class and the method
can be called by every user of the class. If you make the method
protected, it is visible to and can be used by the class itself and
any of its subclasses. If the method is private, it is only visible in
and available to the class itself. Private methods do not form part
of the external point of contact between the class and its users.

• Modeled only

If the flag is set, no entry will be made in the class pool. You
cannot access the components at runtime.

• Description

Short description of the method.

Repeat the above steps for any further methods.

Hope this is helpful, Do reward.

Das könnte Ihnen auch gefallen