Some useful BAPIs

 BAPI stands for Business Application Programming Interface. These are remote enabled function modules (RFCs).

BAPIs are used to Integrate SAP systems with Non-SAP systems

These FM names start with BAPI_

 

*========================================================

*BAPI_COMPANYCODE_GETDETAIL

*This function module gives address details of a company code

*========================================================

DATA ADDRS1 TYPE BAPI0002_3.

CALL FUNCTION 'BAPI_COMPANYCODE_GETDETAIL'

EXPORTING

COMPANYCODEID  = '1000'

IMPORTING

COMPANYCODE_ADDRESS = ADDRS1.

WRITE/:

ADDRS1-NAME,

ADDRS1-STREET,

ADDRS1-CITY,

ADDRS1-COUNTRY.




*================================================================

*BAPI_SALESORDER_GETLIST

*This function module gives list of Sales orders in the form of an internal table

*================================================================

DATA ORD TYPE BAPIORDERS.

DATA INT_TAB TYPE TABLE OF BAPIORDERS.

PARAMETERS PAR_CUST TYPE C LENGTH 10.

CALL FUNCTION 'NUMERIC_CHECK'

EXPORTING

STRING_IN = PAR_CUST

IMPORTING

STRING_OUT = PAR_CUST.

CALL FUNCTION 'BAPI_SALESORDER_GETLIST'

EXPORTING

CUSTOMER_NUMBER = PAR_CUST

SALES_ORGANIZATION = '1000'

TABLES

SALES_ORDERS = INT_TAB.

LOOP AT INT_TAB INTO ORD.

WRITE:/ ORD-SD_DOC,

ORD-DOC_DATE,

ORD-MATERIAL.

ENDLOOP.

*===========================================================

BAPI_CUST_SAREAS_MATERIALS_GET

*This function module gives list of Materials available to a customer in his sales area

*============================================================

DATA MATL TYPE BAPIMAKT.

DATA INT_TAB TYPE TABLE OF BAPIMAKT.

CALL FUNCTION 'BAPI_CUST_SAREAS_MATERIALS_GET'

EXPORTING

CUSTOMERNO = '0000002311'

SPECIFIC_SALESORGANISATION = '1000'

SPECIFIC_DISTR_CHANNEL = '01'

TABLES

MATERIALS = INT_TAB.

LOOP AT INT_TAB INTO MATL.

WRITE: / MATL-MATERIAL,

MATL-MATL_DESC.

ENDLOOP.


 

Comments

Popular posts from this blog

Domains and Data Elements

How to update exchange rates via process chain in BW

Sample ABAP program for Updating notepad file data to Internal table and Sending it to Application server