Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create RFC function module and how to call this function module

Former Member

Hi,

i want to know step for creating RFC function module and then How to use this function module from some other sap system.

Thnaks,

jigar

7 REPLIES 7

Former Member
0 Kudos

In the attributes tab, select radio button 'Remote-enabled module'.

Before calling this FM, check if you have acces to backend using FM 'BBP_GET_ACS_BACKEND'. Here, you need to pass sy-langu, sy-uname and logical system.

If the FM returns sy-subrc 0, then call your RFC FM.

If you do not use above FM, you may get dump error.

Note: This FM 'BBP_GET_ACS_BACKEND' is related to SRM. So the above mentioned example is calling RFC FM in SRM system.

Thanks,

Santosh

Message was edited by:

SKJ

Former Member
0 Kudos

se37 lets you create an RFC.

If you want to access from another system, when you are setting up you need to click on 'Remote-Enable Module'

Set your import parameters, and if you plan on returning a table from the RFC, you may need to create a structure to handle the return info (se11, Data Type)

Then write your code!

I have used RFCs in connection with Visual Studio .NET - if you intend to do the same, SAP provides a connector. Your BASIS admin will need to create another SAP id so that you can connect to your RFC/SAP system.

Reward if helpful.

amit_khare
Active Contributor
0 Kudos

Hi,

RFC enabled FM are the FM with two difference.

1. The RFC enabled checkbox in attributes is checkecd.

2. Pass by Value is checked for all import/export/changing whichever you are using are selected.

Check thsi for creating FM.

<a href="http://help.sap.com/saphelp_470/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm">http://help.sap.com/saphelp_470/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm</a>

Regards

Amit

former_member194669
Active Contributor
0 Kudos

Hi,

1. Create the RFC fm in target system and make it RFC enabled (select the RFC enabled radio buttion in the atributes tab)

2. Create RFC R/3 connection thru SM59 from source to target

3. Call the RFC fm from source using option "DESTINATION".

(here DESTINATION is RFC connection name)

Thanks

aRs

Message was edited by:

aRs

Former Member
0 Kudos

1. Create a FM in SE37 in Target system enabling Remote-Fucntion Enabled Usin attributes of FM.

2. Create the same FM in the Local system ( It's recommended for later debugging) create only the structure - NO Need to put the code and all.

3. Creata a RFC connection in SM59 mentioning Usernam and Password.

4. Using this RFC connctin name, Call the FM in u program using CALL FUNCTION ABC DESTINATION 'YZ'.

sy-subrc value

1 - System Failure

2 - Communication Failure

it is default sy-subrc values in RFCs

hope this will help.

please,close the thread if solved

Thanks

Ashwani

Former Member
0 Kudos

Jigar,

To implement a remote function module in ABAP, perform the following steps:

Register the module as remotely callable in the RFC server system.

In the function module Administration screen (transaction code SE37), set the field Can be called via REMOTE CALL. Registering a module as remote causes an RFC stub to be generated for it.

Write the code for the function module.

*******

Create the destinations.....................

Displaying, Maintaining and Testing Destinations

To display, create or modify destinations, choose Tools ® Administration ® Administration ® Network ® RFC destinations or enter transaction code SM59.

Remote Destinations are stored in table RFCDES. The RFCDES table describes logical destinations for remote function calls.

It is not possible to maintain the RFCDES table directly.

You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® AcceleratedSAP ® Customizing ® Execute Project ® SAP Reference IMG.

In the Implementation Guide, expand the following hierarchy structure:

Basis

Application Link Enabling (ALE)

Sending and Receiving Systems

Systems in Network

Define Target Systems for RFC Calls

Displaying Destinations

The initial screen for this transaction displays a tree:

Different connection types (i.e. partner systems or programs) are possible. For further information, see Types of Destinations.

To display all information for a given destination, double-click it, or place the cursor on it and press F2 .

To search for a destination, press the Find button and specify your selection. You get a list of all entries matching your selection. Place the cursor on the one you want, and press F2 or simply double-click the destination. All information for the given entry appears.

Creating Destinations

On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.

All available connection types are explained in Types of Destinations.

To create a new RFC destination, press the Create button. A new screen is displayed with empty fields for you to fill in.

If you want to create a new destination

As you create a remote destination, you can specify a particular application server or a group of servers for a balanced distribution of system load.

For details of the destination parameters, see Entering Destination Parameters.

Changing Existing Destinations

On the destinations overview screen (transaction code SM59), the connection types and all existing destinations are displayed in a tree structure.

You can display all information for a given destination by double-clicking it or pressing F2 on it.

To change an existing destination, double-click it, or place the cursor on it and press the Change button.

For details of the destination parameters, see Entering Destination Parameters.

Testing Destinations

To test a destination, choose the appropriate function from the Test menu.

Connection (also available via the Test connection pushbutton)

Authorization (checks logon data)

Local network (provides a list of application servers)

******************************************************************************

You can use the CALL FUNCTION statement to call remote functions, just as you would call local function modules. However, you must include an additional DESTINATION clause to define where the function should run:

CALL FUNCTION RemoteFunction

DESTINATION Dest

EXPORTING

f1 =...

f2 =...

IMPORTING

f3 =...

TABLES

t1 =...

EXCEPTIONS......

The field Dest can be either a literal or a variable: its value is a logical destination (for example, "hw1071_53") known to the local SAP System. Logical destinations are defined in the RFCDES table (or the TRFCD table in R/2 Systems) via transaction sm59 or the following menu path: Tools ® Administration, Administration ® Network ® RFC destinations. You can also access logical destinations via the Implementation Guide (IMG) by choosing Tools ® Customizing ® Enterprise IMG. In the Implementation Guide, you can then choose Cross-application components ® ALE ® Communication ® Define RFC destination.

The remote function call concept, for example, allows you to access a function module in an R/2 System from an ABAP program in an R/3 System. If you want to read a customer record from your R/2 System’s database, create a remotely callable function module in the R/2 environment which retrieves customer records. Call this function from your R/3 System using a remote function call and listing the destination for the target R/2 System:

Pls. reward if useful

Former Member
0 Kudos

Hi,

Refer to the link below:

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE2/BCFESDE2.pdf

It contains pdf document on RFC programming in ABAP & to call RFC betwen two SAP systems , all you have to do is insert a 'CALL FUNCTION' statement with the addition of the 'DESTINATION' parameter pointing to your destination SAP system. A list of RFC destinations can be viewed via transaction SM59.

call function 'Z_GET_USER_IDS' destination 'DEV_500'

importing

userid = ld_userid.

Hope this helps.

Reward if helpful.

Regards,

Sipra