The BAPI interface is defined by its input parameters (IMPORT), output parameters (EXPORT), and tables.
After the Adapter Connection wizard has discovered the BAPI interface, the wizard creates a message set that contains an element and a type for the definition of that interface. Each of the import or export parameters has a corresponding field, which has an associated type that can be simple or complex. Tables are represented in the message type definition as repeating complex structures (maxOccurs = -1).
To send an error back to the calling SAP program, use the BAPIReturn structure that was specified as one of the export parameters when the BAPI was defined. Messages are returned in the Return export parameter. You can use the transaction code SE91 for message maintenance.
For more information, see Return Parameters (Error Handling) in
the BAPI Programming Guide Reference on the SAP Help Portal.
As well as the application level errors, which can be reported by the Return export parameter, system or communication failures also exist, which indicate to SAP that the function could not be called or did not complete.