SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
BAPI Step-by-Step




BAPI Step-by-Step



Applies to: SAP ABAP


Summary:


This article demonstrates in a step-by-step process to write ABAP Reports that use BAPI function
modules.


Author(s): Renjith Kumar. P
Company: Pricol Software Soutions.
Created on: 26 January 2007


Author Bio


P. Renjith Kumar is SAP BI Consultant with Pricol Software solutions. He has extensive cross-
functional experience and has been with end-to-end SAP implementations as ABAP Consultant.




SAP DEVELOPER NETWORK | sdn.sap.com                  BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                        1
BAPI Step-by-Step3.doc



     Table of Contents


Business Object Repository............................................................................................................. 3
     BOR Definition........................................................................................................................... 3

     BAPI programming .................................................................................................................... 3

Some Standard BAPI’S ................................................................................................................... 4
      GetList ...................................................................................................................................... 4
      GetDetail................................................................................................................................... 4
      CreateFromData....................................................................................................................... 4
      Selecting the BAPI.................................................................................................................... 7
     Frequently used BAPI: .............................................................................................................. 9

      Sales and Distribution............................................................................................................... 9
      Material Management............................................................................................................... 9
      Production and Planning ........................................................................................................ 10
      Finance ................................................................................................................................... 10
      ABAP Report using BAPI ....................................................................................................... 10
      Testing the Report: ................................................................................................................. 13
Disclaimer and Liability Notice....................................................................................................... 15




SAP DEVELOPER NETWORK | sdn.sap.com                                                       BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                                                                                 2
BAPI Step-by-Step3.doc



Business Object Repository
BOR Definition
All SAP Business Object types and SAP Interface Types and their methods are defined and described in the
R/3 Business Object Repository (BOR). The Business Object Repository was introduced in R/3 Release 3.0,
at the same as time as SAP Business Objects and SAP Business Workflow. Presently, the BOR is mainly
used by SAP Business Workflow.



The BOR has two essential functions:

        It defines and describes SAP Business Objects and SAP Interface Types and their BAPIs.
        It creates instances of SAP Business Objects

BAPI programming
BAPIs are defined in the Business Object Repository (BOR) as methods of SAP Business Objects or SAP
Interface Types and are implemented as function modules. The separation of a BAPI definition from its
actual implementation enables you to access a BAPI in two ways:

        You can call the BAPI in the BOR through object-oriented method calls
        You can make RFC calls to the function module on which the BAPI is based




SAP DEVELOPER NETWORK | sdn.sap.com                       BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                                3
BAPI Step-by-Step3.doc




Some Standard BAPI’S


GetList
          Delivers a list of key fields objects that satisfies certain selection Criteria

GetDetail
          Delivers detailed information of an object, whose complete key has been
          Specified

CreateFromData
           Generates new objects in R3 from key fields and returns information.




SAP DEVELOPER NETWORK | sdn.sap.com                               BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                                      4
BAPI Step-by-Step3.doc




SAP DEVELOPER NETWORK | sdn.sap.com   BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                          5
BAPI Step-by-Step3.doc




The code to illustrate the steps involved when the BAPI ActiveX Control is used to access BAPIs .



•   Creating a BAPI ActiveX Control object
        Set oBAPICtrl = CreateObject(“SAP.BAPI.1”)

