A BPX Cookbook for Developing SAP Netweaver Composite Applications

Size: px
Start display at page:

Download "A BPX Cookbook for Developing SAP Netweaver Composite Applications"

Transcription

1 A BPX Cookbook for Developing SAP Netweaver Composite Applications Introduction Dipankar Saha 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 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 Manager TravelAgent Create Flight Booking Request 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 1

2 subsequent sections. Also define the user roles for each process step from the business process diagram 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 Approve / Reject 3 Approve or Reject Approve 5 Create Flight Booking 4 Receive Notification Step No Figure 2: Employee Travel Request Management Also describe each of the process steps using the following table format: Step Title 6 Receive Confirmation Step Description Interactive (I) Manor datory Background (B) Due handling required date Role Exits Next Step 1 Search Flight Employee enter the search I Y N Employee Default 2 criteria and submit search 2 Create Flight Employee selects a flight I Y N Employee Booking Request from the list and submit booking request 3 Decide On Booking Request Manager decides on the I Y Y Request (within 24 hours) Manager Approved 4,5 Rejected 4 4 Receive Notification Employee decision receives I Y N Employee Default end 5 Book Flight Clerk updates original order I Y Y (within 24 Clerk hours) 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. 2

3 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 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 CheckEmployeeEligibility Checks the employee eligibility for the selected flight CreateTravelBookingRequest Creates a booking request employeeid Flight ID, dates, employee ID, comments Flight List Start date earlier than end date Flight class Booking ID Employee ID is valid Flight ID, employee ID and dates are valid SubmitTravelBookingRequest Submit the booking Status, 3

4 request for approval approver is valid ApproveTravelBookingReque st ReviewTravelBookingRequest Reviews the booking request Booking details is valid CreateTravelBooking ApproveTravelBookingRequest BookFlightForEmployee UpdateBookingRequest CreateInvoice Approves or rejects the travel request Books a flight for the employee Updates the booking request with booking details Creates invoice for the flight booking NotifyEmployee Notifies the employee Table 3: Composite Services Decomposed into Atomic Services, flight confirmation, invoice details Confirmati on Booking Confirmati on Confirmati on, status Invoice number Confirmati on is valid, status is Created is valid, status is Approved is valid, status is Approved is valid, status is Booked is valid, status is Booked 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 4

5 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 CreateBookingRequest Web Service Web Service SAP ECC ECC_ReadEmployeeByIdQR Existing TravelManagement (Composite) Table 4: Mapping Atomic Services CreateBookingRequestForEmployee New 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 Employee Booking Request Descripti on Attributes Datatype Custom findby Methods Related BO/Entity Association Type Persistency Backend Business Object for employe e employeeid String findbyemployeeid BookingRequest Composition Remote SAP ECC employeename String employeedepart ment String findbyemployeedept Business Object for travel booking request requestid String findbyrequestid Local NA requesttext requesttype String String findrequestbyemplo yeeid flightnumber String findbystatus startdate DateTime findbytraveldate enddate status DateTime 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 5

6 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>> Employee 1 0..n <<entity>> BookingRequest <<entity>> BOx 1 * 1..n <<entity>> BOy 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 Web Service SearchFlight Search Flight Start date, end date CreateBookingRequest Creates a booking request Flight List Start date earlier than end date Flight ID, Booking Flight ID, None dates, ID employee ID employee and dates are ID, valid comments Table 6: Specifying the Composite Services BAPI_FLIGHT_GETLIST ManageFlightBookingWS 6

7 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 CreateTravelRequest ApproveTravelReque st CreateFlightBooking Sequential Block Sequential Block Sequential Block CreateTravelRequestAC TerminateProcessAC ApproveTravelRequestA C CreateTravelRequest CO TerminateProcessCO ApproveTravelReque stco Web Dynpro Java (GP Interface) Submit Cancel Terminate Process (Process Control) Success End Web Dynpro Java (GP Interface) Approve Reject ApproveTravelReque stac TerminateProcessAC CreateFlightBookingA C SendRejectionMailAC SendRejectionMailAC SendRejectionMailCO Send Notification Success TerminateProcessAC CreateFlightBookingAC NotifyBookingDetailsAC CreateFlightBookingC O NotifyBookingDetails CO Table 7: Defining the Process Web Dynpro Java (GP Interface) Send Notification Success Failure Success NotifyBookingDetailsA C CreateTravelRequest AC No Target 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: 7

8 Role 1 Role 2 Role 3 Workcenter COMPOSITE APPLICATION BACKEND Step 1 Step 2 Step 3 Step 4 Business Process Actions Adobe Int. Visual UI UI WebDynpro Form UI Composer User Interfaces Business Objects, Remote Business Objects Local Services Services Services Local Remote CAF-Core Exchange Infrastructure (optional) RFC/BAPI WebServices Service Enablement Services Services Services Existing Systems CRM BW ERP DB DB DB Services Actions BO model 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. 8

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

10 Enterprise Portal 7.0 Federated Portal Network Enterprise Portal 7.1 Guided Procedure WebDynpro/Visual Composer/Adobe Forms Netweaver CE 7.1 Composite Services Service Discovery Enterprise Services Registry CAF Core Enterprise Service Repository Service Consumption 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. dipankar.saha@in.ibm.com Dipankar s SAP Community Network Weblog: 10