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.
Step2: Execute Business Object Builder (SWO1). Provide a new name for Object/Interface type and choose the ‘CREATE’ option.
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.
Step4: Execute the menu option Utilities –> API methods –> Add Method. Specify the name of the RFC Function Module created in step1.
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.
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.
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).
This blog is intended for helping consultants with non-SAP background.