ABAP学习(27):SUBMIT获取ALV LIST
ABAP SUBMIT获取返回LIST
使用Submit调用Reports程序,获取Reports程序返回的ALV Lists输出。
示例:
"submit,获取其他report list FORM f_test_submit_memory. DATA:lt_list TYPE TABLE OF abaplist. TYPES:BEGIN OF s_str, line TYPE C LENGTH 255, END OF s_str. DATA:lt_strlist TYPE TABLE OF s_str. DATA:ls_strlist LIKE LINE OF lt_strlist. FIELD-SYMBOLS:<lt_pay_data> TYPE ANY TABLE. FIELD-SYMBOLS:<lt_test> type any . "LIKE LINE OF it_tab . DATA:lr_pay_data TYPE REF TO data. cl_salv_bs_runtime_info=>set( exporting display = abap_false metadata = abap_false data = abap_true ). "调用report程序,从memery获取report List SUBMIT xxxxxx EXPORTING LIST TO MEMORY AND RETURN. "方式1:从ABAP内存中加载缓存的LIST * CALL FUNCTION 'LIST_FROM_MEMORY' * TABLES * listobject = lt_list * EXCEPTIONS * not_found = 1 * OTHERS = 2. * "在当前屏幕中显示上面加载的LIST * IF sy-subrc = 0. * CALL FUNCTION 'WRITE_LIST' * TABLES * listobject = list_tab. * ENDIF. * CALL FUNCTION 'LIST_TO_ASCI' * TABLES * listasci = lt_strlist * listobject = lt_list * EXCEPTIONS * empty_list = 1 * list_index_invalid = 2 * others = 3. * LOOP AT lt_strlist INTO ls_strlist. * WRITE:/ ls_strlist-line. * ENDLOOP. "方式2:使用cl_salv_bs_runtime_info类 TRY . cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = lr_pay_data ). ASSIGN lr_pay_data->* TO <lt_pay_data>. CATCH cx_salv_bs_sc_runtime_info. MESSAGE `Unable to retrieve ALV data` TYPE 'E'. ENDTRY. cl_salv_bs_runtime_info=>clear_all( ). cl_demo_output=>display_data( <lt_pay_data> ). ENDFORM.
本文来自博客园,作者:渔歌晚唱,转载请注明原文链接:https://www.cnblogs.com/tangToms/p/16025422.html