Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 39

BAPI’S

Overview

Overview


BAPI stands for

BUSINESS APPLICATION PROGRAMMING INTERFACE

It is also called as B+API

BUSINESS OBJECT REPOSITARY (BOR) :

It is a Repository of Business objects or container of

Business objects.

SWO1 is the tcode for Business objects

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 3
BusninessObject
Overview


BUSINESS OBJECT(BO) :


It is an object which is similar to class, which is group of
attributes methods, interfaces, key fields, events for a
particular Business Application or Scenario.

SWO1 is the TCODE for Business Object Repository

Examples for Business objects are,

BUS1001 – Materials

BUS2012 – Purchase Order

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 5
Overview


BUS1001

Methods are :

BAPI_Material _Get detail

BAPI_Material_GETLIST

BUS2012

Methods are :

BAPI_PO_GETDETAIL

BAPI_PO_GETITEMS

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 6
Overview

What is BAPI?

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 7
Overview


BAPI:

It is also an Remote Enable function module which is
used to communicate between SAP-SAP or SAP-
NONSAP servers.

Basically BAPI uses RFC Technology

In the Initial stage it is a RFC Function module

Later, this RFC Function module will be inserted into a
business object, Now it is converted into BAPI.

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 8
Overview

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 9
Overview

Differences between RFC & BAPI

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 10
Overview


Both are used to communicate between SAP-SAP &
NONSAP-SAP.

Both are remote enabled FM

The difference is,

RFC’s are called as Standalone Function Modules.

BAPI’s are part of Business Objects which are used to
communicate with other BAPI’s, events, Interfaces,
attributes, Key fields etc., with in a single B.O.

This is not possible with RFC’s. Because they are
standalone FM’S
 SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 11
Overview

USAGE OF BAPI’S

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 12
Overview


BAPI’S are used in 3 scenarios.

1)Report generation using BAPI’S

2)Using standard or custom BAPI to communicate
between SAP & NONSAP

3)Using BAPI’s for uploading data into SAP instead of
BDC.

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 13
Overview

RULES FOR BAPI’S

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 14
Overview


RULES FOR BAPI’S:

Every BAPI should start with BAPI or ZBAPI.

All the Importing and Exporting parameters should be of
Type structures, not the direct Data Types.

All the structures must start with BAPI or ZBAPI.

All the Parameters must be pass by Value because
BAPI’S doesn’t support pass by reference.

Every BAPI should have a returning Parameter by Name
RETURN or BAPIRET2, to display success or error
messages.
 SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 15
Overview


If BAPI is Success, we have to use another BAPI
BAPI_TRANSACTION_COMMIT to Save the Data into
Database Tables.

If the BAPI has error, use another BAPI
BAPI_TRANSACTION_ROLLBACK to revert back the
changes made to the Database Tables.

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 16
Overview


Report generation using BAPI’S

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 17
Overview


Reports:

Develop a Report which displays Material Details

Develop a Report which displays list of the Materials for
a given Range.

BAPI_MATERIAL_GETLIST_PROG.txt


Develop a report which displays PO Details

Develop a report which displays list of items for a PO .

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 18
Overview


Developing Custom BAPI

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 19
Overview


Develop a Custom BAPI to display the Material details
which can be used by NON-SAP.

Step 1: Create structures for Importing and Exporting
Parameters.

Step2: Create a function module and make it as remote
enabled.

Step3 : Create a BO.

Step4 : Embed or insert RFC into BO so that it will be
converted into BAPI.

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 20
Overview


Step 1: Create structures for Importing and Exporting
Parameters.

Go to SE11

Create a structure by Name ZBAPI_MATNR

Create a single field MATNR.

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 21
Overview


Again Go to SE11

Create another structure by name ZBAPI_MARA

Create the fields MATNR, MTART, MBRSH, MEINS

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 22
Overview


Step2: Create a function module ZBAPI_MAT_GET_DET
and make it as remote enabled

Goto SE37

Create a function module ZBAPI_MAT_GET_DET

Specify importing parameter as below with pass by
value.

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 23
Overview


Specify Exporting parameter as below with pass by
value.

Ssssssssssssssssssssssssssssssssssssssssssssssss
ssssssssssssssssssssssssssssssssssssssssssssssss
ssssssssssssssssssssssssssssssssssssssssssssssss
ssssssssssssssssssssssssssssssssssssssssssssssss

Specify returning parameter as below:

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 24
Overview


Write the below source code:

FUNCTION ZBAPI_MAT_GET_DET.

select SINGLE * from mara
into CORRESPONDING FIELDS OF mara
WHERE matnr = matnr .

ENDFUNCTION.

Save it.

Make the FM as REMOTE ENABLED .

Save, Activate and test it .

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 25
Overview


Step3 : Create a BO

Go to SWO1Give the BO name as ZYBUS1001

Click on CreateSpecify the details as below :

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 26
Overview


Put the cursor on methods

Click on Utilities  API-METHODS  ADD METHOD


Give the Function Module name as
ZBAPI_MAT_GET_DET

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 27
Overview


Press enter

Click on NEXT STEP button

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 28
Overview


Again click on NEXT STEP button


A pop-up is displayed with below message

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 29
Overview


Click on Yes

Now our RFC is converted into BAPI

Click on SAVE Click on BACK

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 30
Overview


Goto Object Type  Change Release Status 
Implemented

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 31
Overview


Again Go to Object Type  Change Release Status 
Released

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 32
Overview


Now our Business Object is released and it can be
visible/used by NON-SAP System

Mapping from NON-SAP fields to BAPI fields will be
done by NON-SAP Consultants.

The Remote connection between SAP and NON-SAP
Servers will be done by BASIS Consultants

As an ABAP Consultant, our role is to develop a BAPI
and give it to NON-SAP Consultants

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 33
Overview


BAPI’S For uploading Data

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 34
Overview

Business Requirement:
Develop a program for uploading material
master data.

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 35
Overview


Interview Questions

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 36
Overview

What is an RFC FM?

What is an RFC Destination?

Have you created it?

What is Tcode for RFC Destination?

How do you create RFC fm?

Can I use PASS BY REF in RFC? If not, why?

What is a BAPI?

What is the diff between RFC and BAPI?

What is BO?
 SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 37
Overview

What is the tcode for BO/BOR?

Can you give me some ex on BO?

What are the prerequisites for creating BAPI?

Can I use PASS BY REF?

Tell me some BAPI names what you have used and
where you have used?

How do you find BAPI?

What is diff between BDC AND BAPI when uploading
data?

How do you create a custom BAPI?
 SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 38
Overview

What is the use o RETURN parameter in BAPI?

Suppose, if BAPI is success, what will you do?

Suppose, if BAPI is Error, what will you do?

 SAP AG 2001, Smart Forms - the Form Printing Solution,


Claudia Binder / Jens Stumpe 39

You might also like