Skip to Content

Many a times there could be a need for migrating Remote Function Calls (RFC) to BAPIs. I did face some problems while converting a RFC to BAPI. Hence, thought of preparing a blog that would describe step by step procedure for creating BAPI from RFC in SAP R/3.

Business Application Program Interface (BAPI) is the most powerful tool in SAP R/3. BAPI allows developers to integrate third-party software into SAP’s R/3 product. BAPI is one of the means using which SAP XI and R/3 can talk to each other. Consultants working with SAP systems must be familiar with BAPIs and their role in an ERP system. There are several hundred standard BAPIs for immediate use. They can be used out of the box or modified to create new business objects specific to client’s need.

Step1: Create a Remote (RFC) enabled function module using SE37 transaction. All the parameters of the function module should be ‘Pass by Value’. Reference parameters are not allowed with RFC enabled function module. Save and activate the function module. You will have to define a structure for every parameter in the BAPI. You cannot use the same structures used in existing applications because BAPI structures are frozen when BAPIs are released and then there are restrictions on changing them.

image

Step2: Execute Business Object Builder (SWO1). Provide a new name for Object/Interface type and choose the ‘CREATE’ option.

image

Step3: Super Type can be left blank if the newly created object type should act as super type. Else a super type can be specified. The program name specified would be created in R/3. BAPI cannot be a local object as they should be transportable. They should be attached to a package and transport request.

image

Step4: Execute the menu option Utilities –> API methods –> Add Method. Specify the name of the RFC Function Module created in step1.

image

Step5: The function module should have property ‘Synchronous’. The system would throw up the message shown below. Select ‘Yes’. The method would be added under the methods node.

image

Step6: The API Module must be implemented. This can be achieved by executing the menu option, Change Release Status –> Object Type Component –> to Implemented. After API module is implemented you need to implement Object Type. Select Object type and execute the menu option, Change Release Status –> Object Type –> to Implemented. A success message would be displayed.

image

Step7: Release the RFC function module using SE37 transaction. Execute the menu option, Function Module –> Release –> Release.

Step8: Release the Object type by executing the menu option Release Status –> Object Type –> to Released.

Step9: Release the API method by executing the menu option Release Status –> Object Type Component –> to Released. Save the Object type. The BAPI will now be available in BAPI Explorer (Transaction BAPI).

image

This blog is intended for helping consultants with non-SAP background.

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. John Patterson
    Hi Swaroopa,
    Nice article. I dont want to draw away from the content within this blog, in its context of educating non-SAP developers it is a very good BAPI development 101.

    In response to the statement – Business Application Program Interface (BAPI) is the most powerful tool in SAP R/3. I think that this would be a little misleading to the uninitiated. The ABAP workbench is the most powerful tool available to developers – both inside and out.

    The ABAP Workbench is an IDE which comes second to non, the power is in its tansparency and seamless integration of all underlying ABAP objects (table, structures, data elements, programs, classes, fm, screen etc.), couple with this debugging (RFC enabled) which leaves other products and languages for dead (abstraction is good, code is better).

    In my opinion BAPI is commonly said, but rarely used. Existing Bapi’s nearly always have limitations and are rarely used in a productive environment as the were intended (object exposing methods and attributes ), this is mainly due to not many companies use vanilla out of the box solutions. The developer is often left looking for work arounds which involve the underlying FM’s. Having worked on numerous integration projects and taught ABAP to non ABAPer’s. My advice would be to learn to walk before running, get to know the power of the ABAP workbench, they even got one in the XI now, because you will need it.
    Cheers
    JP

    (0) 
    1. Swaroopa Vishwanath Post author
      This weblog is not for ABAP development but for R/3 Integration. This blog is for XI consultants who need to integrate legacy systems to SAP R/3. Legacy systems can talk to SAP R/3 using SAP XI. In turn SAP XI should make use of BAPI, IDOC or PROXY to communicate to SAP R/3. If a standard BAPI does not meet the needs of the customer, there might be a need to create a custom BAPI. This is where my weblog comes into picture.
      (0) 
      1. Joseph Anthony
        Hi Vishwanath,

        I have a question for you on the other capabilities of BAPIs.

        Are BAPIs the best tools to retract data from SAP Strategic Enterprise Management – BPS to R/3 4.6c?

        I am aware of the few standard retractors that SAP provides for retrtaction purposes. But these retractors are very application specific and is not useful when I am trying to retract data, say Sales and Operations Planning Data into the relevant tables in R/3

        Thanks for your time.

        Regards,

        Joe

        (0) 
  2. Shiv Patil
    This is a good example but the RFC – BAPI comparison is not up to the mark for a non ABAP person to whom this is intended for in the first place.

    However, Thank  you very much for a great practical example.

    Just my two cents.

    (0) 
  3. KRISHNA MOORTHY
    When i create the 541 document in t.code mb1b after the docu no 4900 some i want show the that document of purchase order item no show. i check mb03 t.code but not their. I want show the po.item no 
    (0) 

Leave a Reply