•   Creating a logon control object:
        Set oLogonCtrl = CreateObject(“SAP.Logoncontrol.1")

•   Creating a connection object to the R/3 System:
        Set oBAPICtrl.Connection = oLogonCtrl.NewConnection

•   Logging on to R/3 System by calling the logon method of the connection object:
        If oBAPICtrl.Connection.Logon(frmStart.hwnd,FALSE) = FALSE then
          MsgBox"R/3 Connection failed"
          End
        Endif




SAP DEVELOPER NETWORK | sdn.sap.com                       BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                                6
BAPI Step-by-Step3.doc


Selecting the BAPI


1. Give Transaction BAPI, You will get the Following Screen




Now based on you requirement you have to search for BAPI, Here we are going to search for BAPI related to
Purchase Order. Purchase order is in MM so we select that from the list.




We have to get purchase order detail, So Double click on the ‘GetDetail’. The right frame will show the BAPI
name.




SAP DEVELOPER NETWORK | sdn.sap.com                       BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                                  7
BAPI Step-by-Step3.doc




Now Expand The GetList by pressing > , you will get the screen as below



We need Purchase Order Header detail, so double Click Header; you will get Right Frame with the Dictionary
Reference. The Dictionary Reference is BAPIEKKO; Note that you have to use that in Report. Double click
that BAPIEKKO to see the fields that can be displayed in Report.




                       1




                           2




SAP DEVELOPER NETWORK | sdn.sap.com                      BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                               8
BAPI Step-by-Step3.doc




Note down the Fields name from the Components Column that you need in the Report output.


Frequently used BAPI:


Sales and Distribution


Customer Material Info        BAPI_CUSTMATINFO_GETDETAILM

Sales order                           BAPI_SALESORDER_GETLIST

Sales order                           BAPI_SALESORDER_GETSTATUS



Material Management


Purchase Req Item                     BAPI_REQUIREMENT_GET_LIST

Purchase order                        BAPI_PO_GETDETAIL



Purchase order                        BAPI_PO_GETITEMS



SAP DEVELOPER NETWORK | sdn.sap.com                    BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                            9
BAPI Step-by-Step3.doc


Purchase order                        BAPI_PO_GETITEMSREL

Purchase order                        BAPI_PO_GET_LIST

Purchasing info                BAPI_INFORECORD_GETLIST

Production and Planning


Planned order                         BAPI_PLANNEDORDER_GET_DETAIL

Planned order                         BAPI_PLANNEDORDER_GET_DET_LIST



Planned Indep Reqmt                   BAPI_REQUIREMENTS_GETDETAIL




Finance


AP Account                            BAPI_AP_ACC_GETOPENITEMS

AP Account                            BAPI_AP_ACC_GETOPENITEMS

Debtor Credit Account          BAPI_CR_ACC_GETDETAIL

AR Account                            BAPI_AR_ACC_GETOPENITEMS

AR Account                            BAPI_AR_ACC_GETPERIODBALANCES

AR Account                            BAPI_AR_ACC_GETSTATEMENT




ABAP Report using BAPI


Now in The ABAP editor (SE38) create a new report and write the Code


*&---------------------------------------------------------------------*
*& Report       ZBAPI_1
*&
*&---------------------------------------------------------------------*
*&
*&              BAPI TO GET PO ITEM DETAILS
*&---------------------------------------------------------------------*


REPORT     ZBAPI_1.


DATA : BEGIN OF I_POITEM OCCURS 0.
          INCLUDE STRUCTURE BAPIEKPO.    “Include the Structure of dictionary Ref.


SAP DEVELOPER NETWORK | sdn.sap.com                     BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                           10
BAPI Step-by-Step3.doc


DATA : END OF I_POITEM.




PARAMETERS P_EBELN LIKE EKKO-EBELN default '4500012164'.. “ Input .




CALL FUNCTION 'BAPI_PO_GETDETAIL'
    EXPORTING
     PURCHASEORDER                     = P_EBELN
*    ITEMS                             = 'X'
*    ACCOUNT_ASSIGNMENT                = ' '
*    SCHEDULES                         = ' '
*    HISTORY                           = ' '
*    ITEM_TEXTS                        = ' '
*    HEADER_TEXTS                      = ' '
*    SERVICES                          = ' '
*    CONFIRMATIONS                     = ' '
*    SERVICE_TEXTS                     = ' '
*    EXTENSIONS                        = ' '
* IMPORTING
*    PO_HEADER                         =
*    PO_ADDRESS                        =
 TABLES
*    PO_HEADER_TEXTS                   =
    PO_ITEMS                          = I_POITEM.   “ Assign the Internal Table
*    PO_ITEM_ACCOUNT_ASSIGNMENT        =
*    PO_ITEM_SCHEDULES                 =
*    PO_ITEM_CONFIRMATIONS             =
*     PO_ITEM_TEXTS                     = .
*    PO_ITEM_HISTORY                   =
*    PO_ITEM_HISTORY_TOTALS            =
*    PO_ITEM_LIMITS                    =
*    PO_ITEM_CONTRACT_LIMITS           =
*    PO_ITEM_SERVICES                  =
*    PO_ITEM_SRV_ACCASS_VALUES         =
*    RETURN                            =
*    PO_SERVICES_TEXTS                 =
*    EXTENSIONOUT                      =




LOOP AT I_POITEM.


WRITE :/ 'PO NUMBER         = ' , I_POITEM-PO_NUMBER COLOR COL_HEADING,



SAP DEVELOPER NETWORK | sdn.sap.com                 BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                       11
BAPI Step-by-Step3.doc


         / 'ITEM              = ' , I_POITEM-PO_ITEM,
         / 'MATERIAL NAME     = ' , I_POITEM-MATERIAL,
         / 'MATERIAL          = ' , I_POITEM-PUR_MAT,
         / 'CHANGED ON        = ',   I_POITEM-CHANGED_ON,
         / 'SHORT TEXT        = ' , I_POITEM-SHORT_TEXT,
         / 'COMPANY CODE      = ' , I_POITEM-CO_CODE,
         / 'PLANT             = ' , I_POITEM-PLANT,
         / 'MATERIAL GROUP = ' , I_POITEM-MAT_GRP,
         / 'QUANTITY          = ' , I_POITEM-QUANTITY LEFT-JUSTIFIED,
         / 'UNIT              = ' , I_POITEM-UNIT,
         / 'NET PRICE         = ' , I_POITEM-NET_PRICE LEFT-JUSTIFIED.
ULINE.


ENDLOOP.


Note: You can write any no fields from the Dictionary BAPIEKPO in the output, just
         Note the field and give that in the Write statement within LOOP…ENDLOOP



Output of the Report




SAP DEVELOPER NETWORK | sdn.sap.com                       BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                             12
BAPI Step-by-Step3.doc




Testing the Report:
Give transaction ME23 and give the Purchase order no, you can see the details of the report there.




SAP DEVELOPER NETWORK | sdn.sap.com                       BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                               13
BAPI Step-by-Step3.doc




.




SAP DEVELOPER NETWORK | sdn.sap.com   BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                         14
BAPI Step-by-Step3.doc




Disclaimer and Liability Notice
This document may discuss sample coding or other information that does not include SAP official interfaces
and therefore is not supported by SAP. Changes made based on this information are not supported and can
be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods
suggested in this document, and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of
this technical article or code sample, including any liability resulting from incompatibility between the content
within this document and the materials and services offered by SAP. You agree that you will not hold, or
seek to hold, SAP responsible or liable with respect to the content of this document.




SAP DEVELOPER NETWORK | sdn.sap.com                          BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com

© 2007 SAP AG                                                                                                    15

Más contenido relacionado

La actualidad más candente

ABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infoABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infosapdocs. info
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overviewsapdocs. info
 
Sap Abap Reports
Sap Abap ReportsSap Abap Reports
Sap Abap Reportsvbpc
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniquesJugul Crasta
 
Beginner’s guide to sap abap 1
Beginner’s guide to sap abap 1Beginner’s guide to sap abap 1
Beginner’s guide to sap abap 1Panduka Bandara
 
Introducing enhancement framework.doc
Introducing enhancement framework.docIntroducing enhancement framework.doc
Introducing enhancement framework.docKranthi Kumar
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsHicham Khallouki
 
Edit idoc , reprocess and test idoc
Edit idoc , reprocess and test idocEdit idoc , reprocess and test idoc
Edit idoc , reprocess and test idoclakshmi rajkumar
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exitsKranthi Kumar
 
abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)Kranthi Kumar
 
SAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional ConsultantSAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional ConsultantAnkit Sharma
 
Introduction to ABAP
Introduction to ABAPIntroduction to ABAP
Introduction to ABAPsapdocs. info
 
Ab1011 module pool programming
Ab1011   module pool programmingAb1011   module pool programming
Ab1011 module pool programmingSatheesh Kanna
 
User exits
User exitsUser exits
User exitsanilkv29
 
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+Ashish Saxena
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAPsapdocs. info
 

La actualidad más candente (20)

ABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infoABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.info
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overview
 
Sap Abap Reports
Sap Abap ReportsSap Abap Reports
Sap Abap Reports
 
Sap abap
Sap abapSap abap
Sap abap
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniques
 
Abap reports
Abap reportsAbap reports
Abap reports
 
Field symbols
Field symbolsField symbols
Field symbols
 
Beginner’s guide to sap abap 1
Beginner’s guide to sap abap 1Beginner’s guide to sap abap 1
Beginner’s guide to sap abap 1
 
Introducing enhancement framework.doc
Introducing enhancement framework.docIntroducing enhancement framework.doc
Introducing enhancement framework.doc
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflows
 
Edit idoc , reprocess and test idoc
Edit idoc , reprocess and test idocEdit idoc , reprocess and test idoc
Edit idoc , reprocess and test idoc
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exits
 
abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)
 
SAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional ConsultantSAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional Consultant
 
Introduction to ABAP
Introduction to ABAPIntroduction to ABAP
Introduction to ABAP
 
Ab1011 module pool programming
Ab1011   module pool programmingAb1011   module pool programming
Ab1011 module pool programming
 
Badi document
Badi documentBadi document
Badi document
 
User exits
User exitsUser exits
User exits
 
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAP
 

Similar a Bapi step-by-step

SAP Quickviewer
SAP QuickviewerSAP Quickviewer
SAP Quickviewerotchmarz
 
Trigger bi process chain from ecc
Trigger bi process chain from eccTrigger bi process chain from ecc
Trigger bi process chain from eccObaid shaikh
 
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Backup%20 domain%20controller%20(bdc)%20step by-step(1)Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Backup%20 domain%20controller%20(bdc)%20step by-step(1)Srinivas Dukka
 
8077811e 7637-2e10-7c9f-dcb81d630b5c
8077811e 7637-2e10-7c9f-dcb81d630b5c8077811e 7637-2e10-7c9f-dcb81d630b5c
8077811e 7637-2e10-7c9f-dcb81d630b5cYogeeswar Reddy
 
Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3Wiiisdom
 
Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3Wiiisdom
 
Interfacing sap - BDC
Interfacing sap - BDC Interfacing sap - BDC
Interfacing sap - BDC Syam Sasi
 
Creating new unit of measure in sap bw
Creating new unit of measure in sap bwCreating new unit of measure in sap bw
Creating new unit of measure in sap bwRajat Agrawal
 
Rda step by step
Rda   step by stepRda   step by step
Rda step by stepPhani Kumar
 
Reporting data in alternate unit of measure in bi 7.0
Reporting data in alternate unit of measure in bi 7.0Reporting data in alternate unit of measure in bi 7.0
Reporting data in alternate unit of measure in bi 7.0Ashwin Kumar
 
Variables in sap bi
Variables in sap biVariables in sap bi
Variables in sap bishabari76
 
Pricing Efficiency
Pricing EfficiencyPricing Efficiency
Pricing EfficiencyDaya Nadar
 
Journals SAP BPC 7
Journals SAP BPC 7Journals SAP BPC 7
Journals SAP BPC 7khalimail
 
