2007 Dec 24 11:37 AM
Hi,
Can anyone send me a document for ,
1. object-oriented programming, ideally with ABAP OO
2.Programming concepts (data model, authorization, transaction model, batch, archiving, logs, etc.)
3.Integration concepts (ALE/IDOC, BAPI, etc.)
4.Optimization techniques (database and programming)
and can anyone let me know abt advanced SAP technologies
2007 Dec 24 11:44 AM
Hi ,
i am sending few documents for u,
please reward points, if it is useful.
Go through the following Steps For ALE/IDOC
ALE IDOC
Sending System(Outbound ALE Process)
Tcode SALE ? for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 ? Create Model View
Tcode BD82 ? Generate partner Profiles & Create Ports
Tcode BD64 ? Distribute the Model view
Message Type MATMAS
Tcode BD10 ? Send Material Data
Tcode WE05 ? Idoc List for watching any Errors
Receiving System(Inbound ALE )
Tcode SALE ? for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 ? Check for Model view whether it has distributed or not
Tcode BD82 -- Generate partner Profiles & Create Ports
Tcode BD11 Getting Material Data
Tcode WE05 ? Idoc List for inbound status codes
ALE IDOC Steps
Sending System(Outbound ALE Process)
Tcode SALE ?3 for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 !V Create Model View
Tcode BD82 !V Generate partner Profiles & Create Ports
Tcode BD64 !V Distribute the Model view
This is Receiving system Settings
Receiving System(Inbound ALE )
Tcode SALE ?3 for
a) Define Logical System
b) Assign Client to Logical System
Tcode SM59-RFC Destination
Tcode BD64 !V Check for Model view whether it has distributed or not
Tcode BD82 -- Generate partner Profiles & Create Ports
Tcode BD11 Getting Material Data
Tcode WE05 !V Idoc List for inbound status codes
Message Type MATMAS
Tcode BD10 !V Send Material Data
Tcode WE05 !V Idoc List for watching any Errors
1)a Goto Tcode SALE
Click on Sending & Receiving Systems-->Select Logical Systems
Here Define Logical Systems---> Click on Execute Button
go for new entries
1) System Name : ERP000
Description : Sending System
2) System Name : ERP800
Description : Receiving System
press Enter & Save
it will ask Request
if you want new request create new Request orpress continue for transfering the objects
B) goto Tcode SALE
Select Assign Client to Logical Systems-->Execute
000--> Double click on this
Give the following Information
Client : ERP 000
City :
Logical System
Currency
Client role
Save this Data
Step 2) For RFC Creation
Goto Tcode SM59-->Select R/3 Connects
Click on Create Button
RFC Destination Name should be same as partner's logical system name and case sensitive to create the ports automatically while generating the partner profiles
give the information for required fields
RFC Destination : ERP800
Connection type: 3
Description
Target Host : ERP000
System No:000
lan : EN
Client : 800
User : Login User Name
Password:
save this & Test it & RemortLogin
3)
Goto Tcode BD64 -- click on Change mode button
click on create moduleview
short text : xxxxxxxxxxxxxx
Technical Neme : MODEL_ALV
save this & Press ok
select your just created modelview Name :'MODEL_ALV'.
goto add message type
Model Name : MODEL_ALV
sender : ERP000
Receiver : ERP800
Message type :MATMAS
save & Press Enter
4) Goto Tcode BD82
Give Model View : MODEL_ALV
Partner system : ERP800
execute this by press F8 Button
it will gives you sending system port No :A000000015(Like)
5) Goto Tcode BD64
seelct the modelview
goto >edit>modelview-->distribute
press ok & Press enter
6)goto Tcode : BD10 for Material sending
Material : mat_001
Message Type : MATMAS
Logical System : ERP800
and Execute
7)goto Tcode : BD11 for Material Receiving
Material : mat_001
Message Type : MATMAS
and Execute --> 1 request idoc created for message type Matmas
press enter
Here Master Idoc set for Messge type MATMAS-->press Enter
1 Communication Idoc generated for Message Type
this is your IDOC
Change Pointers
I know how to change the description of a material using ALE Change Pointers.
I will give the following few steps
1) Tcode BD61---> check the change pointers activated check box
save and goback.
2) Tcode BD50---> check the MATMAS check box save and comeback.
3) Tcode BD51---> goto IDOC_INPUT_MATMAS01 select the checkbox save and comeback.
4) Tcode BD52---> give message type : matmas press ok button.
select all what ever you want and delete remaining fields.
save & come back.
5) 5) go to Tcode MM02 select one material and try to change the description and save it
it will effects the target systems material desciption will also changes
6) goto Tcode SE38 give program Name is : RBDMIDOC and Execute
give Message type : MATMAS and Executte
ALE/IDOC Status Codes/Messages
-
01 Error --> Idoc Added
30 Error --> Idoc ready for dispatch(ALE Service)
then goto SE38 --> Execute the Program RBDMIDOC
29 Error --> ALE Service Layer
then goto SE38 --> Execute the Program RSEOUT00
03 Error --> Data Passed to Port ok
then goto SE38 --> Execute the Program RBDMOIND
12 Error --> Dispatch ok
Inbound Status Codes
50 Error --> It will go for ALE Service Layer
56 Error --> Idoc with Errors added
51 Error --> Application Document not posted
65 Error --> Error in ALE Service Layer
for 51 or 56 Errors do the following steps
goto WE19 > give the IDOC Number and Execute>
Press on Inbound function Module
for 65 Error --> goto SE38 --> Execute the Program RBDAPP01 then your getting 51 Error
OOABAP
OO ABAP
Classes
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.
Local and Global Classes
Classes in ABAP Objects can be declared either globally or locally. You define global classes and interfaces in the Class Builder (Transaction SE24) in the ABAP Workbench. They are stored centrally in class pools in the class library in the R/3 Repository. All of the ABAP programs in an R/3 System can access the global classes. Local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined. When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, it then looks for a global class. Apart from the visibility question, there is no difference between using a global class and using a local class.
There is, however, a significant difference in the way that local and global classes are designed. If you are defining a local class that is only used in a single program, it is usually sufficient to define the outwardly visible components so that it fits into that program. Global classes, on the other hand, must be able to be used anywhere. This means that certain restrictions apply when you define the interface of a global class, since the system must be able to guarantee that any program using an object of a global class can recognize the data type of each interface parameter.
The following sections describe how to define local classes and interfaces in an ABAP program. For information about how to define local classes and interfaces, refer to the Class Builder section of the ABAP Workbench Tools documentation.
Defining Local Classes
Local classes consist of ABAP source code, enclosed in the ABAP statements CLASS ... ENDCLASS. A complete class definition consists of a declaration part and, if required, an implementation part. The declaration part of a class <class> is a statement block:
CLASS <class> DEFINITION.
...
ENDCLASS.
It contains the declaration for all components (attributes, methods, events) of the class. When you define local classes, the declaration part belongs to the global program data. You should therefore place it at the beginning of the program.
If you declare methods in the declaration part of a class, you must also write an implementation part for it. This consists of a further statement block:
CLASS <class> IMPLEMENTATION.
...
ENDCLASS.
The implementation part of a class contains the implementation of all methods of the class. The implementation part of a local class is a processing block. Subsequent coding that is not itself part of a processing block is therefore not accessible.
Structure of a Class
The following statements define the structure of a class:
A class contains components
Each component is assigned to a visibility section
Classes implement methods
The following sections describe the structure of classes in more detail.
Class Components
The components of a class make up its contents. All components are declared in the declaration part of the class. The components define the attributes of the objects in a class. When you define the class, each component is assigned to one of the three visibility sections, which define the external interface of the class. All of the components of a class are visible within the class. All components are in the same namespace. This means that all components of the class must have names that are unique within the class.
There are two kinds of components in a class - those that exist separately for each object in the class, and those that exist only once for the whole class, regardless of the number of instances. Instance-specific components are known as instance components. Components that are not instance-specific are called static components.
In ABAP Objects, classes can define the following components. Since all components that you can declare in classes can also be declared in interfaces, the following descriptions apply equally to interfaces.
Attributes
Attributes are internal data fields within a class that can have any ABAP data type. The state of an object is determined by the contents of its attributes. One kind of attribute is the reference variable. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
Instance Attributes
The contents of instance attributes define the instance-specific state of an object. You declare them using the DATA statement.
Static Attributes
The contents of static attributes define the state of the class that is valid for all instances of the class. Static attributes exist once for each class. You declare them using the CLASS-DATA statement. They are accessible for the entire runtime of the class.
All of the objects in a class can access its static attributes. If you change a static attribute in an object, the change is visible in all other objects in the class.
Methods
Methods are internal procedures in a class that define the behavior of an object. They can access all of the attributes of a class. This allows them to change the data content of an object. They also have a parameter interface, with which users can supply them with values when calling them, and receive values back from them The private attributes of a class can only be changed by methods in the same class.
The definition and parameter interface of a method is similar to that of function modules. You define a method <met> in the definition part of a class and implement it in the implementation part using the following processing block:
METHOD <meth>.
...
ENDMETHOD.
You can declare local data types and objects in methods in the same way as in other ABAP procedures (subroutines and function modules). You call methods using the CALL METHOD statement.
Instance Methods
You declare instance methods using the METHODS statement. They can access all of the attributes of a class, and can trigger all of the events of the class.
Static Methods
You declare static methods using the CLASS-METHODS statement. They can only access static attributes and trigger static events.
Special Methods
As well as normal methods, which you call using CALL METHOD, there are two special methods called CONSTRUCTOR and CLASS_CONSTRUCTOR, which are automatically called when you create an object (CONSTRUCTOR) or when you first access the components of a class (CLASS_CONSTRUCTOR).
Events
Objects or classes can use events to trigger event handler methods in other objects or classes. In a normal method call, one method can be called by any number of users. When an event is triggered, any number of event handler methods can be called. The link between the trigger and the handler is not established until runtime. In a normal method call, the calling program determines the methods that it wants to call. These methods must exist. With events, the handler determines the events to which it wants to react. There does not have to be a handler method registered for every event.
The events of a class can be triggered in the methods of the same class using the RAISE EVENT statement. You can declare a method of the same or a different class as an event handler method for the event <evt> of class <class> using the addition FOR EVENT <evt> OF <class>.
Events have a similar parameter interface to methods, but only have output parameters. These parameters are passed by the trigger (RAISE EVENT statement) to the event handler method, which receives them as input parameters.
The link between trigger and handler is established dynamically in a program using the SET HANDLER statement. The trigger and handlers can be objects or classes, depending on whether you have instance or static events and event handler methods. When an event is triggered, the corresponding event handler methods are executed in all registered handling classes.
Instance Events
You declare instance events using the EVENTS statement. An instance event can only be triggered in an instance method.
Static Events
You declare static events using the CLASS-EVENTS statement. All methods (instance and static methods) can trigger static events. Static events are the only type of event that can be triggered in a static method.
See also Triggering and Handling Events.
Types
You can define your own ABAP data types within a class using the TYPES statement. Types are not instance-specific, and exist once only for all of the objects in a class.
Constants
Constants are special static attributes. You set their values when you declare them, and they can then no longer be changed. You declare them using the CONSTANTS statement. Constants are not instance-specific, and exist once only for all of the objects in a class.
Visibility Sections
You can divide the declaration part of a class into up to three visibility areas:
CLASS <class> DEFINITION.
PUBLIC SECTION.
...
PROTECTED SECTION.
...
PRIVATE SECTION.
...
ENDCLASS.
These areas define the external visibility of the class components, that is, the interface between the class and its users. Each component of a class must be assigned to one of the visibility sections.
Public Section
All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.
Protected Section
All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. Protected components form a special interface between a class and its subclasses. Since inheritance is not active in Release 4.5B, the protected section currently has the same effect as the private section.
Private Section
Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.
Encapsulation
The three visibility areas are the basis for one of the important features of object orientation - encapsulation. When you define a class, you should take great care in designing the public components, and try to declare as few public components as possible. The public components of global classes may not be changed once you have released the class.
For example, public attributes are visible externally, and form a part of the interface between an object and its users. If you want to encapsulate the state of an object fully, you cannot declare any public attributes. As well as defining the visibility of an attribute, you can also protect it from changes using the READ-ONLY addition.
Object Handling
Objects
Objects are instances of classes. Each object has a unique identity and its own attributes. All transient objects reside in the context of an internal session (memory area of an ABAP program). Persistent objects in the database are not yet available. A class can have any number of objects (instances).
Object References
To access an object from an ABAP program, you use object references. Object references are pointers to objects. In ABAP, they are always contained in reference variables.
Reference variables
Reference variables contain references. A reference variable is either initial or contains a reference to an existing object. The identity of an object depends on its reference. A reference variable that points to an object knows the identity of that object. Users cannot access the identity of the object directly.
Reference variables in ABAP are treated like other elementary data objects. This means that a reference variable can occur as a component of a structure or internal table as well as on its own.
Data Types for References
ABAP contains a predefined data type for references, comparable to the data types for structures or internal tables. The full data type is not defined until the declaration in the ABAP program. The data type of a reference variable determines how the program handles its value (that is, the object reference). There are two principal types of references: Class references and interface references (see Interfaces).
You define class references using the
... TYPE REF TO <class>
addition in the TYPES or DATA statement, where <class> refers to a class. A reference variable with the type class reference is called a class reference variable, or class reference for short.
A class reference <cref> allows a user to create an instance (object) of the corresponding class, and to address a visible component <comp> within it using the form
cref->comp
Creating Objects
Before you can create an object for a class, you need to declare a reference variable with reference to that class. Once you have declared a class reference variable <obj> for a class <class>, you can create an object using the statement
CREATE OBJECT <cref>.
This statement creates an instance of the class <class>, and the reference variable <cref> contains a reference to the object.
Addressing the Components of Objects
Programs can only access the instance components of an object using references in reference variables. The syntax is as follows (where <ref> is a reference variable):
To access an attribute <attr>: <ref>-><attr>
To call a method <meth>: CALL METHOD <ref>-><meth>
You can access static components using the class name as well as the reference variable. It is also possible to address the static components of a class before an object has been created.
Addressing a static attribute <attr>: <class>=><attr>
Calling a static method <meth>: CALL METHOD <class>=><meth>
Within a class, you can use the self-reference ME to access the individual components:
To access an attribute <attr> in the same class: ME-><attr>
To call a method <meth> in the same class: CALL METHOD ME-><meth>
Self references allow an object to give other objects a reference to it. You can also access attributes in methods from within an object even if they are obscured by local attributes of the method.
Creating More Than One Instance of a Class
In a program, you can create any number of objects from the same class. The objects are fully independent of each other. Each one has its own identity within the program and its own attributes. Each CREATE OBJECT statement generates a new object, whose identity is defined by its unique object reference.
Assigning References
You can assign references to different reference variables using the MOVE statement. In this way, you can make the references in several reference variables point to the same object. When you assign a reference to a different reference variable, their types must be either compatible or convertible.
When you use the MOVE statement or the assignment operator (=) to assign reference variables, the system must be able to recognize in the syntax check whether an assignment is possible. The same applies when you pass reference variables to procedures as parameters. If you write the statement
<cref1> = <cref2>
the two class references <cref1> and <cref2> must have the same type, that is, they must either refer to the same class, or the class of <cref1> must be the predefined empty class OBJECT. The class OBJECT has no components, and has the same function for reference variables as the data type ANY has for normal variables. Reference variables with the type OBJECT can function as containers for passing references. However, you cannot use them to address objects.
Object Lifetime
An object exists for as long as it is being used in the program. An object is in use by a program for as long as at least one reference points to it, or at least one method of the object is registered as an event handler.
As soon as there are no more references to an object, and so long as none of its methods are registered as event handlers, it is deleted by the automatic memory management (garbage collection). The ID of the object then becomes free, and can be used by a new object.
Declaring and Calling Methods
This section contains explains how to work with methods in ABAP Objects. For precise details of the relevant ABAP statements, refer to the corresponding keyword documentation in the ABAP Editor. The example shows how to declare, implement, and call methods.
Declaring Methods
You can declare methods in the declaration part of a class or in an interface. To declare instance methods, use the following statement:
METHODS <meth> IMPORTING.. [VALUE(]<ii>[)] TYPE type [OPTIONAL]..
EXPORTING.. [VALUE(]<ei>[)] TYPE type [OPTIONAL]..
CHANGING.. [VALUE(]<ci>[)] TYPE type [OPTIONAL]..
RETURNING VALUE(<r>)
EXCEPTIONS.. <ei>..
and the appropriate additions.
To declare static methods, use the following statement:
CLASS-METHODS <meth>...
Both statements have the same syntax.
When you declare a method, you also define its parameter interface using the additions IMPORTING, EXPORTING, CHANGING, and RETURNING. The additions define the input, output, and input/output parameters, and the return code. They also define the attributes of the interface parameters, namely whether a parameter is to be passed by reference or value (VALUE), its type (TYPE), and whether it is optional (OPTIONAL, DEFAULT). Unlike in function modules, the default way of passing a parameter in a method is by reference. To pass a parameter by value, you must do so explicitly using the VALUE addition. The return value (RETURNING parameter) must always be passed explicitly as a value. This is suitable for methods that return a single output value. If you use it, you cannot use EXPORTING or CHANGING parameters.
As in function modules, you can use exception parameters (EXCEPTIONS) to allow the user to react to error situations when the method is executed.
Implementing Methods
You must implement all of the methods in a class in the implementation part of the class in a
METHOD <meth>.
...
ENDMETHOD.
block. When you implement the method, you do not have to specify any interface parameters, since these are defined in the method declaration. The interface parameters of a method behave like local variables within the method implementation. You can define additional local variables within a method using the DATA statement.
As in function modules, you can use the RAISE <exception> and MESSAGE RAISING statements to handle error situations.
When you implement a static method, remember that it can only work with the static attributes of your class. Instance methods can work with both static and instance attributes.
Calling Methods
To call a method, use the following statement:
CALL METHOD <meth> EXPORTING... <ii> =.<f i>...
IMPORTING... <ei> =.<g i>...
CHANGING ... <ci> =.<f i>...
RECEIVING r = h
EXCEPTIONS... <ei> = rc i...
The way in which you address the method <method> depends on the method itself and from where you are calling it. Within the implementation part of a class, you can call the methods of the same class directly using their name <meth>.
CALL METHOD <meth>...
Outside the class, the visibility of the method depends on whether you can call it at all. Visible instance methods can be called from outside the class using
CALL METHOD <ref>-><meth>...
where <ref> is a reference variable whose value points to an instance of the class. Visible instance methods can be called from outside the class using
CALL METHOD <class>=><meth>...
where <class> is the name of the relevant class.
When you call a method, you must pass all non-optional input parameters using the EXPORTING or CHANGING addition in the CALL METHOD statement. You can (but do not have to) import the output parameters into your program using the IMPORTING or RECEIVING addition. Equally, you can (but do not have to) handle any exceptions triggered by the exceptions using the EXCEPTIONS addition. However, this is recommended.
You pass and receive values to and from methods in the same way as with function modules, that is, with the syntax:
... <Formal parameter> = <Actual parameter>
after the corresponding addition. The interface parameters (formal parameters) are always on the left-hand side of the equals sign. The actual parameters are always on the right. The equals sign is not an assignment operator in this context; it merely serves to assign program variables to the interface parameters of the method.
If the interface of a method consists only of a single IMPORTING parameter, you can use the following shortened form of the method call:
CALL METHOD <method>( f).
The actual parameter <f> is passed to the input parameters of the method.
If the interface of a method consists only of IMPORTING parameters, you can use the following shortened form of the method call:
CALL METHOD <method>(....<ii> =.<f i>...).
Each actual parameter <f i > is passed to the corresponding formal parameter <i i >.
Event Handler Methods
Event handler methods are special methods that cannot all be called using the CALL METHOD statement. Instead, they are triggered using events. You define a method as an event handler method using the addition
... FOR EVENT <evt> OF <cif>...
in the METHODS or CLASS-METHODS statement.
The following special rules apply to the interface of an event handler method:
The interface may only consist of IMPORTING parameters.
Each IMPORTING parameter must be an EXPORTING parameter of the event <evt>.
The attributes of the parameters are defined in the declaration of the event <evt> (EVENTS statement) and are adopted by the event handler method.
See also Triggering and Handling Events
Constructors
Constructors are special methods that cannot be called using CALL METHOD. Instead, they are called automatically by the system to set the starting state of a new object or class. There are two types of constructors - instance constructors and static constructors. Constructors are methods with a predefined name. To use them, you must declare them explicitly in the class.
The instance constructor of a class is the predefined instance method CONSTRUCTOR. You declare it in the public section as follows:
METHODS CONSTRUCTOR
IMPORTING.. [VALUE(]<ii>[)] TYPE type [OPTIONAL]..
EXCEPTIONS.. <ei>.
and implement it in the implementation section like any other method. The system calls the instance constructor once for each instance of the class, directly after the object has been created in the CREATE OBJECT statement. You can pass the input parameters of the instance constructor and handle its exceptions using the EXPORTING and EXCEPTIONS additions in the CREATE OBJECT statement.
The static constructor of a class is the predefined static method CLASS_CONSTRUCTOR. You declare it in the public section as follows:
CLASS-METHODS CLASS_CONSTRUCTOR.
and implement it in the implementation section like any other method. The static constructor has no parameters. The system calls the static constructor once for each class, before the class is accessed for the first time. The static constructor cannot therefore access the components of its own class.
Regards
satish