02-04-2009 4:34 PM
Hi,
Actually in the normal ABAP, if we want to read the report, then we will write read report statement.
If we want to read method then this statement will not work.
So, to read the method and put that code in 1 internal table , which statement we need to write?
Regards,
Radhika
02-04-2009 4:39 PM
You can use the same READ report statement, but before doing that you need to get the INCLUDE name which is actually storing the METHOD's code.
Use the FM SEO_METHOD_GET_INCLUDE_BY_NAME to get the Inlcude name by providing CLASS & METHOD as the key.
Now use the Read report statement for Include program to get the source code of the method.
Regards
Naimesh Patel
02-04-2009 4:39 PM
You can use the same READ report statement, but before doing that you need to get the INCLUDE name which is actually storing the METHOD's code.
Use the FM SEO_METHOD_GET_INCLUDE_BY_NAME to get the Inlcude name by providing CLASS & METHOD as the key.
Now use the Read report statement for Include program to get the source code of the method.
Regards
Naimesh Patel
02-06-2009 1:29 PM
Hi Naimesh,
Thanks for your reply.
As, i am not aware of ABAP Objects i am having some issues:
Actually that is working for some methods in some classes.
Here 1 issue is there:
In se24 1 method is there in 1 class.
Even by using that FM i am able to get the program name by giving class and method name,
but in se38 and in se80 that program is not there.
so, where we can i find that program to read the source code of the program?
1 example here:
Class name is CL_GUI_FRONTEND_SERVICES.
in this class, methods like FILE_EXIST , FILE_GET_SIZE, etc are there.
By giving the class name and method name i am able to get the program name also,
but in se38 that program is not there. So, i am unable to read the source code of that program.
please help me out in this regard.
Thanks & Regards,
Radhika
02-05-2009 4:55 AM
Hello Radhika
An alternative approach is to use fm SEO_METHOD_GET_SOURCE.
Regards
Uwe
02-06-2009 2:05 PM
Hi Naimesh,
Thanks for your reply.
As, i am not aware of ABAP Objects i am having some issues:
Actually that is working for some methods in some classes.
Here 1 issue is there:
In se24 1 method is there in 1 class.
Even by using that FM in SE37 i am able to get the program name by giving class and method name,
but while using that FM in the program i am not able to get that program name.
so, i am unable to read the source code of the program?
1 example here:
Class name is CL_GUI_FRONTEND_SERVICES.
in this class, methods like FILE_EXIST , FILE_GET_SIZE, etc are there.
By giving the class name and method name i am able to get the program name also,
but while using that FM in the program i am not able to get that program name.
so, i am unable to read the source code of the program?
Here is my code:
REPORT Z16059_SCAN_METHOD.
DATA: BEGIN OF I_PROGRAM OCCURS 0,
LINE(256) TYPE C,
END OF I_PROGRAM.
DATA METHOD TYPE PROGRAM.
DATA: BEGIN OF I_STRUCTURE,
CLS_NAME(30) TYPE C,
METH_NAME(61) TYPE C,
END OF I_STRUCTURE.
I_STRUCTURE-CLS_NAME = 'CL_GUI_FRONTEND_SERVICES'.
I_STRUCTURE-METH_NAME = 'CL_GUI_FRONTEND_SERVICES-FILE_EXIST'.
CALL FUNCTION 'SEO_METHOD_GET_INCLUDE_BY_NAME'
EXPORTING
MTDKEY = I_STRUCTURE
IMPORTING
PROGNAME = METHOD
EXCEPTIONS
INTERNALMETHOD_NOT_EXISTING = 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.
READ REPORT METHOD INTO I_PROGRAM.
Please help me out in this regard.
Thanks & Regards,
Radhika
02-06-2009 2:17 PM
You should only pass the method name to the METH_NAME field.
I_STRUCTURE-CLS_NAME = 'CL_GUI_FRONTEND_SERVICES'.
I_STRUCTURE-METH_NAME = 'FILE_EXIST'.
Regards,
Naimesh Patel
02-06-2009 2:31 PM
Naimesh,
Thanks a lot, now it is working.
Thanks for your instant reply.
if any doubts, i'll get back to you.
Thanks,
Radhika