美文网首页
ABAP获取报表程序的ALV数据2021-09-03

ABAP获取报表程序的ALV数据2021-09-03

作者: JayDragon | 来源:发表于2021-09-03 10:52 被阅读0次

    有时候写接口程序需要获取自开发报表或标准报表的ALV数据用于外发,这里以获取标准Tcode:MB52物料库存报表数据为例:

      DATA: ls_data TYPE REF TO data.
      FIELD-SYMBOLS: <lt_data> TYPE ANY TABLE,
                     <ls_data>  TYPE data.
      cl_salv_bs_runtime_info=>set(
           display = abap_false
           metadata = abap_false
           data    = abap_true ).
      SUBMIT rm07mlbs WITH werks IN rt_werks
                      WITH pa_sond = ''
                      WITH nozero = 'X'
                      WITH pa_flt = 'X'
                      AND RETURN.
      TRY.
          cl_salv_bs_runtime_info=>get_data_ref(
            IMPORTING r_data = ls_data ).
          ASSIGN ls_data->* TO <lt_data>.
        CATCH cx_salv_bs_sc_runtime_info.
      ENDTRY.
      cl_salv_bs_runtime_info=>clear_all( ).
      cl_salv_bs_runtime_info=>clear_error( ).
      IF <lt_data> IS ASSIGNED.
        LOOP AT <lt_data> ASSIGNING <ls_data>.
          MOVE-CORRESPONDING <ls_data> TO ls_yfkdata.
          APPEND ls_yfkdata TO lt_yfkdata.
          CLEAR ls_yfkdata.
        ENDLOOP.
      ENDIF.
    
    

    相关文章

      网友评论

          本文标题:ABAP获取报表程序的ALV数据2021-09-03

          本文链接:https://www.haomeiwen.com/subject/glzhwltx.html