Typical Structure of a BAPI

BAPI

BAPIs can be likened to function calls where you pass in inputs (also called "Import" Parameters) and generate outputs (also called "Export" Parameters). Each BAPI is assigned to a corresponding Business Object. In the example below, Material is the Business Object, and the elements below are its corresponding BAPIs.

Besides simple data types like integers and strings, complex Table Parameters can also be passed as inputs or outputs. This is represented in the figure below.

Besides being associated with a Business Object, a nice property of BAPIs is that they tend to follow conventions, where as Function Modules tend to be more arbitrary. While not enforced, BAPIs tend to be maintained across multiple SAP versions, and they often use a standard convention for returning status information. The screenshot below shows the elements of the "BAPIRETURN" structure, which many BAPIs return as an output (or "Export") parameter. This is useful for understanding whether or not the BAPI operation completed successfully.

For BAPIs that need to return multiple records, they may instead return a "BAPIRET2" structure – which contains similar but not identical fields – as a Table Parameter, as shown in the following figure.


Next