1. 关于REPOLOAD REPOSRC和ABAP Buffer
- ABAP Load Reference:Understanding Program Load (ABAP Load)
- ABAP Buffer(PXA):Understanding Program Buffer (PXA)
- 表:REPOSRC 用于存放SAP ABAP程序源代码,内容就是SE38看到的文本不过是压缩格式的RAWSTRING(XSTRING)
- 表:REPOLOAD 用于存放SAP ABAP程序经过编译后的可执行的二进制文件
2. 解析(读取)REPOSRC的源代码
-
SE38显示的代码
-
方法一:READ REPORT语法直接读取
DATA: source TYPE TABLE OF string WITH EMPTY KEY. READ REPORT 'ZHIDE_03' INTO source. cl_demo_output=>display( source ).
-
方法二:通过decompress工具读取
-
使用ZS_REPOSRC_DOWNLOAD下载REPOSRC源代码RAWSTRING字符串
DATA: v_fnam TYPE rlgrap-filename, " Local file name v_file TYPE string, " Same, but as a string v_xstr TYPE xstring, " Source (compressed) v_xlen TYPE i, " Length of source t_xtab TYPE TABLE OF x255. " Source plugged into a table PARAMETERS: report TYPE progname DEFAULT sy-repid "#EC * MATCHCODE OBJECT progname OBLIGATORY. START-OF-SELECTION. " -- Select local file name WHILE v_fnam IS INITIAL. v_fnam = report. CALL FUNCTION 'NAVIGATION_FILENAME_HELP' EXPORTING default_path = v_fnam mode = 'S' IMPORTING selected_filename = v_fnam. ENDWHILE. v_file = v_fnam. " -- Fetch compressed source code SELECT SINGLE data INTO v_xstr FROM reposrc WHERE progname = report AND r3state = 'A'. v_xlen = XSTRLEN( v_xstr ). " -- Plug source into a table CALL METHOD cl_swf_utl_convert_xstring=>xstring_to_table EXPORTING i_stream = v_xstr IMPORTING e_table = t_xtab EXCEPTIONS OTHERS = 1. " -- Download to local file CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING filetype = 'BIN' filename = v_file bin_filesize = v_xlen TABLES data_tab = t_xtab EXCEPTIONS OTHERS = 0.
-
编译/下载decompress.exe工具
- Reference:decompress ABAP source code from table REPOSRC
- decompress源代码:Gitlab下载 CSDN下载
- decompress编译命令(Window需安装MinGW,然后安装gcc g++编译器)
g++ sap-*.cpp lib\*.cpp -o decompress.exe
- decompress编译命令(Window需安装MinGW,然后安装gcc g++编译器)
- 博主编译好的decompress.exe可执行文件:CSDN下载
-
使用decompress.exe解析源代码(Window需安装MinGW,然后安装gcc g++编译器)
-
使用方法
------------------------------------ SAP Source Code Decompressor, v1.2.0 ------------------------------------ Usage: decompress.exe <infile> <outfile> [-u] [-n] Options: -u : create UTF-16 output; defaults to ASCII -n : assume input from non-Unicode SAP system
-
解析
decompress.exe ZHIDE_03.TXT ZHIDE_03_OUT.TXT -u decompress.exe ZHIDE_03.TXT ZHIDE_03_OUT.TXT -n
-
-
3. 解析(读取)REPOLOAD的源代码
- 尝试中…
- REPOLOAD是编译后的RAWSTRING,decompress解析后乱码;感觉解析不了呢!