1.                   ABAP Classes and Business Workflow: 
We can use ABAP classes in the definition and runtime components of SAP    WebFlow Engine in the same way as object types defined in the Business    object Repository (BOR). 
Before proceeding further we    need to know where to create and maintain ABAP    Classes and ABAP Interfaces. 
2.                     What is Class Builder and its purpose? 
The Class Builder allows us 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. We can display existing classes and interfaces in the class library using the Class Browser.
We can define local classes as well as global classes. They are defined  locally in programs, function groups or as auxiliary classes of global classes  of the class pools. Local classes are only visible within the defining module.
 
ABAP classes are processed using the Class Builder.
 
3.                   How to reach Class Builder? 
To reach the initial screen of the Class Builder, choose Development à Class Builder from the initial screen of the ABAP Workbench or enter transaction code SE24.
   
  
4.                   How does it integrate? 
The Class Builder allows us to create Web development objects within the    ABAP Workbench. We can use the Class Browser to display and maintain existing    global object types from the class library.  
The diagram below illustrates the architecture of the Class Builder and the relationships between its components (including the Class Browser)
From here, we can either display the contents of the class library or edit a class using the Class Editor. Once we have defined an object type, we can implement its methods. From the initial screen or the Class Editor, we can also access the Class Builder’s test environment. We can define the object types immediately after implementing the method in the ABAP Editor. It is also possible to access the test environment from the initial screen or Class Editor.
 5.                     How to use the Class Builder?
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. 
6.                     What are the constraints?
We cannot define object types on the basis of graphical object modeling.
7.                     Note before    creating global classes and interfaces:
Global classes and interfaces that we create in the Class Builder are stored    in the class library and administered by the R/3 Repository: they therefore have    the same namespace as all other Repository objects. It is therefore necessary to    have naming conventions for object types and their components and to use them    uniformly within program development. 
8.                     Naming Conventions in ABAP Objects:  
The following naming convention    has been conceived for use within the SAP namespace. If we do not observe    the naming conventions for object types (classes and interfaces), conflicts will    occur when the system creates persistent classes, since it will be unable to    generate the necessary co-classes. 
9.                   Conventions for Object Types: 
| Class in the class library | CL_   | 
| Interfaces in the class library | IF_   | 
| Local classes in          programs | LCL_   | 
| Local interfaces in          programs | LIF_   | 
 10. Conventions    for Components: 
| Method name |   | 
| Events |   | 
| Local type          definitions within a class | TY_   | 
| Data definitions (variables) |   | 
| Data definitions          (constants) | CO_ 
 | 
11.   Local Conventions within Methods: 
For parameters: 
| IMPORTING parameters | IM_ | 
| EXPORTING parameters | EX_ | 
| CHANGING parameters | CH_ | 
| RESULT | RE_ | 
 12.                Using ABAP Classes in Workflow: 
Within the SAP   WebFlow Engine we can use ABAP classes that support the IF_WORKFLOW   interface. Classes that have implemented the IF_WORKFLOW   interface are recognized as workflow-enabled in the Class Builder. 
13.    How to create ABAP Classes that support IF_WORKFLOW interface? 
- Go to transaction SE24 and create a customized class.
 
- Next the pop up appears where we need to mention the detail as follows:
  
 
- Save it and the class is created.
- Now the class is to implement IF_WORKFLOW interface.       For this go to the       tab and declare the IF_WORKFLOW as the interface       there and press Enter; two sub-interfaces appear: BI_OBJECT       and BI_PERSISTENT. Save the Class. tab and declare the IF_WORKFLOW as the interface       there and press Enter; two sub-interfaces appear: BI_OBJECT       and BI_PERSISTENT. Save the Class.
 
- The ZCL_TEST class now contains the existing methods      of IF_WORKFLOW interface.  
The key attributes are used to  define the object key. There can also be other defined attributes other than key  attributes. The SAP WebFlow Engine can access all public attributes of a class.
Key Attributes:
In the Class Builder there is an   additional column Key   Attributes on the   tab   page as shown below:
 tab   page as shown below:
 
We  need to check this box when we are  defining any attribute as the Key Attribute.
All key fields must be character-type fields (elementary types: CHAR, NUMC) and have a defined length. The maximum length allowed for all key fields is 32 characters. The length of the key field for the persistent display is 32 characters.
In the case of persistent ABAP objects we can use the GUID, which is generated automatically by the object manager when an instance is created.
Attributes:
In addition to all the other data types that the Class Builder supports, we can also define attributes with reference to an object from the Business Object Repository (BOR). To do this, we have to use the structure SWOTOBJID as the data type. The BOR object is determined using the corresponding value.
To assign a BOR object instance to an attribute we need to use the corresponding BOR macros. Normally, this is implemented within the CONSTRUCTOR of a class.
To use the BOR macros in a class, two INCLUDES  must be included.
Ø       Include 
Ø       Include 

11.   Local Conventions within Methods: 
For parameters: 
| IMPORTING parameters | IM_ | 
| EXPORTING parameters | EX_ | 
| CHANGING parameters | CH_ | 
| RESULT | RE_ | 
 12.                Using ABAP Classes in Workflow: 
Within the SAP   WebFlow Engine we can use ABAP classes that support the IF_WORKFLOW   interface. Classes that have implemented the IF_WORKFLOW   interface are recognized as workflow-enabled in the Class Builder. 
13.    How to create ABAP Classes that support IF_WORKFLOW interface? 
- Go to transaction SE24 and create a customized class.
 
- Next the pop up appears where we need to mention the detail as follows:
  
 
- Save it and the class is created.
- Now the class is to implement IF_WORKFLOW interface.       For this go to the       tab and declare the IF_WORKFLOW as the interface       there and press Enter; two sub-interfaces appear: BI_OBJECT       and BI_PERSISTENT. Save the Class. tab and declare the IF_WORKFLOW as the interface       there and press Enter; two sub-interfaces appear: BI_OBJECT       and BI_PERSISTENT. Save the Class.
 
- The ZCL_TEST class now contains the existing methods      of IF_WORKFLOW interface.  
The key attributes are used to  define the object key. There can also be other defined attributes other than key  attributes. The SAP WebFlow Engine can access all public attributes of a class.
Key Attributes:
In the Class Builder there is an   additional column Key   Attributes on the   tab   page as shown below:
 tab   page as shown below:
 
We  need to check this box when we are  defining any attribute as the Key Attribute.
All key fields must be character-type fields (elementary types: CHAR, NUMC) and have a defined length. The maximum length allowed for all key fields is 32 characters. The length of the key field for the persistent display is 32 characters.
In the case of persistent ABAP objects we can use the GUID, which is generated automatically by the object manager when an instance is created.
Attributes:
In addition to all the other data types that the Class Builder supports, we can also define attributes with reference to an object from the Business Object Repository (BOR). To do this, we have to use the structure SWOTOBJID as the data type. The BOR object is determined using the corresponding value.
To assign a BOR object instance to an attribute we need to use the corresponding BOR macros. Normally, this is implemented within the CONSTRUCTOR of a class.
To use the BOR macros in a class, two INCLUDES  must be included.
Ø       Include 
Ø       Include 
 

 







No comments:
Post a Comment