‎2007 Aug 10 10:02 AM
Hello All,
Does any one know whether is it possible to create a FM dynamically and write some code in it?
Regards,
Lisa.
‎2007 Aug 10 10:03 AM
Hi,
Yes it is possible.
Use this FM to create a function module on the fly programatically.
RS_FUNCTIONMODULE_INSERT.
Here is an example
Here an example how to call it:
call function 'RS_FUNCTIONMODULE_INSERT'
exporting
funcname = '/TEST40P/FB_TEST_EVE99'
function_pool = 'CRAS1'
* INTERFACE_GLOBAL = ' '
* REMOTE_CALL = ' '
short_text = 'TEST Anlage FB'
suppress_corr_check = ' ' -----------------> means with transport popup
update_task = '1'
* corrnum = 'B20K8A0V3F'
namespace = '/TEST40P/'
* suppress_language_check = 'X'
* AUTHORITY_CHECK = 'X'
* save_active = ' '
new_source = it_report[]
* IMPORTING
* FUNCTION_INCLUDE =
* CORRNUM_E =
tables
import_parameter = if_import
export_parameter = if_export
tables_parameter = if_tables
changing_parameter = if_change
exception_list = if_except
parameter_docu = if_docu_tab
* SOURCE =
exceptions
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
others = 11.
Regards,
Sesh
‎2007 Aug 10 10:03 AM
Hi,
Yes it is possible.
Use this FM to create a function module on the fly programatically.
RS_FUNCTIONMODULE_INSERT.
Here is an example
Here an example how to call it:
call function 'RS_FUNCTIONMODULE_INSERT'
exporting
funcname = '/TEST40P/FB_TEST_EVE99'
function_pool = 'CRAS1'
* INTERFACE_GLOBAL = ' '
* REMOTE_CALL = ' '
short_text = 'TEST Anlage FB'
suppress_corr_check = ' ' -----------------> means with transport popup
update_task = '1'
* corrnum = 'B20K8A0V3F'
namespace = '/TEST40P/'
* suppress_language_check = 'X'
* AUTHORITY_CHECK = 'X'
* save_active = ' '
new_source = it_report[]
* IMPORTING
* FUNCTION_INCLUDE =
* CORRNUM_E =
tables
import_parameter = if_import
export_parameter = if_export
tables_parameter = if_tables
changing_parameter = if_change
exception_list = if_except
parameter_docu = if_docu_tab
* SOURCE =
exceptions
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
others = 11.
Regards,
Sesh
‎2007 Aug 10 10:13 AM
Hi,
Could you please explain me a little bit about parameters.
Regards,
Lisa.
‎2007 Aug 10 10:22 AM
Hi
I have given comments for most used paramters
you can get the type of the parameters from SE37.
exporting
funcname = '/TEST40P/FB_TEST_EVE99' " Function module name
function_pool = 'CRAS1' "Function group name
* INTERFACE_GLOBAL = ' '
* REMOTE_CALL = ' '
short_text = 'TEST Anlage FB' "Shorttext from the Function module
suppress_corr_check = ' ' " To supress any request for Transport reuqest popup
update_task = '1'
* corrnum = 'B20K8A0V3F'
namespace = '/TEST40P/' " This is optional and used to supply the namespace
* suppress_language_check = 'X'
* AUTHORITY_CHECK = 'X'
* save_active = ' '
new_source = it_report[] " If alreayd existing FM new source code for it
* IMPORTING
* FUNCTION_INCLUDE = " Function module include that gets generated
* CORRNUM_E =
tables
import_parameter = if_import " Function moduels import paramters
export_parameter = if_export " export paramters
tables_parameter = if_tables " Tables parameteers of the FM to be generated
changing_parameter = if_change "changing parameters
exception_list = if_except " Exception list
parameter_docu = if_docu_tab " Documentation of the paramters
* SOURCE = " Table containing the Source code of the FM to be generated
Regards,
Sesh