交货单实际发货日期修改

REPORT  Z_POSTING_DELIVERY.

DATA: code(255) TYPE c OCCURS 0,
      prog LIKE sy-repid value 'ZCHD_ZSDR021'.
*Insert '*@#@@[SAP]' into CODE
* INDEX 13 .
DATA: BEGIN OF I_VBKOK OCCURS 11.
        INCLUDE STRUCTURE VBKOK.
DATA: END OF I_VBKOK.

DATA: BEGIN OF I_VBPOK_TAB OCCURS 12.
        INCLUDE STRUCTURE VBPOK.
DATA: END OF I_VBPOK_TAB.

PARAMETERS: P_VBELN TYPE VBELN.

DATA:G_LIKP LIKE  LIKP.
DATA:G_LIPS LIKE  LIPS.
DATA GV_14(14) TYPE C.

START-OF-SELECTION.


*  READ   REPORT prog INTO code.
*  check sy-subrc = 0.
*  insert '*@#@@[SAP]' into code index 1.
*  INSERT REPORT prog FROM code.

  READ REPORT prog INTO code.
  CHECK SY-SUBRC = 0 .
  DELETE code INDEX 1.
  INSERT REPORT prog FROM code.



  SELECT SINGLE * INTO G_LIKP FROM LIKP
    WHERE VBELN = P_VBELN.

  I_VBKOK-VBELN_VL        = P_VBELN.        "Delivery number
  I_VBKOK-WABUC           = 'X'.            "Automatic PGI
  I_VBKOK-WADAT_IST       =  SY-DATUM .
  APPEND I_VBKOK.

  SELECT * INTO G_LIPS FROM LIPS
    WHERE VBELN = P_VBELN.
    I_VBPOK_TAB-VBELN_VL    = P_VBELN.      "Delivery number
    I_VBPOK_TAB-POSNR_VL    = G_LIPS-POSNR.
    I_VBPOK_TAB-VBELN       = P_VBELN.
    I_VBPOK_TAB-POSNN       = G_LIPS-POSNR.
    I_VBPOK_TAB-MATNR       = G_LIPS-MATNR.
    GV_14                   = G_LIPS-LFIMG.
    CONDENSE GV_14.
    I_VBPOK_TAB-PIKMG       = GV_14 .
    APPEND I_VBPOK_TAB.
  ENDSELECT.

  CALL FUNCTION 'WS_DELIVERY_UPDATE'
    EXPORTING
      VBKOK_WA       = I_VBKOK
      COMMIT         = 'X'
      DELIVERY       = P_VBELN
*      update_picking = 'X'
    TABLES
      VBPOK_TAB      = I_VBPOK_TAB
    EXCEPTIONS
      ERROR_MESSAGE  = 1
      OTHERS         = 2.
  IF  SY-SUBRC <> 0.

  ENDIF.
  .

 

posted @ 2018-06-02 11:03  追寻无限  阅读(1230)  评论(0编辑  收藏  举报