Monday, October 14, 2019

BAPI

WHAT IS A BAPI & BAPI WRAPPER ?


BAPI is a function module which is remotely enabled & does not raise any exceptions.
It is defined as business API’s for SAP objects. They play an important role in the technical integration & in the exchange of business data between SAP components & between SAP & non SAP components.

A BAPI wrapper is a Remote enabled Function Module in a backend system, that has a specific signature, so that it can be used in a mobile scenario.
Typically, it calls a BAPI in the backend system, so it 'wraps' a BAPI, hence the name.
As long as a Remote enabled FM follows the standard signature of a BAPI wrapper, it can be called a BAPI wrapper even if it doesnt actually call one.
Conceptually, a BAPI wrapper has the role of a private method of a business object (SyncBO) and resides in a backend system.

Let's say you want to mobilize a Sales Order scenario. You will need a set of BAPI wrappers (GETLIST, GETDETAIL etc) for distributing Sales Orders.
Now, if there already BAPIs in your backend that do this work, then all you need to do is write RFC FMs, which call the BAPIs on the backend instead of getting data directly from tables. If you don't have already BAPIs for a Sales Order, you can still make BAPI wrappers (since a BAPI wrapper is simply an RFC enabled FM), without using any BAPIs, but which get their data directly from the corresponding Sales Order table(s).
Then you can go ahead and use these BAPI wrappers.

The main thing is this:
1. To make a BAPI wrapper, you need to make a RFC FM with a particular signature. That FM can then be called a BAPI wrapper.
2. It does not matter how a BAPI wrapper does its work internally, as long as it's signature follows the standard. i.e. It may or may not call a BAPI.

Summarizing this can say that you create a function module (RFC or not) in which you call the BAPI you are trying to 'wrap'. This is oftenly done because (for example) the interface of a BAPI (import / export / tables) is quite 'large'. 
To avoid this, one creates a wrapper in which a lot of coding is already done before the BAPI is called. So when calling the wrapper, the calling program has (a lot) less to do before it can use the BAPI.

Tcode BAPI - will give you a list of BAPIs

Some comooly used BAPIs -

PO Creation : BAPI_PO_CREATE

Sales order Creation : BAPI_SALESORDER_CREATEFROMDAT2
sales order change : BAPI_SALESORDER_CHANGE
Delivery : BAPI_OUTB_DELIVERY_CONFIRM_DEC



AMOR FATI - LOVE OF FATE







No comments:

Post a Comment