A composite application cookbook This blog post discusses how to use the CAF/GP to model an application with two...
enterprise services and one external Web service with minimal coding. Twan van den Broek For a demo on E-SOA and composite applications, Ronald Kleijn and I wanted to develop a composite application with the Composite Application Framework. Last time (see Mash up your application) we sort of did the same but used the Visual Composer as our modeling environment.
Our new goal was: Use the CAF / GP to model our application, use two enterprise services and one external Web service. We wanted to create the application without having to code any line, or at least with a minimum of coding activities. The new application, which was still in our heads, was created by just re-using existing components or templates. And as a last point, we also wanted to explore the role assignment within a process as this was not possible with the VC.
- SAP NetWeaver 2004s (7.00 SP9) demo environment with the CAF and GP installed
- SAP NetWeaver Developer Studio (7.0.09)
- mySAP ERP 2005 (ECC 6.0), system provided via SDN, that provided two enterprise services: ECC_PURCHASEORDER002QR and ECC_SUPPLIERBASICDATABYIDQR
- Microsoft Mappoint that provided the external web service that returns an URL to a map.
And now: the application. As techies, we tried to make a functional demo application that our BPX-to-be colleagues could give an idea of the interesting future that we are heading. So our application starts with a purchase order that the requester wants to get approved from his manager. He enters the PO-number and some accompanying text and sends it for approval. The manager has a look at the details of the PO and also sees where the vendor is located on a map and decides to approve or not. Finally the requester gets a confirmation whether his PO was approved or rejected.
What we did
We started out with the tutorial How to consume an SAP Enterprise Service using Visual Composer and the Composite Application Framework. In this tutorial, the first enterprise service (ECC_PURCHASEORDER002QR) is used in the NW Developer Studio and a new Web service is created. The UI is created with the Visual Composer. Now that was a little bit of a problem, as the VC was not installed on our demo system. So we decided to use the templates that were available in the GP design time. Unfortunately we could not make it happen that all items from the PO were displayed.
As an alternative, we tried to use the UI patterns from the CAF. We tried the Object List pattern and were able to retrieve the metadata of the service. Unfortunately the item table was not visible.
Now it was time to post a question into the Composite Application Framework forum. Dipankar Saha did not provide a solution but lead us to an alternative solution: We created the UI with a Web Dynpro callable object. For this we followed the tutorial Implementing a Web Dynpro Callable Object.
But first the NetWeaver Developer Studio had to be set up to handle this kind of Web Dynpro.
To make sure that the items would get displayed in our Web Dynpro, Dipankar Saha helped us again with his blog How to pass multiple line items data bBetween Web Dynpro Java callable objects in GP.
The standard Microsoft MapPoint Web service is quite extensive and was also not supported by SAP. We built a wrapper to only provide the necessary information. Its only functionality was to provide a URL to the location map on the basis of address information.
The wrapper service was created by using the Visual Web Developer in VB.NET and deployed to a Microsoft server.
Now all components are ready for use in our process. We modeled the process in the GP design time in 4 blocks. By using blocks you get the Phase navigator, which is a good aid to the end user.
An interesting part of modeling your application is the mapping part. With user friendliness in top of our head while we are going to create new (composite) applications in the E-SOA era, this parameter mapping step is very developer unfriendly. Finding the right parameter in a table that shows too few lines is a hard job. In order to make our life easy, we started out by mapping on top level, on process level.
Every block itself passed the test, but unfortunately the whole process did not want to come to life. Somehow we were not able to solve this issue; we tried again and again, created the process once more – but still no luck. Then we thought of doing the mapping of the second block (the one with three actions: GetPoDetails, GetVendorAddress and GetMapUrl) on block level in stead of on process level. That was the golden idea, with three actions in one block you have to map these on block level, the mapping between the blocks is done on process level.
Two roles play a role in our process, the requester and the approver. As we have six actions, we made life a lot easier by consolidating actions to the two roles. During runtime it is now possible to assign a user to a consolidated role instead of having to assign a user to each action.
And finally a screenshot of our working application:
- With the current GP UI elements, it is not possible to display items of a table.
- CAF UI patterns: not possible, input parameters not taken from only default parameters available. Configuration pattern, parameters from service available.
- Take care of proper parameter mapping: with multiple actions within one block, first map the parameters from the actions within the block. After that map the parameters on process level.
- Make sure that the SP release from the NW2004s and the NW Developer Studio are the same. We started with a NW2004s SP8 and a developer studio with SP9. With this difference on SP level there is a fundamental difference in the different CAF packages.
- On TechEd 2006, I heard that the SAP will integrate the Process layer in the Visual Composer. When will that happen? That would make our life as developers so much easier ;-)
Of course we are already looking forward to our next demo. We still want to make the UI patterns working, create the UI via the VC and explore more on the differences between the GP / Phase navigator and the WD / Road map.
Twan van den Broek is managing consultant at Capgemini and clusterlead SAP NetWeaver Development
This content is reposted from the SAP Developer Network.
Copyright 2007, SAP Developer Network
SAP Developer Network (SDN) is an active online community where ABAP, Java, .NET, and other cutting-edge technologies converge to form a resource and collaboration channel for SAP developers, consultants, integrators, and business analysts. SDN hosts a technical library, expert blogs, exclusive downloads and code samples, an extensive eLearning catalog, and active, moderated discussion forums. SDN membership is free.