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: 

RFC

Former Member
0 Kudos

Hi,

Can ne1 plz give me some info abt RFC????

Thanks,

Mohit.

6 REPLIES 6

Former Member

Former Member
0 Kudos

Hi Mohit

CALL FUNCTION – RFC

 A remote function call is a call to a function module running in a system different from the caller's. The remote function can also be called from within the same system (as a remote call).

RFC consists of two interfaces

: A calling interface for ABAP Programs and a calling interface for Non-SAP programs.

 Any ABAP program can call a remote function using the CALL FUNCTION...DESTINATION statement. The DESTINATION parameter tells the SAP System that the called function runs in a system other than the caller's.

 You can use the CALL FUNCTION statement to call remote functions by including an additional DESTINATION clause.



	CALL FUNCTION ‘remotefunction’
    	 DESTINATION dest    
    	 EXPORTING f1 = 
	 IMPORTING  f2 = 
	 TABLES t1 = 
	 EXCEPTIONS 



Calling remote functions locally

:-

( i.e. call a remote function within the same system )

The two options to do this are –

• CALL FUNCTION...DESTINATION = 'NONE'

• CALL FUNCTION...

The remote function can invoke its own caller (if the caller is itself a function module), or any function module loaded with the caller.

You can trigger this call-back mechanism using

CALL FUNCTION... DESTINATION 'BACK‘.

Types of RFC’s



Synchronous RFC

– The calling program continues the execution only after the called function is complete.


       SYNTAX: CALL FUNCTION func DESTINATION dest 
                     parameter_list. 
<b>EXAMPLE:</b>
data : posnr type posnr.
posnr = '70'.
CALL FUNCTION 'ZUPDATE' DESTINATION 'ESUCLNT500'
 EXPORTING
   ITEM          = posnr.
FUNCTION ZUPDATE. “IN ESUIDES
*"----------------------------------------------------------------------
*"*"Update Function Module:
*"
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(ITEM) TYPE  POSNR
*"----------------------------------------------------------------------

data: itab type standard table of zupdatetable1,
      wa_itab type zupdatetable1 .

wa_itab-posnr = item.

append wa_itab to itab.

update zupdatetable1 from table itab .
ENDFUNCTION.

&#61656;

Asynchronous RFC

- The calling program continues the execution without waiting for return from the called function.

SYNTAX

Eg: CALL FUNCTION ‘remotefunction’ STARTING NEW TASK ‘taskname’.


REPORT calltransaction.

CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'TEST'
  EXPORTING
    tcode                   = 'SM59'
  EXCEPTIONS
    call_transaction_denied = 1
    tcode_invalid           = 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.


CASE sy-subrc.
  WHEN 2.
    WRITE 😕 ' transaction doesnot exist'.

ENDCASE.

WRITE: / ' Demo For Asynchronous Transaction End'.

&#61656;

Transactional RFC

 This type of RFC was renamed from asynchronous to transactional RFC, because asynchronous RFC has another meaning in R/3 Systems.

 The called function module is executed exactly once in the RFC server system. Each function call is seen as a transaction in the target system.

 Transactional RFCs use the suffix IN BACKGROUND TASK. The remote system need not be available at the time when the RFC client program is executing a tRFC.

 The tRFC component stores the called RFC function together with the corresponding data in the R/3 database, including a unique transaction identifier (TID).

 If a call is sent, and the receiving system is down, the call remains in the local queue until a later time.

 The calling dialog program can proceed without waiting to see whether or not the remote call was successful. If the receiving system does not become active within a certain amount of time, the call is scheduled to run in batch.

 The system logs the remote call request in the database tables ARFCSSTATE and ARFCSDATA with all of its parameter values. You can display the log file using transaction SM58.

 When the calling program reaches a COMMIT WORK, the remote call is forwarded to the requested system for execution.

 Transactional RFC requests are transferred, with parameter data in byte-stream form, using TCP/IP or X400.

 LUW's are identified by transaction ID's that are unique world-wide. The transaction ID can be determined from an ABAP program by calling function module ID_OF_BACKGROUNDTASK. (You must call this function after the first asynchronous CALL, and before the related COMMIT WORK.)





 The system function module ARFC_DEST_SHIP transports the data to the target system and the function module ARFC_EXECUTE executes the stored function calls. If an error or an exception occurs during one of the calls, all the database operations started by the preceding calls are rolled back and an appropriate error message is written to the file ARFCSSTATE.

 Once you have identified the ID of the LUW, you can use the function module STATUS_OF_BACKGROUNDTASK to determine the status of the transactional RFC.

 Call transaction SM58 (Tools _ Administration _ Monitoring _ Transactional RFC). This tool lists only those transactonal RFCs that could not be carried out successfully or that had to be planned as batch jobs. The list includes the LUW ID and an error message. Error messages displayed in SM58 are taken from the target system. To display the text of the message, double-click on the message.

 If a LUW runs successfully in the target system, the function module ARFC_DEST_CONFIRM is triggered and confirms the successful execution in the target system. Finally, the entries in the Tables ARFCSSTATE and ARFCSDATA are deleted.

