Rfc

Post on 09-Jul-2016

214 views 1 download

description

sap ABAP RFC

Transcript of Rfc

Calling an RFC function module from one system to anotherFollowing are the participant system for our demo purpose:

D05 – System where RFC function module exists

DS3 – Calling system (an RFC call is made from this system to D05)  

Scenario:

We would develop a small RFC function module in D05 system, which would add two variables. We would pass two variables from DS3 to D05 and get back the sum of those two variables back to DS3.  

Activities to be performed in the system D05 

Go to SE37.

Under Utilities > Create Function Group (say ZGB_FUNC), if doesn’t exists. 

Now create a New Function Module ZGB_FUNC01  

 

Under IMPORT Tab, define the following variables

Under EXPORT Tab  

 

In the Source Code

Now set the function module as “Remote-enabled module” in the attributes tab.  

 

Activities to be performed in the System DS3 

Create an RFC destination from DS3 to D05.

Go to SM59, Press Create.

Enter the RFC Destination name: D05-205-TEST

Connection Type: 3

In Description: Test Connection to D05  

In The Technical Settings Tab, enter the system details

In The Logon/Security Tab, enter the logon details.

Click on Save. A Popup will imply that connection has been created  

Now Press the TEST CONNECTION to check the connection.  

This means the connection to the remote system was successful.

If the connection fails we get an error like this

However establishing a connection will not ensure logging on to the target system. For that we have to test REMOTE LOGON. 

Press the REMOTE LOGON button 

If we can see this

And this

 

Then our connection was successful. 

However if we see the screen as shown below then there is an authentication failure (user-id or password is wrong). 

 

The new connection will become visible in the SM59 list like this.

 

After establishing the connection, let us create a program, which would trigger the RFC in D05 system. 

Go to SE38 and create a program ZGB_RFC 

Write the following code

 

Activate (Ctrl+F3) and Execute (F8) 

Type any two numbers. 

 

Press (F8) Again. We have the desired output.