08-20-2007 3:08 PM
Hi,
I'am looking for a facility to generate a function module dynamic.
Is it possible to do this?
Thanx
Tony
08-20-2007 3:17 PM
Yes, it is, but I'm not really sure why would need to.
report zrich_0001 .
data: import type rsimp occurs 0 with header line.
data: export type rsexp occurs 0 with header line.
data: source type rssource occurs 0 with header line.
start-of-selection.
* Create the function module
import-parameter = 'INDATE'.
import-dbfield = 'SY-DATUM'.
append import.
export-parameter = 'OUTDATE'.
export-dbfield = 'SY-DATUM'.
append export.
source-line = 'outdate = indate + 1.'.
append source.
call function 'RS_FUNCTIONMODULE_INSERT'
exporting
funcname = 'Z_RICH_TEST'
function_pool = 'ZRICHTESTGROUP'
* INTERFACE_GLOBAL = ' '
* REMOTE_CALL = ' '
short_text = 'This is a test'
* SUPPRESS_CORR_CHECK = 'X'
* UPDATE_TASK = ' '
* CORRNUM = ' '
* NAMESPACE = ' '
* SUPPRESS_LANGUAGE_CHECK = 'X'
* AUTHORITY_CHECK = 'X'
* SAVE_ACTIVE = 'X'
* SUPPRESS_UPGRADE_CHECK = ' '
* IMPORTING
* FUNCTION_INCLUDE =
* CORRNUM_E =
tables
import_parameter = import
export_parameter = export
* TABLES_PARAMETER =
* CHANGING_PARAMETER =
* EXCEPTION_LIST =
* PARAMETER_DOCU =
source = 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.
* Use the function module.
data: date_out like sy-datum.
call function 'Z_RICH_TEST'
exporting
indate = sy-datum
importing
outdate = date_out.
write:/ sy-datum, date_out.
* Now delete the function module
call function 'RS_FUNCTION_DELETE'
exporting
funcname = 'Z_RICH_TEST'
suppress_popups = 'X'
suppress_checks = 'X'
exceptions
cancelled = 1
function_released = 2
others = 3.
Regards,
RIch Heilman
08-20-2007 3:12 PM
yes this is possible,
check the abap help on GENERATE SUBROUTINE POOL
Kind regards, Rob Dielemans
08-20-2007 3:17 PM
Yes, it is, but I'm not really sure why would need to.
report zrich_0001 .
data: import type rsimp occurs 0 with header line.
data: export type rsexp occurs 0 with header line.
data: source type rssource occurs 0 with header line.
start-of-selection.
* Create the function module
import-parameter = 'INDATE'.
import-dbfield = 'SY-DATUM'.
append import.
export-parameter = 'OUTDATE'.
export-dbfield = 'SY-DATUM'.
append export.
source-line = 'outdate = indate + 1.'.
append source.
call function 'RS_FUNCTIONMODULE_INSERT'
exporting
funcname = 'Z_RICH_TEST'
function_pool = 'ZRICHTESTGROUP'
* INTERFACE_GLOBAL = ' '
* REMOTE_CALL = ' '
short_text = 'This is a test'
* SUPPRESS_CORR_CHECK = 'X'
* UPDATE_TASK = ' '
* CORRNUM = ' '
* NAMESPACE = ' '
* SUPPRESS_LANGUAGE_CHECK = 'X'
* AUTHORITY_CHECK = 'X'
* SAVE_ACTIVE = 'X'
* SUPPRESS_UPGRADE_CHECK = ' '
* IMPORTING
* FUNCTION_INCLUDE =
* CORRNUM_E =
tables
import_parameter = import
export_parameter = export
* TABLES_PARAMETER =
* CHANGING_PARAMETER =
* EXCEPTION_LIST =
* PARAMETER_DOCU =
source = 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.
* Use the function module.
data: date_out like sy-datum.
call function 'Z_RICH_TEST'
exporting
indate = sy-datum
importing
outdate = date_out.
write:/ sy-datum, date_out.
* Now delete the function module
call function 'RS_FUNCTION_DELETE'
exporting
funcname = 'Z_RICH_TEST'
suppress_popups = 'X'
suppress_checks = 'X'
exceptions
cancelled = 1
function_released = 2
others = 3.
Regards,
RIch Heilman