2007 Apr 05 3:28 PM
Hi,
I have custom table with following field
FUNNAME CHAR 1000
That contains records like the following
CALL FUNCTION 'ZMATF' EXPORTING MATNR = P_MATNR IMPORTING MATDESCRIPTION = V_MATERIALDESC.
CALL FUNCTION 'Y_CHECK_EXIT' EXPORTING USEREXIT = 'EFNDTAXWAR' IMPORTING EXECUTE = EXECUTE TABLES I_ZA01 = I_ZA01.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING WAIT = 'X'.
CALL FUNCTION 'RS_TABLE_LIST_CREATE' EXPORTING TABLE_NAME = TABNAME.
My requirement is according some of the user conditions i need to select entry from this table and execute the corresponding function module
I tried to use GENERATE SUBROUTINE POOL itab NAME name. But this have limitation of 36 subroutine pools for one program.
Any info highly appreciated.
aRs
2007 Apr 05 4:05 PM
If you can put the name of the FM in a variable and the parameters and exceptions in separate internal tables, then you can call the function modules using the statement:
<b>call function NAME
parameter-table
PARA_TAB
exception-table
EXCP_TAB.</b>
See a small example:
Example
type pools ABAP.
data NAME type STRING value `READ_SPFLI_INTO_TABLE`.
data PARA_TAB type ABAP_FUNC_PARMBIND_TAB.
data PARA_LINE like line of PARA_TAB.
data EXCP_TAB type ABAP_FUNC_EXCPBIND_TAB.
data EXCP_LINE like line of EXCP_TAB.
data CARRIER type SPFLI-CARRID.
data JTAB type SPFLI_TAB.
CARRIER = 'XYZ'.
PARA_LINE-NAME = 'ID'.
PARA_LINE-KIND = ABAP_FUNC_EXPORTING.
get reference of CARRIER into PARA_LINE-VALUE.
append PARA_LINE to PARA_TAB.
PARA_LINE-NAME = 'ITAB'.
PARA_LINE-KIND = ABAP_FUNC_IMPORTING.
get reference of JTAB into PARA_LINE-VALUE.
append PARA_LINE to PARA_TAB.
EXCP_LINE-NAME = 'NOT_FOUND'.
EXCP_LINE-VALUE = 1.
insert EXCP_LINE into table EXCP_TAB.
EXCP_LINE-NAME = 'OTHERS'.
EXCP_LINE-VALUE = 4.
insert EXCP_LINE into table EXCP_TAB.
call function NAME
parameter-table
PARA_TAB
exception-table
EXCP_TAB.
case SY-SUBRC.
when 1.
message id SY-MSGID type SY-MSGTY number SY-MSGNO.
when 2.
message E888(SABAPDOCU) with 'Error in function module'.
endcase.
REgards,
Ravi
Hi..
you can do like this..
get all the FM Names from Dbase and place in Itab where ur
itab is having FM name and Position.
now read the FM name u want...and find position from ITAB.
ur ITAB is
FM_NAME POSITION
Now using following stmt...u can assign number to the subroutine. write all the FMs in different subroutines...go through this...
<b>perform n OF subr1 subr2 ...</b>
n OF subr1 subr2 ...
This statement selects a subroutine subr in the same program from a list. The list subr1 subr2 ... can contain up to 256 subroutines specified directly. For n, you must specify a numeric data object that contains a number between 1 and the number of subroutines specified when executed. The system calls the subroutine subr, for which the list item i is contained in n. You cannot specify parameter_list for this variant and you can only call subroutines without a parameter interface.
2007 Apr 05 3:48 PM
Hi..
you can do like this..
get all the FM Names from Dbase and place in Itab where ur
itab is having FM name and Position.
now read the FM name u want...and find position from ITAB.
ur ITAB is
FM_NAME POSITION
Now using following stmt...u can assign number to the subroutine. write all the FMs in different subroutines...go through this...
<b>perform n OF subr1 subr2 ...</b>
n OF subr1 subr2 ...
This statement selects a subroutine subr in the same program from a list. The list subr1 subr2 ... can contain up to 256 subroutines specified directly. For n, you must specify a numeric data object that contains a number between 1 and the number of subroutines specified when executed. The system calls the subroutine subr, for which the list item i is contained in n. You cannot specify parameter_list for this variant and you can only call subroutines without a parameter interface.
2007 Apr 05 3:58 PM
I could not able understand what your are suggesting. Can please explain little bit more on this?
aRs
2007 Apr 05 4:05 PM
If you can put the name of the FM in a variable and the parameters and exceptions in separate internal tables, then you can call the function modules using the statement:
<b>call function NAME
parameter-table
PARA_TAB
exception-table
EXCP_TAB.</b>
See a small example:
Example
type pools ABAP.
data NAME type STRING value `READ_SPFLI_INTO_TABLE`.
data PARA_TAB type ABAP_FUNC_PARMBIND_TAB.
data PARA_LINE like line of PARA_TAB.
data EXCP_TAB type ABAP_FUNC_EXCPBIND_TAB.
data EXCP_LINE like line of EXCP_TAB.
data CARRIER type SPFLI-CARRID.
data JTAB type SPFLI_TAB.
CARRIER = 'XYZ'.
PARA_LINE-NAME = 'ID'.
PARA_LINE-KIND = ABAP_FUNC_EXPORTING.
get reference of CARRIER into PARA_LINE-VALUE.
append PARA_LINE to PARA_TAB.
PARA_LINE-NAME = 'ITAB'.
PARA_LINE-KIND = ABAP_FUNC_IMPORTING.
get reference of JTAB into PARA_LINE-VALUE.
append PARA_LINE to PARA_TAB.
EXCP_LINE-NAME = 'NOT_FOUND'.
EXCP_LINE-VALUE = 1.
insert EXCP_LINE into table EXCP_TAB.
EXCP_LINE-NAME = 'OTHERS'.
EXCP_LINE-VALUE = 4.
insert EXCP_LINE into table EXCP_TAB.
call function NAME
parameter-table
PARA_TAB
exception-table
EXCP_TAB.
case SY-SUBRC.
when 1.
message id SY-MSGID type SY-MSGTY number SY-MSGNO.
when 2.
message E888(SABAPDOCU) with 'Error in function module'.
endcase.
REgards,
Ravi
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |