sapdev logo background
sapdev logo sapdev logo
Comments

SAP Remote Function Call using the RFC destination parameter




The CALL FUNCTION... ABAP statement executes an SAP function module that exists within the SAP system the ABAP report or program is being executed on.

But what if you want to execute a function module that only exists on one of your other connected SAP systems? For example you want to call a FM from within your sandpit system that that only exists in your DEV system. The function call DESTINATION parameter allows this functionality and allows you to call source code contained within an RFC function module on a second SAP system.

Using an RFC call between two SAP systems is a fairly simple process, all you have to do insert a 'CALL FUNCTION' statement with the addition of the 'DESTINATION' parameter which points to your destination SAP system.

You can view A list of all the available RFC destinations within SAP transaction SM59 or by looking at the contents of table RFCDES.


* Call a function module on a connected SAP system
* See Tcode SM59 for list of RFC Destinations
call function 'Z_GET_USERIDS' destination 'DEV_500'
  importing
      userid = ld_userid.

Set Destination to NONE
You can also run a Function Module as a remote function call locally using the DESTINATION = 'NONE' parameter. Although this means it runs within the same system as the calling program it still uses it's own roll area and handles all parameter values and processing as if it was a remote call.

call function 'Z_GET_USERIDS' destination 'NONE'
  importing
      userid = ld_userid.


Remote function with no destination
Just for completeness if you run a remote enable function module without any destination parameter it will run like any other function module. I.e. it will run locally using the same roll area as the calling program and parameter handling will be the same as if it was a none remote enabled FM.

call function 'Z_GET_USERIDS'
  importing
      userid = ld_userid.





comments powered by Disqus