ABAP 报告的源代码无限制
如果您必须使用 RFC,可以编写启用 RFC 的函数模块。您可以编写一个新的 FM,以便检索程序源代码。首先,您需要创建一个如下所示的结构,然后基于该结构创建一个表类型。此表可以传递给 RFC 函数。
以下是您可以在函数模块中使用的表类型
下一步是创建一个启用 RFC 的函数模块。创建函数模块时必须传递参数。
function zsrcex_extractor . *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(PACKAGE_SIZE) TYPE I DEFAULT 250 *" VALUE(SELECT_AFTER) TYPE PROGNAME OPTIONAL *" VALUE(LANGU) TYPE SYLANGU DEFAULT SY-LANGU *" EXPORTING *" VALUE(EXTRACT) TYPE ZSRCEX_T *" VALUE(NO_MORE_DATA) TYPE CHAR1 *"---------------------------------------------------------------------- data: table_lines type i. statics: last_progname type progname. statics: s_no_more_data type char1. data: progs type table of progname with header line. data: extract_line type zsrcex. data: texts type table of textpool with header line. data: source type table of text1000 with header line. data: nl type abap_char1 value cl_abap_char_utilities=>newline. data: tab type abap_char1 value cl_abap_char_utilities=>horizontal_tab. clear: extract[]. * If we have previously (from last call) determined that there * is no more data, exit the function if s_no_more_data = 'X'. no_more_data = 'X'. "Keep informing caller return. endif. * Start selecting after specified program name, if supplied if not select_after is initial. last_progname = select_after. endif. * Read a number of source objects specified by package_size select progname from reposrc into table progs up to package_size rows where progname > last_progname * This list is probably not comprehensive, * it's just for demonstration purposes: and ( progname like 'Z%' or progname like 'Y%' or progname like 'SAPMZ%' or progname like 'SAPMY%' or progname like 'SAPLZ%' or progname like 'SAPLY%' or progname like 'LZ%' or progname like 'LY%' ) * To retrieve EVERYTHING, just comment out the above 4 lines and r3state = 'A'. "Active sources only * Check whether we should stop selecting yet describe table progs lines table_lines. if table_lines lt package_size. s_no_more_data = 'X'. endif. * Process the selected programs loop at progs. clear: extract_line, texts[]. extract_line-progname = progs. * The following does not work e.g. for type pools read report progs into source. read textpool progs into texts language langu. * Don't pass back programs with neither texts not source if source[] is initial and texts[] is initial. continue. endif. * Put source into one string into EXTRACT loop at source. concatenate extract_line-source source nl into extract_line-source. endloop. * Put texts into single string loop at texts. concatenate extract_line-texts texts-id tab texts-key tab texts-entry nl into extract_line-texts. endloop. * Store program title separately read table texts with key id = 'R'. if sy-subrc = 0. extract_line-title = texts-entry. endif. append extract_line to extract. endloop. * Return determined value of no_more_data indicator no_more_data = s_no_more_data. endfunction.
您可以调用此函数模块来提取程序源信息并为其编制索引。有关更多详细信息,请参阅链接 -
http://ceronio.net/2009/06/improved-abap-source-code-search/
广告