Data extraction and retraction in bpc bi
Data extraction and retraction in bpc biData extraction and retraction in bpc bi
Data extraction and retraction in bpc bivikram2355
 
Data extraction and retraction bpc bi
Data extraction and retraction bpc  biData extraction and retraction bpc  bi
Data extraction and retraction bpc bisakthirobotic
 
inter-company-reconciliation in SAP
inter-company-reconciliation in SAPinter-company-reconciliation in SAP
inter-company-reconciliation in SAPRajeev Kumar
 

Similar a Bapi step-by-step (20)

SAP Quickviewer
SAP QuickviewerSAP Quickviewer
SAP Quickviewer
 
Trigger bi process chain from ecc
Trigger bi process chain from eccTrigger bi process chain from ecc
Trigger bi process chain from ecc
 
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Backup%20 domain%20controller%20(bdc)%20step by-step(1)Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
 
8077811e 7637-2e10-7c9f-dcb81d630b5c
8077811e 7637-2e10-7c9f-dcb81d630b5c8077811e 7637-2e10-7c9f-dcb81d630b5c
8077811e 7637-2e10-7c9f-dcb81d630b5c
 
Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3
 
Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3
 
Interfacing sap - BDC
Interfacing sap - BDC Interfacing sap - BDC
Interfacing sap - BDC
 
Creating new unit of measure in sap bw
Creating new unit of measure in sap bwCreating new unit of measure in sap bw
Creating new unit of measure in sap bw
 
Rda step by step
Rda   step by stepRda   step by step
Rda step by step
 
Reporting data in alternate unit of measure in bi 7.0
Reporting data in alternate unit of measure in bi 7.0Reporting data in alternate unit of measure in bi 7.0
Reporting data in alternate unit of measure in bi 7.0
 
Bte
BteBte
Bte
 
Bte
BteBte
Bte
 
Variables in sap bi
Variables in sap biVariables in sap bi
Variables in sap bi
 
sap
sap sap
sap
 
Pricing Efficiency
Pricing EfficiencyPricing Efficiency
Pricing Efficiency
 
Journals SAP BPC 7
Journals SAP BPC 7Journals SAP BPC 7
Journals SAP BPC 7
 
Data extraction and retraction in bpc bi
Data extraction and retraction in bpc biData extraction and retraction in bpc bi
Data extraction and retraction in bpc bi
 
Data extraction and retraction bpc bi
Data extraction and retraction bpc  biData extraction and retraction bpc  bi
Data extraction and retraction bpc bi
 
inter-company-reconciliation in SAP
inter-company-reconciliation in SAPinter-company-reconciliation in SAP
inter-company-reconciliation in SAP
 
Usgage of ABAP in BI
Usgage of ABAP in BIUsgage of ABAP in BI
Usgage of ABAP in BI
 

Último

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

