移动代码

01 -- MB01
02 -- MB31
03 -- MB1A
04 -- MB1B
05 -- MB1C
06 -- MB11
07 -- MB04

一、收货(101)

说明:采购订单、生产订单收货

[plain] view plain copy
  1. form recvfromord tables pt_tran structure zwttran.
  2. "移库定义
  3. data: goodsmvt_header  type   bapi2017_gm_head_01,
  4. goodsmvt_code    type   bapi2017_gm_code,
  5. goodsmvt_headret type   bapi2017_gm_head_ret,
  6. materialdocument type   bapi2017_gm_head_ret-mat_doc,
  7. matdocumentyear  type   bapi2017_gm_head_ret-doc_year,
  8. goodsmvt_item    type standard table of   /afs/bapi2017_gm_item_create,
  9. return           type standard table of   bapiret2,
  10. w_creturn        type   bapiret2,
  11. w_goodsmvt_item  type                     /afs/bapi2017_gm_item_create,
  12. w_return         type   bapiret2.
  13. data:lt_retmsg like table of bapiret2 with header line,
  14. lt_return like table of bapiret2 with header line.
  15. data:l_tran_nbr like zwttran-tran_nbr,
  16. l_tranpo   like zwttran-tranpo,
  17. l_matdoc   like zwttran-matdoc,
  18. l_flag     like zwttran-flag,
  19. l_line_id type i.
  20. data:l_asn_nbr type ze_ref_field, "asn号
  21. l_po type ze_ref_field,"po号
  22. l_po_line(5) type n,"po行号
  23. l_matnr type matnr."货号
  24. data:l_type type char1,"类型
  25. l_afpo type afpo,"生产订单
  26. l_j_3abssi type  j_3abssi,"生产订单计划行
  27. l_eket type eket,"采购订单计划行
  28. l_ekpo type ekpo."采购订单行项目
  29. data:lt_bom like table of zwmbom with header line.
  30. refresh:t_tran_nbr.
  31. loop at pt_tran.
  32. clear :t_tran_nbr.
  33. t_tran_nbr-tran_nbr = pt_tran-tran_nbr.
  34. if pt_tran-tran_type = '603' and pt_tran-tran_code = '02' and pt_tran-proc_stat_code = '10'  and pt_tran-ref_field_6 = 'P'.
  35. t_tran_nbr-po = pt_tran-ref_field_3.
  36. endif.
  37. append t_tran_nbr.
  38. endloop.
  39. sort t_tran_nbr by tran_nbr po.
  40. delete adjacent duplicates from t_tran_nbr.
  41. loop at t_tran_nbr.
  42. clear:l_tran_nbr,l_matdoc,l_matnr,l_asn_nbr,l_po,l_matnr,l_type,l_afpo,l_j_3abssi,l_eket,l_ekpo,l_tranpo,lt_retmsg,lt_return,pt_tran.
  43. refresh:lt_return.
  44. clear:goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return.
  45. refresh:goodsmvt_item ,return.
  46. "头
  47. goodsmvt_header-pstng_date = sy-datum.
  48. goodsmvt_header-doc_date = sy-datum.
  49. "明细
  50. loop at pt_tran where tran_type = '603' and tran_code = '02'  and proc_stat_code = '10' and units_rcvd > 0
  51. and tran_nbr = t_tran_nbr-tran_nbr and ref_field_3 = t_tran_nbr-po.
  52. if pt_tran-ref_field_6 = 'P'.
  53. l_tran_nbr =  pt_tran-tran_nbr.
  54. "获取asn号
  55. l_asn_nbr = pt_tran-ref_field_1.
  56. l_po = pt_tran-ref_field_3.
  57. concatenate l_tran_nbr l_po into l_tranpo.
  58. if pt_tran-ref_field_4 is not initial.
  59. l_po_line = pt_tran-ref_field_4.
  60. else.
  61. clear l_po_line.
  62. endif.
  63. l_matnr = pt_tran-matnr.
  64. clear:lt_retmsg.
  65. refresh:lt_retmsg.
  66. call function 'ZLC_GET_PREMOVE101'
  67. EXPORTING
  68. p_matnr    = l_matnr
  69. p_po       = l_po
  70. p_po_line  = l_po_line
  71. IMPORTING
  72. p_type     = l_type
  73. p_afpo     = l_afpo
  74. p_j_3abssi = l_j_3abssi
  75. p_ekpo     = l_ekpo
  76. p_eket     = l_eket
  77. TABLES
  78. pt_retmsg  = lt_retmsg.
  79. read table lt_retmsg with key type = 'E'.
  80. if sy-subrc <> 0.
  81. case l_type.
  82. when 'E'.
  83. "事务代码
  84. goodsmvt_code-gm_code = '02'.                 "mb31
  85. "明细
  86. w_goodsmvt_item-line_id = w_goodsmvt_item-line_id + 1.
  87. w_goodsmvt_item-move_type = '101'."移动类型
  88. w_goodsmvt_item-material = l_j_3abssi-matnr."大货号
  89. w_goodsmvt_item-grid_value = l_j_3abssi-j_3asize."网格值
  90. w_goodsmvt_item-plant = g_plant."工厂
  91. w_goodsmvt_item-stge_loc = g_stge_loc."地点
  92. w_goodsmvt_item-entry_qnt = pt_tran-units_rcvd."数量
  93. w_goodsmvt_item-orderid = l_j_3abssi-j_3absnr."订单号
  94. w_goodsmvt_item-order_itno = l_j_3abssi-j_3ahbsp."行项目
  95. w_goodsmvt_item-sched_line_sku = l_j_3abssi-j_3aebsp."计划行项目
  96. w_goodsmvt_item-mvt_ind = 'F'."生产订单
  97. w_goodsmvt_item-stck_type = 'E'.
  98. w_goodsmvt_item-gr_rcpt  = pt_tran-user_id.
  99. append w_goodsmvt_item to goodsmvt_item.
  100. when 'F'.
  101. "事务代码
  102. goodsmvt_code-gm_code = '01'.                 "mb01
  103. "明细
  104. w_goodsmvt_item-line_id = w_goodsmvt_item-line_id + 1.
  105. l_line_id = w_goodsmvt_item-line_id.
  106. w_goodsmvt_item-move_type = '101'."移动类型
  107. w_goodsmvt_item-material = l_ekpo-matnr."大货号
  108. w_goodsmvt_item-grid_value = l_eket-j_3asize."网格值
  109. w_goodsmvt_item-plant = g_plant."工厂
  110. w_goodsmvt_item-stge_loc = g_stge_loc."地点
  111. clear w_goodsmvt_item-vendor.
  112. w_goodsmvt_item-entry_qnt = pt_tran-units_rcvd."数量
  113. clear w_goodsmvt_item-batch.
  114. w_goodsmvt_item-po_number = l_eket-ebeln."采购订单
  115. w_goodsmvt_item-po_item = l_eket-ebelp."采购订单行号
  116. w_goodsmvt_item-sched_line_sku = l_eket-etenr."计划行
  117. clear:w_goodsmvt_item-parent_id,w_goodsmvt_item-line_depth.
  118. w_goodsmvt_item-mvt_ind = 'B'."采购订单
  119. w_goodsmvt_item-stck_type = 'E'."库存类型
  120. w_goodsmvt_item-gr_rcpt  = pt_tran-user_id.
  121. append w_goodsmvt_item to goodsmvt_item.
  122. refresh:lt_bom.
  123. call function 'ZLC_GET_BOM'
  124. EXPORTING
  125. p_ebeln = l_eket-ebeln
  126. p_ebelp = l_eket-ebelp
  127. p_etenr = l_eket-etenr
  128. TABLES
  129. pt_bom  = lt_bom.
  130. if lines( lt_bom ) > 0.
  131. loop at lt_bom.
  132. w_goodsmvt_item-line_id = w_goodsmvt_item-line_id + 1.
  133. w_goodsmvt_item-move_type = '543'."移动类型
  134. w_goodsmvt_item-material = lt_bom-matnr."货号
  135. if lt_bom-grdv is not initial.
  136. w_goodsmvt_item-grid_value = lt_bom-grdv.
  137. else.
  138. clear w_goodsmvt_item-grid_value.
  139. endif.
  140. w_goodsmvt_item-plant = '1000'."工厂
  141. clear w_goodsmvt_item-stge_loc.
  142. w_goodsmvt_item-vendor = lt_bom-vendor."供应商
  143. w_goodsmvt_item-entry_qnt = lt_bom-entry_qnt * pt_tran-units_rcvd."数量
  144. if lt_bom-charg is not initial.
  145. w_goodsmvt_item-batch = lt_bom-charg.
  146. else.
  147. clear w_goodsmvt_item-batch.
  148. endif.
  149. w_goodsmvt_item-parent_id = l_line_id.
  150. w_goodsmvt_item-line_depth = 1.
  151. w_goodsmvt_item-mvt_ind = 'B'."采购订单
  152. w_goodsmvt_item-stck_type = 'E'."库存类型
  153. w_goodsmvt_item-gr_rcpt  = pt_tran-user_id.
  154. append w_goodsmvt_item to goodsmvt_item.
  155. endloop.
  156. endif.
  157. endcase.
  158. else.
  159. append lines of lt_retmsg to lt_return.
  160. endif.
  161. endif.
  162. endloop.
  163. read table lt_return with key type = 'E'.
  164. if sy-subrc <> 0.
  165. if goodsmvt_item[] is not initial.
  166. "删除日志
  167. perform deletepixtranlog using l_tranpo.
  168. "执行操作
  169. call function '/AFS/BAPI_GOODSMVT_CREATE'
  170. EXPORTING
  171. goodsmvt_header   = goodsmvt_header
  172. goodsmvt_code     = goodsmvt_code
  173. IMPORTING
  174. goodsmvt_headret  = goodsmvt_headret
  175. materialdocument  = materialdocument
  176. matdocumentyear   = matdocumentyear
  177. TABLES
  178. afs_goodsmvt_item = goodsmvt_item
  179. return            = return.
  180. read table return with key type = 'E' into w_return.
  181. if sy-subrc <> 0.
  182. "提交
  183. call function 'BAPI_TRANSACTION_COMMIT'
  184. EXPORTING
  185. wait = 'X'.
  186. l_flag = 'S'.
  187. l_matdoc = materialdocument.
  188. else.
  189. call function 'BAPI_TRANSACTION_ROLLBACK'.
  190. l_flag = 'F'.
  191. endif.
  192. update zwttran set flag = l_flag matdoc = l_matdoc where tranpo = l_tranpo.
  193. if l_flag = 'F'.
  194. perform writepixtranlog tables return using l_tranpo.
  195. endif.
  196. endif.
  197. else.
  198. update zwttran set flag = 'F' where tranpo = l_tranpo.
  199. perform writepixtranlog tables lt_return using l_tranpo.
  200. endif.
  201. endloop.
  202. endform.                    "recvfromord
二、移库、冻结、解冻、内部领用、盘点、报废、转包、门店退货等
[plain] view plain copy
  1. form dopixtran tables pt_tran structure zwttran.
  2. data: l_tran_nbr like zwttran-tran_nbr,
  3. l_matdoc   like zwttran-matdoc,
  4. l_flag     like zwttran-flag,
  5. l_mara     like mara,
  6. lt_mard like table of mard with header line.
  7. data:goodsmvt_header  type   bapi2017_gm_head_01,
  8. goodsmvt_code    type   bapi2017_gm_code,
  9. goodsmvt_headret type   bapi2017_gm_head_ret,
  10. materialdocument type   bapi2017_gm_head_ret-mat_doc,
  11. matdocumentyear  type   bapi2017_gm_head_ret-doc_year,
  12. goodsmvt_item    type standard table of   bapi2017_gm_item_create,
  13. return           type standard table of   bapiret2,
  14. w_goodsmvt_item  type                     bapi2017_gm_item_create,
  15. w_return         type bapiret2.
  16. data:lt_retmsg like table of bapiret2 with header line.
  17. refresh:t_tran_nbr.
  18. loop at pt_tran.
  19. clear:t_tran_nbr.
  20. t_tran_nbr-tran_nbr = pt_tran-tran_nbr.
  21. collect t_tran_nbr.
  22. endloop.
  23. sort t_tran_nbr by tran_nbr.
  24. loop at t_tran_nbr.
  25. "&--------------------------------------------------------------------------------------------------------------&
  26. "& BEGIN 从3,4仓移库到物流中心仓库
  27. "&--------------------------------------------------------------------------------------------------------------&
  28. clear:l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return.
  29. refresh:goodsmvt_item ,return.
  30. "事物码
  31. goodsmvt_code-gm_code = '04'.
  32. "头
  33. goodsmvt_header-pstng_date = sy-datum.
  34. goodsmvt_header-doc_date = sy-datum.
  35. "明细
  36. loop at pt_tran where tran_type = '603' and tran_code = '02' and proc_stat_code = '10' and units_rcvd > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  37. if pt_tran-ref_field_6 = 'Y'.
  38. l_tran_nbr = pt_tran-tran_nbr.
  39. w_goodsmvt_item-move_type = '311'."移库
  40. w_goodsmvt_item-plant = g_plant.
  41. w_goodsmvt_item-stge_loc = pt_tran-ref_field_7.
  42. w_goodsmvt_item-material = pt_tran-matnr.
  43. w_goodsmvt_item-entry_qnt = pt_tran-units_rcvd.
  44. w_goodsmvt_item-move_plant = g_plant.
  45. w_goodsmvt_item-move_stloc = g_stge_loc.
  46. append w_goodsmvt_item to goodsmvt_item.
  47. endif.
  48. endloop.
  49. "执行操作
  50. if goodsmvt_item[] is not initial.
  51. l_flag = 'F'.
  52. call function 'BAPI_GOODSMVT_CREATE'
  53. EXPORTING
  54. goodsmvt_header  = goodsmvt_header
  55. goodsmvt_code    = goodsmvt_code
  56. IMPORTING
  57. goodsmvt_headret = goodsmvt_headret
  58. materialdocument = materialdocument
  59. matdocumentyear  = matdocumentyear
  60. TABLES
  61. goodsmvt_item    = goodsmvt_item
  62. return           = return.
  63. read table return with key type = 'E' into w_return.
  64. if sy-subrc <> 0.
  65. call function 'BAPI_TRANSACTION_COMMIT'
  66. EXPORTING
  67. wait = 'X'.
  68. if materialdocument is not initial.
  69. l_flag = 'S'.
  70. l_matdoc = materialdocument.
  71. endif.
  72. else.
  73. call function 'BAPI_TRANSACTION_ROLLBACK'.
  74. perform writepixtranlog tables return using l_tran_nbr.
  75. endif.
  76. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  77. endif.
  78. "&--------------------------------------------------------------------------------------------------------------&
  79. "& END 移入
  80. "&--------------------------------------------------------------------------------------------------------------&
  81. "&--------------------------------------------------------------------------------------------------------------&
  82. "& BEGIN 从物流中心仓库移至3,4仓
  83. "&--------------------------------------------------------------------------------------------------------------&
  84. clear:l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return.
  85. refresh:goodsmvt_item ,return.
  86. "事物码
  87. goodsmvt_code-gm_code = '04'.
  88. "头
  89. goodsmvt_header-pstng_date = sy-datum.
  90. goodsmvt_header-doc_date = sy-datum.
  91. "明细
  92. loop at pt_tran where  tran_type = '300' and tran_code = '01' and actn_code = '07'and invn_adjmt_qty > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  93. if pt_tran-rsn_code = 'YC'.
  94. l_tran_nbr = pt_tran-tran_nbr.
  95. w_goodsmvt_item-move_type = '311'."移库
  96. w_goodsmvt_item-plant = g_plant.
  97. w_goodsmvt_item-stge_loc =  g_stge_loc.
  98. w_goodsmvt_item-material = pt_tran-matnr.
  99. w_goodsmvt_item-entry_qnt = pt_tran-invn_adjmt_qty.
  100. w_goodsmvt_item-move_plant = g_plant.
  101. w_goodsmvt_item-move_stloc = pt_tran-ref_field_5.
  102. append w_goodsmvt_item to goodsmvt_item.
  103. endif.
  104. endloop.
  105. "执行操作
  106. if goodsmvt_item[] is not initial.
  107. l_flag = 'F'.
  108. call function 'BAPI_GOODSMVT_CREATE'
  109. EXPORTING
  110. goodsmvt_header  = goodsmvt_header
  111. goodsmvt_code    = goodsmvt_code
  112. IMPORTING
  113. goodsmvt_headret = goodsmvt_headret
  114. materialdocument = materialdocument
  115. matdocumentyear  = matdocumentyear
  116. TABLES
  117. goodsmvt_item    = goodsmvt_item
  118. return           = return.
  119. read table return with key type = 'E' into w_return.
  120. if sy-subrc <> 0.
  121. call function 'BAPI_TRANSACTION_COMMIT'
  122. EXPORTING
  123. wait = 'X'.
  124. if materialdocument is not initial.
  125. l_flag = 'S'.
  126. l_matdoc = materialdocument.
  127. endif.
  128. else.
  129. call function 'BAPI_TRANSACTION_ROLLBACK'.
  130. perform writepixtranlog tables return using l_tran_nbr.
  131. endif.
  132. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  133. endif.
  134. "&--------------------------------------------------------------------------------------------------------------&
  135. "& END 移出
  136. "&--------------------------------------------------------------------------------------------------------------&
  137. "&--------------------------------------------------------------------------------------------------------------&
  138. "& begin 冻结库存
  139. "&--------------------------------------------------------------------------------------------------------------&
  140. clear:l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return.
  141. refresh:goodsmvt_item ,return.
  142. "事物码
  143. goodsmvt_code-gm_code = '04'.
  144. "头
  145. goodsmvt_header-pstng_date = sy-datum.
  146. goodsmvt_header-doc_date = sy-datum.
  147. "明细
  148. loop at pt_tran where tran_type = '300' and tran_code = '01' and actn_code = '05' and invn_adjmt_qty > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  149. l_tran_nbr = pt_tran-tran_nbr.
  150. w_goodsmvt_item-move_type = '344'."冻结库存
  151. w_goodsmvt_item-plant = g_plant.
  152. w_goodsmvt_item-stge_loc = g_stge_loc.
  153. w_goodsmvt_item-material = pt_tran-matnr.
  154. w_goodsmvt_item-entry_qnt = pt_tran-invn_adjmt_qty.
  155. append w_goodsmvt_item to goodsmvt_item.
  156. endloop.
  157. "执行操作
  158. if goodsmvt_item[] is not initial.
  159. l_flag = 'F'.
  160. call function 'BAPI_GOODSMVT_CREATE'
  161. EXPORTING
  162. goodsmvt_header  = goodsmvt_header
  163. goodsmvt_code    = goodsmvt_code
  164. IMPORTING
  165. goodsmvt_headret = goodsmvt_headret
  166. materialdocument = materialdocument
  167. matdocumentyear  = matdocumentyear
  168. TABLES
  169. goodsmvt_item    = goodsmvt_item
  170. return           = return.
  171. read table return with key type = 'E' into w_return.
  172. if sy-subrc <> 0.
  173. call function 'BAPI_TRANSACTION_COMMIT'
  174. EXPORTING
  175. wait = 'X'.
  176. if materialdocument is not initial.
  177. l_flag = 'S'.
  178. l_matdoc = materialdocument.
  179. endif.
  180. else.
  181. call function 'BAPI_TRANSACTION_ROLLBACK'.
  182. perform writepixtranlog tables return using l_tran_nbr.
  183. endif.
  184. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  185. endif.
  186. "&--------------------------------------------------------------------------------------------------------------&
  187. "& END 冻结库存
  188. "&--------------------------------------------------------------------------------------------------------------&
  189. "&--------------------------------------------------------------------------------------------------------------&
  190. "& begin 解冻库存
  191. "&--------------------------------------------------------------------------------------------------------------&
  192. clear:l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return.
  193. refresh:goodsmvt_item ,return.
  194. "事物码
  195. goodsmvt_code-gm_code = '04'.
  196. "头
  197. goodsmvt_header-pstng_date = sy-datum.
  198. goodsmvt_header-doc_date = sy-datum.
  199. "明细
  200. loop at pt_tran where tran_type = '606' and tran_code = '02' and actn_code = '06' and invn_adjmt_qty > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  201. l_tran_nbr = pt_tran-tran_nbr.
  202. w_goodsmvt_item-move_type = '343'."解冻库存
  203. w_goodsmvt_item-plant = g_plant.
  204. w_goodsmvt_item-stge_loc = g_stge_loc.
  205. w_goodsmvt_item-material = pt_tran-matnr.
  206. w_goodsmvt_item-entry_qnt = pt_tran-invn_adjmt_qty.
  207. append w_goodsmvt_item to goodsmvt_item.
  208. endloop.
  209. "执行操作
  210. if goodsmvt_item[] is not initial.
  211. l_flag = 'F'.
  212. call function 'BAPI_GOODSMVT_CREATE'
  213. EXPORTING
  214. goodsmvt_header  = goodsmvt_header
  215. goodsmvt_code    = goodsmvt_code
  216. IMPORTING
  217. goodsmvt_headret = goodsmvt_headret
  218. materialdocument = materialdocument
  219. matdocumentyear  = matdocumentyear
  220. TABLES
  221. goodsmvt_item    = goodsmvt_item
  222. return           = return.
  223. read table return with key type = 'E' into w_return.
  224. if sy-subrc <> 0.
  225. call function 'BAPI_TRANSACTION_COMMIT'
  226. EXPORTING
  227. wait = 'X'.
  228. if materialdocument is not initial.
  229. l_flag = 'S'.
  230. l_matdoc = materialdocument.
  231. endif.
  232. else.
  233. call function 'BAPI_TRANSACTION_ROLLBACK'.
  234. perform writepixtranlog tables return using l_tran_nbr.
  235. endif.
  236. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  237. endif.
  238. "&--------------------------------------------------------------------------------------------------------------&
  239. "& END 解冻库存
  240. "&--------------------------------------------------------------------------------------------------------------&
  241. "&--------------------------------------------------------------------------------------------------------------&
  242. "& BEGIN 内部领用
  243. "&--------------------------------------------------------------------------------------------------------------&
  244. data:l_kostl like csks-kostl,"成本中心
  245. l_prctr like cepc-prctr,"利润中心
  246. l_csks like csks,"成本中心结构
  247. l_cepc like cepc."利润中心结构
  248. data:lt_tpmsg like table of bapiret2 with header line.
  249. clear:l_kostl,l_prctr,l_csks,l_cepc.
  250. clear:l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return,lt_tpmsg,lt_retmsg.
  251. refresh:goodsmvt_item,return,lt_tpmsg,lt_retmsg.
  252. "事物码
  253. goodsmvt_code-gm_code = '03'.                           "MB1A
  254. "头
  255. goodsmvt_header-pstng_date = sy-datum.
  256. goodsmvt_header-doc_date = sy-datum.
  257. "明细
  258. loop at pt_tran where  tran_type = '300' and tran_code = '01' and actn_code = '07'and invn_adjmt_qty > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  259. if pt_tran-rsn_code = 'NL'.
  260. clear:l_kostl,l_csks,lt_tpmsg.
  261. refresh:lt_tpmsg.
  262. l_tran_nbr = pt_tran-tran_nbr.
  263. l_kostl = pt_tran-ref_field_5.
  264. call function 'ZLC_GET_CSKS'
  265. EXPORTING
  266. P_KOKRS   = '1000'
  267. P_KOSTL   = l_kostl
  268. IMPORTING
  269. p_csks    = l_csks
  270. TABLES
  271. pt_retmsg = lt_tpmsg.
  272. read table lt_tpmsg with key type = 'E'.
  273. if sy-subrc <> 0.
  274. w_goodsmvt_item-move_type = '201'."内部领用
  275. w_goodsmvt_item-plant = g_plant.
  276. w_goodsmvt_item-stge_loc = g_stge_loc.
  277. w_goodsmvt_item-material = pt_tran-matnr.
  278. w_goodsmvt_item-entry_qnt = pt_tran-invn_adjmt_qty.
  279. w_goodsmvt_item-costcenter = l_kostl."成本中心
  280. w_goodsmvt_item-profit_ctr = l_csks-prctr."利润中心
  281. append w_goodsmvt_item to goodsmvt_item.
  282. else.
  283. append lines of lt_tpmsg to lt_retmsg.
  284. endif.
  285. endif.
  286. endloop.
  287. "执行操作
  288. read table lt_retmsg with key type = 'E'.
  289. if sy-subrc <> 0.
  290. if goodsmvt_item[] is not initial.
  291. l_flag = 'F'.
  292. call function 'BAPI_GOODSMVT_CREATE'
  293. EXPORTING
  294. goodsmvt_header  = goodsmvt_header
  295. goodsmvt_code    = goodsmvt_code
  296. IMPORTING
  297. goodsmvt_headret = goodsmvt_headret
  298. materialdocument = materialdocument
  299. matdocumentyear  = matdocumentyear
  300. TABLES
  301. goodsmvt_item    = goodsmvt_item
  302. return           = return.
  303. read table return with key type = 'E' into w_return.
  304. if sy-subrc <> 0.
  305. call function 'BAPI_TRANSACTION_COMMIT'
  306. EXPORTING
  307. wait = 'X'.
  308. if materialdocument is not initial.
  309. l_flag = 'S'.
  310. l_matdoc = materialdocument.
  311. endif.
  312. else.
  313. call function 'BAPI_TRANSACTION_ROLLBACK'.
  314. perform writepixtranlog tables return using l_tran_nbr.
  315. endif.
  316. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  317. endif.
  318. else.
  319. update zwttran set flag = 'F' where tran_nbr = l_tran_nbr.
  320. perform writepixtranlog tables lt_retmsg using l_tran_nbr.
  321. endif.
  322. "&--------------------------------------------------------------------------------------------------------------&
  323. "& END 内部领用
  324. "&--------------------------------------------------------------------------------------------------------------&
  325. "&--------------------------------------------------------------------------------------------------------------&
  326. "& BEGIN 内部领用退回
  327. "&--------------------------------------------------------------------------------------------------------------&
  328. clear:l_kostl,l_prctr,l_csks,l_cepc.
  329. clear:l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return,lt_tpmsg,lt_retmsg.
  330. refresh:goodsmvt_item,return,lt_tpmsg,lt_retmsg.
  331. "事物码
  332. goodsmvt_code-gm_code = '03'.                           "MB1A
  333. "头
  334. goodsmvt_header-pstng_date = sy-datum.
  335. goodsmvt_header-doc_date = sy-datum.
  336. "明细
  337. loop at pt_tran where tran_type = '603' and tran_code = '02' and proc_stat_code = '10' and units_rcvd > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  338. if pt_tran-ref_field_6 = 'N'.
  339. clear:l_kostl,l_csks,lt_tpmsg.
  340. refresh:lt_tpmsg.
  341. l_tran_nbr = pt_tran-tran_nbr.
  342. l_kostl = pt_tran-ref_field_5.
  343. call function 'ZLC_GET_CSKS'
  344. EXPORTING
  345. P_KOKRS   = '1000'
  346. P_KOSTL   = l_kostl
  347. IMPORTING
  348. p_csks    = l_csks
  349. TABLES
  350. pt_retmsg = lt_tpmsg.
  351. read table lt_tpmsg with key type = 'E'.
  352. if sy-subrc <> 0.
  353. w_goodsmvt_item-move_type = '202'."内部领用冲销
  354. w_goodsmvt_item-plant = g_plant.
  355. w_goodsmvt_item-stge_loc = g_stge_loc.
  356. w_goodsmvt_item-material = pt_tran-matnr.
  357. w_goodsmvt_item-entry_qnt = pt_tran-units_rcvd.
  358. w_goodsmvt_item-costcenter = l_kostl."成本中心
  359. w_goodsmvt_item-profit_ctr = l_csks-prctr."利润中心
  360. append w_goodsmvt_item to goodsmvt_item.
  361. else.
  362. append lines of lt_tpmsg to lt_retmsg.
  363. endif.
  364. endif.
  365. endloop.
  366. "执行操作
  367. read table lt_retmsg with key type = 'E'.
  368. if sy-subrc <> 0.
  369. if goodsmvt_item[] is not initial.
  370. l_flag = 'F'.
  371. call function 'BAPI_GOODSMVT_CREATE'
  372. EXPORTING
  373. goodsmvt_header  = goodsmvt_header
  374. goodsmvt_code    = goodsmvt_code
  375. IMPORTING
  376. goodsmvt_headret = goodsmvt_headret
  377. materialdocument = materialdocument
  378. matdocumentyear  = matdocumentyear
  379. TABLES
  380. goodsmvt_item    = goodsmvt_item
  381. return           = return.
  382. read table return with key type = 'E' into w_return.
  383. if sy-subrc <> 0.
  384. call function 'BAPI_TRANSACTION_COMMIT'
  385. EXPORTING
  386. wait = 'X'.
  387. if materialdocument is not initial.
  388. l_flag = 'S'.
  389. l_matdoc = materialdocument.
  390. endif.
  391. else.
  392. call function 'BAPI_TRANSACTION_ROLLBACK'.
  393. perform writepixtranlog tables return using l_tran_nbr.
  394. endif.
  395. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  396. endif.
  397. else.
  398. update zwttran set flag = 'F' where tran_nbr = l_tran_nbr.
  399. perform writepixtranlog tables lt_retmsg using l_tran_nbr.
  400. endif.
  401. "&--------------------------------------------------------------------------------------------------------------&
  402. "& END 内部领用退回
  403. "&--------------------------------------------------------------------------------------------------------------&
  404. "&--------------------------------------------------------------------------------------------------------------&
  405. "& BEGIN 报废
  406. "&--------------------------------------------------------------------------------------------------------------&
  407. clear:l_kostl,l_prctr,l_csks,l_cepc.
  408. clear:l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return,lt_tpmsg,lt_retmsg.
  409. refresh:goodsmvt_item,return,lt_tpmsg,lt_retmsg.
  410. "事物码
  411. goodsmvt_code-gm_code = '03'.
  412. "头
  413. goodsmvt_header-pstng_date = sy-datum.
  414. goodsmvt_header-doc_date = sy-datum.
  415. "明细
  416. loop at pt_tran where  tran_type = '300' and tran_code = '01' and actn_code = '07'and invn_adjmt_qty > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  417. if pt_tran-rsn_code = 'BF'.
  418. clear:l_prctr,l_cepc.
  419. refresh:lt_tpmsg.
  420. l_tran_nbr = pt_tran-tran_nbr.
  421. l_prctr = pt_tran-ref_field_5.
  422. call function 'ZLC_GET_CEPC'
  423. EXPORTING
  424. p_kokrs   = '1000'
  425. p_prctr   = l_prctr
  426. IMPORTING
  427. p_cepc    = l_cepc
  428. TABLES
  429. pt_retmsg = lt_tpmsg.
  430. read table lt_tpmsg with key type = 'E'.
  431. if sy-subrc <> 0.
  432. w_goodsmvt_item-move_type = '551'."报废
  433. w_goodsmvt_item-plant = g_plant.
  434. w_goodsmvt_item-stge_loc = g_stge_loc.
  435. w_goodsmvt_item-material = pt_tran-matnr.
  436. w_goodsmvt_item-entry_qnt = pt_tran-invn_adjmt_qty.
  437. w_goodsmvt_item-profit_ctr = l_prctr."利润中心
  438. append w_goodsmvt_item to goodsmvt_item.
  439. else.
  440. append lines of lt_tpmsg to lt_retmsg.
  441. endif.
  442. endif.
  443. endloop.
  444. "执行操作
  445. read table lt_retmsg with key type = 'E'.
  446. if sy-subrc <> 0.
  447. if goodsmvt_item[] is not initial.
  448. l_flag = 'F'.
  449. call function 'BAPI_GOODSMVT_CREATE'
  450. EXPORTING
  451. goodsmvt_header  = goodsmvt_header
  452. goodsmvt_code    = goodsmvt_code
  453. IMPORTING
  454. goodsmvt_headret = goodsmvt_headret
  455. materialdocument = materialdocument
  456. matdocumentyear  = matdocumentyear
  457. TABLES
  458. goodsmvt_item    = goodsmvt_item
  459. return           = return.
  460. read table return with key type = 'E' into w_return.
  461. if sy-subrc <> 0.
  462. call function 'BAPI_TRANSACTION_COMMIT'
  463. EXPORTING
  464. wait = 'X'.
  465. if materialdocument is not initial.
  466. l_flag = 'S'.
  467. l_matdoc = materialdocument.
  468. endif.
  469. else.
  470. call function 'BAPI_TRANSACTION_ROLLBACK'.
  471. perform writepixtranlog tables return using l_tran_nbr.
  472. endif.
  473. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  474. endif.
  475. else.
  476. update zwttran set flag = 'F' where tran_nbr = l_tran_nbr.
  477. perform writepixtranlog tables lt_retmsg using l_tran_nbr.
  478. endif.
  479. "&--------------------------------------------------------------------------------------------------------------&
  480. "& END 报废
  481. "&--------------------------------------------------------------------------------------------------------------&
  482. "&--------------------------------------------------------------------------------------------------------------&
  483. "& BEGIN 转包
  484. "&--------------------------------------------------------------------------------------------------------------&
  485. data:l_lifnr like lfa1-lifnr.
  486. clear:l_lifnr,l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return,lt_tpmsg,lt_retmsg.
  487. refresh:goodsmvt_item,return,lt_tpmsg,lt_retmsg.
  488. "事物码
  489. goodsmvt_code-gm_code = '04'.
  490. "头
  491. goodsmvt_header-pstng_date = sy-datum.
  492. goodsmvt_header-doc_date = sy-datum.
  493. "明细
  494. loop at pt_tran where  tran_type = '300' and tran_code = '01' and actn_code = '07'and invn_adjmt_qty > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  495. if pt_tran-rsn_code = 'ZB'.
  496. clear:l_lifnr.
  497. refresh:lt_tpmsg.
  498. l_tran_nbr = pt_tran-tran_nbr.
  499. l_lifnr = pt_tran-ref_field_5.
  500. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  501. EXPORTING
  502. input  = l_lifnr
  503. IMPORTING
  504. output = l_lifnr.
  505. select count(*) from lfa1 where lifnr = l_lifnr.
  506. if sy-subrc <> 0.
  507. lt_tpmsg-type = 'E'.
  508. concatenate '供应商' l_lifnr '不存在!' into lt_tpmsg-message.
  509. append lt_tpmsg.
  510. endif.
  511. read table lt_tpmsg with key type = 'E'.
  512. if sy-subrc <> 0.
  513. w_goodsmvt_item-move_type = '541'."转包
  514. w_goodsmvt_item-plant = g_plant.
  515. w_goodsmvt_item-stge_loc = g_stge_loc.
  516. w_goodsmvt_item-material = pt_tran-matnr.
  517. w_goodsmvt_item-entry_qnt = pt_tran-invn_adjmt_qty.
  518. w_goodsmvt_item-vendor = l_lifnr."供应商
  519. append w_goodsmvt_item to goodsmvt_item.
  520. else.
  521. append lines of lt_tpmsg to lt_retmsg.
  522. endif.
  523. endif.
  524. endloop.
  525. "执行操作
  526. read table lt_retmsg with key type = 'E'.
  527. if sy-subrc <> 0.
  528. if goodsmvt_item[] is not initial.
  529. l_flag = 'F'.
  530. call function 'BAPI_GOODSMVT_CREATE'
  531. EXPORTING
  532. goodsmvt_header  = goodsmvt_header
  533. goodsmvt_code    = goodsmvt_code
  534. IMPORTING
  535. goodsmvt_headret = goodsmvt_headret
  536. materialdocument = materialdocument
  537. matdocumentyear  = matdocumentyear
  538. TABLES
  539. goodsmvt_item    = goodsmvt_item
  540. return           = return.
  541. read table return with key type = 'E' into w_return.
  542. if sy-subrc <> 0.
  543. call function 'BAPI_TRANSACTION_COMMIT'
  544. EXPORTING
  545. wait = 'X'.
  546. if materialdocument is not initial.
  547. l_flag = 'S'.
  548. l_matdoc = materialdocument.
  549. endif.
  550. else.
  551. call function 'BAPI_TRANSACTION_ROLLBACK'.
  552. perform writepixtranlog tables return using l_tran_nbr.
  553. endif.
  554. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  555. endif.
  556. else.
  557. update zwttran set flag = 'F' where tran_nbr = l_tran_nbr.
  558. perform writepixtranlog tables lt_retmsg using l_tran_nbr.
  559. endif.
  560. "&--------------------------------------------------------------------------------------------------------------&
  561. "& END 转包
  562. "&--------------------------------------------------------------------------------------------------------------&
  563. "&--------------------------------------------------------------------------------------------------------------&
  564. "& BEGIN 转包冲销
  565. "&--------------------------------------------------------------------------------------------------------------&
  566. clear:l_lifnr,l_tran_nbr,l_flag,l_matdoc,goodsmvt_header,goodsmvt_code,goodsmvt_headret,materialdocument,matdocumentyear, goodsmvt_item ,return,w_return,lt_tpmsg,lt_retmsg.
  567. refresh:goodsmvt_item,return,lt_tpmsg,lt_retmsg.
  568. "事物码
  569. goodsmvt_code-gm_code = '04'.
  570. "头
  571. goodsmvt_header-pstng_date = sy-datum.
  572. goodsmvt_header-doc_date = sy-datum.
  573. "明细
  574. loop at pt_tran where tran_type = '603' and tran_code = '02' and proc_stat_code = '10' and units_rcvd > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  575. if pt_tran-ref_field_6 = 'T'.
  576. clear:l_lifnr.
  577. refresh:lt_tpmsg.
  578. l_tran_nbr = pt_tran-tran_nbr.
  579. l_lifnr = pt_tran-ref_field_7.
  580. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  581. EXPORTING
  582. input  = l_lifnr
  583. IMPORTING
  584. output = l_lifnr.
  585. select count(*) from lfa1 where lifnr = l_lifnr.
  586. if sy-subrc <> 0.
  587. lt_tpmsg-type = 'E'.
  588. concatenate '供应商' l_lifnr '不存在!' into lt_tpmsg-message.
  589. append lt_tpmsg.
  590. endif.
  591. read table lt_tpmsg with key type = 'E'.
  592. if sy-subrc <> 0.
  593. w_goodsmvt_item-move_type = '542'."转包冲销
  594. w_goodsmvt_item-plant = g_plant.
  595. w_goodsmvt_item-stge_loc = g_stge_loc.
  596. w_goodsmvt_item-material = pt_tran-matnr.
  597. w_goodsmvt_item-entry_qnt = pt_tran-units_rcvd.
  598. w_goodsmvt_item-vendor = l_lifnr."供应商
  599. append w_goodsmvt_item to goodsmvt_item.
  600. else.
  601. append lines of lt_tpmsg to lt_retmsg.
  602. endif.
  603. endif.
  604. endloop.
  605. "执行操作
  606. read table lt_retmsg with key type = 'E'.
  607. if sy-subrc <> 0.
  608. if goodsmvt_item[] is not initial.
  609. l_flag = 'F'.
  610. call function 'BAPI_GOODSMVT_CREATE'
  611. EXPORTING
  612. goodsmvt_header  = goodsmvt_header
  613. goodsmvt_code    = goodsmvt_code
  614. IMPORTING
  615. goodsmvt_headret = goodsmvt_headret
  616. materialdocument = materialdocument
  617. matdocumentyear  = matdocumentyear
  618. TABLES
  619. goodsmvt_item    = goodsmvt_item
  620. return           = return.
  621. read table return with key type = 'E' into w_return.
  622. if sy-subrc <> 0.
  623. call function 'BAPI_TRANSACTION_COMMIT'
  624. EXPORTING
  625. wait = 'X'.
  626. if materialdocument is not initial.
  627. l_flag = 'S'.
  628. l_matdoc = materialdocument.
  629. endif.
  630. else.
  631. call function 'BAPI_TRANSACTION_ROLLBACK'.
  632. perform writepixtranlog tables return using l_tran_nbr.
  633. endif.
  634. update zwttran set flag = l_flag matdoc = l_matdoc where tran_nbr = l_tran_nbr.
  635. endif.
  636. else.
  637. update zwttran set flag = 'F' where tran_nbr = l_tran_nbr.
  638. perform writepixtranlog tables lt_retmsg using l_tran_nbr.
  639. endif.
  640. "&--------------------------------------------------------------------------------------------------------------&
  641. "& END 转包冲销
  642. "&--------------------------------------------------------------------------------------------------------------&
  643. "&--------------------------------------------------------------------------------------------------------------&
  644. "& BEGIN 盘点
  645. "&--------------------------------------------------------------------------------------------------------------&
  646. data:l_physinv_head type bapi_physinv_create_head,
  647. lt_physinv_item   like table of bapi_physinv_create_items with header line.
  648. data:it_count_item like table of bapi_physinv_count_items with header line,
  649. lt_temp like table of bapi_physinv_count_items with header line,
  650. l_invdoc type iblnr,
  651. l_nblnr(10) type c,
  652. l_count type i.
  653. "&--------------------------------------------盘点-------------------------------------------------------------&
  654. "初始化
  655. clear:l_tran_nbr,l_flag,l_matdoc,l_physinv_head,lt_physinv_item, lt_retmsg,it_count_item,lt_temp,l_invdoc,l_nblnr,l_count.
  656. refresh:lt_physinv_item, lt_retmsg,lt_temp,it_count_item.
  657. "盘点单头
  658. l_physinv_head-plant = g_plant.
  659. l_physinv_head-stge_loc = g_stge_loc.
  660. l_physinv_head-doc_date = sy-datum.
  661. l_physinv_head-plan_date = sy-datum.
  662. loop at pt_tran where  ( ( tran_type = '300' and ( tran_code = '04' or tran_code = '01') and actn_code = '14' )
  663. or ( tran_type = '300' and tran_code = '04' and actn_code = '' ) ) and invn_adjmt_qty > 0 and tran_nbr = t_tran_nbr-tran_nbr.
  664. clear:lt_temp.
  665. l_tran_nbr = pt_tran-tran_nbr.
  666. "盘点单计数
  667. lt_temp-material = pt_tran-matnr.
  668. case pt_tran-invn_adjmt_type.
  669. when 'A'.
  670. lt_temp-entry_qnt = pt_tran-invn_adjmt_qty.
  671. when 'S'.
  672. lt_temp-entry_qnt = - pt_tran-invn_adjmt_qty.
  673. endcase.
  674. collect lt_temp.
  675. endloop.
  676. loop at lt_temp.
  677. add 1 to l_count.
  678. "初始化
  679. clear:lt_mard.
  680. refresh:lt_mard.
  681. "获取当前库存
  682. call function 'ZLC_GET_STOCK'
  683. EXPORTING
  684. p_matnr = lt_temp-material
  685. p_werks = g_plant
  686. p_lgort = g_stge_loc
  687. TABLES
  688. pt_mard = lt_mard.
  689. read table lt_mard index 1.
  690. "盘点处理
  691. if sy-subrc = 0.
  692. "盘点单物料
  693. lt_physinv_item-material = lt_temp-material.
  694. append lt_physinv_item.
  695. "盘点单计数
  696. it_count_item-item = l_count.
  697. it_count_item-material = lt_temp-material.
  698. it_count_item-entry_qnt = lt_mard-labst + lt_temp-entry_qnt.
  699. clear:l_mara.
  700. call function 'ZLC_GET_MARA'
  701. EXPORTING
  702. p_matnr = lt_temp-material
  703. IMPORTING
  704. p_mara  = l_mara.
  705. if l_mara is not initial.
  706. it_count_item-entry_uom = l_mara-meins.
  707. endif.
  708. append it_count_item.
  709. else.
  710. clear:lt_retmsg.
  711. lt_retmsg-type = 'E'.
  712. concatenate '商品' lt_temp-material ',' g_plant ',' g_stge_loc  '不存在!' into lt_retmsg-message.
  713. append lt_retmsg.
  714. endif.
  715. endloop.
  716. read table lt_retmsg with key type = 'E'.
  717. if sy-subrc <> 0.
  718. if it_count_item[] is not initial.
  719. l_flag = 'F'.
  720. clear:lt_retmsg.
  721. refresh:lt_retmsg.
  722. call function 'BAPI_MATPHYSINV_CREATE_MULT'"创建盘点凭证
  723. exporting
  724. head   = l_physinv_head
  725. tables
  726. items  = lt_physinv_item
  727. return = lt_retmsg.
  728. loop at lt_retmsg.
  729. if lt_retmsg-type = 'S' and lt_retmsg-id = 'M7'
  730. and lt_retmsg-number = '710'.
  731. l_nblnr = lt_retmsg-message_v1.
  732. shift l_nblnr right deleting trailing space.
  733. overlay l_nblnr with '0000000000'.
  734. l_invdoc = l_nblnr.
  735. endif.
  736. endloop.
  737. read table lt_retmsg with key type = 'E'.
  738. if sy-subrc <> 0.
  739. call function 'BAPI_TRANSACTION_COMMIT'
  740. EXPORTING
  741. wait = 'X'.
  742. clear:lt_retmsg.
  743. refresh:lt_retmsg.
  744. call function 'BAPI_MATPHYSINV_COUNT'"输入盘点数量
  745. exporting
  746. physinventory = l_invdoc
  747. fiscalyear    = sy-datum+0(4)
  748. count_date    = sy-datum
  749. tables
  750. items         = it_count_item
  751. return        = lt_retmsg.
  752. read table lt_retmsg with key type = 'E'.
  753. if sy-subrc <> 0.
  754. call function 'BAPI_TRANSACTION_COMMIT'
  755. EXPORTING
  756. wait = 'X'.
  757. clear:lt_retmsg.
  758. refresh:lt_retmsg.
  759. call function 'BAPI_MATPHYSINV_POSTDIFF'"处理差异
  760. exporting
  761. physinventory = l_invdoc
  762. fiscalyear    = sy-datum+0(4)
  763. pstng_date    = sy-datum
  764. tables
  765. return        = lt_retmsg.
  766. read table lt_retmsg with key type = 'E'.
  767. if sy-subrc <> 0.
  768. call function 'BAPI_TRANSACTION_COMMIT'
  769. EXPORTING
  770. wait = 'X'.
  771. loop at lt_retmsg.
  772. if lt_retmsg-type = 'S' and lt_retmsg-id = 'M7'
  773. and lt_retmsg-number = '716'.
  774. l_nblnr = lt_retmsg-message_v2.
  775. shift l_nblnr right deleting trailing space.
  776. overlay l_nblnr with '0000000000'.
  777. l_matdoc = l_nblnr.
  778. endif.
  779. endloop.
  780. l_flag = 'S'.
  781. else.
  782. call function 'BAPI_TRANSACTION_ROLLBACK'.
  783. endif.
  784. else.
  785. call function 'BAPI_TRANSACTION_ROLLBACK'.
  786. endif.
  787. else.
  788. call function 'BAPI_TRANSACTION_ROLLBACK'.
  789. endif.
  790. update zwttran set flag = l_flag matdoc = l_matdoc iblnr = l_invdoc where tran_nbr = l_tran_nbr.
  791. if l_flag = 'F'.
  792. perform writepixtranlog tables lt_retmsg using l_tran_nbr.
  793. endif.
  794. endif.
  795. else.
  796. update zwttran set flag = 'F' where tran_nbr = l_tran_nbr.
  797. perform writepixtranlog tables lt_retmsg using l_tran_nbr.
  798. endif.
  799. "  &--------------------------------------------------------------------------------------------------------------&
  800. "  & end 报损、报溢、盘点
  801. "  &--------------------------------------------------------------------------------------------------------------&
  802. endloop.

