10-12-2007 8:15 AM
Hi,
Can any one plz tell me the way to call a function Module dynamically. And any way out to find whether a FM has called dynamically or not.
Thanks,
10-12-2007 8:24 AM
try:
DATA: BEGIN OF TKOMP OCCURS 5,
FUNCTION LIKE TRWPR-FUNCTION,
END OF TKOMP.
LOOP AT TKOMP.
CALL FUNCTION TKOMP-FUNCTION
EXPORTING BLTXT = PA_BLTXT
GJAHR = PA_GSJHR
KOKRS = X-KOKRS
PERAB = T_PLZ-PERAB " n. 168475
PERBI = T_PLZ-PERBI " n. 168475
UPDATE_VALUES = 'X'
DELTA = L_DELTA
COMMIT = ' '
VERSN = PA_VERSI
VRGNG = 'RKP1'
MESSAGES_SHOW = ' '
IRKU01_CUR = RKU01_CUR
TESTMODE = PA_TESTL "n.525131
TABLES IRKU01JA = HLP_RKU01JA
EXCEPTIONS OTHERS = 04.
IF PA_TESTL EQ SPACE. "msg
PERFORM ABEND_WHEN_POSTING_ERROR. "msg
ENDIF. "msg
ENDLOOP.
ENDIF.
ENDDO.
ENDLOOP. " n. 168475
A.
Message was edited by:
Andreas Mann
10-12-2007 8:27 AM
HI,
instead of call function 'function_module'.
data:var(30) value 'function_module'.
and <b>call function var</b>.
this will be supported only when the importing,exporting,changing,tables parameters of the function modules match.other wise u should not use this type of calling.
rgds,
bharat.
10-12-2007 8:30 AM
Based on your different scenarios, store the name of function module in a variable.
Call function <var>
But here you must be sure about the interface of the function module and required to pass the mandatory fields while calling function module.
Sy-subrc check will let you know whether the function call is successful of not.