zoukankan      html  css  js  c++  java
  • MM物料重新过账的代码摘抄

    *&---------------------------------------------------------------------*
    *& Report  ZZWASTOR                                                    *
    *&                                                                     *
    *&---------------------------------------------------------------------*
    *&                                                                     *
    *&                                                                     *
    *&---------------------------------------------------------------------*
    REPORT ZZWASTOR .

    *********************************************************************
    * If you do not know the material document of the goods issue any   *
    * more you can use transaction SE16.                                *
    * - Type in table name MKPF                                         *
    * - Type in the delivery note number in field XBLNR (always with    *
    *   leading zeroes)                                                 *
    * - Execute                                                         *
    * - The Material document number of the goods issue for the deleted *
    *   delivery will be shown.                                         *
    *                                                                   *
    *                                                                   *
    *                                                                   *
    * LF_BUDAT  =>  Posting date for the reversal                       *
    * LF_MJAHR  =>  Posting year of the material document to reverse    *
    * LF_MBLNR  =>  Goods issue document (with leading zeroes)          *
    * LF_VBELN  =>  Delivery note number (with leading zeroes)          *
    * LF_TEST   =>  When 'X' it is test mode only, otherwise GI will be *
    *               cancelled                                           *
    *********************************************************************

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

  • 相关阅读:
    基础Linux命令总结
    [博客美化]新年啦,给自己博客加个雪花效果吧~
    自制操作系统Antz(5)——深入理解保护模式与进入方法
    自制操作系统Antz(4)——进入保护模式 (下) 实现内核并从硬盘载入
    自制操作系统Antz(3)——进入保护模式 (中) 直接操作显存
    自制操作系统Antz(2)——进入保护模式 (上) jmp到保护模式
    自制操作系统Antz(1)——Boot Sector
    Java爬取B站弹幕 —— Python云图Wordcloud生成弹幕词云
    Kali Day01 --- arpspoof命令进行断网攻击(ARP欺骗)
    手写杀毒软件——放心的安全卫士
  • 原文地址:https://www.cnblogs.com/xiaomaohai/p/6157169.html
Copyright © 2011-2022 走看看