以下为正文

​ 
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. 
 
  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       = g_likp-bldat. 
  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. 
  
 
*---仅发货过账: 
 
  report. 
 
* Data Define 
data: i_vbkok type vbkok. 
data: begin of i_vbpok_tab occurs 12. 
        include structure vbpok. 
data: end of i_vbpok_tab. 
data: p_vbeln type vbeln value '0080002730'. 
 
*---交货抬头数据 
i_vbkok-vbeln_vl        = p_vbeln.        "Delivery number 
i_vbkok-wabuc           = 'X'.            "Automatic PGI 
i_vbkok-wadat_ist       = '20110223'. 
 
*---发货过账 
call function 'WS_DELIVERY_UPDATE' 
  exporting 
    vbkok_wa       = i_vbkok 
    commit         = 'X' 
    delivery       = p_vbeln 
    update_picking = 'X' 
  exceptions 
    error_message  = 1 
    others         = 2. 
if sy-subrc <> 0. 
  write:/ '发货过账失败!'. 
endif. 
 
​

评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!