abap中獲取COOIS的ALV內容
阿新 • • 發佈:2019-01-04
*&---------------------------------------------------------------------*
*& Report ZTEST_LIUXY
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ztest_liuxy.
TABLES:aufk.
FIELD-SYMBOLS <lt_pay_data> TYPE ANY TABLE.
DATA lr_pay_data TYPE REF TO data.
DATA lt_selscreen TYPE TABLE OF rsparams.
"初始設定
CALL METHOD cl_salv_bs_runtime_info=>set
EXPORTING
display = abap_false
metadata = abap_false
data = abap_true.
SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:s_aufnr FOR aufk-aufnr. "生產訂單
SELECTION-SCREEN END OF BLOCK main.
* 呼叫目標程式COOIS
SUBMIT ppio_entry
WITH s_aufnr IN s_aufnr
WITH SELECTION-TABLE lt_selscreen
AND RETURN.
TRY.
"獲取ALV顯示資料
CALL METHOD 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 `無法取得ALV術` TYPE 'E'.
ENDTRY.
"結束
cl_salv_bs_runtime_info=>clear_all( ).
*& Report ZTEST_LIUXY
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ztest_liuxy.
TABLES:aufk.
FIELD-SYMBOLS
DATA lr_pay_data TYPE REF TO data.
DATA lt_selscreen TYPE TABLE OF rsparams.
"初始設定
CALL METHOD cl_salv_bs_runtime_info=>set
EXPORTING
display = abap_false
metadata = abap_false
data = abap_true.
SELECTION-SCREEN BEGIN OF
SELECT-OPTIONS:s_aufnr FOR aufk-aufnr. "生產訂單
SELECTION-SCREEN END OF BLOCK main.
* 呼叫目標程式COOIS
SUBMIT ppio_entry
WITH s_aufnr IN s_aufnr
WITH SELECTION-TABLE lt_selscreen
AND RETURN.
TRY.
"獲取ALV顯示資料
CALL METHOD cl_salv_bs_runtime_info=>
IMPORTING
r_data = lr_pay_data.
ASSIGN lr_pay_data->* TO <lt_pay_data>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE `無法取得ALV術` TYPE 'E'.
ENDTRY.
"結束
cl_salv_bs_runtime_info=>clear_all( ).