BAPI- What is it and how its used [Part 2]


This posts explains the steps involved in using any BAPI in report/program.


Steps in using BAPI :

1) Find out which BAPI to be used.
Example: To create material found out that BAPI_MATERIAL_SAVEDATA can be used

2) Go to function builder SE37 and see the BAPI. See import and export parameters. Double click on the structure or table type to know whether the fields involved in your program/report are present or not.

3) find out which are fields you require and accordingly create variables of that type only.
Avoid 'like' and use 'type' and' type table of' in case of tables.


4) Pass the values to the BAPI function. Tables parameters requires variables with Header line. All others are just work area.

5) Always after calling BAPI call , BAPI_TRANSACTION_COMMIT to commit the changes (After each BAPI call this has to be done )

6) Keep a breakpoint and look at BAPI return. IF success it shows success message also if problem it lists the problem clearly.
BAPI RETURN TABLE
BAPI RETURN TABLE

7) In case of long text . See the function documentation of BAPI. Use accordingly. Just append each text_line and there you go it will pass long text.

Example program to create/update a material along with long text description of the material.