Business Application Programming Language Cross Applications

Embed Size (px)

Citation preview

  • 7/27/2019 Business Application Programming Language Cross Applications

    1/24

    Cross Applications

    BAPI:-Business Applications Programming Interface

    SAP created the Business Framework to allow the technical integration and exchange ofbusiness data among SAP components and between SAP and non-SAP components. Important

    components of the Business Framework are the Business Application Programming Interfaces

    (BAPIs), which represent visible interfaces at the component boundaries and whose properties

    serve to integrate these components.

    The integration can include both components within a local network and components that are

    connected with one another through the Internet. BAPIs allow integration at the business level,

    not at the technical level. This provides greater stability in the link, and independence from the

    underlying communication

    Process Flow

    The structure of the tools in the ABAP Workbench determines how the BAPI is implemented.

    1. Defining the data structures (including domains and data elements) in the ABAPDictionary.

    2. Implementing the Function Module in the Function Builder3. Defining the Business Object Types And its methods in the BOR4. The Business object Repository (BOR) is object oriented repository in R/3 system. It

    contains SAP business objects and their methods.

    Conventions for BAPI Data Structures

    1. Each parameter must refer to a data structure in the ABAP Dictionary. In the case ofstructured parameters this is always to the whole BAPI data structure. If the parameter

    consists of only one field, it must refer to a field in a BAPI structure.

    2. You have to create separate data structures for BAPIs, which are independent of the datastructures generally, used in the R/3 application.

    3. All data structure names must begin with BAPI.4. BAPI structure names should be as meaningful as possible.

    Custom BAPI creation - Step-by-step Procedure

  • 7/27/2019 Business Application Programming Language Cross Applications

    2/24

    Scenario: Step-by-step creation of a BAPI to retrieve fields from table T001.

    Procedure: Go to transaction SE11 and create a structure as shown or as per your requirement.

    Give the name in the Data type field and click on create.

    In the pop-up that comes up, select the radio button structure.

  • 7/27/2019 Business Application Programming Language Cross Applications

    3/24

    In the components tab of the structure, give the different fields and their corresponding field

    types and press enter to check the compatibility and creativeness.

    Do not forget to save it in a package. You can even save it as a local object. For my example, I

    save it in a package.

    Check the structure (ctrl + F2) and activate (ctrl + F3) the structure.

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Now we are done with the creation of a Structure.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  • 7/27/2019 Business Application Programming Language Cross Applications

    4/24

    Go to transaction SE37 where you create function modules. Click on create after you enter the

    name of the Function module.

    A screen as shown above would pop-up where you mention the function group to save the

    function module and also provide some short text describing your function module.

    In the next pop-up that follows, click on continue as shown above.

  • 7/27/2019 Business Application Programming Language Cross Applications

    5/24

    The function module screen would look like the one above.

    Go to the Attributes tab and select the radio button reading remote-enabled module. Comeback to the imports tab and provide the import parameters as shown or as per your requirement.

    Now in the Export tab, provide the export parameters as shown or as per your requirement.

  • 7/27/2019 Business Application Programming Language Cross Applications

    6/24

    In the tables tab, provide the information as shown or as per your requirement.

    The next screen you visit is the source code. It would look like this.

    In the source code tab, write the following code in order to pick the data based on the input you

    provide.

  • 7/27/2019 Business Application Programming Language Cross Applications

    7/24

    Now, save and check the code and activate the function module.

    After successful activation, go to the attributes tab. Go to Function moduleReleaseRelease.

    +++++++++++++++++++++++++++++++++++++++++++++++Now we are done with the creation of a Function Module.

    +++++++++++++++++++++++++++++++++++++++++++++++

    Go to transaction SWO1 and enter the name of the BAPI you would like to create or as shown in

    the screen and click the create button.

  • 7/27/2019 Business Application Programming Language Cross Applications

    8/24

    Give the name of the BAPI as above and click on create.

    Give the above-mentioned details and click on the continue icon.

  • 7/27/2019 Business Application Programming Language Cross Applications

    9/24

    Save in a package.The resulting screen is as follows.

    Now click on the methods to drop down and see what methods are provided by default. There

    would be two methods, showing in red color which comes by default while creating the BAPI.

  • 7/27/2019 Business Application Programming Language Cross Applications

    10/24

    Click or select the method as shown above and go to the path UtilitiesAPI methodsAdd

    methods.

    On the screen that follows, provide the function module name and click on the continue icon.

  • 7/27/2019 Business Application Programming Language Cross Applications

    11/24

    In the ultimate pop-up, click the next step icon. We observe that the information is predefined in

    the fields.

    This is the next screen where you would just click on the next icon.

  • 7/27/2019 Business Application Programming Language Cross Applications

    12/24

    Click on Yes. You can see an information message reading ZBAPIFMT001 inserted.

    Now save after you add the method. Select & Double click on the API method.

    Go to Tab: ABAP Check 'API Function'.

  • 7/27/2019 Business Application Programming Language Cross Applications

    13/24

    The above screen is displayed. Go to the ABAP tab as shown below.

    Select the Radio button reading API Function as already said above.

  • 7/27/2019 Business Application Programming Language Cross Applications

    14/24

    click on the continue icon to proceed further.

    Now select the Object ZBAPI_T001 as shown below.

    Go to : EditChange Release StatusObject typeTo Modeled.

  • 7/27/2019 Business Application Programming Language Cross Applications

    15/24

    The above shown screen will be displayed. Click on yes.

    The message shows, The object type status set to modeled. (Or already modeled)

    Go to: EditChange Release StatusObject type To Implemented.

  • 7/27/2019 Business Application Programming Language Cross Applications

    16/24

    You can see a message reading Object type status set to implemented

    Now, go to: EditChange Release StatusObjectTo Released.

    There would be two pop ups coming up. Click on continue on the Pop Ups.

    Keep the cursor on the 'Method'.

    Go to: EditChange Release StatusObject type componentTO Modeled.

    You can see the message reading status for method zbapifmt001 set to modeled.

  • 7/27/2019 Business Application Programming Language Cross Applications

    17/24

    Now, go to: EditChange Release StatusObject type component TO Implemented

    You can see the message reading status for method zbapifmt001 set to implemented.

    Now go to: EditChange Release Status Object type component To Released

    You can see the message reading status for method zbapifmt001 set to Released.

    Click on Generate Button. (The red ball kind of button is the Generate button)

  • 7/27/2019 Business Application Programming Language Cross Applications

    18/24

    After clicking on the generate button, you can see the message reading Object type

    'ZBAPI_T001' generated successfully.

    Now go to BAPI Tcode (BOR) there we can find the BAPI (our BAPI)The BAPI browser would look like the screen below.

    You can click on the Alphabetical tab so that you can browse the BAPIs in an alphabetical

    order. Find your BAPI as shown.

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Now we are done with the creation of a BAPI.

  • 7/27/2019 Business Application Programming Language Cross Applications

    19/24

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Test Your BAPI.

    Enter the name of your BAPI in the transaction SWO1 and clickon Test.

    The above screen is displayed. Click on the Execute icon against the BAPI as shown.

  • 7/27/2019 Business Application Programming Language Cross Applications

    20/24

    The above screen is displayed where you would require entering the data against the empty input

    fields.

    We have entered some data in the Field.

    After entering the data, click on the execute icon as shown below.

  • 7/27/2019 Business Application Programming Language Cross Applications

    21/24

    The following screen is displayed which has some values as is indicated by the ITEMTAB.

    Click on the Edit table icon as shown below.

  • 7/27/2019 Business Application Programming Language Cross Applications

    22/24

    The results as per our input are as shown below.

    By this, we would get it confirmed that our BAPI is working properly.

    We can even check it by passing different values again. Come back to the input and execution

    screen.

  • 7/27/2019 Business Application Programming Language Cross Applications

    23/24

    After executing the BAPI based on the input provided, we get the following screen.

    Hit on the execute icon.

  • 7/27/2019 Business Application Programming Language Cross Applications

    24/24

    In the above shown screen, hit on the edit table icon.

    The above is the output we get from the input we provided.We are now done with the creation and successful execution of a BAPI.