Programming GetList() BAPIs
With the BAPI GetList() you can select a range of object key values, for example, company codes and material numbers. The key values returned by this BAPI can be passed on to another BAPI for further processing, for example, the BAPI GetDetail().
The BAPIs GetList() is a class method (instance-independent).
Provide all the relevant fields in the interface of the GetList() BAPI. How complex and extensive you structure the interface, depends on the requirements the BAPI is to fulfill.
You should keep the following points in mind when defining the import parameters:
● The interface of a GetList() BAPI must provide selection parameters, in which the required selection criteria can be passed on by the calling program.
●
You must also create the parameter MaxRows that enables you to limit the number of entries selected. This
parameter prevents too large a value set from being selected, if the selection
parameter specification is not very precise.
Use the data element BAPIMAXROW as the reference type for the MaxRows parameter.
●
If customers are to be enabled to enhance the import
parameters of the BAPI without modifications being necessary, you must create
the parameter ExtensionIn.
For information about extension parameters and recommendations on how the
customer enhancement concept should be implemented in a GetList() BAPI,
see
Customer
Enhancements and Modification to
BAPIs.

Since the GetList() BAPI is a class method, you cannot create a parameter in the function module that has the same name as a key field of the corresponding business object type.
You should keep the following points in mind when defining the export parameters:
● The values selected by the BAPI GetList() are returned to the calling program in a table, together with other useful information, for example, short texts.
●
If customers
are to be allowed to extend the export parameters of the BAPI without
modifications being necessary, you must create the parameter
ExtensionOut.
For information about extension parameters and recommendations on how the
customer enhancement concept should be implemented in a GetList() BAPI,
see
Customer
Enhancements and Modification to
BAPIs.
● To report messages from the method call back to the calling program, you should create the export parameter Return . It is of particular importance when errors occur that messages describing the errors in detail are returned. You should, therefore, use all of the fields of the structure BAPIRET2. You should, in particular, fill the fields Parameter, Row, and Field.