Blog Layout

BAPI for beginners - Part 1

flabouch • Jan 18, 2021

No need to present SAP, it is one of the most used ERP in the world. Usually, when discussing with our customer, the common challenge they are facing is the in-house technical SAP knowledge and/or the cost of external resources. Therefore they have to make choice based on budget; stable operation and mission critical change having priority, it usually means not much budget left to spend time on process simplification, optimization and automation.

Good news is, SAP do expose the business function to outside program thru the BAPI (Business Application Programming Interface), to make it simple an API. The second good news is that BAPI are accessible from outside SAP. There are a lot of literature out there that can explain in more details BAPI and RFC.

In the following post, we will explain how to use BAPI via python from a regular Windows machine. Same can be done with a Linux machine or a Mac.

1. Python

First, you need to install Python on your computer. All required step can be found on python.org web site.

2. SAP RFC SDK

Download and install the SAP RFC SDK available directly on SAP Website here

After downloading the install will consist on the following steps:

  1. Create the SAP NW RFC SDK home directory, e.g. c:\nwrfcsdk
  2. Set the SAPNWRFC_HOME env variable: =c:\nwrfcsdk
  3. Unpack the SAP NW RFC SDK archive to it, e.g. c:\nwrfcsdk\lib shall exist.
  4. Include the lib directory to the library search path on Windows, i.e. extend the PATH environment variable. Add c:\nwrfcsdk\lib to PATH.

3. Wheel

Install wheel:

 pip install wheel 

4. Microsoft Visual C++ 14.0

If not already on your computer, you will need to insall Microsot Visual C++ 14.0. This website explains the why and how.

5. pyRfc

The last step is to install pyrfc. The best way that has always worked for us is to follow these steps:

 python setup.py bdist_wheel 
 pip install dist/pyrfc-1.9.6-cp27-cp27mu-linux_x86_64.whl 

After these steps, you should be good to go.

you can now move to the next part.

SII Spain Integration thru API
14 Jul, 2023
SII in Spain: What is it, why does your company need to comply, and how to do it?
Integrating VIES VAT Validation with your ERP
By flabouch 19 May, 2022
How to integrate and automate VIES VAT number validation of EU commission with your ERP.
SAP Idoc parser python library
By flabouch 12 May, 2022
SAP Idoc parser in Python
Share by: