BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications A BPX Cookbook for Developing SAP Netweaver Composite Applications Dipankar Saha Introduction Composite Applications are a new breed of business applications which are developed on top of existing assets and solutions. They have their own lifecycle and extend the functionality of the existing assets and are developed following SOA principles. SAP Netweaver provides a framework called the Composite Application Framework or Composition Environment which supports the development of composite applications on a SAP Netweaver platform and is based on SAP assets such as SAP ERP, SAP CRM, etc., as well as non-SAP assets available in the landscape. In this document, we will discuss how to develop a composite application in SAP Netweaver platform focusing on specification design phases. 1. Specifying Composite Application Specification is the first step in developing a new composite application. While specifying a composite application, the required functionality and features should be documented. This step will help to identify the technical components and assets to be used for the development. To start with, it is important to remember that a composite application is always based on a specific business process. So the definition of a composite application starts with defining a business process. The following steps should be followed in specifying a composite application: 1.1. Specify the Business Problem Describe in detail the business problem which the composite application will address. At this point it is a good idea to state the criticality of the problem so that it can provide a context for understanding the demand for the solution in the market. In addition, identify the target users and the business benefits to be achieved by the composite application. 1.2. Define the Business Process & Process User Roles A composite application is typically based on a business process. In this step business process which will address the issue should be described at a high level. A business process diagram is useful to understand the scenario. An example of the business process diagram is as below for an employee travel request scenario: Employee Travel Request Management Employee Create Flight Booking Request Manager TravelAgent Approve/Reject Booking Request Book Flight & Notify Employee Figure 1 The business process diagram will provide a basic idea of the process and process roles. Each high level step can be broken down into granular sub-steps which will be demonstrated in Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 1 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications subsequent sections. Also define the user roles for each process step from the business process diagram. 1.3. Define the Process Steps The business process described in section 2.2 should be decomposed into granular steps. The process steps should be depicted in a detailed business process flow diagram as below: Employee Travel Request Management Employee Manager Travel Desk 1 Search for Flight 2 Create Flight Booking Request 3 Approve or Reject Approve 5 Create Flight Booking Approve / Reject 4 Receive Notification 6 Receive Confirmation Figure 2: Employee Travel Request Management Also describe each of the process steps using the following table format: Step No Step Title Step Description Interactive (I) Manor datory Background (B) Due date Role handling required Exits Next Step 1 Search Flight Employee enter the search I criteria and submit search Y N Employee Default ◊ 2 2 Create Flight Employee selects a flight I Booking Request from the list and submit booking request Y N Employee 3 Decide On Booking Manager decides on the I Request Request Y Y (within hours) 4 Receive Notification Employee decision receives I Y N 5 Book Flight Clerk updates original order I Y Y (within 24 Clerk hours) Manager Approved ◊ 4,5 24 Rejected ◊ 4 Employee Default ◊ end Default ◊ end Table 1: Description of Process Steps The above table will help to explain the detail activity for each process step as well as the process flow information, such as due date handling, subsequent step and whether a step is interactive (UI based) or a background action. Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 2 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications 1.4. Define the User Interfaces The user interfaces for each interactive process step should be specified using screen mock-ups. This will help while designing and developing the user interface. The above steps will specify the composite application features and functions at a high level and should be typically performed by the Business Analysts or the Business Process Experts. The Guidelines for Specifying Composite Applications is a good resource provided by SAP to capture the specification of a composite application being developed. 2. Designing Composite Application After the specification of the composite application is complete, the design phase is started. In the next steps, the process is decomposed into granular blocks, and the underlying services are identified. 2.1. Service Identification Composite applications are based on services and follow SOA principles. Each process or process step is typically based on a service. Identify the coarse-grained services underlying each process step. For example, Create Travel Booking Request is a service performed in first step of the composite application. These are the composite services that comprise the total business functionality. Include all the identified services following the example in the table below: Service Name Description CreateTravelBookingRequest Creates a flight booking request ApproveTravelBookingRequest Approves or rejects a travel booking request CreateTravelBooking Creates a flight booking based on the request Table 2: List of Identified Services 2.2. Service Decomposition In the next step, decompose the above composite services into granular atomic services if possible. An identified service may perform a set of activities which are executed by a series of atomic services. Include all the atomic services for each composite service as in the table below. Also specify the input, output and exception handling logic for each of the services: Composite Service Atomic Services Description Input Output Exception Handling CreateTravelBookingRequest SearchFlight Search Flight Start date, end date Flight List Start date earlier than end date CheckEmployeeEligibility Checks the employee eligibility for the selected flight employeeID Flight class Employee ID is valid CreateTravelBookingRequest Creates request Flight ID, dates, employee ID, comments Booking ID Flight ID, employee ID and dates are valid SubmitTravelBookingRequest Submit the booking Booking ID Status, Booking ID Copyright © 2008 Dipankar Saha. All Rights Reserved. a www.bptrends.com booking 3 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications request for approval ApproveTravelBookingReque st CreateTravelBooking approver is valid ReviewTravelBookingRequest Reviews the booking request Booking ID Booking details Booking ID is valid ApproveTravelBookingRequest Approves or rejects the travel request Booking ID Confirmati on Booking ID is valid, status is Created BookFlightForEmployee Books a flight for the employee Booking ID Booking Confirmati on Booking ID is valid, status is Approved UpdateBookingRequest Updates the booking request with booking details Booking ID, flight confirmation Confirmati on, status Booking ID is valid, status is Approved CreateInvoice Creates invoice for the flight booking Booking ID, invoice details Invoice number Booking ID is valid, status is Booked NotifyEmployee Notifies employee Booking ID Confirmati on Booking ID is valid, status is Booked the Table 3: Composite Services Decomposed into Atomic Services 2.3. Service Mapping In the next step, map each atomic service identified in section 2.2 to services from existing assets wherever available as in the following table. Existing assets can be enterprise systems such as SAP ERP, SAP CRM or legacy, etc. Wherever a corresponding service is not available from any existing asset, it should be provided by the composite application, i.e. the services should be developed in the composite application. You can use the SDN ES WorkPlace or the Service Registry installed in your local environment to learn the Enterprise Services available, which can be used in the composite application. The Enterprise Services are grouped in the SDN ES Workplace in a hierarchy of Deployment Units, Process Components and Service Interfaces which are referenced by the SAP solution maps. Start with a solution map in ES Workplace for the corresponding business scenario address by the composite application and drill down to find the relevant Enterprise Services. Refer the following document on how to explore the ES Workplace: ES Workplace Handbook Also if an existing service does not support the full business functionality required by the composite application or if multiple existing services provide the actual functionality required, the existing service functionality can be extended as well multiple services can be composed in the CAF Core layer. Also you can refer to the following documents for more information on how to configure and publish enterprise services in the Netweaver CE 7.1 UDDI registry: Configuring & Publishing Enterprise Services from SAP Business Suite system into NWCE (Netweaver Composition Environment) Services Registry Configuring the Services Registry Services Registry Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 4 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications If the required Enterprise Service is not available currently, BAPI or RFC can be used which may provide the corresponding business functionality. Atomic Service Type Provider Provider Service Existing/New SearchFlight RFC/BAPI SAP ECC BAPI_FLIGHT_GETLIST Existing CheckEmployeeEligibility Web Service SAP ECC ECC_ReadEmployeeByIdQR Existing CreateBookingRequest Web Service TravelManagement (Composite) CreateBookingRequestForEmployee New Table 4: Mapping Atomic Services 2.4. Defining the Business Objects Define the business objects used in the process. Each service is consumed by a Business Object, i.e. an atomic service is an operation of a business object. Some business objects are available in the backend while some are custom business objects to be modelled in the composite layer. The source of the business objects should be specified along with the persistency. Also, the attributes of the business objects should be defined here. Business Object/Entity Descripti on Employee Business Object for employe e Booking Request Business Object for travel booking request Attributes Datatype Custom findBy Methods Related BO/Entity Association Type Persistency Backend employeeID String findByEmployeeID BookingRequest Composition Remote SAP ECC employeeName String employeeDepart ment String findByEmployeeDept requestID String findByRequestID Local NA requestText String findRequestByEmplo yeeID requestType String flightNumber String findByStatus startDate DateTime findByTravelDate endDate DateTime status String Table 5: Defining Business Objects The Business Objects defined above are the Entity Services in Netweaver 7.0 and Business Objects in Netweaver CE. The related Business Objects/Entity also must be specified here along with the association type. For details on association and composition of BOs in Netweaver CE 7.1, refer the following SDN blog: Modeling Business Objects in Netweaver CE CAF Core It is not recommended to model the remote business objects/entity in the composite layer. For business objects/entities which exist in the backend/existing assets, the services for the same Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 5 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications should be directly consumed in the composite layer as external services. Modeling remote business objects/entities in the composite layer will increase complexity, and some scenarios may not be supported. Also the Business Objects/Entity should be represented in an E-R diagram as below: <<entity>> 1 0..n Employee <<entity>> BookingRequest 1..n * <<entity>> BOx <<entity>> BOy 1 Figure 3: Business Objects Diagram 2.5. Service Specification Specify the services needs to be developed in the composite application with the relevant details of service operations, input, output, exception handling and dependent service details. Atomic services which are defined and mapped with external services in section 2.2 and section 2.3 are the operations of the services developed in the composite layer. Group the relevant atomic services as operations of a composite service and specify each of them as in the following table. These services have to be developed in the CAF Core layer as application services, which will provide the business functionalities offered by the composite application. Service 1: ManageFlightBookingRequest Operations Description Input Output Exception Handling Dependent Service SearchFlight Search Flight Start date, end date Flight List Start date earlier than end date BAPI_FLIGHT_GETLIST CreateBookingRequest Creates a booking request Flight ID, dates, employee ID, comments Booking ID Flight ID, employee ID and dates are valid Web Service ManageFlightBookingWS None Table 6: Specifying the Composite Services Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 6 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications 2.6. Designing the Process The process steps identified in section 1.3 along with the services and user interfaces identified in section 1.4 define the composite process which will be developed using Guided Procedure. Specify the process blocks along with the actions and callable objects to be developed in Guided Procedure in the table format as below: Block Name Block Type Action Callable Object CO Type ResultState Target CreateTravelRequestAC CreateTravelRequest CO Web Dynpro Java (GP Interface) Submit ApproveTravelReque stAC Cancel TerminateProcessAC Success End Web Dynpro Java (GP Interface) Approve CreateFlightBookingA C Reject SendRejectionMailAC Sequential Block CreateTravelRequest TerminateProcessAC ApproveTravelReque st Sequential Block ApproveTravelRequestA C TerminateProcessCO ApproveTravelReque stCO SendRejectionMailAC SendRejectionMailCO Send Notification Success TerminateProcessAC CreateFlightBookingAC CreateFlightBookingC O Web Dynpro Java (GP Interface) Success NotifyBookingDetailsA C Failure CreateTravelRequest AC Success No Target Sequential Block CreateFlightBooking Terminate Process (Process Control) NotifyBookingDetailsAC NotifyBookingDetails CO Send Notification Table 7: Defining the Process 3. Architecture of the Composite Application A composite application can have the following components: • CAF Core as composite service layer • Web Dynpro/ Visual Composer/Adobe Interactive Forms as user interface layer • Guided Procedure as process layer The following diagram explains the architecture of a composite application in the SAP Netweaver platform: Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 7 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications Role 1 Role 2 Role 3 COMPOSITE APPLICATION Workcenter Step 1 Step 2 Step 3 Step 4 Business Process Actions UI Remote Services Adobe Int. Form UI WebDynpro UI Business Objects Remote Local Visual Composer User Interfaces Business Objects, Services Local Services CAF-Core Exchange Infrastructure BACKEND (optional) RFC/BAPI WebServices Services Services Services CRM BW ERP DB Services Actions Existing Systems DB BO model Service Enablement DB Database Figure 4: Architecture of a Composite Application The backend systems are the enterprise systems, such as SAP ERP, SAP CRM, SAP BI, etc. as well as non-SAP and legacy systems which provide existing business functionality as services that are consumed by the composite layer, i.e. CAF Core and new composite service are developed over them. The composite services are consumed by the user interfaces which are part of the actions or process steps in the Guided Procedure. It is always a good practice to consume the backend service in the CAF layer only and not directly in the user interface layer. 4. Tools and Platform for Developing Composite Applications SAP has released a new platform called SAP Netweaver Composition Environment 7.1 which provides the tools and technologies for development of composite applications in a model-driven development environment. The salient features of Netweaver CE are: • Enterprise Service Repository and Services Registry for provisioning, discovering and consuming Enterprise Services by composite applications • Enhanced CAF Core layer supporting Java EE 5 • Web Dynpro Java for development of user interfaces • Enhanced Visual Composer for development of user interfaces supporting Web Dynpro as well as Flex runtimes. Visual Composer in Netweaver CE can also be used to model Enterprise Portal Content, develop voice-enabled applications. Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 8 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications • Adobe Interactive forms as Composite forms to be used in Guided Procedure and Web Dynpro user interfaces • Guided Procedure with enhanced features to model composite collaborative processes. Figure 5: Composition Capability Provided By SAP Netweaver Platform Netweaver 7.0 along with Netweaver CE 7.1 can provide the service provisioning as well as the composition platform for SAP Netweaver composite applications. Enterprise applications such as SAP ERP, CRM, SCM run on Netweaver 7.0, which uses the service provisioning layer to provide the Enterprise Services defined in Enterprise Service Repository, provided in Netweaver CE 7.1. The Enterprise Services are published in the Services Registry and are consumed by the composite layer in Netweaver CE 7.1. The figure below explains the platform architecture. Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 9 BPTrends ▪ July 2008 A BPX Cookbook for Developing SAP Netweaver Composite Applications Federated Enterprise Portal 7.0 Portal Network Enterprise Portal 7.1 Guided Procedure WebDynpro/Visual Composer/Adobe Forms Composite Services Netweaver CE 7.1 CAF Core Service Discovery Service Consumption Enterprise Service Repository Enterprise Services Registry Service Provisioning Netweaver 7.0 Legacy SAP SCM SAP CRM SAP ERP Service Provisioning Layer Service Consumption Layer Figure 6: Netweaver 7.0 and CE 7.1 as Service Provisioning and Composition Platforms References Composite Application Architecture: Introduction and Basic Overview Composite Application Development Cookbook Architecture Guideline series for Composite Applications Introduction and Basic Overview Architecture Guideline Series for Composite Applications Portal and Process Layer Architecture Guideline Series for Composite Applications Business Logic, Abstraction Layer and Connectivity Composition Environment Info Center CAF Training Materials Online Additional CAF Training Materials Online Author Dipankar Saha is a SAP Certified Enterprise Architect and Advisory system Analyst at IBM India. Email: dipankar.saha@in.ibm.com Dipankar’s SAP Community Network Weblog: https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/251760438 Copyright © 2008 Dipankar Saha. All Rights Reserved. www.bptrends.com 10