05-05-2008 9:25 AM
Hello,
within my bachelor thesis I am engaged in parsing ABAP Objects to calculate different code metrics. The analysis tool and many of the known parser-apis do require source-files at the file system layer.
As SAP stores everything in a DB, I wonder if there is a way to export the repository to the file system. And if this is not possible, is there another practicable way to access the source code?
Another point is: Does anyone know a source for a complete grammar (like ebnf or so) for ABAP Objects? that could make my life quite a lot easier...
mfg
- clemens heppner
05-05-2008 11:03 PM
Hello Clemens
You may write a small ABAP report employing class CL_OO_SOURCE. If you create an instance of this class using any class name as input the public instance attribute SOURCE contains the entire coding which you could download (-> CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD).
Regards
Uwe.
05-07-2008 11:59 AM
Thanks for your advice! I've written this report:
START-OF-SELECTION.
DATA: source TYPE REF TO cl_oo_source,
source_tab TYPE seop_source_string,
classname TYPE seoclskey VALUE 'CL_OO_SOURCE'.
CREATE OBJECT source EXPORTING clskey = classname.
* Copy source->SOURCE table because gui_download( ) needs a changeable
* argument and source->source is read-only.
source_tab = source->source.
cl_gui_frontend_services=>gui_download( EXPORTING filename =
'c:\source.ao' CHANGING data_tab = source_tab ).
But that approach has some serious drawbacks:
I have to save each class one by one (is there a way to automate that? P.e. find all classes in one package?)
I can not access the code of reports and such because cl_oo_source requires a classname.
Is there another way or an extension to this one, to solve those problems?
Thanks,
- clemens