Created by Jerry Wang, last modified on Aug 30, 2014
在使用ABAP program调用function时trace mode指定为lean trace:
运行过程中的细节能够被trace下来:
并且能够在BRF+ workbench的trace view里浏览:
REPORT zcall_function. DATA: lo_function TYPE REF TO if_fdt_function, lo_context TYPE REF TO if_fdt_context, lo_result TYPE REF TO if_fdt_result, lx_fdt TYPE REF TO cx_fdt, lo_trace TYPE REF TO if_fdt_trace, lo_lean_trace TYPE REF TO if_fdt_lean_trace, lt_trace TYPE if_fdt_lean_trace=>ts_record, lv_string TYPE string. FIELD-SYMBOLS <ls_message> TYPE if_fdt_types=>s_message. lo_function = cl_fdt_factory=>if_fdt_factory~get_instance( )->get_function( iv_id = '3440B5B172DE1ED48BEAF1808FD98CB7' ). TRY. lo_context = lo_function->get_process_context( ). lo_context->set_value( iv_name = 'CUSTOMER' ia_value = 'sap' ). CALL METHOD lo_function->process EXPORTING io_context = lo_context iv_trace_mode = if_fdt_constants=>gc_trace_mode_lean IMPORTING eo_result = lo_result eo_trace = lo_trace. lo_result->get_value( IMPORTING ea_value = lv_string ). WRITE lv_string . CATCH cx_fdt INTO lx_fdt. LOOP AT lx_fdt->mt_message ASSIGNING <ls_message>. WRITE / <ls_message>-text. ENDLOOP. ENDTRY. lo_lean_trace ?= lo_trace. lo_lean_trace->read( IMPORTING ets_trace_record = lt_trace ). lo_lean_trace->save( ). ———————————————— 版权声明:本文为CSDN博主「汪子熙」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/i042416/article/details/95004830
完整的report source code如下: