Show TOC

Implementing Your Own BAPIsLocate this document in the navigation structure

Use

SAP provides a large number of BAPIs. If you want to implement your own BAPIs, you have to use your own namespace.

Procedure

You have the following options:

  • You can develop your own BAPI in the customer namespace.

  • You can modify a BAPI delivered in the standard system:

    1. Copy and modify the function module belonging to the original BAPI.

    2. In the Business Object Repository, create a subobject type for your BAPI object type in the customer namespace by choosing Start of the navigation path Tools Next navigation step Business Framework Next navigation step BAPI Development Next navigation step Business Object Builder End of the navigation path.

      When you create the subobject, the subtype inherits the methods of the business object.

    3. Set the status of the object type to Implemented ( Start of the navigation path Edit Next navigation step Change Release Status Next navigation step Object Type End of the navigation path).

    4. You can change and delete the methods of the subtype or enhance them with your own methods.

Notes on Asynchronous BAPIs

If you want to implement an asynchronous ALE business process, you have to maintain a BAPI-ALE interface from the BAPI.

If you implement a BAPI as an asynchronous interface, in addition to following the standard programming BAPI guidelines, keep in mind the following:

  • The BAPI must not issue a COMMIT WORK command.

  • The BAPI return parameter must use the reference structure BAPIRET2.

  • All method export parameters with the exception of the return parameter are ignored and are not included in the IDoc that is generated.

  • Status records log the BAPI return parameter values.

    After the function module which converts the IDoc into the corresponding BAPI in the receiving system has been called, status records are written for the IDoc in which messages sent in the return parameter are logged.

    If the type field is filled with A (abort) or E (error) in at least one of the entries of the return parameter, this means:

    1. Type A:

      Status 51 (error, application document not posted) is written for all status records, after a ROLLBACK WORK has been executed.

    2. Type E:

      Status 51 (error, application document not posted) is written for all status records and a ROLLBACK WORK is executed.

    Otherwise status 53 (application document posted) is written and a COMMIT WORK is executed.