BAPI FROM BASICS

BAPI IN BOR:

SAP business objects provide an object-oriented view of business data and processes in the R/3 System.The Business Object Repository (BOR) manages business objects, organizational objects, and technical objects in a hierarchical display corresponding to the component hierarchy in the R/3 System.Methods in a business objects let you change or display its attributes.

COMPONENTS OF OBJECT TYPE:

- Basic data: Technical details such as an internal ID, release level, transport data, and so on.

- Interfaces: List of the interface from which the object type adopts attributes, methods, and events.

- Key fields: Attributes that uniquely identify an object of this type. Usually the key fields of the underlying database tables.

- Attributes: Object attributes.

These are either values from database fields (field references), values that are calculated at runtime (virtual attributes), or pointers to other objects (object references). Object references are particularly useful in Workflow definitions, allowing you to navigate easily between objects that belong together in a particular business context.

- Methods: Calls to R/3 transactions, function modules, or other ABAP code.

BAPIs are known as API methods.

- Events:

To be used in workflow definitions. The events are only defined in the BOR. To trigger an event, you can use the following (for details, see the online documentation on workflow definition):
- Links to change documents for the underlying database fields
- Links to the status administration
- Links to message control
- Calling the function module SWE_EVENT_CREATE

WHAT IS BAPI?

BAPIs are special, remote-enabled methods of a business object, and are implemented as RFC-enabled function modules.

BAPIs can perform various functions such as:
- cretaing an object
- querying the attributes of an object
- changing the attributes of an object

USES OF BAPI:

You can use BAPIs for different applications. For example:
­ Internet application components: Where individual R/3 functions are implemented on the Internet or Intranet for users with no R/3 experience.

­ Building R/3 components Communication between the business objects from different R/3 components (applications).

­ VisualBasic / JAVA / C++ : External clients access R/3 data and processes through the BAPIs.

BAPI ATTRIBUTES:

You can access BAPIs from external clients like methods access objects, which are themselves an instance in the client.

SAP guarantees that no incompatible changes will be made to the interfaces of BAPIs.

You can also use BAPIs within the R/3 System to access business data. This makes it easier for customers and partners to add to the functions offered by the system.

Displaying data that is transmitted to a BAPI or that is returned from a BAPI must be done from the calling program.

The return parameter RETURN contains success or error messages for the BAPI, and depending on the SAP R/3 Release has the dictionary structure BAPIRETURN, BAPIRETURN1, BAPIRET1, BAPIRET2 or BAPIRET2_FIX. The (common) relevant fields of these structures are:
TYPE (Message type: S(uccess), E(rror), W(arning), I(nformation) ) ;
ID (message class) ; NUMBER (message number) ; MESSAGE (message text) ;
MESSAGE_V1 , MESSAGE_V2 , MESSAGE_V3 , MESSAGE_V4 (message variables)

If the transmission is successful, RETURN is either completely empty (all the fields have their initial fields for their types), or only the TYPE field has the value 'S'. Refer to the documentation to find out which applies to the BAPI you are using.

DATA BASE UPDATES WITH BAPI:

Database updates in BAPIs are always performed by an update. The update type (synchronous or asynchronous) is specified when you call the COMMIT-BAPIs.

In BAPIs containing database updates, a COMMIT / ROLLBACK WORK is not used. Closing or rejecting a BAPI-LUW occurs by calling a special BAPI from the service object BapiService (object type 'SAP0001').
BAPI TransactionCommit (relevant function module BAPI_TRANSACTION_COMMIT)
BAPI TransactionRollback (relevant function module BAPI_TRANSACTION_ROLLBACK)

ACCESSING BAPI FROM EXTERNAL SYSTEM:

When you use BAPIs, there are 2 phases that SAP supports:

Development -

The programmer needs to know which business objects are available with which BAPIs, and what the interface looks like. You can find out this information using the BAPI Browser in the Business Object Builder. The BAPI Browser is a logical view of the BOR in which only those objects are displayed that have BAPIs. The complete interface of each BAPI is displayed.

Runtime -

SAP delivers libraries for BAPI calls for various development environments (Visual Basic, C++, Java). These libraries encapsulate the technical details of the communication, enabling developers to call a BAPI from outside the system without having to worry themselves about how BAPIs are actually implemented in the system.

ACCESSING BAPI FROM ABAP:

You can only access BAPIs currently from an ABAP program using the relevant direct function call (local or remote). SAP is planning for a later release for all BOR business objects to be integrated in the class library of ABAP so that you will be able to access BAPIs from ABAP using ABAP-OO.

The naming convention for BAPI function modules is: BAPI__

There are no exceptions for BAPI function modules.
Success or error messages are returned by the RETURN export parameter, which depending on the SAP R/3 Release has the dictionary structure BAPIRETURN, BAPIRETURN1, BAPIRET1, BAPIRET2 or BAPIRET2_FIX. The (common) relevant fields of these structures are:

TYPE (Message type: S(uccess), E(rror), W(arning), I(nformation) ) ;
ID (message class) ; NUMBER (message number) ; MESSAGE (message text) ;
MESSAGE_V1 , MESSAGE_V2 , MESSAGE_V3 , MESSAGE_V4 (message variables)

If the transmission is successful, RETURN is either completely empty (all the fields have their initial fields for their types), or only the TYPE field has the value 'S'. Refer to the documentation to find out which applies to the BAPI you are using.

RELATED POSTS

BAPI 1
 

No comments :

Post a Comment