custom development of enterprise services
DESCRIPTION
These are the slides of my talk at SAP Mentor monday 8th november about development of Enterprise Services.TRANSCRIPT
CustomCustom DevelopmentDevelopment of Enterprise Services of Enterprise Services --
WhatWhat doesdoes an Software an Software ArchitectArchitect needneed to to knowknow??
Tobias Trapp
© Tobias Trapp 2010 2
Table of Table of ContentContent
Implementation Details
Standardization of Web Services
Summary
Component Architecture
© Tobias Trapp 2010 3
WhichWhich SAP technology SAP technology isis thethe mostmost appropriateappropriate forfor specificspecific purposespurposes??
� lightweight interfaces: REST are very useful for integration of output and
document management systems
� application integration: A2A services outside-in using PI
� commerce transactions between businesses : B2B services generated
outside-in, propably using PI
� integration using arbitrary clients: A2X services generated outside in
� exposing BOL classes on the fly: CRM Web Service framework
� mobile apps: Sybase CRM Mobile Sales and Mobility for SAP
� coming soon: project Gateway
� exposing function modules on thy fly: inside out generation
WelcomeWelcome to ABAP Web Service to ABAP Web Service JungleJungle!!
© Tobias Trapp 2010 4
„„InsideInside OutOut““ isis a a DeadDead End StreetEnd Street
„Inside Out“ means poor man‘s SOA
� no standardized data types
� we can‘t control mandatory and
non-mandatory elements
� no standardized naming conventions
� no standardized communication patterns
� no patterns for asynchronous scenarios
� no standardized change strategies: first one wins vs. last one wins
� complicated & database–like because of TABLES parameters
� important frameworks are missing
- idempotency
- forward error handling
- no enhancement concept for customers
© Tobias Trapp 2010 5
Enterprise ServicesEnterprise Services
Build your SOA on standards and best practices
� use global data types according UN/CEFACT standards
� develop enterprise „outside in“: generate ABAP proxies from a WSDL (file, URL,
ESR) using transaction SPROXY / SE80
� follow ESR modelling guidelines and create ESR certified content
� from SAP Guidelines for Best-Built Applications that Integrate with
SAP Business Suite:
© Tobias Trapp 2010 6
NearlyNearly everythingeverything youyou needneed to to knowknow isis writtenwritten downdown
There are lots of resources on SCN and SAP Press
� many tutorials about ESR on SDN
� SOA 300 training
� everything about modelling & implementation is written down
in SAP Press Book „Developing Enterprise Services for SAP“
� „How To… Develop, Monitor and Debug WS Consumer
and Provider“
� Enterprise SOA Development Handbook 1.1
� chapter about SOA & loose coupling of
applications in SAP Guidelines for
Best-Built Applications that Integrate
with SAP Business Suite
© Tobias Trapp 2010 7
Enterprise Services Enterprise Services havehave wellwell--defineddefined SemanticsSemantics
Use naming conventions and communication patterns
� naming convention is: <business object view> <action> <message type>
Sales Order Create Request
� actions are Create, Read, Update (first one wins), Change (last one wins),
Cancel and Check: Purchase Order Cancel Check Query Request
� there are well-defined semantics described below:
© Tobias Trapp 2010 8
Table of Table of ContentContent
Implementation Details
Standardization of Web Services
Summary
Component Architecture
© Tobias Trapp 2010 9
SOA SOA byby „„ControlledControlled EvolutionEvolution““
SOA by Design vs. SOA by Evolution
� SAP‘s SOMAID methodology is heavy weight – you need a list of all processes
whether they are IT-based or not
� whenever you can use Enterprise Services of SAP Business Suite - you‘ll find them
on ES work place http://www.sdn.sap.com/irj/bpx/esworkplace
� if necessary enhance SAP standard services as described in
Enterprise Service Enhancement Guide
� create custom Enterprise Services using SAP‘s
modelling approach - construct them from business
objects of your ABAP app.
© Tobias Trapp 2010 10
ABAP ABAP AppsApps, ESR , ESR SWCVsSWCVs and XML and XML NamespacesNamespaces
How to structure ESR development
� SWVCs in ESR correspond to ABAP SCs
� an ABAP application corresponds to an repository namespace
� define data types for reuse in separate namespaces
� create repository namespace for each application containing business objects
� this leads to a hierarchy of repository namespaces
http://tempuri.org/xi/flightmanagement/CRM
http://tempuri.org/xi/flightmanagement/CRM/Global
http://tempuri.org/xi/flightmanagement/BP
http://tempuri.org/xi/flightmanagement/BP/Global
http://tempuri.org/xi/flightmanagement/Global
� hint: avoid special characters in XML names because package names of generatedclasses consumers tend to get complicated – this is a problem of many non-SAPframeworks
© Tobias Trapp 2010 11
ABAP ABAP ComponentComponent StructureStructure
How to structure server proxies according to your ABAP component hierarchy?
� in NW 7.01 there can be only one proxy element per system (and ABAP
namespace).
� ESR dependencies lead to dependencies in ABAP: proxy elements will be reused -
so be careful if the proxies are in different ABAP components:
http://tempuri.org/xi/flightmanagement/CRM
http://tempuri.org/xi/flightmanagement/CRM/Global
http://tempuri.org/xi/flightmanagement/BP
http://tempuri.org/xi/flightmanagement/BP/Global
http://tempuri.org/xi/flightmanagement/Global
� create packages that contain only ABAP proxies
}}
CUSTBP
CUSTCRM
SCs in an
ABAP system
© Tobias Trapp 2010 12
Table of Table of ContentContent
Implementation Details
Standardization of Web Services
Summary
Component Architecture
© Tobias Trapp 2010 13
Best Best PracticesPractices forfor Creating Enterprise ServicesCreating Enterprise Services
Common mistakes and how to avoid them
� specify error handling: system errors, wrong input parameters, missingauthorities…
� consider compensation scenarios: what happens if a web service call fails?
� use forward error handling in asynchronous scenarios
� consider reviews for ESR development – developers tend to break every rulebecause they can do anything in XML
� keep code in generated classes small – delegate to classescontaining business logic for each method
� use naming conventions for data types, parameters, message types and message data types in generated classes
� develop in a test driven way: check ABAP classes using unit tests,test Enterprise Services using ABAP test tool resp. eCATT
� study best practices in SAP guidelines esp. the SAP Press book
� don‘t follow guidelines for SAP Business Suite blindly: asually an ES doesn‘tneed to be XI 3.0 conform and contain more than 1 operation.
© Tobias Trapp 2010 14
AbsolutelyAbsolutely necessarynecessary to to knowknow: : ExtendedExtended XML HandlingXML Handling
Empty values vs. Null values
� NULL values have different semantics compared to initial values:
- NULL values in an update service mean that they should not be changed
- NULL values in a query mean that a data element is not relevant in a search
� Initial values can be coded as empty XML elements
� NULL values can be coded using xsi:nil and missing elements
� In the constructor of a server proxy switch extended XML handling on:
set_extended_xml_handling( i_switch_on = abap_true ).
� Then you get the information about every data element (omitted, xsi:nil, initial) in
an structure PRXCTRLTAB
© Tobias Trapp 2010 15
A A hiddenhidden gemgem: : GenericGeneric Code List Provider FrameworkCode List Provider Framework
Codes can be defined an ABAP backend system
� define code lists as XML schema enumeration types
only if the values are well-defined & do not change
� In most cases code lists are defined in ABAP backend in
customizing tables
� you can bind domain values, (text) tables to server
proxy data elements and read them using the
generic Enterprise Service QueryCodeList
� the framework is extensible – think of time depended
customizing, subsets of customizing sets…
© Tobias Trapp 2010 16
Table of Table of ContentContent
Implementation Details
Standardization of Web Services
Summary
Component Architecture
© Tobias Trapp 2010 17
ExplainExplain to to developersdevelopers thethe conceptconcept of Enterprise Servicesof Enterprise Services
As software architect now you are well prepared for a SOA project, but don‘t
forget:
� keep yourself informed - ABAP frameworks are rapidly evolved by SAP
� learn about eventing, service groups, forward error handling…
What do developers of Enterprise Services need to know?
� a prototype implementation will help developers to understand the concepts
� teach developers the transactional behaviour esp. in update/change services: SET
UPDATE TASK LOCAL, cl_soap_commit_rollback and that enterprise
services are stateless – no DB cursor!
� don‘t forget to test the enterprise services with user with different authorization
profiles in the ABAP backend.