1,问题描述
项目里使用了ADSUBCON,在调用BAPI_GOODSMVT_CREATE创建带subcontractor行项目的物料移动凭证时,发现主行项目中的批次赋值错误。
错误截图:
看到第一行,也就是物料移动类型是101的行项目上的批次是1208221560,实际调用bapi时的输入批次是另外一个1906050181,但是创建出来的物料凭证却不同,而且bapi返回消息中也没有提示任何信息。
<img class="alignnone size-medium wp-image-6450" src="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-05-26-740x255.jpg" alt="" width="740" height="255" srcset="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-05-26-740x255.jpg 740w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-05-26-768x264.jpg 768w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-05-26-1024x352.jpg 1024w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-05-26.jpg 1206w" sizes="(max-width: 740px) 100vw, 740px" />
预想结果:
<img class="alignnone size-medium wp-image-6452" src="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-10-50-740x212.jpg" alt="" width="740" height="212" srcset="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-10-50-740x212.jpg 740w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-10-50-768x220.jpg 768w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-10-50-1024x293.jpg 1024w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-10-50.jpg 1206w" sizes="(max-width: 740px) 100vw, 740px" />
2,问题分析
业务顾问一头雾水,所以只能搬出debug大法,此处略去10000000个字。。。。经过debug发现了一段标准SAP代码中的注释,
include:MM07MFS0_SEGMENTDATEN_EK_SETZE中
翻译过来就是,用tcode MIGO根据带subcon的采购订单创建物料凭证时,主行项目中的批次号和评估类型是不能被PO带过来的值覆盖,反言之,就是不使用MIGO创建物料凭证时PO中的批次和评估类型的优先级就高,会覆盖bapi输入参数里的值!!!
<img class="alignnone size-medium wp-image-6453" src="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-15-38-740x391.jpg" alt="" width="740" height="391" srcset="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-15-38-740x391.jpg 740w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-15-38-768x405.jpg 768w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-15-38-1024x540.jpg 1024w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-15-38.jpg 1205w" sizes="(max-width: 740px) 100vw, 740px" />
这时再查看一下对应的PO批次,
MIGO中找到物料凭证中的PO
<img class="alignnone size-medium wp-image-6456" src="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-29-44-740x331.jpg" alt="" width="740" height="331" srcset="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-29-44-740x331.jpg 740w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-29-44-768x343.jpg 768w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-29-44.jpg 781w" sizes="(max-width: 740px) 100vw, 740px" />
ME23n找到PO中的批次,果然和BAPI输入的不一致。
<img class="alignnone size-medium wp-image-6455" src="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-19-56-740x262.jpg" alt="" width="740" height="262" srcset="http://www.baidusap.com/wp-content/uploads/2019-06-10_10-19-56-740x262.jpg 740w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-19-56-768x272.jpg 768w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-19-56-1024x363.jpg 1024w, http://www.baidusap.com/wp-content/uploads/2019-06-10_10-19-56.jpg 1117w" sizes="(max-width: 740px) 100vw, 740px" />
以上。