0% found this document useful (0 votes)
12 views

BAPI setup

The document outlines key BAPIs used in SAP SD, including their purposes and associated business objects. It provides configuration steps for using BAPIs, examples of ABAP code for creating a sales order, common issues and solutions, and best practices for BAPI usage. Additionally, it emphasizes the importance of error handling and proper authorization when integrating with external systems.

Uploaded by

gaurikp7a
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

BAPI setup

The document outlines key BAPIs used in SAP SD, including their purposes and associated business objects. It provides configuration steps for using BAPIs, examples of ABAP code for creating a sales order, common issues and solutions, and best practices for BAPI usage. Additionally, it emphasizes the importance of error handling and proper authorization when integrating with external systems.

Uploaded by

gaurikp7a
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Key BAPIs Used in SAP SD

BAPI Name Purpose Business


Object

BAPI_SALESORDER_CREATE Create Sales Order BUS2032


FROMDAT2

BAPI_SALESORDER_CHANGE Change Sales Order BUS2032

BAPI_SALESORDER_GETLIS Get Sales Order List BUS2032


T

BAPI_OUTB_DELIVERY_CRE Create Outbound BUS2081


ATE_SLS Delivery

BAPI_DELIVERYPROCESSIN Process Outbound BUS2081


G_EXEC Delivery

BAPI_BILLINGDOC_CREATE Create Billing BUS2091


Document

BAPI_CUSTOMER_CREATEFR Create Customer BUS1006


OMDATA1 Master

BAPI_PRICING_CONDITION Maintain Pricing BUS2032


S Conditions
Configuration Steps for Using BAPIs in SAP SD
Step 1: Check Business Object Repository (BOR)

1.​ Go to Transaction SWO1


2.​ Enter the Business Object (e.g., BUS2032 for Sales Order)
3.​ Confirm that the relevant BAPI is listed under the business object

Step 2: Create a Custom Function Module (Optional)

👉 If customization is needed, create a Z-function module that calls the standard


BAPI:

1.​ Go to SE37 → Create a new function module


2.​ Include the BAPI logic (using CALL FUNCTION)
3.​ Activate and release the function module

Step 3: Test the BAPI

1.​ Go to SE37
2.​ Enter the BAPI name (e.g., BAPI_SALESORDER_CREATEFROMDAT2)
3.​ Input the required parameters
4.​ Execute the function
5.​ Check the Return Table (RETURN) for success or error messages

Step 4: Configure Authorization for BAPI Use

👉 Ensure that the user executing the BAPI has the required authorizations:
1.​ Go to PFCG
2.​ Create a Role → Assign the relevant Authorization Objects (e.g., S_RFC)
3.​ Assign the role to the user

Step 5: Add BAPI to External or Internal Application

●​ If the BAPI will be triggered externally (e.g., from a non-SAP system), create
a Remote Function Call (RFC) connection:
1.​ Go to SM59 → Create RFC Destination
2.​ Define Connection Type = 3 (ABAP Connection)
3.​ Assign the Program ID and Gateway Host

Example: Using BAPI_SALESORDER_CREATEFROMDAT2 to Create a Sales Order

Sample Code (ABAP):

DATA: lt_return TYPE TABLE OF bapiret2,

ls_order_header TYPE bapi_salesorder_header_in,

lt_order_items TYPE TABLE OF bapi_salesorder_item_in,

ls_order_item TYPE bapi_salesorder_item_in.

* Populate Order Header Data

ls_order_header.doc_type = 'OR'. " Order Type - Standard Order

ls_order_header.sales_org = '1000'. " Sales Organization

ls_order_header.distr_chan = '10'. " Distribution Channel

ls_order_header.division = '00'. " Division

* Populate Order Item Data

ls_order_item.itm_number = '000010'.

ls_order_item.material = 'MAT001'. " Material Code

ls_order_item.target_qty = '10'.

APPEND ls_order_item TO lt_order_items.

* Call the BAPI

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

order_header_in = ls_order_header

TABLES
order_items_in = lt_order_items

return = lt_return.

* Handle Return Messages

LOOP AT lt_return INTO DATA(ls_return).

WRITE:/ ls_return.

ENDLOOP.

* Commit Work

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Output:

✅ Sales Order Created Successfully: Document Number 123456​


✅ Error: Check the RETURN table for details

Common BAPI Issues and Solutions

Issue Cause Solution

BAPI returns Incorrect parameters passed Double-check input


no data parameters in SE37

Material not Material is not created in the Extend material to the sales
found relevant sales area area using MM01

Customer not Customer master data missing Create/extend customer


found or incomplete using XD01
Document not BAPI_TRANSACTION_COMMIT Always call
posted not called BAPI_TRANSACTION_COMMI
T after execution

Authorization Missing S_RFC authorization Assign the correct role in


failure PFCG

Best Practices for BAPI Usage

✔️ Always handle errors using the RETURN table.​


✔️ Ensure that the BAPI is remote-enabled for external integration.​
✔️ Use BAPI_TRANSACTION_COMMIT to confirm changes.​
✔️ Test in a sandbox system before deploying in production.​
✔️ Avoid direct table updates; use BAPIs for data consistency.

✅ Frequently Used BAPIs in SAP SD – Cheat Sheet


BAPI Name Purpose Business
Object

BAPI_SALESORDER_CREATE Create Sales Order BUS2032


FROMDAT2

BAPI_SALESORDER_CHANGE Change Sales Order BUS2032

BAPI_SALESORDER_GETLIS Get Sales Order List BUS2032


T

BAPI_OUTB_DELIVERY_CRE Create Outbound BUS2081


ATE_SLS Delivery
BAPI_DELIVERYPROCESSIN Process Outbound BUS2081
G_EXEC Delivery

BAPI_BILLINGDOC_CREATE Create Billing BUS2091


Document

BAPI_CUSTOMER_CREATEFR Create Customer BUS1006


OMDATA1 Master

🌟 Summary:
✅ BAPIs are the safest and most effective way to integrate SAP SD with external
✅ Ensure proper configuration of business objects and authorization.​
systems.​

✅ Handle errors gracefully using the RETURN table.​


✅ Always call BAPI_TRANSACTION_COMMIT after executing a BAPI.

You might also like