zoukankan      html  css  js  c++  java
  • 物料冲销过账MB_CANCEL_GOODS_MOVE…

    *&---------------------------------------------------------------------*
    *& Report  ZLM_TEST_023
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*

    REPORT  zlm_test_023.

    TABLES: mkpf, imkpf, emkpf, likp.
    DATA:   BEGIN OF imseg OCCURS 0.
            INCLUDE STRUCTURE imseg.
    DATA:   END OF imseg.

    DATA:   BEGIN OF emseg OCCURS 0.
            INCLUDE STRUCTURE emseg.
    DATA:   END OF emseg.

    PARAMETERS: lf_budat  LIKE sy-datlo   DEFAULT sy-datlo OBLIGATORY,
                lf_mjahr  LIKE mkpf-mjahr DEFAULT sy-datlo(4) OBLIGATORY,
                lf_mblnr  LIKE mkpf-mblnr OBLIGATORY,
                lf_vbeln  LIKE likp-vbeln OBLIGATORY,
                lf_test   TYPE c DEFAULT 'X'.

    DATA:   mblpo LIKE mseg-zeile.

    SELECT SINGLE * FROM mkpf WHERE mblnr = lf_mblnr
                              AND   mjahr = lf_mjahr
                              AND   xblnr = lf_vbeln.
    IF sy-subrc IS INITIAL.
      CALL FUNCTION 'MB_CANCEL_GOODS_MOVEMENT'
        EXPORTING
          budat     = lf_budat
          mblnr     = lf_mblnr
          mblpo     = mblpo
          mjahr     = lf_mjahr
          tcode     = 'VL09'
          called_by = 'VL09'
        IMPORTING
          emkpf     = emkpf
        TABLES
          emseg     = emseg
          imseg     = imseg
        EXCEPTIONS
          OTHERS    = 1.
    *... No error found, then it will be posted
      IF emkpf-subrc EQ 1.
        IF lf_test IS INITIAL.
          CALL FUNCTION 'MB_POST_GOODS_MOVEMENT'
            EXPORTING
              xblnr_sd = lf_vbeln
            IMPORTING
              emkpf    = emkpf
            EXCEPTIONS
              OTHERS   = 0.
          COMMIT WORK.
          WRITE: / 'Goods movement was cancelled successfully with document:',
                  emkpf-mblnr.
        ELSE.
          WRITE: / 'Testmode: Goods movement could be cancelled !'.
        ENDIF.
      ELSE.
    *... otherwise write an error-log
        LOOP AT emseg.
          WRITE: /
                    emseg-msgid,
                    emseg-msgno,
                    emseg-msgty,
                    emseg-msgv1,
                   emseg-msgv2,
                   emseg-msgv3,
                   emseg-msgv4.
        ENDLOOP.
        WRITE: / emkpf-msgid,
                 emkpf-msgno,
                 emkpf-msgty,
                 emkpf-msgv1,
                 emkpf-msgv2,
                 emkpf-msgv3,
                 emkpf-msgv4.
      ENDIF.
    ELSE.
      WRITE: / 'Material document to reverse does not exsist'.
    ENDIF.

    http://blog.sina.com.cn/sapliumeng
  • 相关阅读:
    Creating and Using Static Libraries for iPhone using Xcode 4.3
    Build fat static library (device + simulator) using Xcode and SDK 4+
    How to safely shut down a loading UIWebView in viewWillDisappear?
    处理iOS设备的屏幕旋转
    Instruments Tutorial for iOS: How To Debug Memory Leaks【转】
    自定义UINavigationBar的背景【转】
    iOS编程——Objective-C KVO/KVC机制[转]
    ios PNG Crush error (PNG图片错误)
    实现自定义延迟加载的滚动视图
    Linux添加或修改ssh端口
  • 原文地址:https://www.cnblogs.com/senlinmu110/p/3802155.html
Copyright © 2011-2022 走看看