Show TOC

TestingLocate this document in the navigation structure

Use

After you have implemented the function module your BAPI is based on and you have defined the BAPI as a method of an SAP business object type in the Business Object Repository (BOR) you should test the BAPI.

Recommendation

Carry out the test together with the persons responsible for quality control in your development group.

Test Phase

The following steps are carried out in the test phase:

Testing the Documentation

Check that the documentation for each business object type, each BAPI and for each interface parameter is available and that you understand it. As the BAPI documentation is critical for being able to use the BAPI, this test should be carried out thoroughly.

Testing the BAPI Syntax

In the test phase you must check that the BAPI meets all the conventions described above and that you have followed the guidelines for developing BAPIs. You can check that the syntax is correct using the BAPI Explorer and the BAPI ToDo. An implicit check is also carried out when the BAPI is appended in the BAPI/BOR Wizard and when it is released in the BOR.

Note

To test the BAPI syntax in the BAPI Explorer, position the cursor on the relevant BAPI in the left-hand frame. Select the tab page Tools in the right-hand frame and then the option BAPI Consistency Checks .

Testing the BAPI Semantics

Once you have checked that the syntax is correct, you have to check that the semantics of the BAPI are correct - its functions and integrity. You can do this in the following ways:

Testing the underlying function module in the Function Builder

You can test the parameters in your function module in one test by entering the appropriate test values in the parameters to verify that the source code in the function module can run without errors. However, the test in the Function Builder has the following drawbacks:

  • The tests do not update the database because a COMMIT WORK cannot be executed.

  • The tests cannot be automated.

  • The test data is not transported into other systems and is lost, if the function module is changed. So, for example, no regression tests can be carried out.

Testing the function module with the extended Computer Aided Testing Tool (CATT)

Function modules can be tested within the SAP standard test tool using an eCATT test script. The use of eCATT has the following advantages over testing in the Function Builder:

  • The tests can be automated.

  • The test data is transported together with the test module and is therefore available in other systems and releases for regression tests.

  • eCATT offers the possibility of performing tests remotely. When doing so, you can combine a number of BAPIs into a block and complete the database updates with BAPI_TRANSACTION_COMMIT.

Recommendation

Tests with eCATT are preferable to tests in the Function Builder because the test runs are retained and can be optimally integrated into the SAP quality assurance process.

More information about using eCATT for testing function modules: eCATT: extended Computer Aided Test Tool .

Testing the BAPI call in an external application

To use a BAPI in an external application, the following conditions must be fulfilled:

  • The syntax of the BAPI is correct. This should be tested by the BAPI developer using the BAPI Explorer.

The communication connection functions without errors. This should be checked using tests from the Middleware departments.

Testing the BAPI on different platforms

The platform tests are carried out during the final assembly. The tests can only be carried out, provided that the BAPI semantics have been tested with eCATT and that the eCATT procedures created in the tests can be used again in the final assembly.

Caution

If you find any errors in the BAPI implementation, correct them and repeat the tests until you and the quality control team in your group are fully satisfied with the BAPI implementation and with the documentation.