nullnullBAPI Development TechEd Hamburg, April 2000
Anton Deimel
Internet Business Framework Architecture
SAP AGBAPI DevelopmentBAPI DevelopmentIntroduction
BAPI DevelopmentChange ManagementCustomer EnhancementsThe SAP Business FrameworkThe SAP Business FrameworkAn integrated family of distributed products
The distributed products are made up of cooperating components
Strategic product architecture
Integration scenarios (example: HR Master Data Distribution)
Business components (example: Human Resources)
Business object types (examples: Employee, Applicant, ...)
BAPI interfaces (example: Employee.ChangeAddress)
ALE enables cross-component integrationBusiness Objects as a Wrapper LayerBusiness Objects as a Wrapper LayerAim of the “Wrapper” approach:
- Object-based view and OO access to data and processes in the R/3 System
- However, implementation is mainly still functionalWhat Is a BAPI?What Is a BAPI?Business Application Programming InterfaceA BAPI is a well-defined interface to the processes and data in a business application system, defined as a method of a business object in the BOR.
A BAPI is implemented as a function module.How Is a BAPI Implemented in the R/3 System?How Is a BAPI Implemented in the R/3 System?Function Library (SE37)Defined in the BORImplemented as a function modulefunction bapi_salesorder_getlist.
------------------------------------------------------------
Local interface: Importing
VALUE(CUSTOMERNUMBER) LIKE ...
...
Exporting
VALUE(RETURN) LIKE ...
Tables
SALESORDERS STRUCTURE ...
------------------------------------------------------------
perform ...SalesOrder.GetListParameters: CustomerNumber Imp
...
Return Exp
SalesOrders Imp/ExpBORImplemented by:BAPI DevelopmentBAPI DevelopmentIntroduction
BAPI DevelopmentChange ManagementCustomer EnhancementsBAPI Development - Getting StartedBAPI Development - Getting StartedBAPI Workshop (optional)
Use the BAPI Explorer (as of 4.6A)
BAPI Project (in the BAPI Explorer)
Programming guideline for BAPIs
Completely revised for 4.6C
Made more concise (approx. 25 pages)
Detail information in appendix All information is available
As Ken documentation (CA-BFA)
In SAPNet at the BFA homepage (alias IBF) Steps for Developing a New BAPISteps for Developing a New BAPIIntegrated in the BAPI Explorer (as of 4.6A)BAPI Development Process: AnalysisBAPI Development Process: AnalysisAn (integration) scenario defines the business process to be implemented either between various R/3 components or between R/3 components and non-SAP components.
An integration scenario forms the basis for developing BAPIs!
Analysis - Draw Up a ScenarioAnalysis - Draw Up a ScenarioIntegration scenario
Issues
Which requirements are met?
What does the business process look like?
How will the business process be realized in the IT-system? (In other words, describe the scenario)
Which business object types are involved? Is there already an object model?
Which methods (BAPIs) are required?
Analysis - Business Object TypesAnalysis - Business Object TypesBusiness object types
Issues
Object model
Independence, uniqueness
Generally applicable for use in BAPIs, Workflow, ArchivLink
Performance, maintenance, ...
Responsibility for object
Names and conventions are important
BAPI Development Process - Designing BAPIsBAPI Development Process - Designing BAPIsBAPIs
BAPI signature defined at conceptual level
Issues
Standardized BAPIs
Full, complete scenario
Complexity of interfaces
Performance, maintenance, ...
Precise names are importantConventions in the Design PhaseConventions in the Design PhaseConventions for BAPI methods
Specify whether it is an instance method or class method
Method name must be in English
BAPI has a return parameter
Customer enhancement possible (ExtensionIn, ExtensionOut)
Conventions for parameters
Parameters and field names must be in English
ISO code fields for ISO-relevant fields
All quantity fields must also have corresponding quantity unit fields
All currency amounts must also have corresponding fields for currency descriptions/namesBAPI Development Process - ImplementationBAPI Development Process - ImplementationCreate structures for BAPI function module parameters in ABAP Dictionary
Create BAPI function module
Include BAPI function module in BOR as API method of the corresponding business object
BAPI documentation
BAPI-ALE integration
Create Structures in DDIC - Data Formats BAPIs are programming interfaces!
Values are not formatted
No domain conversion
Exception: external keys
Example: WBS element
The format for date fields is YYYYMMDD
ISO code (countries, language, currency, quantities)
Additional field for ISO values
Currency amounts have four places after the decimal point
Pass on with correct number of places
Domains BAPICURR, BAPICUREXT Create Structures in DDIC - Data Formats Create Structures in DDIC (2) Create Structures in DDIC (2) Every parameter has a DDIC data structure
Name of structures: BAPI*
30 characters (before 4.0, 10 characters)
No INCLUDEs or APPENDs
Maintenance of check tables, search help for BAPI F4
“Frozen” when BAPI is released
BAPI structures must have English field names
Report BBAPIFLD generates proposed values for each BAPI structure
Define English default names for data elements
Example: COMP_CODE for the data element BUKRS
Create BAPI Function Module (1) Create BAPI Function Module (1)Naming convention: BAPI__
One function group for all the BAPIs of a business object (recommended).
Create BAPI Function Module -
Define Interface Create BAPI Function Module -
Define InterfaceTake key fields into account
Instance method: all key fields are mandatory importing parameters
Class method: no key fields as parameters
Create-method: all key fields are exporting parameters
Use only full key (no partial key allowed)
Every key field is represented by a scalar parameter in the function module
The key parameter in the function module has the same name as the key field in the BOR
Use standard data structures for Return, ExtensionIn and ExtensionOut
The function module must be RFC-enabled Create BAPI Function Module -
Implement the Function Module (1) Create BAPI Function Module -
Implement the Function Module (1)Database changes always by using update task
BAPI can not have any screen output
Intercepting of all messages
A BAPI does not cause a program termination (“A” message)
A BAPI may not dispatch a COMMIT-WORK command
Transaction Model - Explicit COMMITTransaction Model - Explicit COMMITLogonLogoffBAPI1BAPI2ClientR/3TimeRFC sessionSAP LUWBAPI: TransactionCommitCOMMIT WORK Create BAPI Function Module -
Implement Function Module (2) Create BAPI Function Module -
Implement Function Module (2)No Exceptions
Error via return parameter (structure or table)
Parameter name RETURN
DDIC structure BAPIRETURN1, BAPIRET2 (as of 4.0)
Optional: Application Log
Logging of errors
Classification of errors
Optional: More error tables
In addition to the return parameters, you can also define application-specific error tablesError handling Create BAPI Function Module -
Implement Function Module (3) Create BAPI Function Module -
Implement Function Module (3)Provide customer exits for customer enhancements
Mapping BAPI structure - internal structure
Transaction ”BDBS” generates function modules that do the mapping between internal and external structures. (BAPISAP and SAPBAPI)
ABAP source code for the MOVE between German and English field names
ISO code conversions
Converting currency amounts
Converting internal/external keys Create BAPI Function Module -
Generic BAPI Services Create BAPI Function Module -
Generic BAPI ServicesError messages:
Function module BALW_BAPIRETURN_GET1 writes data to BAPIRETURN1
Currency amounts
Domains BAPICURR (19+4) and BAPICUREXT (19+9)
BAPI_CURRENCY_CONV_TO_EXTERNAL
BAPI_CURRENCY_CONV_TO_INTERNAL
Naming conventions for field with ISO codes
_ISO Include as API Method of Corresponding BO Include as API Method of Corresponding BOIn the Business Object Builder:
Select object type to be changed
UtilitiesAPI methodsAdd method
BAPI Wizard
Specify function module BAPI__
Name of method: Words begin with capital letters; do not use any underscores
Parameters: adapt names (capital letters)
Have the system generate method source code for workflow automatically Document the BAPI Document the BAPIDocument all parameters fully
Documentation on return parameter contains all relevant error messages
Documentation specifies whether a COMMIT-WORK was used
Note: Documentation guidelines available in BAPI Programming Guideline BAPI-ALE Integration BAPI-ALE IntegrationBAPI has two working modes
synchronous as RFC
asynchronous by sending an IDoc
Guideline as of 4.0: All (new) asynchronous interfaces (IDocs) are based on BAPIs
How do you get an IDoc?
Develop the required BAPIs
Generate the ALE-Interface (use transaction BDBG):
Message type, Idoc type
Two ALE function modules for inbound and outbound
In this way IDoc interface is identical to BAPI interface
BAPI Development Process - ReleaseBAPI Development Process - Release
What is released?
Function module released externally (in Function Builder)
Business object type released (in BOR)
Method released in BOR
If applicable, corresponding IDoc released (for asynchronous communication)
Once released, the interface may only be changed in a way that is compatible
Check by DDICSidetrack: Enhancements for BAPIsSidetrack: Enhancements for BAPIsCustomers
In the BAPI, the ExtensionIn and ExtensionOut parameters are made available
The parameters are used as data containers in which the customer-specific parameters can be transferred
Structuring by means of table extensions
Code in customer exits
See: Customer Enhancement Guide
Partners and IBUs/Add-On
Define a subtype of the business object
Insert new method Generic BAPI Services (1)Generic BAPI Services (1)BapiService object
“BAPIs are programming interfaces”, internal data presentation
DataConversionExt2Int()
DataConversionInt2Ext()
BAPI documentation (F1)
FieldhelpGetDocu()
InterfaceGetDocu()
Message handling
MessageGetDetail()
Programming model, logical unit of work
TransactionCommit()
TransactionRollback()BapiServiceGeneric BAPI Services (2)Generic BAPI Services (2)HelpvaluesHelpvalues object (F4)
BAPI GetList()
Determines possible entries for a field in a BAPI call
Input: business object, BAPI, parameters, field, search help
Output: list of possible values for the field in question
BAPI GetSearchhelp
Determines existing search help services
Input: business object, BAPI, parameters, field
Output: List of search help services
These search help services can then be used in the GetList BAPIBAPI DevelopmentBAPI DevelopmentIntroduction
BAPI DevelopmentChange ManagementCustomer EnhancementsChange ManagementChange ManagementCustomers and partners use the BOR for
Workflows of their own
Access to external programs via BAPIs
...
Incompatible changes will result in terminations in these programs
Incompatible changes must be avoided!What Does “Incompatible” Mean?
(BAPI example)What Does “Incompatible” Mean?
(BAPI example)Different syntax
Transaction is no longer technically possible (import/export)
Different semantic
Fields of the same type/length, but with a new meaning
Different functionality
Does the BAPI execute the same functionality?
If you have the same input, does you also get the same output as before?
If the BAPI makes changes to the database: are these changes coherent with the changes of the previous version?BAPIs - Compatible and Incompatible Changes
BAPIs - Compatible and Incompatible Changes
Compatible changes
New optional parameters (fields, structures, tables)
Add on new optional fields to existing parameters
Incompatible changes
New mandatory parameters (fields, structures, tables)
Functional dependencies between new and old parameters
Semantic changes to parameters
Deleting, renaming, changing the length of, changing the data type of parameters
Defined process ("End of Life”) (see next slide) “End of Life” Process (BO and BAPIs)“End of Life” Process (BO and BAPIs)What happens in the case of incompatible changes?
Example: 3.1 Object OLD is replaced in Release 4.0 by Object NEW
4.0 Change release
4.5 Subsequent releaseBAPI DevelopmentBAPI DevelopmentIntroduction
BAPI DevelopmentChange ManagementCustomer EnhancementsEnhancements to Business Objects and BAPIsEnhancements to Business Objects and BAPIsBAPI customer enhancement concept
Enhancement option for BAPIs predefined by SAP
For customers only (not for partners or Add-Ons)
Other change concepts for BAPIs
New customer-specific business objects
Changes to existing SAP business objectsnullStandard concept proposed by SAP
Principle:
BAPI enhancement option predefined by SAP
The BAPI must be intended by SAP for enhancement
Benefits:
Not a modification
Largely generic concept
Easy to implement
In simple cases even without own coding Customer Enhancement Concept Elements of a Customer EnhancementElements of a Customer EnhancementExtensionIn and ExtensionOut parameters in the BAPI interface
Used as containers for customer-specific data
BAPI table extensions (data types)
Enable simple (syntactic) interpretation of the data transferred
Customer exits in the BAPI function module
Enables a jump to customer-specific subroutines
ExtensionIn and ExtensionOut ParametersExtensionIn and ExtensionOut ParametersContainers for import and export of customer-specific data without modification of the interface
Table parameters
Data type of the parameters is a standard Dictionary structure:BAPI Table ExtensionsBAPI Table ExtensionsInterpretation of data in container
A structure in the ABAP Dictionary (= data type) must be specified for each data record. This information determines how the data are to be interpreted.
Stored in the STRUCTURE field of BAPIPAREX
Provides simple support for importing and exporting data
Particularly powerful with table enhancement
Define a BAPI Table Extension (= structure) for every DB table to be enhanced
Customer defines additional fields in a structure of his own, and includes these both in the DB table (table enhancement) and in the BAPI Table Extension structure
Supports consistency and generic data processing
BAPI Table Extensions (2)BAPI Table Extensions (2)BAPI Table Extension (Structure)Database TableCustomer Enhancement Structure Customer ExitsCustomer ExitsA customer exit is a point in the source code provided by SAP from which it is possible to go to additional customer code
A BAPI function module usually contains 2 customer exits
First exit:
For checking the customer data in ExtensionIn
Second exit:
For processing customer data
If applicable, update database
Write data to ExtensionOut nullDefine BO in BOR (in customer name range)
Also possible to create methods (BAPIs), attributes and events
If you define a new BAPI: create the function module and store meta information in BOR
Support provided by BAPI development tools (BAPI Explorer)
Support provided by guides Customer-Specific Business ObjectsChanging Existing Business ObjectsChanging Existing Business ObjectsPossible changes:
New methods (BAPIs), attributes, events
Change existing BAPIs
Define a subtype for the SAP business object
Make all changes to the subtype only!
This means that, technically, changes do not represent modifications
Semantic comparison necessary for release change
Buzzword: Fragile Base Class Problem
It is more a case of delegation than inheritance
Inheritance utility used to ensure interface compatibility
However, polymorphism is not supported directly
Changing Existing Business Objects (Details)Changing Existing Business Objects (Details)Define new methods (BAPIs), attributes, events for the subtype
Proceed in the same way as for customer-specific business objectsDelegation from Supertype to SubtypeDelegation from Supertype to SubtypeIn the BOR, you can specify that all calls to the supertypes are automatically delegated to the subtypes
This means that BOR applications defined by SAP (Workflow, for example) also flow via the customer object
Note, though, that this applies only for BOR applications
But, generally speaking, not for calls from external platforms
If customer applications are integrated, we recommend that you always use the subtypeStrategies for Redefining BAPIs (1)Strategies for Redefining BAPIs (1)Create a new implementing function module
Use the original functionality by calling up
This procedure is recommended because it results in clean-cut encapsulation of the original BAPI
Strategies for Redefining BAPIs (2)Strategies for Redefining BAPIs (2)Compatible modification of superordinate function module
Advantage:
Better coupling between original code and enhancement
Disadvantages:
Encapsulation no longer exists
Modification of SAP code Strategies for Redefining BAPIs (3)Strategies for Redefining BAPIs (3)Create a new function module by copying
Advantage:
More flexibility
Disadvantages:
Further data (global variants) might also have to be copied
Much effort involved in making changes for a release upgrade
Difficult to maintain
Generally not recommendedThe SAP Business Framework - OutlookThe SAP Business Framework - OutlookAn integrated family of distributed intra and inter enterprise products
Integration via XML
All BAPIs, IDOCs and relevant RFCs are supported by an new Interface Repository
Strategic product architecture
Integration scenarios
Business components
Business object types
XML BAPI interfaces Business
componentBOBOBAPIBOBAPIBusiness
ComponentBAPISAP Internet Business FrameworkXML
based
Application Linking
本文档为【BAPI开发资料介绍】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。