DISADVANTAGES



 These can reduce performance significantly in both the send and the target
systems.

 In addition, the sequence of LUWs defined in the application cannot be kept. Therefore, there is no guarantee that the transactions are executed in the sequence dictated by the application. The only guarantee is that all LUWs are transferred sooner or later.






SYNTAX
Eg : CALL FUNCTION ‘remotefunction’ IN BACKGROUND TASK
CALL FUNCTION func IN BACKGROUND UNIT
parameter_list.
 The field ‘dest’ can be either a literal or a variable. Logical destinations are defined in the RFCDES table via transaction SM59 or via the menu path: Tools ->Administration,Administration->Network->RFC destinations.

SAMPLE PROGRAM
RSTRFCT0

Thanks & regards

Ravish Garg

*reward if of any help

Former Member
0 Kudos

hi,

Remote Function Call:

RFC is an SAP interface protocol. Based on CPI-C, it considerably simplifies the programming of communication processes between systems.

RFCs enable you to call and execute predefined functions in a remote system - or even in the same system.

RFCs manage the communication process, parameter transfer and error handling.

How to create it.

goto Se37 create a Function module.

in the attribute tab select remote function enabled radio button.

in Sm59 create a destination, select type 3 for R/3 system

specify the ip address of the target system & save it.then click the button test connection to check the connection.

in Function module specify ur import export parameters. it must be pass by value so tick the check box.

write ur code & save it.

Have a look at this link.

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

http://help.sap.com/saphelp_47x200/helpdata/en/22/042860488911d189490000e829fbbd/frameset.htm.

Regards

Reshma

Former Member
0 Kudos

hi,

Remote Function Call:

RFC is an SAP interface protocol. Based on CPI-C, it considerably simplifies the programming of communication processes between systems.

RFCs enable you to call and execute predefined functions in a remote system - or even in the same system.

RFCs manage the communication process, parameter transfer and error handling.

Have a look at this link.

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

http://help.sap.com/saphelp_47x200/helpdata/en/22/042860488911d189490000e829fbbd/frameset.htm.

Regards

Former Member
0 Kudos

Hi Dear.

RFC is Remote Function Call. Suppose when u Select the Radio Button while Creating

any Function Module in se37 u can call this Function Module any where in SAP using RFC Destination in sm59.

If more doubts feel free to ask

Reward Points if this supports you.

Regards,

Bohra.

Former Member
0 Kudos

RFC(Remote Function call): you basically use RFC connection to do connectivity to any remote system.Basically use in data transfer between sap system to another sap system or sap to another system.

you can create RFC using SM59 tcode.

1.Goto SM59

2. Choose Connection type.

3.Choose R/3 if you want to connect another sap system.

4.then enter IP address of remote system on which remote server installed.

4.then enter logon parameter for traget system like user id,password,client.

5.Now test ur connection and try to log on remote system by pressing remote logon tab on application toolbar.

plz rewards the point if helpful.