Calling this function module with in this system you have to use the code as follows.
CALL FUNCTION ‘Z_TEST_FM’
EXPORTING
IN_VAL2 =
IN_VAL1 =
* IMPORTING
* OUT_VAL1 =
* EXCEPTIONS
* NOT_A_NUMBER = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Calling this function module from a different system you have to use the code as follows.
CALL FUNCTION ‘Z_TEST_FM’
destination <RFCDestination>
EXPORTING
IN_VAL2 =
IN_VAL1 =
* IMPORTING
* OUT_VAL1 =
* EXCEPTIONS
* NOT_A_NUMBER = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Make sure you give the RFC destination. Talk to BASIS team to get this information if you want to connect to another system’s Function Module.
Use the T-Code RSRFCCHK to see if your RFC destination to another system is available. (check with your basis team).
I hope this gives some Idea of How to use the function Module.