ABAP submit程序获取ALV数据的方法

1、使用标准ALV类方法

数据定义
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 ).

  submit zwm001 with selection-table  lt_sel_tab  exporting list to memory and return.

  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> ).

2、使用memory

  submit zwm001 with selection-table  lt_sel_tab  exporting list to memory and return.

  call function 'LIST_FROM_MEMORY'
    tables
      listobject = lt_list
    exceptions
      not_found  = 1
      others     = 2.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  else.
    call function 'LIST_TO_ASCI'
*     EXPORTING
*       LIST_INDEX               = -1
*       WITH_LINE_BREAK          = ' '
      tables
        listasci           = t_ascilist
        listobject         = lt_list
      exceptions
        empty_list         = 1
        list_index_invalid = 2
        others             = 3.
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    else.
"      write:/ 'Below are the lines from the submitted program.'.
"      loop at t_ascilist.
"        write:/ t_ascilist-line.
"      endloop.
"      skip 2.
    endif.
  endif.
  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值