Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Generate Function But Can't Call It?

Former Member
0 Likes
1,524

hi all,

I use the function module "rs_functionmodule_insert" to generate function module dynamic. And my code looks like below:

DO 10 TIMES.
CALL FUNCTION "RS_FUNCTIONMODULE_INSERT"
EXPORTING
    funcname = lv_fname
.....
.....
CALL FUNCTION lv_fname
....
....
   
ENDDO.

However, the system tell me "Function module not found or not active"(a very red exception) at twice (call function lv_fname).

How to deal it?

hi all,

I use the function module "rs_functionmodule_insert" to generate function module dynamic. And my code looks like below:

DO 10 TIMES.
CALL FUNCTION "RS_FUNCTIONMODULE_INSERT"
EXPORTING
    funcname = lv_fname
.....
.....
CALL FUNCTION lv_fname
....
....
   
ENDDO.

However, the system tell me "Function module not found or not active"(a very red exception) at twice (call function lv_fname).

How to deal it?

11 REPLIES 11
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,434

You can check this include as refernce LBDBGF04 as how this FM should be used.

Read only

0 Likes
1,434

hi,

this file is difficult to read.....

Read only

Former Member
0 Likes
1,434

Hi,

This function would generate a function module based on the inputs, and what you need to provide to this function is the function module name, the function group, the input parameters,output parameters,tables parameters,exceptions and the code for the FM that you want to generate once you provide all this then the function module should generated . In order to check whats not working add the exceptions to the function module call and then check the subrc that should give youo some idea on what the issue is.

reagrds,

Himanshu

Read only

0 Likes
1,434

Hi Himanshu,

For excample, the lv_fname='z_one' at first time, and the lv_fname='z_two' at twice. Actuallty, I have seen them in SE80 when I debug it, but the system still tell me "not found or inactive"

Read only

0 Likes
1,434

Make sure you are calling the FM with single quotes (') instead of double quotes (").

Rob

Read only

0 Likes
1,434

hi Rob,

that's a mistake when I edit the post, don't care it.

Read only

Former Member
0 Likes
1,434

Hi friend,

Please excute this statement and select all the function module place in one internal table.

OTHER WISE all the function module are stored in THIS table TFDIR.

do 10 times.

READ TABLE ITAB INTO WA INDEX LV_COUNT.

SELECT SINGLE funcname FROM tfdir INTO func WHERE funcname = wa-srname.

CALL FUNCTION func

EXPORTING

in_string = lv_in_str

IMPORTING

out_string = lv_out_str.

LV_COUNT = LV_COUNT + 1.

CLEAR:FUNC.

ENDDO.

call function will call dynamically.

thanks&regards,

muralii

Read only

0 Likes
1,434

hi muralii,

your codes similar to mine. but in my program, it need to generate a new function by another function "RS_FUNCTIONMODULE_INSERT", and then call the new function. and the system can't discover the second new function.

Read only

0 Likes
1,434

Hi,

I created as below and I was able to create the FM ..

Call the function 'SBUF_SYNCHRONIZE' before calling 'RS_FUNCTIONMODULE_INSERT' ...

DATA : funcname type RS38L_FNAM value 'ZTEST_CREATE_001', "

function_pool type AREA value 'ZFG_GENERIC', <-- ensure that the function group is active

short_text type RS38L_FTXT value 'Test FM',

l_active type c value 'X',

new_include like trdir-name.

call function 'SBUF_SYNCHRONIZE'.

CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'

EXPORTING

funcname = funcname

function_pool = function_pool

short_text = short_text

SAVE_ACTIVE = l_active

IMPORTING

FUNCTION_INCLUDE = new_include

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

.

CALL FUNCTION funcname .

Regards,

Srini.

Read only

0 Likes
1,434

hi Srini,

thanks for you. i'll try it tomorrow.

Regards,

Read only

Former Member
0 Likes
1,434

问题描述不清楚,重发一个