A Step-by-Step Guide on Asynchronous RFC - to -JDBC Scenario Using SAP PI 7.0

By Deepak Shah, L&T Infotech

Brief Overview:

The purpose of this exercise is to call an RFC from SAP R/3 asynchronously.  A function module is used to send Data to XI / PI. SAP PI will then convert the data in the Standard SQL Format and Insert the data into the JDBC database tables.

The Data from table 'ZEMP_DET' created in R/3 will be fetched by the RFC 'ZTEST_TIPS_DOI' and sent to SAP PI. SAP PI will then insert these Records into database tables.  

Prerequisites:

  1. Basic Knowledge of SAP PI / XI 7.0
  2. Business System configuration in SLD is not covered in detail. 
  3. JDBC drivers should be deployed on SAP PI system  

Implementation Steps:

A.) Maintain R/3 System.    

 A.1) Create RFC in SAP R/3 System (Send Data to SAP PI).

Go to Transaction SE37. Enter the name for functional module. Click on Create.  

Define a table’s parameter 'ZEMP_DET' table like 'ZEMP_DET' created in R/3.  

Save & activate.  

A.2) Create RFC Destination in SAP R/3 System.  

Create an RFC destination 'RFC_SENDER_DS' of type 'T' in the SAP R/3 system itself (Not in XI System)

Make sure to select radio button “Registered Server Program”

Enter a Unique Program ID 'RFC2JDBC'.

To find the Gateway Host & service: Goto Transaction SMGW -> Goto -> Parameter -> Display  

A.3) Create ABAP Report in SAP R/3 system.  

Create an R/3 report that will call the RFC which will send data to SAP XI.

The ABAP code is as follows.

For calling the RFC asynchronously use “In Background task” command.

Also use 'Commit work' at the end of RFC call.

*&------------------------------------------------------------------*
*& Report  ZTEST_WEBSERVICE
*&------------------------------------------------------------------*
REPORT  ztest_webservice.
DATA: ssh_no TYPE char30.
DATA : g_zemp_det  LIKE zemp_det OCCURS 0 WITH HEADER LINE.
DATA : l_temp TYPE string.
SELECT * FROM zemp_det INTO CORRESPONDING FIELDS OF TABLE g_zemp_det.  

CALL FUNCTION 'ZTEST_TIPS_DOI' in background task DESTINATION 'RFC_SENDER_DS'  

*  IMPORTING
*    count              = l_temp
  TABLES
    zemp_det           = g_zemp_det
  EXCEPTIONS
    rfc_external_abort = 1
    deliveryexception  = 2
    OTHERS             = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

commit work.

WRITE : 'test'.  "'count = ' , l_temp. 

B.) Maintain SAP XI / PI System.

 B.1) Maintain SLD (System Landscape Directory)   

This Document does not contain configuration steps for creating the Business System, Technical system, Product & Software component. It is assumed that the sender and receiver Business Systems are already created along with corresponding Technical System, Product, Software components. Also the Software Component is imported into Integration Repository.

In this Example,  

Sender Business System: CX1_Business_System

Receiver Business System: TBIT40_SQLSERVER_BS

Software Component: TBIT40_DS_SWCW, 2.0 of sap

B.2) Maintain IR (Integration Repository)  

B.2.1 Importing RFC from SAP R/3 System

Double Click on your Software Component in the Integration Repository.

Select the radio Button 'Import of RFC and IDoc interfaces from SAP system Permitted'

Enter the Connection Data for Import from SAP System

Click on SAVE & Activate.  

Now right click on Imported Object under your Software Component and click on Import of SAP Objects.

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image