BAPI:
Business Application Programming Interface
It is an interface programming across business applications
Difference between BDC & BAPI:
BDC BAPI
BDC BAPI
In BDC we have to update the database Via Screens BAPI updates the database directly
Screen mapping is compulsory No mapping required
BDC programs not effective for Large applications BAPI ensures very good
(poor performance) performance for all
In upgradation projects as there may be New screens
with new fields therefore you
Have to rewrite your BDC program Same BAPI programs can be reused
Can upload data for Every
BDC is not available for Every transactions Transactions
Features of BAPI:
1. BAPI is an interface programming
2. It is based on Object Oriented Programming
3. It supports all types of Languages (.Net, Java, C++………etc)
4. In BAPI, RFC function module converted to method & the same method
is accessed by 3rd party communication interfaces
5. BAPI is synchronous
Business Object:
The entire business objected oriented programming is designed based on
business objects
Every business object holds business data & does not allow it to access
by outside world
Components of Business Object:
1. Kernel
2. Integration Layer
3. Interface Layer
4. Communication Layer
Kernel:
It holds inherent data
Integration Layer:
In this layer methods are defined for accessing Kernel data
Interface Layer:
Here interfaces (BAPIs) are maintained for integrating with methods
Communication Layer:
All communication interfaces (RFC, CORBA……..etc) can access this layer
Other Components of Business Object:
1. Object Type
2. Key Fields
3. Methods
4. Attributes ………….etc
Object Type:
Business Objects are created based on Object Type
It acts as a blue print (or) template for creating business objects
Key Fields:
Using this option key fields are maintained (Customer Number, Sales
Order………etc)
Methods:
The main logic for extracting business data is maintained using Methods
Attributes:
These are the parameters which are passed & returns from Methods
These are actually part of Methods
BOR:
Business Object Repository
It is the central repository for all business object types & their BAPIs
Features of BOR:
1. It acts as central access point (or) repository for all Business Objects,
Object Types, Their Key Fields, Methods …………..etc
2. All 3rd party Communication interfaces can access Business Objects
stored in BOR
3. Business Objects maintained in BOR remains stable for a long time
Note:
The T code for working with BOR is BAPI & SW01
Where BAPIs are used in Real Time:
1. In all modules (SD, MM, PP, HR ………etc)
2. In dimensional products (CRM, APO, SCM………etc)
3. In ALE directly
***Types of BAPIs:
1. Standard BAPI
2. Custom BAPI
3. Extended BAPI
Standard BAPI:
In standard BAPI, all BAPI function modules are predefined
Object:
Create a bank in client database
Solution:
Go to SE38
Program: ZFI_BAPI_BANK
Create
Title: Uploading bank data using BAPI
Type: Executable Program
Save
*SELECTIO N-SCREEN: BEGIN OF BLOCK b1 WITH FRAME
*TITLE TEXT-000.
*PARAMETERS: p_banks TYPE banks,
* p_bankl TYPE bankl.
*SELECTION-SCREEN: END OF BLOCK b1.
DATA: wa_bank_address TYPE BAPI1011_ADDRESS,
wa_return TYPE BAPIRET2.
wa_bank_address-bank_name = ‘Sbi’.
wa_bank_address-street = ‘Lbnagar’.
wa_bank_address-city = ‘Mumbai’.
wa_bank_address-bank_brnch = ‘Lbnagarbranch’.
CALL FUNCTION ‘BAPI_BANK_CREATE’
EXPORTING
BANK_COUNTRY = p_banks
BANK_KEY = p_bankl
BANK_ADDRESS = wa_bank-address
IMPORTING
RETURN = wa_return.
IF SY-SUBRC EQ 0.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
EXPORTING
WAIT = ‘X’.
ENDIF.
IF wa_return-message IS NOT INITIAL.
WRITE:/30 wa_return-message.
ELSE.
MESSAGE ‘Bank created successfully’ TYPE ‘I’.
ENDIF.
Object-2:
Create interface program for update bank data
Solution:
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE
TEXT-000.
PARAMETERS: p_banks TYPE banks,
p_bankl TYPE bankl.
SELECTION-SCREEN: END OF BLOCK b1.
DATA: wa_bank_address TYPE BAPI1011_ADDRESS,
wa_return TYPE BAPIRET2.
wa_bank_address-bank_name = ‘Sbi’.
wa_bank_address-street = ‘Tnagar’.
wa_bank_address-city = ‘Chennai’.
wa_bank_address-bank_brnch = ‘Tnagarbranch’.
wa_bank_addressx-street = ‘X’.
wa_bank_addressx-city = ‘X’.
wa_bank_addressx-bank_brnch = ‘X’.
CALL FUNCTION ‘BAPI_BANK_CHANGE’
EXPORTING
BANK_COUNTRY = p_banks
BANK_ADDRESS = wa_bank-address
BANK_ADDRESSX = wa_bank-addressx
IMPORTING
RETURN = wa_return.
IF SY-SUBRC EQ 0.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
EXPORTING
WAIT = ‘X’.
ENDIF.
IF wa_return-message IS NOT INITIAL.
WRITE:/30 wa_return-message.
ELSE.
MESSAGE ‘Bank updated successfully’ TYPE ‘I’.
ENDIF.