‎2008 Nov 20 3:37 PM
Hi
In one of the program, we have found a FM ' rfc_update_taxes_doc', and which does not has any code,
but what i think that this Fm is called dynamically from some prog and is calling external system.
As it has 'targt server' in importing parameters.
So can anybody tell me if this is the way we call to External system.
And please if anyone can tell me the real meaning of calling a Fm dynamically.
Please dont provide links.
Thanks and Regards
Manu
‎2008 Nov 20 3:39 PM
Use the DESTINATION addition of the CALL FUNCTION statement.
Press F1 on the CALL FUNCTION and get the online help
Regards
Naimesh Patel
‎2008 Nov 20 4:39 PM
Hi Manu,
You can try with this example. I connect Bussiness system with R/3 system, because I need R/3 table in Bw system.
IF SY-SYSID EQ 'BWD'. "SYSID = Name sap system
D_DESTINATION = 'DESD47020'.
ELSEIF SY-SYSID EQ 'BWC'.
D_DESTINATION = 'DESW47420'.
ELSEIF SY-SYSID EQ 'BWP'.
D_DESTINATION = 'DESP47420'.
ENDIF.
CAMPOS-FIELDNAME = 'MANDT'.
CAMPOS-OFFSET = '000000'.
CAMPOS-LENGTH = '000003'.
CAMPOS-FIELDTEXT = 'Mandant'.
APPEND CAMPOS.
CLEAR CAMPOS.
CAMPOS-FIELDNAME = 'BUKRS'.
CAMPOS-OFFSET = '000004'.
CAMPOS-LENGTH = '000004'.
CAMPOS-FIELDTEXT = 'Society'.
APPEND CAMPOS.
CLEAR CAMPOS.
CALL FUNCTION 'RFC_READ_TABLE' DESTINATION D_DESTINATION
EXPORTING
QUERY_TABLE = 'TZBZ'
* DELIMITER = ' '
* NO_DATA = ' '
* ROWSKIPS = 0
* ROWCOUNT = 0
TABLES
OPTIONS = OPTIONS1
FIELDS = CAMPOS
DATA = DATOS
* EXCEPTIONS
* TABLE_NOT_AVAILABLE = 1
* TABLE_WITHOUT_DATA = 2
* OPTION_NOT_VALID = 3
* FIELD_NOT_VALID = 4
* NOT_AUTHORIZED = 5
* DATA_BUFFER_EXCEEDED = 6
* OTHERS = 7That's all.
About the real meaning of calling a FM dynamically could be something like that because
you can generate the call dynamically to just call with the needed parameters (you can change
the parameters).
types: begin of s_codigo,
Lines type string,
End of s_codigo.
Data: it_codigo type standard table of s_codigo with header line.
APPEND 'Title.' TO it_codigo.
APPEND 'form Calculate_sum.' TO it_codigo.
APPEND 'call function ''RFC FUNCTION ''' TO it_codigo.
APPEND 'destination ''D_DESTINATION''' TO it_codigo.
APPEND 'exporting PARAM1 = ''2''' TO it_codigo.
APPEND 'PARAM2 = IT_TABLE ' TO it_codigo.
APPEND 'importing PARAM_I1 = RESULT.' TO it_codigo.
APPEND 'endform.' TO it_codigo.
DATA prog_name LIKE sy-cprog.
DATA resultado(1) TYPE c.
GENERATE SUBROUTINE POOL it_codigo NAME prog_name.
PERFORM Calculate_sum IN PROGRAM (prog_name) CHANGING nok.
Best regards .
Ana