This web log is continuation of my earlier web log How to develop and manage composite applications using the design time tools in CE 7.1.1? (Part 1): Process Composer.. In this web log, I’ll show you the next step after process composer process creation. This step will explain about how to implement business logic.
Here we go.
After the creation of Process using Process Composer, we need to provide persistent data types for your composite application; we will now define two business objects with the names Employee and Travel. The corresponding database table definition will be generated as a result of this procedure.
To start with these activities, open composite designer.
Create Business Object
To create a business object, expand Business Logic from the palette in the Composite Designer and select Business Object.
Add the object element from the palette to the “Business Logic” panel of the editor using drag-and-drop.
In wizard, accept the suggested value “modeled” for the package and enter “Employee” as the object name. Accept the option “Create new structure” and choose “Finish”.
Creation of New Object for the Object
The business object Employee only exposes a generic structure. To add new custom attribute to the object, proceed as follows:
Double-click the business object’s symbol on the panel (you just created) to open the object editor.
Select the “Structure” tab and choose “Edit Main Structure”. In the structure editor, select the “Edit” tab. To add an attribute, expand the “Existing Types” tree, select “caf.core > primitive > LONG”. Then choose the “Add an Attribute” icon.
Double-click the “Name” property of the new attribute in the “Structure Fields” area and enter the name “employeeId”. Double-click the “Cardinality” property and select the value “1..1” in the list box.
Add Custom Attributes to Object
Repeat the last step to create further custom attributes for the Employee business object:
LastName (Name) | primitive.STRING (Type) | 0..1 (Cardinality)
firstName (Name) | primitive.STRING (Type) | 0..1 (Cardinality)
department (Name) | primitive.STRING (Type) | 1..1 (Cardinality)
Save the new entries.
Define Association between Business Objects
To create a unidirectional association to the Employee object, proceed as follows:
Choose the “Associations” tab of the business object editor for the “Travel” object.
In the “Available Business Object Nodes” tree, select the object node “Employee” and then choose the “Add Association” icon.
Save the new entries.
Generate Table Definitions
To generate Dictionary tables for the business objects and the association you have just created, select the corresponding project node in the Composite Explorer (under Business Logic) and then choose Generate in the context menu.
Open the Dictionary perspective using Click to perform button and explore the table definitions in the table editor.
Developing Business Logic with CAF
Create Application Service
To create an application service, expand Business Logic from the palette in the Composite Designer and select Application Service. In wizard, accept the suggested value “modeled” for the package and enter “TravelRequest” as the service name. Choose “Finish”.
Add a Custom Operation to the Service
The application service you have just created does not yet include all the operations that enable you to define the specific functions for the service. Double-click the symbol of the service created to open the service editor. Select the “Operations” tab and choose “Add”.
In the wizard that appears, select “Custom operation” and choose “Next”.
Enter “submitTravelRequest” as operation name. Leave the other settings unchanged and choose “Finish”.
To add an output parameter, expand the parameters tree on the screen below, select “caf.core > primitive > Data Types > Simple Types > LONG” . Choose “Add to Output”.
In the “Properties” view, enter “requestId” as the output parameter name (“Attributes” > “Name”).
Specify the Input Parameters for Operation
Complete the signature of the submitTravelRequest operation and specify the input parameters as follows:
employeeId (Name) | primitive.LONG (Type)
travelId (Name) | primitive.LONG (Type)
costCenter (Name) | primitive.INT (Type)
Save the new entries.
Define Dependency of the business objects
To define service dependency of the business objects Employee and Travel proceed as follows:
In the service editor, select the “Dependency” tab.
Expand the object tree up to “[DC name] > modeled > Business Objects > Employee”.
Select the “Employee” node and choose the “Add Dependency” icon.Define the dependency for “Travel” in the same way.
Save new entries.
You will see a graph in CAF Model diagram.
In next web log of this series will contain the integration of Business logic with UI Layer and relationship with web Dynpro and the Process and deployment of the product on server (SAP AS Java).