bapi的创建方法_第1页
bapi的创建方法_第2页
bapi的创建方法_第3页
bapi的创建方法_第4页
bapi的创建方法_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、窗体顶端Implementation Project for New BAPIsThis form will guide you through all the work steps necessary for implementing BAPIs. It also enables you to create a checklist to document the steps as you complete them, thereby providing you with a record of the creation process for your BAPI.  Complet

2、e this form for each of your projects. One project may cover either a single BAPI, or several BAPIs within the framework of one scenario. However, there must only be one person responsible for each project.  Overview: 1. Project Organization 2. Scenario Analysis 3. BAPI Design 4. Defining BAPI

3、Data Structures 5. Creating BAPI Function Modules 6. Defining BAPI Methods in the BOR 7. Documenting BAPIs 8. BAPI/ALE Integration - Generating IDocs 9. ToDo Checks and Tests 10. Release  Project OrganizationProject namePerson responsible for projectQuality Manager Scenario AnalysisBAPIs a

4、re always implemented as part of an integration scenario. This ensures that the various BAPIs complement each other and provide structured, focused access to SAP functionality. When analyzing the scenario, you must answer the following questions:  · What requirements need to be met? 

5、· How can the business process be described in business terms? (= business process description)  · How can the business process be described in software terms? (= scenario description)  · Which business objects are affected? Can you use an existing object model?  ·

6、 Which methods (BAPIs) are required? You can find further information in the BAPI Programming guide under 'Analysis'  Name of the ALE integration scenarioObject model exists.The following BOR methods (BAPIs) must be implemented for the scenario:Business ObjectMethod (BAPI)Function modul

7、e BAPI DesignDuring the design phase, you must define the BAPI signature at a conceptual level. Then describe the contents of the BAPI and specify the parameter names and parameter structure. You can find detailed information on the design phase in the BAPI Programming guide under 'Designin

8、g the BAPI'. During the design phase, you must bear in mind that there is a series of standard methods and parameters that provide certain basic functions. If the BAPIs you want to implement and their parameters are included in this category, then you must adhere to the relevant guidelines. You

9、can find an overview in the BAPI Programming guide under 'Standardized  BAPIs' and under 'Standardized Parameter'.When you are working on the implementation of a BAPI, you must consider whether, based on its functionality, it is an instance method or a class method.Instance meth

10、ods refer to a specific instance of a business object; for example, the SalesOrder.GetDetail  BAPI displays the detailed data for precisely one sales order (which you must specify). Such methods are defined as instance-dependent in the BOR.  Class methods do not refer to a specific instanc

11、e of a business object; for instance, the SalesOrder.GetList BAPI gets a list of all available sales orders that fulfill certain criteria. Class methods include standardized create methods. Create methods are used to create new instances; for example, the SalesOrder.Create BAPI creates a new sales o

12、rder in the SAP System. Such methods are defined as instance-independent in the BOR.  You must adhere to the following conventions for BAPI methods:You must establish whether you are dealing with an instance method or a class method.The method name must be in English (maximum 30 characters).The

13、 individual name components of BAPI names are marked by initial capital letters. Underscores ("_") are not permitted in BAPI names. Every BAPI must have a return parameter that is either an export parameter or an export table.Every BAPI must have an ExtensionIn and an ExtensionOut paramete

14、r to enable customer enhancements.You can find further information on customer enhancements of BAPIs in the document titled 'Customer Enhancement and Modification of BAPIs'.The following conventions are valid for parameters:The parameter and field names must be in English (maximum 30 charact

15、ers).The individual name components of parameter names are marked by initial capital letters to ensure maximum readability.Fields that are ISO-relevant (country, language, quantity, currency) have additional fields for ISO codes.You must include quantity unit fields for all quantity fields, and curr

16、ency descriptors for all currency amount fields. Defining BAPI Data StructuresYou must now define, in the ABAP Dictionary, all data structures (including domains and data elements) that are required for the parameters of the BAPI to be implemented. You can find further information on defining B

17、API data structures in the  BAPI Programming guide under 'Actions in the ABAP Dictionary'. ABAP Dictionary (SE11) The following conventions are valid in this phase: Conventions for BAPI data structures:Each parameter must refer to a data structure in the ABAP Dictionary. For structured

18、parameters, this is always the overall BAPI data structure. However, if the parameter consists of only one field, then it must refer to a field in a BAPI data structure. You must create specific data structures for BAPIs, which must be independent of the data structures that are used generally in SA

19、P applications. Tool: existing internal structures can be mapped to existing BAPI structures using a module to map fields that is automatically generated by a mapping tool (Transaction BDBS). Mapping Tool All data structure names must begin with < namespace > BAPI. You must not use APPENDs or

20、INCLUDEs in BAPI data structures. Conventions for field names.Fields in structures must have easily understandable English names that are no longer than 30 characters.Tool: Internally at SAP, you can use the BAPIFELD report to create a list of proposals for English field names for an ABAP Dictionary

21、 structure. You can find a description of how to use this report in the report documentation. Report BAPIFELDYou must also create an easily understandable English default name that is no longer than 30 characters for each data element. This name then becomes the proposal always given by the BAPIFELD

22、 SAP internal report.Tool: The BAPIFELD report shows which data elements still need to be processed. Enter the default field name for the data element in the ABAP Dictionary using Definition ?Default field name. Report BAPIFELDConventions for Input HelpIndividual values or a value table may be maint

23、ained for a domain, which enables you to use the F4 help. All useful input help (that can be used with the HelpvaluesGetList service BAPI) must be maintained for the data structures/data elements.To do this, you must specify foreign keys for the fields of a BAPI structure. If a value table has been

24、defined for a field domain, then a foreign key is mandatory. Technical ConventionsInternal data presentation is used for all parameters. Tool: Mapping Tool If both an internal and an external key are stored in the database, then the external key must be used for the BAPI interface. Field that are IS

25、O-relevant (country, language, quantity, currency) have additional fields for ISO codes. All currency fields use the BAPICURR domain. In special cases you can also use the BAPICUREXT domain. You must always use a decimal point. All quantity and currency amounts must have the decimal point in the cor

26、rect place.Reason: BAPIs always have standardized amount representations with decimal points. Therefore you must use function modules BAPI_CURRENCY_CONV_TO_EXTERNAL and BAPI_CURRENCY_CONV_TO_INTERNAL to convert currency amounts. . For quantity fields, the reference field/reference table must be set

27、correctly to the quantity unit field. All data elements for date fields have the format YYYYMMDD. Conventions for BAPI/ALE IntegrationBAPI structure names must not be longer than 27 characters, otherwise the automatically generated segment name will be too long and will require manual correction. In

28、dividual fields in a data structure have a maximum length of 250 bytes. Conventions for Customer DevelopmentsIBUs, partners and customers must always observe the namespaces defined by SAP when creating data structures (domains or data elements).  Creating BAPI Function ModulesOnce the parameter

29、s have been defined, the function module on which the BAPI is based is implemented in the Function Builder (Transaction SE37). Function Builder (SE37)  When creating this module, you must observe the following rules:The BAPI is a transactional BAPI.For more information see the BAPI Programming

30、guide under 'Transaction Model for Developing BAPIs'.All function modules must correspond to the following naming convention: BAPI_<Business-Object>_<Method>. A maximum of 30 characters is permitted. If you need to, you can use abbreviations that correspond to the above conventio

31、n, as long as the assignment to the business object remains clear.All BAPIs for one SAP business object type should be summarized to a function group. You should only deviate from this rule in exceptional cases.BAPIs for different object types must not be summarized to a function group. Interface De

32、finition A BAPI parameter must be defined both in the function module and in the method for that business object type in the BOR. The definitions must be identical in both cases, excepting only the key fields of the business object type.You can find further information on interface definition in the

33、 BAPI Programming guide under 'Defining the interface'.The following conventions are valid for key fields with function module interfaces :For instance methods, all BOR key fields are mandatory import parameters in the function module. BOR key fields cannot be export parameters in the functi

34、on module. For class methods, BOR key fields cannot be export parameters in the function module (exception: create methods). BOR key fields also cannot exist as import parameters in the function module. For create methods, all BOR key fields for that method are export parameters in the function modu

35、le. BOR key fields (as for all class methods) cannot be import parameters in the function module. Create methods are defined as instance-independent in the BOR. If key fields occur as parameters in function modules, then you must observe the following conventions:You must use the fully defined key,

36、not the partial key.            Each key for the business object type has its own parameter in the function module. The function module parameter and the BOR key field have the same name. (Underscores ("_") are not allowed in the param

37、etername in the Functuin Builder.)You must also observe the following conventions for function module interfaces:In the Function Builder only capitalization is used. Because of this underscores ("_") are allowed and recommended in order to mark the individual name components of parameterna

38、me. (Example: ExtensionIn, in the Function Builder: EXTENSION_IN). You must use the BAPIPAREX structure for parameters ExtensionIn and ExtensionOut. You must base the return parameter on structure BAPIRET2. The function module must be RFC-capable. Implementing the Function Module The most important

39、BAPI-specific requirements for function module coding are as follows: A BAPI must not execute a  COMMIT-WORK command.The database can only be changed by updating. A BAPI cannot display anything on the screen, that is, it cannot create lists, queries or dialog boxes.This is valid not just for th

40、e BAPI itself, but also for all function modules called indirectly from the BAPI. You cannot use exceptions in a BAPI.Instead, all error messages are returned to the calling program using the standardized parameter Return. A BAPI itself cannot cause program termination, it can only return the corres

41、ponding message (message type A, termination message) in the return parameter. You must provide customer exits to enable customer enhancements of BAPIs.You can find further information on customer enhancements of BAPIs in the document titled 'Customer Enhancement and Modification to BAPIs'.

42、You can find a comprehensive overview of all requirements that you must meet in the  BAPI Programming guide under ' Implementing the Function Module'. Defining BAPI Methods in the BOROnce the implementation of the function module is complete, you must define the BAPI as a business

43、object method. This not only enables central storage in the Business Object Repository (BOR), but also object-oriented access to the BAPI and the option to link to the ALE distribution model (for ansychronous BAPIs). BOR (SWO1)Use the BOR/BAPI Wizard to implement the BAPI as a method in the BOR. Thi

44、s automatically generates the BOR method from the function module. In the BOR, first choose the change mode for the object you are working on and then the menu path:  Utilities ?/font> API methods ?/font> Add methodFollow the steps in the wizard. You will have to complete a few additional

45、 tasks in the wizard. Note the following points in particular: Initial capital letter for each word.Ensure that the import and export behavior of the table parameters is correctly maintained in the BOR.Reason: Unlike function modules, in the BOR you can differentiate between import and export for ta

46、bles. You should only choose Import/Export if the table has actually been imported or exported. The return parameter must always be defined as export. Apart from simplifying the tasks, the wizard also ensures that the BAPI interface is identical in both the BOR and the function module. This is parti

47、cularly important for the following aspects:For every function module parameter there is a BOR parameter (or a key field) with the same name (and vice versa). These two parameters refer to the same ABAP Dictionary structure. These two parameters have the same characteristics (mandatory or optional,

48、import, export or table parameters). Note: If you cannot use the BOR/BAPI wizard (for example, if you are changing the BAPI at a later date or redefining a method), work on the method in the BOR itself. If you are doing this, you must take particular care to observe the points listed above. BOR (SWO

49、1)IBUs, customers and partners must also observe the following additional points:You must read the document titled 'Customer Enhancement and Modification to BAPIs'. As a customer you can create your own BAPIs for your own business object types, or you can define a subtype for an existing SAP

50、 business object type. You must not define new BAPIs for SAP business object types, since this constitutes a modification.See 'Customer Enhancement and Modification to BAPIs' for details. You must create all development objects (business object types, BAPIs and parameters) in your own namesp

51、ace.  Documenting BAPIsFor the BAPI  to be used correctly (particularly by users outside the SAP System) you must provide all relevant information in the documentation.  BAPI documentation is automatically transferred from the function module documentation. Create comprehensive raw do

52、cumentation for each BAPI and each parameter in the Function Builder (SE37). This will then be processed by the documentation developers. You can find further information on BAPI documentation in the BAPI Programming guide under 'BAPI Documentation'. All BAPIs and all parameters are fully do

53、cumented.The return parameter documentation contains all relevant error messages. The documentation developer then saves the active version of the function module and parameter documentation (otherwise the documentation cannot be translated).The business objects have been documented in the BOR. 

54、0;BAPI/ALE Integration - Generating IDocsBAPIs are integrated into the ALE distribution model. ALE distribution is asynchronous and based on messages. ALE distribution is the preferred means of integration for distributed SAP Systems, for instance, for distributing master data. As of Release 4.0, BAPIs are the standa

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论