Start of Content Area

Background documentation Testing  Locate the document in its SAP Library structure

After you have implemented the underlying function module of your BAPI, 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:

This graphic is explained in the accompanying text

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.

This graphic is explained in the accompanying text

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.

This graphic is explained in the accompanying text

Testing the BAPI Semantics

After you have checked that the syntax is correct, you have to check that the semantics of the BAPI are correct (testing the functions and integrity). You have the following options:

Testing the underlying function module in the Function Builder

You can test the parameters in your function module in one test. Enter 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 Computer Aided Testing Tool (CATT)

Function modules can be tested within the SAP standard test tool using the CATT test module type F. The CATT has the following advantages over testing in the Function Builder:

  • The tests do change the database because a COMMIT WORK is automatically executed.
  • The tests can be automated.
  • The test data is transported with the test module and is therefore available in other systems and releases for regression tests.

Recommendation

Tests with the CATT should be carried out in preference to tests in the Function Builder because the test runs are retained and can be optimally integrated into the SAP quality assurance process.

For more information on using CATT for testing function modules, see CATT: Using Function Module Tests.

This graphic is explained in the accompanying text

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 functions without errors.
    This should be checked using appropriate tests from the Middleware departments.

This graphic is explained in the accompanying text

Testing the BAPI on different platforms

The platform tests are carried out during the final assembly. The tests can only be carried out when the BAPI semantics have been tested with CATT, and when the CATT 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.