SAP货物移动BAPI BAPI_GOODSMVT_CREATE(WMS TO SAP)相关推荐

  1. SAP 领料BAPI BAPI_GOODSMVT_CREATE 提示 短缺未限制使用的SL

    短缺未限制使用的SL  一般是 BAPI_GOODSMVT_CREATE的参数 GOODSMVT_ITEM 里面含有待移动数量为0的行项目 但是此次比较特殊 跟了很久 都是这样的问题, 解决方案:BA ...

  2. SAP 货物移动 BAPI 的简单使用 BAPI_GOODSMVT_CREATE

    在进行货物移动时,会经常用到  BAPI_GOODSMVT_CREATE 这个BAPI ,在使用这个BAPI是有三个参数是必须传进去的 1.抬头数据  一般只要传个时间,过账人就可以了  2.行项目数 ...

  3. SAP 货物移动相关Bapi

    货物移动的bapi BAPI_GOODSMVT_CREATE 其中 参数 : GOODSMVT_CODE 有 GMCODE Table T158G - 01 - MB01 - Goods Receip ...

  4. sap货物移动相关的bapi(MIGO/MB1A)

    货物移动的bapi  BAPI_GOODSMVT_CREATE 其中 参数 : GOODSMVT_CODE 有  GMCODE Table T158G - 01 - MB01 - Goods Rece ...

  5. SAP 411移库demo BAPI BAPI_GOODSMVT_CREATE

    SAP 411移库demo BAPI BAPI_GOODSMVT_CREATE REPORT zmm026. TABLES:mska. **全局定义 TYPES:BEGIN OF tp_alv, ma ...

  6. 浅谈WMS系统(SAP WMS系统及非SAP的WMS系统)

    随着国内信息化.数字化的普及,WMS系统的实施越来越成为一个常规的操作.本文对此做简要的说明,具体包括如下内容 全球范围的WMS系统厂商 中国市场的WMS系统厂商 SAP提供的WMS 系统产品 SAP ...

  7. sap可以指定应用服务器,SAP扫盲系列之一:什么是SAP系统和应用服务器

    Jerry Wang,2007年加入SAP成都研究院工作至今,至今为止有13年的ABAP开发经验,SAP社区导师,SAP中国技术大使. SAP Netweaver Application Server ...

  8. sap 用户权限表_干货丨SAP系统的RPA实施技巧

    SAP SAP(System Applications and Products)是SAP公司的产品--企业管理解决方案的软件名称. SAP是其ERP(Enterprise-Wide Resource ...

  9. SAP UI5 应用开发教程之六十 - SAP UI5 地图控件的一些高级用法试读版

    一套适合 SAP UI5 初学者循序渐进的学习教程 教程目录 SAP UI5 本地开发环境的搭建 SAP UI5 应用开发教程之一:Hello World SAP UI5 应用开发教程之二:SAP U ...

最新文章

  1. 设计模式之命令模式(Command)摘录
  2. 用 Opencv 和 Python 模糊检测
  3. 如何在Android模拟器上安装和卸载APK程序包
  4. SVM入门(八)松弛变量
  5. PHP删除排序数组中的重复项,每日一道算法:删除排序数组中的重复项
  6. Python学习杂记_2_格式化字符串的一些操作
  7. python 视频转图片和图片转视频
  8. 社区发现算法————总结
  9. sourceTree 添加 ssh key 方法
  10. 思科模拟器Cisco Packet Tracer交换机的端口聚合配置
  11. iOS主题/皮肤之SakuraKit
  12. 7-55 查询水果价格 (15分)
  13. 辅助神器——Kaggle
  14. 动态规划---多边形游戏
  15. 认识哈希函数和哈希表
  16. POJ1837-Balance
  17. SemEval-2022 Task 6 有意讽刺检测
  18. Redis:史上最强【集群】入门实践教程
  19. 数据结构之二叉树的实现
  20. mysql在cmd下启动及操作

热门文章

  1. 永磁同步电机转子位置估算专题 —— 基波模型类位置估算概要
  2. 人工智能/数据科学比赛汇总 2019.6
  3. 跨考计算机 经验,跨考计算机成功的“重要”经验_跨考网
  4. SpringBoot关闭druid的页面和添加密码验证
  5. 写作活动第三期!让我们再挣200元稿费吧!
  6. 安卓端身份证识别与云端服务器识别
  7. vue:前端导出PDF 加图片:前端
  8. allergro音乐术语什么意思_常见音乐术语(速度术语)
  9. 实现一个Android输入法
  10. 胡子决定编程语言运势