Model your Composite Application in NetWeaver CE 7.1 Ehp 1
From NetWeaver 2004S to NetWeaver CE 7.1 we have created composite application from Composite Application Explorer and for Business Object and Application Service we have used right click on composite application project. But from NW CE 7.1 Ehp 1 we can create Application Service, Business Object, Operation and we can import external service and all the related activities using graphical tool and here we need to use just drag and drop features. I will share here how you can model CAF project using graphical tool.
<u>Introduction of CAF modeling Tool</u>
Please go to Composite Application perspective using the link Window -> Open Perspective -> Others ->
Composite Application and create a CAF project, called cafempl
The composite project will be available in Composite Application Explorer. Now right click on project +cafempl + and select Open Diagram. On right hand side you will get CAF model diagram board.
Within the Palette you will get the entire required artifact which you need to model your composite application. Please find below the diagram for details
*_Create
Business Object_*
From the Palette click
on Business Object Node and drag it to design board. It will ask you for
business object name. Please put the business object name like Employee and click on Finish.
To create an attribute select Attribute from Palette and drag it on business object Employee and put the attribute name like
empId, type is String.
Same way as above please add another attribute called empName, type is String.To create an operation please select Operation from Palette and drag it on BO Employee. In the wizard please put the name of operation +searchEmployeeById + and select empId
as input parameter of the operation and click on Finish.
*_Create an
Application Service_ *
From the Palette click on Application Service and drag it to design board. It will ask you
for Application Service name. Please
put the Application Service name like
EmployeeApp and click on Finish. To create an operation please
select Operation from Palette and
drag it on Application Service EmployeeApp.
In the wizard please put the name of operation, +getEmployeeNameById +and clicks on Finish.
To make the dependency between Employee BO and EmployeeApp
application service please select +AS
Dependency + from Palette and drag it
from +EmployeeApp + application service to +Employee + BO.
Note: From the
Permissions tab page of BO please uncheck +permission
check enabled+ check box.
Now from Composite Application Explorer edit the application
service EmployeeApp and switch to
operations tab page. Please select the operation (getEmployeeNameById) which
you have created for application service. Bellow of the screen you will get the
operations parameters. Please add input parameters, output parameters and
faults for the operation like below.
To put your business logic please switch to Implementation
tap page and put the following code within the operation +getEmployeeNameById +and also put the return result.
public java.lang.String
getEmployeeNameById(java.lang.String employeeId) throws
com.sap.caf.rt.exception.CAFServiceException {
EmployeeServiceLocal
employeeServiceLocal = this.getEmployeeService();
String emplname =
employeeServiceLocal.searchEmployeeById(QueryFilterFactory.createFilter(employeeId)).get(0).getEmpName();
return emplname;
}
*_Build, Deploy and
Test_*
Now save and generate the application. Next you need to go
for build and after successful building please deploy it in server (Before
deploy please make it confirm that your server is configured in NWDS). After
successful deployment we can go for testing. To test the application please
open the link, http://<Host>:<Port>/caf ->Service Browser. Here
you will find you project within navigator. Please select your Business Object,
Employee and create some data like below.
Now select your application service operation
and put the employee id like 01234 and execute. You will get the result.
*_Note_: *Within the cafempl/metadata
you will find the .xmi (XML Metadata
Interchange) file corresponding to your diagram.