Skip to Content

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.

image

 

Add the object element from the palette to the “Business Logic” panel of the editor using drag-and-drop.

 image   

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.

image 

 

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.

image

 

 

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.

image

 

 

Check Result

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.

image

 

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).

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply