‎2010 Sep 20 8:38 AM
Hello,
Is it possible to access (read only of course) the Source-Code of class-methods / function modules & abap programs in ABAP?
Example:
Function Module yy_test:
FUNCTION yy_test.
data yy_test_boolean type xfeld.
yy_test_boolean = 'X'.
ENDFUNCTION.
Webdynpro method:
Data lv_result type string.
CALL FUNCTION 'READ_FUNCTION_SOURCE'
EXPORTING iv_name = 'YY_TEST'
IMPORITNG ev_source = lv_result.
==> lv_result = 'function yy_testndata yy_test_boolean type xfeld. \n\nyy_test_boolean = 'X'.\nendfunction'.
Thank you very much,
Timo Stark
‎2010 Sep 20 9:19 AM
Hi ,
To access source code of class methods , go to transaction se24 ,
Give the class name , you will get all methods , attributes etc .
Double click on the method to read the code.(Its only read only though).
Thanks,
Aditya.
‎2010 Sep 20 10:43 AM
Yeah.. I really meant a dynamic way.
E.g. imagine a situation in which i want to present the user the source of a class in a web-dynpro dynamically (==> the user can determine the name of the class).
Or another situation: I want to analyse the source-code of classes dynamically for common faults and programming mistakes.
‎2010 Sep 20 1:17 PM
This isn't really a web dynpro ABAP directly related question. You might want to use the source in a WD application, but actually retrieving the source code is not WD specific. I am going to move this question to ABAP General, but you should also search that forum or look at the source of the SAPlink project (or perform a trace during editing in SE80). There are internal APIs used within the workbench for accessing the class method's source code for example.
>>>Moderator note: moved thread from Web Dynpro ABAP forum to ABAP General
Edited by: Thomas Jung on Sep 20, 2010 8:18 AM
‎2010 Sep 20 1:26 PM
there are several FM´s that can read sources e.G. RV_READ_REPORT.
reports are stored in table REPOSRC. hope this will get you a bit further.