‎2008 Dec 04 9:14 AM
Hello experts,
I want to search a string in the sourcecode of function modules.
i had already programmed a version for abap programms, but the function READ REPORTS does not accept function modules.
thx for help
D. S.
‎2008 Dec 04 9:15 AM
Hi
The function module is write in an include so u need to transfer the name of the include instead of the name of function.
U can see the name of the include in the property tab in trx SE37
Max
Edited by: max bianchi on Dec 4, 2008 10:16 AM
‎2008 Dec 04 9:15 AM
Hi
The function module is write in an include so u need to transfer the name of the include instead of the name of function.
U can see the name of the include in the property tab in trx SE37
Max
Edited by: max bianchi on Dec 4, 2008 10:16 AM
‎2008 Dec 04 9:16 AM
The source code of function modules (in functiongroup ZTST) can be found in LZTSTU01 etc. Includes will be LZTST
regards,
Hans
‎2008 Dec 04 9:18 AM
Hi,
you need to put in the name of the include
and not the FM
-Raj
‎2008 Dec 04 9:25 AM
Hi,
As you have to search a string in a FM then it means that you have to read a function module so to do this go to transaction SE37 and then you write the name of a required FM and press the display tab .
then you can easily go through the FM and can search for the required string.
Regards,
Anand
‎2008 Dec 04 9:26 AM
Try to use read textpools ,i think this includes function modules.
‎2008 Dec 04 9:33 AM
okay with include it works,
but I want to scan all* function modules
(* frist I scan the first 1000 only).
can i read the include of some table? The column "include" of the table TFDIR has only numbers but no names.
and how can I get back the name of the function module if I have the include?
‎2008 Dec 04 9:37 AM
Hi,
Use the following FM to get the include name of the function module.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = lv_functionname
IMPORTING
include = lv_include
namespace = lv_namespace
str_area = lv_str_area
EXCEPTIONS
function_not_exist = 1.
Now you can use lv_include as the program name in read report.
Regards,
Vadivelan B
‎2008 Dec 04 9:45 AM
Thanks, I think that schould work,
but now I understand one of the answears above, with adding an "L" before the name and adding the include number at the end. I think this solution is a little bit faster (´cause there are a lot of function modules to scan)
‎2008 Dec 04 10:09 AM
Hi
Yes you're right, u need a code like this:
tables: tfdir.
data: v_include type trdir-NAME,
v_funcgroup(30) type C.
parameters: p_func type tfdir-FUNCNAME.
select single * from tfdir where FUNCNAME = p_func.
v_funcgroup = TFDIR-PNAME+4.
concatenate 'L' v_funcgroup 'U' tfdir-INCLUDE into v_include.
condense v_include.
write: v_funcgroup, v_include.But I'm not sure this solution can be faster than call FUNCTION_EXISTS, because they do the same thing.
Max
‎2008 Dec 04 10:23 AM
Well the results are teh same but the function module FUNCTION_EXISTS has 130 lines of code (minus lines of comments). And at least with direct sql-statements you save 1 function call. It sound not much but SAP has more than 683 function modules.
‎2008 Dec 04 10:59 AM
Okay my programm works.
But im still using "....up to 1000 rows" in my select-statement.
can I say something like: ".....where rownr between 1000 and 2000"? known from Oracle
than I can go trough the database step by step
‎2008 Dec 04 11:12 AM
Hi
I believe it can't do it, it can only indicate the max number of hits to be extracted.
I think every time a "SELECT" is open the cursor starts from the beginning.
Try to check the command OPEN CURSOR.
Max
‎2008 Dec 04 12:01 PM
But the good news is, that the number of function mudules is 10% of the the number of abap-reports, so I can go trough in 1 step. (takes less then 10 minutes)
‎2008 Dec 04 1:20 PM
TYPES: BEGIN OF progstruc,
name TYPE string,
grp TYPE string,
inclu TYPE string,
END OF progstruc.
DATA tmp0 TYPE progstruc.
DATA prog TYPE c LENGTH 60.
DATA itab TYPE TABLE OF string.
DATA iline TYPE string.
DATA tmp1 TYPE i.
DATA tmp2 TYPE i.
DATA prognames TYPE TABLE OF progstruc.
parameter strg TYPE string.
select FUNCNAME PNAME INCLUDE
from TFDIR
into table prognames.
loop at prognames into tmp0.
tmp0-grp = tmp0-grp+3.
CONCATENATE '' tmp0-grp 'U' tmp0-inclu ''
into prog.
READ REPORT prog INTO itab.
tmp1 = 0.
tmp2 = sy-subrc.
IF tmp2 = 0.
LOOP AT itab into iline.
SEARCH iline FOR strg.
IF sy-subrc = 0.
tmp1 = 1.
ENDIF.
ENDLOOP.
IF tmp1 = 1.
WRITE : / tmp0-name.
ENDIF.
ENDIF.
endloop.