SUBMIT RM07DOCSMB51 获取返回清单,抓取标准报表数据

Posted Rainystuday

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SUBMIT RM07DOCSMB51 获取返回清单,抓取标准报表数据相关的知识,希望对你有一定的参考价值。

*&---------------------------------------------------------------------*
*& Report  YT_SUBMIT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT YT_SUBMIT.


  DATA: LV_VA TYPE SLIS_VARI.

  FIELD-SYMBOLS: <LT_PAY_DATA> TYPE ANY TABLE,
                 <LT_TEMP>     TYPE ANY TABLE,
                 <LS_DATA>.

  DATA LR_PAY_DATA              TYPE REF TO DATA.

  DATA: LT_MCHA   TYPE TABLE OF MCHA,
        LT_KNA1   TYPE TABLE OF KNA1,
        LT_T001L  TYPE TABLE OF T001L,
        LT_CSKT   TYPE TABLE OF CSKT,
        LT_MM0004 TYPE TABLE OF ZTCOFCO_MM_0004,
        LT_LFA1   TYPE TABLE OF LFA1.

****选择屏幕全部为空需要给物料赋值*防止弹出警告
  IF S_MATNR[] IS INITIAL.
    S_MATNR-SIGN = I.
    S_MATNR-OPTION = CP.
    S_MATNR-LOW = *.
    APPEND S_MATNR.
  ENDIF.

***检查是否有MB51的权限
  AUTHORITY-CHECK OBJECT S_TCODE
           ID TCD FIELD MB51.
  IF SY-SUBRC <> 0.
    MESSAGE S006 WITH MB51 DISPLAY LIKE E.
    LEAVE LIST-PROCESSING.
  ENDIF.

  SELECT SINGLE DCPFM INTO GV_DCPFM
          FROM USR01
          WHERE BNAME = SY-UNAME.


  PERFORM FRM_GET_VARIANT CHANGING LV_VA."获取程序变式

***为后续获取ALV数据做设置
  CL_SALV_BS_RUNTIME_INFO=>SET(
     EXPORTING
       DISPLAY  = ABAP_FALSE
       METADATA = ABAP_FALSE
       DATA     = ABAP_TRUE ).




  SUBMIT RM07DOCS                " Tcode MB51
    WITH MATNR IN S_MATNR   "物料
    WITH WERKS IN S_WERKS   "工厂
    WITH LGORT IN S_LGORT   "库位
    WITH CHARG IN S_CHARG   "批次
    WITH LIFNR IN S_LIFNR   "供应商
    WITH KUNNR IN S_KUNNR   "客户
    WITH BWART IN S_BWART   "移动类型
    WITH SOBKZ IN S_SOBKZ   "特殊库存
    WITH AUFNR IN S_AUFNR   "生产订单
    WITH KOSTL IN S_KOSTL   "成本中心
    WITH MAT_KDAU IN S_KDAU   "销售订单
    WITH MAT_KDPO IN S_KDPO   "销售订单行项目
    WITH RSNUM IN S_RSNUM   "预留
    WITH RSPOS IN S_RSPOS   "预留行
    WITH BUDAT IN S_BUDAT "过账日期
    WITH USNAM IN S_USNAM   "用户
    WITH VGART IN S_VGART
    WITH MBLNR IN S_MBLNR
    WITH MJAHR IN S_MJAHR
    WITH XBLNR IN S_XBLNR
    WITH RHIER_L = ‘‘
    WITH RFLAT_L = ABAP_TRUE"扁平结构
    WITH DATABASE = ABAP_TRUE "读取数据库
    WITH ALV_DEF = LV_VA"变式
      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.
  ENDTRY.
  CL_SALV_BS_RUNTIME_INFO=>CLEAR_ALL( ).
  IF <LT_PAY_DATA> IS ASSIGNED.


    LOOP AT <LT_PAY_DATA> ASSIGNING <LS_DATA>.
      MOVE-CORRESPONDING <LS_DATA> TO GS_ALV.
      APPEND GS_ALV TO GT_ALV.
    ENDLOOP.


*&---------------------------------------------------------------------*
*&      Form  FRM_GET_VARIANT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      <--P_LV_VA  text
*----------------------------------------------------------------------*
FORM FRM_GET_VARIANT  CHANGING CV_VA.
* prepare the areas for the different display variants
*  repid = sy-repid.

  DATA: LS_DEF_VARIANTE  LIKE DISVARIANT,
        LS_VARIANTE_FLAT LIKE DISVARIANT,
        LS_VARIANTE      LIKE DISVARIANT.

  MOVE  : RM07DOCS              TO  LS_VARIANTE-REPORT,
         RM07DOCS              TO  LS_VARIANTE_FLAT-REPORT,
          DETA                TO  LS_VARIANTE_FLAT-HANDLE.

* the display variant is depending on the seleted mode of
* the SAP-LIST-VIEWER : look for both variants

* a) Get default variant for the hierarchic list
  LS_DEF_VARIANTE = RM07DOCS.

  CALL FUNCTION REUSE_ALV_VARIANT_DEFAULT_GET
    EXPORTING
      I_SAVE     = A
    CHANGING
      CS_VARIANT = LS_DEF_VARIANTE
    EXCEPTIONS
      NOT_FOUND  = 2.

  IF SY-SUBRC = 0.
    MOVE  LS_DEF_VARIANTE-VARIANT    TO  CV_VA.
  ELSE.

* b) Get default variant for the non-hierarchic list
    LS_DEF_VARIANTE = LS_VARIANTE_FLAT.

    CALL FUNCTION REUSE_ALV_VARIANT_DEFAULT_GET
      EXPORTING
        I_SAVE     = A
      CHANGING
        CS_VARIANT = LS_DEF_VARIANTE
      EXCEPTIONS
        NOT_FOUND  = 2.

    IF SY-SUBRC = 0.
      MOVE  LS_DEF_VARIANTE-VARIANT    TO  CV_VA.
    ENDIF.
  ENDIF.

ENDFORM.

 

以上是关于SUBMIT RM07DOCSMB51 获取返回清单,抓取标准报表数据的主要内容,如果未能解决你的问题,请参考以下文章

submit和execute的区别

PHP函数memory_get_usage获取PHP内存清耗量

如何通过submit提交form表单获取后台传来的返回值

ExecutorService中submit和execute区别

Linux常用命令

dubbo接口未更新,清maven缓存问题