2010 Nov 26 6:12 AM
hi all,
I have program like below, but the SAP system tell me "Call Function NOT FOUND" when lv_idx = 2.
How to make it work?
*&---------------------------------------------------------------------*
*& Report Z_TEST_DYN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT z_test_dyn.
DATA fname TYPE rs38l-name.
DATA:
lt_code TYPE TABLE OF rssource,
lv_idx TYPE n LENGTH 3 VALUE 0.
APPEND 'write: /''test''.' TO lt_code.
DO 10 TIMES.
ADD 1 TO lv_idx.
CONCATENATE 'Z_TEST_' lv_idx INTO fname.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = fname
function_pool = 'ZIF_FGDYN'
* INTERFACE_GLOBAL = ' '
* REMOTE_CALL = ' '
short_text = 'TEST'
* SUPPRESS_CORR_CHECK = 'X'
* UPDATE_TASK = ' '
* CORRNUM = ' '
* NAMESPACE = ' '
* SUPPRESS_LANGUAGE_CHECK = 'X'
* AUTHORITY_CHECK = 'X'
* SAVE_ACTIVE = 'X'
* NEW_SOURCE =
* EXCEPTION_CLASS = ' '
* SUPPRESS_UPGRADE_CHECK = ' '
* IMPORTING
* FUNCTION_INCLUDE =
* CORRNUM_E =
TABLES
* IMPORT_PARAMETER =
* EXPORT_PARAMETER =
* TABLES_PARAMETER =
* CHANGING_PARAMETER =
* EXCEPTION_LIST =
* PARAMETER_DOCU =
SOURCE = lt_code
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
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = fname
* IMPORTING
* GROUP =
* INCLUDE =
* NAMESPACE =
* STR_AREA =
EXCEPTIONS
function_not_exist = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'SBUF_SYNCHRONIZE'
EXCEPTIONS
c_func_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = fname
* IMPORTING
* GROUP =
* INCLUDE =
* NAMESPACE =
* STR_AREA =
EXCEPTIONS
function_not_exist = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION fname <<<<<<<<<< Error when twice here
TABLES
et_table = lt_a.
ENDDO.
regards,
jkchen
Edited by: jkchen on Nov 26, 2010 7:13 AM
Edited by: jkchen on Nov 26, 2010 7:15 AM
hi all,
I have program like below, but the SAP system tell me "Call Function NOT FOUND" when lv_idx = 2.
How to make it work?
*&---------------------------------------------------------------------*
*& Report Z_TEST_DYN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT z_test_dyn.
DATA fname TYPE rs38l-name.
DATA:
lt_code TYPE TABLE OF rssource,
lv_idx TYPE n LENGTH 3 VALUE 0.
APPEND 'write: /''test''.' TO lt_code.
DO 10 TIMES.
ADD 1 TO lv_idx.
CONCATENATE 'Z_TEST_' lv_idx INTO fname.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = fname
function_pool = 'ZIF_FGDYN'
* INTERFACE_GLOBAL = ' '
* REMOTE_CALL = ' '
short_text = 'TEST'
* SUPPRESS_CORR_CHECK = 'X'
* UPDATE_TASK = ' '
* CORRNUM = ' '
* NAMESPACE = ' '
* SUPPRESS_LANGUAGE_CHECK = 'X'
* AUTHORITY_CHECK = 'X'
* SAVE_ACTIVE = 'X'
* NEW_SOURCE =
* EXCEPTION_CLASS = ' '
* SUPPRESS_UPGRADE_CHECK = ' '
* IMPORTING
* FUNCTION_INCLUDE =
* CORRNUM_E =
TABLES
* IMPORT_PARAMETER =
* EXPORT_PARAMETER =
* TABLES_PARAMETER =
* CHANGING_PARAMETER =
* EXCEPTION_LIST =
* PARAMETER_DOCU =
SOURCE = lt_code
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
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = fname
* IMPORTING
* GROUP =
* INCLUDE =
* NAMESPACE =
* STR_AREA =
EXCEPTIONS
function_not_exist = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'SBUF_SYNCHRONIZE'
EXCEPTIONS
c_func_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = fname
* IMPORTING
* GROUP =
* INCLUDE =
* NAMESPACE =
* STR_AREA =
EXCEPTIONS
function_not_exist = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION fname <<<<<<<<<< Error when twice here
TABLES
et_table = lt_a.
ENDDO.
regards,
jkchen
Edited by: jkchen on Nov 26, 2010 7:13 AM
Edited by: jkchen on Nov 26, 2010 7:15 AM
2010 Nov 26 8:42 AM
2010 Nov 26 8:55 AM
hi Jkchen ,
Can you please check if the FM are created when you execute the program .
Please execute the program debugging it and see if FM is created.
Regards,
Arun
2010 Nov 26 9:01 AM
hi Arun,
I'm sure the FM is created successful, and I can see them in SE80 when i debugging. But system still throw exception...
2010 Nov 26 8:59 AM
Hi,
check the value from fname after
CONCATENATE 'Z_TEST_' lv_idx INTO fname.
It could be better to go on with the last fuba, only if the fuba before is succesfully.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = fname
IMPORTING
GROUP =
INCLUDE =
NAMESPACE =
STR_AREA =
EXCEPTIONS
function_not_exist = 1
OTHERS = 2
.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
if sy-subrc eq 0.
CALL FUNCTION fname <<<<<<<<<< Error when twice here
TABLES
et_table = lt_a.
2010 Nov 26 9:04 AM
hi Nicole,
I'm sure the value of sy-subrc is zero after every call function 'FUNCTION_EXISTS'.
2010 Nov 26 9:18 AM
Hi Jkchen ,
I tested your code in my system and the FM are created , i have a doubt in the last starement when you are callinf the FM why are you using the paramater
TABLES
et_table = lt_a.
When i look at the FM created it does not have any interface parameters. This might be causing the error.
Regards
Arun
2010 Nov 26 9:21 AM
hi Arun,
that's a mistake...I forget to delete the parameter...
2010 Nov 26 9:54 AM
Hi jkchen,
I am not sure what is the issue , as if i call the Fm after exiting the do- enddo loop then it works fine.
This is a bit strange as the FM is existing in the system.
Regards,
Arun
2010 Nov 26 10:24 AM