Último (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Bapi step-by-step

  • 1. BAPI Step-by-Step BAPI Step-by-Step Applies to: SAP ABAP Summary: This article demonstrates in a step-by-step process to write ABAP Reports that use BAPI function modules. Author(s): Renjith Kumar. P Company: Pricol Software Soutions. Created on: 26 January 2007 Author Bio P. Renjith Kumar is SAP BI Consultant with Pricol Software solutions. He has extensive cross- functional experience and has been with end-to-end SAP implementations as ABAP Consultant. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 1
  • 2. BAPI Step-by-Step3.doc Table of Contents Business Object Repository............................................................................................................. 3 BOR Definition........................................................................................................................... 3 BAPI programming .................................................................................................................... 3 Some Standard BAPI’S ................................................................................................................... 4 GetList ...................................................................................................................................... 4 GetDetail................................................................................................................................... 4 CreateFromData....................................................................................................................... 4 Selecting the BAPI.................................................................................................................... 7 Frequently used BAPI: .............................................................................................................. 9 Sales and Distribution............................................................................................................... 9 Material Management............................................................................................................... 9 Production and Planning ........................................................................................................ 10 Finance ................................................................................................................................... 10 ABAP Report using BAPI ....................................................................................................... 10 Testing the Report: ................................................................................................................. 13 Disclaimer and Liability Notice....................................................................................................... 15 SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 2
  • 3. BAPI Step-by-Step3.doc Business Object Repository BOR Definition All SAP Business Object types and SAP Interface Types and their methods are defined and described in the R/3 Business Object Repository (BOR). The Business Object Repository was introduced in R/3 Release 3.0, at the same as time as SAP Business Objects and SAP Business Workflow. Presently, the BOR is mainly used by SAP Business Workflow. The BOR has two essential functions: It defines and describes SAP Business Objects and SAP Interface Types and their BAPIs. It creates instances of SAP Business Objects BAPI programming BAPIs are defined in the Business Object Repository (BOR) as methods of SAP Business Objects or SAP Interface Types and are implemented as function modules. The separation of a BAPI definition from its actual implementation enables you to access a BAPI in two ways: You can call the BAPI in the BOR through object-oriented method calls You can make RFC calls to the function module on which the BAPI is based SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 3
  • 4. BAPI Step-by-Step3.doc Some Standard BAPI’S GetList Delivers a list of key fields objects that satisfies certain selection Criteria GetDetail Delivers detailed information of an object, whose complete key has been Specified CreateFromData Generates new objects in R3 from key fields and returns information. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 4
  • 5. BAPI Step-by-Step3.doc SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 5
  • 6. BAPI Step-by-Step3.doc The code to illustrate the steps involved when the BAPI ActiveX Control is used to access BAPIs . • Creating a BAPI ActiveX Control object Set oBAPICtrl = CreateObject(“SAP.BAPI.1”) • Creating a logon control object: Set oLogonCtrl = CreateObject(“SAP.Logoncontrol.1") • Creating a connection object to the R/3 System: Set oBAPICtrl.Connection = oLogonCtrl.NewConnection • Logging on to R/3 System by calling the logon method of the connection object: If oBAPICtrl.Connection.Logon(frmStart.hwnd,FALSE) = FALSE then MsgBox"R/3 Connection failed" End Endif SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 6
  • 7. BAPI Step-by-Step3.doc Selecting the BAPI 1. Give Transaction BAPI, You will get the Following Screen Now based on you requirement you have to search for BAPI, Here we are going to search for BAPI related to Purchase Order. Purchase order is in MM so we select that from the list. We have to get purchase order detail, So Double click on the ‘GetDetail’. The right frame will show the BAPI name. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 7
  • 8. BAPI Step-by-Step3.doc Now Expand The GetList by pressing > , you will get the screen as below We need Purchase Order Header detail, so double Click Header; you will get Right Frame with the Dictionary Reference. The Dictionary Reference is BAPIEKKO; Note that you have to use that in Report. Double click that BAPIEKKO to see the fields that can be displayed in Report. 1 2 SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 8
  • 9. BAPI Step-by-Step3.doc Note down the Fields name from the Components Column that you need in the Report output. Frequently used BAPI: Sales and Distribution Customer Material Info BAPI_CUSTMATINFO_GETDETAILM Sales order BAPI_SALESORDER_GETLIST Sales order BAPI_SALESORDER_GETSTATUS Material Management Purchase Req Item BAPI_REQUIREMENT_GET_LIST Purchase order BAPI_PO_GETDETAIL Purchase order BAPI_PO_GETITEMS SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 9
  • 10. BAPI Step-by-Step3.doc Purchase order BAPI_PO_GETITEMSREL Purchase order BAPI_PO_GET_LIST Purchasing info BAPI_INFORECORD_GETLIST Production and Planning Planned order BAPI_PLANNEDORDER_GET_DETAIL Planned order BAPI_PLANNEDORDER_GET_DET_LIST Planned Indep Reqmt BAPI_REQUIREMENTS_GETDETAIL Finance AP Account BAPI_AP_ACC_GETOPENITEMS AP Account BAPI_AP_ACC_GETOPENITEMS Debtor Credit Account BAPI_CR_ACC_GETDETAIL AR Account BAPI_AR_ACC_GETOPENITEMS AR Account BAPI_AR_ACC_GETPERIODBALANCES AR Account BAPI_AR_ACC_GETSTATEMENT ABAP Report using BAPI Now in The ABAP editor (SE38) create a new report and write the Code *&---------------------------------------------------------------------* *& Report ZBAPI_1 *& *&---------------------------------------------------------------------* *& *& BAPI TO GET PO ITEM DETAILS *&---------------------------------------------------------------------* REPORT ZBAPI_1. DATA : BEGIN OF I_POITEM OCCURS 0. INCLUDE STRUCTURE BAPIEKPO. “Include the Structure of dictionary Ref. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 10
  • 11. BAPI Step-by-Step3.doc DATA : END OF I_POITEM. PARAMETERS P_EBELN LIKE EKKO-EBELN default '4500012164'.. “ Input . CALL FUNCTION 'BAPI_PO_GETDETAIL' EXPORTING PURCHASEORDER = P_EBELN * ITEMS = 'X' * ACCOUNT_ASSIGNMENT = ' ' * SCHEDULES = ' ' * HISTORY = ' ' * ITEM_TEXTS = ' ' * HEADER_TEXTS = ' ' * SERVICES = ' ' * CONFIRMATIONS = ' ' * SERVICE_TEXTS = ' ' * EXTENSIONS = ' ' * IMPORTING * PO_HEADER = * PO_ADDRESS = TABLES * PO_HEADER_TEXTS = PO_ITEMS = I_POITEM. “ Assign the Internal Table * PO_ITEM_ACCOUNT_ASSIGNMENT = * PO_ITEM_SCHEDULES = * PO_ITEM_CONFIRMATIONS = * PO_ITEM_TEXTS = . * PO_ITEM_HISTORY = * PO_ITEM_HISTORY_TOTALS = * PO_ITEM_LIMITS = * PO_ITEM_CONTRACT_LIMITS = * PO_ITEM_SERVICES = * PO_ITEM_SRV_ACCASS_VALUES = * RETURN = * PO_SERVICES_TEXTS = * EXTENSIONOUT = LOOP AT I_POITEM. WRITE :/ 'PO NUMBER = ' , I_POITEM-PO_NUMBER COLOR COL_HEADING, SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 11
  • 12. BAPI Step-by-Step3.doc / 'ITEM = ' , I_POITEM-PO_ITEM, / 'MATERIAL NAME = ' , I_POITEM-MATERIAL, / 'MATERIAL = ' , I_POITEM-PUR_MAT, / 'CHANGED ON = ', I_POITEM-CHANGED_ON, / 'SHORT TEXT = ' , I_POITEM-SHORT_TEXT, / 'COMPANY CODE = ' , I_POITEM-CO_CODE, / 'PLANT = ' , I_POITEM-PLANT, / 'MATERIAL GROUP = ' , I_POITEM-MAT_GRP, / 'QUANTITY = ' , I_POITEM-QUANTITY LEFT-JUSTIFIED, / 'UNIT = ' , I_POITEM-UNIT, / 'NET PRICE = ' , I_POITEM-NET_PRICE LEFT-JUSTIFIED. ULINE. ENDLOOP. Note: You can write any no fields from the Dictionary BAPIEKPO in the output, just Note the field and give that in the Write statement within LOOP…ENDLOOP Output of the Report SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 12
  • 13. BAPI Step-by-Step3.doc Testing the Report: Give transaction ME23 and give the Purchase order no, you can see the details of the report there. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 13
  • 14. BAPI Step-by-Step3.doc . SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 14
  • 15. BAPI Step-by-Step3.doc Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 15