a step by step guide for beginners on user defined bapi creation - abap development - scn wiki

Upload: raky0369

Post on 11-Oct-2015

77 views

Category:

Documents


8 download

TRANSCRIPT

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-

    Getting Started Newsletters Store

    Search the CommunityWelcome, Guest Login Register

    Products Services & Support About SCN Downloads

    Industries Training & Education Partnership Developer Center

    Lines of Business University Alliances Events & Webinars Innovation

    Added by aby.joseph, las t edited by aby.joseph on Nov 08, 2011

    ABAP Development / Data Transfers - BAPI, BDC, ALE, LSMW, DX-WB / BAPI

    A step by step guide for beginners on user defined BAPI creation

    A step by step guide for beginners on user defined BAPI creation

    Link to Content's target Space :

    http://wiki.sdn.sap.com/wiki/display/ABAP/BAPI

    Applies to:

    SAP ERP

    Summary

    A simple guide for beginners on creating a user defined BAPI and how to test it. The guide is prepared in a step by step format with almost all possible screenshots. This guide contains 5 stages wh

    explained in 30 simple steps. A basic know ledge in ABAP and Function module is preferred for the reader.

    Author: Abyson Joseph Chavara

    Company: Applexus Technologies (P) LTD.

    Created on: 26 July 2011

    Author(s) Bio

    Abyson Joseph Chavara is w orking as an SAP ABAP consultant at Applexus Technologies (P) LTD. He has an experience of 2 years in ABAP programming and 1 year in SAP PI.

    Table of Contents

    Stage1: Creating a structure in SE11

    Stage2: Creating the function module in SE37

    Stage 3: Creating the business object in SWO1

    Stage 4: View ing the created BAPI in BAPI Explorer

    Stage 5: Test your BAPI

    Introduction

    A Business Application Programming Interface (BAPI) is a precisely defined interface providing access to process es and data in business application systems such as R/3. BAPIs are defined as AP

    methods of SAP business object types. These business object types and their BAPIs are described and stored in the Business Object Repository (BOR). A BAPI is implemented as a function module

    stored and described in the Function Builder.

    BAPIs can be called w ithin the R/3 System from external application sys tems and other programs. BAPIs are the communication standard f or business applications. BAPI interface technology f orms

    basis for the f ollowing developments:

    Connecting:

    New R/3 components, f or example, Advanced Planner and Optimizer (APO) and Business Information Warehouse (BW).

    Non-SAP softw are

    Legacy systems

    Isolating components w ithin the R/3 System in the context of Business Framew ork

    Distributed R/3 scenarios w ith asynchronous connections using Application Link Enabling (ALE)

    Connecting R/3 Systems to the Internet using Internet Application Components (IACs)

    PC programs as frontends to the R/3 System, for example, Visual Basic (Microsof t) or V isual Age f or Java (IBM).

    Workflow applications that extend beyond system boundaries

    Customers' and partners ' ow n developments

    BAPI is basically a RFC enabled function module. The diff erence betw een RFC enabled function module and BAPI is business objects. You create business objects and those are then registered in y

    BOR (Business Object Repository) w hich can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA . In this case you only s pecify the business ob

    http://wiki.sdn.sap.com/wiki/display/ABAP/BAPIhttp://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creationhttp://scn.sap.com/welcomehttp://scn.sap.com/welcomehttp://scn.sap.com/welcomehttp://scn.sap.com/welcomehttp://wiki.sdn.sap.com/wiki/display/ABAP/BAPIhttp://wiki.scn.sap.com/wiki/display/ABAP/A+step+by+step+guide+for+beginners+on+user+defined+BAPI+creationhttp://wiki.scn.sap.com/wiki/display/ABAP/BAPIhttp://wiki.scn.sap.com/wiki/display/ABAP/Data+Transfers+-+BAPI%2C+BDC%2C+ALE%2C+LSMW%2C+DX-WBhttp://wiki.scn.sap.com/wiki/display/ABAPhttp://wiki.scn.sap.com/wiki/display/~jkwfb3qhttp://wiki.scn.sap.com/wiki/display/~jkwfb3qhttp://scn.sap.com/community/uachttp://scn.sap.com/community/developer-centerhttp://scn.sap.com/community/downloadshttp://wiki.scn.sap.com/wikihttp://wiki.scn.sap.com/wiki/login.jsp?os_destination=%2Fdisplay%2FABAP%2FA%2Bstep%2Bby%2Bstep%2Bguide%2Bfor%2Bbeginners%2Bon%2Buser%2Bdefined%2BBAPI%2Bcreationhttp://scn.sap.com/welcomehttp://www.sapstore.com/http://scn.sap.com/community/newslettershttp://scn.sap.com/community/getting-started
  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-

    its method from external sys tem. In BAPI there is no direct system call, w hile RFC are direct system call. Some BAPIs prov ide basic f unctions and can be used f or most SAP business object types . T

    BAPIs should be implemented the same for all business object types . In short BAPI is a RFC enabled func tion module on the w rapper of Business object.

    In this guide I have started w ith creating a s tructure in dictionary. Then I am creating a s imple remote enabled function module. The function module fetches some details f rom Table T001 based on th

    company code (BUKRS). Table T001 contains the Company Codes. The next step is creating a business object using SWO1 and w e are adding the above f unction module as a method of that busine

    object. Af ter completing the steps in SWO1 we w ill find our c reated BAPI in BAPI Explorer. Then w e w ill do the testing of BAPI by inputting some values.

    Stage1: Creating a structure in SE11

    Step 1:Go to transaction SE11 and create a struc ture as show n or as per y our requirement.

    Do not forget to save it in a package. Check the structure (ctrl + F2) and activate (ctrl + F3) the structure.

    Stage2: Creating the function module in SE37

    Step 2:Go to transaction SE37 w here you c reate func tion modules.

    Click on create af ter you enter the name of the function module. Enter the f unction group and short tex t. Now c lick on save button.

    Note:If f unction group is not already made, you could create it f rom Goto > Function group > Create Group fr om the initial screen of SE37.

    Step 3:A message w ill be displayed Function module name is reserved f or SAP. Just click continue.

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-

    Step 4:A scr een w ill be displayed as below. In the attributes tab, make the process ing type as Remote-Enabled Module.

    Step 5:Now go to the Import tab and enter the details as f ollows or as per your requirement. Here I am giving the associated type as ZBAPISTRT001-BUKRS that w e have created in previous stage

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-

    Step 6:In the export tab enter the details as below .

    Step 7:In the Tables tab enter the details as below .

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-

    Step 8:Now go to the source code tab and enter the code as show n below.

    Step 9:Next w e have to release the f unction module by Function Module>Release>Release.

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-

    Stage 3: Creating the business object in SWO1

    Step 10:Go to transac tion SWO1 and enter the name of the BAPI you w ould like to c reate and click cr eate. Here I have given the name ZBAPI_ABY. In the coming screen Enter the details as below

    per requirement and click continue. That w ill ask you to save the object. Save it in a package.

    Step 11:In the resulting screen click on the methods to drop down and see w hat methods are provided by default. There would be tw o methods, show ing in red color w hich comes by default whil

    creating the BAPI. Now selec t Add Method from Utilities > API Methods > Add Method.

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-

    Step 12:On the screen that f ollows , provide the f unction module name that w e just created in the prev ious stage and click on the continue icon. In the coming pop-up, click the next step icon. We ob

    that the information is predef ined in the fields.

    Step 13:This is the next screen w here you w ould just click on the next icon.

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation

    Step 14:A popup w ill be displayed as below.

    Click on Yes . You c an see an information message reading ZBAPIT001 inserted.

    Step 15:Now save after you add the method. Select & Double click on the A PI method.

    Go to Tab: ABAP Check 'API Function' as show n below .

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-

    Select the Radio button reading A PI Function as already said above.

    Step 16:Now select the Object ZBAPI_ABY as show n below.

    Step 17:Now Go to : Edit > Change Release Status > Object type > To Modeled.

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-a

    Step 18:The below show n screen w ill be displayed. Click on yes.

    The message show s, The object type status s et to modeled. ( or already modeled )

    Step 19:Now go to: Edit > Change Release Status > Object type >To Implemented. You can see a message reading Object type status set to implemented .

    Step 20:Now, go to: Edit > Change Release Status > Object > To Released. There w ould be tw o pop ups coming up. Click continue on the Pop Ups.

    Step 21:Keep the cursor on the 'Method'. Now go to: Edit > Change Release Status > Object type component> To Modeled. (Shown as below).

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-a

    Step 22:Now, go to: Edit > Change Release Status > Object type component > To Implemented. You can see the message reading s tatus f or method zbapif mt001 set to implemented.

    Step 23:Now go to: Edit > Change Releasse Status > Object type component > To Released. You can see the message reading status f or method zbapifmt001 set to Released.

    Step 24:Click on Generate from Object Type as show n below .

    Af ter clicking on the generate button, you can see the message reading Object type 'ZBAPI_ABY' generated success fully. Now w e are done w ith the creation of a BAPI.

    Stage 4: Viewing the created BAPI in BAPI Explorer

    Step 25:Go to BAPI Explorer (Transaction code is BAPI) there w e can find the BAPI (our BAPI). You can click on the Alphabetical tab so that you can brow se the BAPIs in an alphabetical order. Fi

    BAPI as show n.

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-a

    Stage 5: Test your BAPI

    Step 26:Enter the name of your BAPI in the transaction SWO1 and click on Test.

    Step 27:The below screen is displayed. Click on the Execute icon (circled in red) against the BAPI as show n

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-a

    Step 28:The below screen w ill be displayed w here you w ould require entering the data against the empty input fields.

    Step 29:You could use the input help as show n below; here I have selected 0001. And click the execute button.

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-a

    Step 30:The resulting screen is displayed below , w here you can see 1 Entry (circled in red) against ITEMTAB. Double click on 1 Entry.

    The results as per our input are as show n below.

  • 5/20/2018 A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Developmen...

    http:///reader/full/a-step-by-step-guide-for-beginners-on-user-defined-bapi-creation-a

    By this, w e w ould get it confirmed that our BAPI is w orking properly. We can even check it by passing diff erent values again. Come back to the input and execution screen.

    We are now done with the creation and successful execution of a BAPI.

    standard template document paper a

    Follow Contact Us SAP Help Por tal

    Privacy Terms of Use Legal Disclosure Copyright

    http://www.sap.com/corporate-en/our-company/legal/copyright/index.epxhttp://www.sap.com/corporate-en/our-company/legal/impressum.epxhttp://www.sdn.sap.com/irj/scn/policyhttp://www.sdn.sap.com/irj/scn/policy?view=PPhttp://help.sap.com/http://scn.sap.com/docs/DOC-18476http://bit.ly/SCNLnIhttp://bit.ly/SCNyouThttp://bit.ly/SCNFBhttp://bit.ly/SCNTwRhttp://wiki.scn.sap.com/wiki/label/ABAP/articlehttp://wiki.scn.sap.com/wiki/label/ABAP/paperhttp://wiki.scn.sap.com/wiki/label/ABAP/documenthttp://wiki.scn.sap.com/wiki/label/ABAP/templatehttp://wiki.scn.sap.com/wiki/label/ABAP/standard