1,问题描述
在BADI ME_PROCESS_PO_CUST的方法CHECK中增强,增加对采购订单行项目的校验,发现使用宏mpur_message_forced添加错误消息时,这些错误消息只能显示到采购订单的最后一行上,并不能按照行项目归集显示。
增强点:
<img class="alignnone size-full wp-image-6487" src="//pic.ikafan.com/imgp/L3Byb3h5L2h0dHAvd3d3LmJhaWR1c2FwLmNvbS93cC1jb250ZW50L3VwbG9hZHMvMjAxOS0wNi0xNF85LTMyLTUzLmpwZw==.jpg" width="626" height="407" />
错误截图,
点击检查按钮后,下图中,可以看到行00020上的错误显示到PO的最后一个行项目30上了,
<img class="alignnone size-medium wp-image-6488" src="//pic.ikafan.com/imgp/L3Byb3h5L2h0dHAvd3d3LmJhaWR1c2FwLmNvbS93cC1jb250ZW50L3VwbG9hZHMvMjAxOS0wNi0xM18xNy0yMi0xNS03NDB4MzI5LmpwZw==.jpg" width="740" height="329" srcset="http://www.baidusap.com/wp-content/uploads/2019-06-13_17-22-15-740x329.jpg 740w, http://www.baidusap.com/wp-content/uploads/2019-06-13_17-22-15-768x342.jpg 768w, http://www.baidusap.com/wp-content/uploads/2019-06-13_17-22-15-1024x456.jpg 1024w, http://www.baidusap.com/wp-content/uploads/2019-06-13_17-22-15.jpg 1124w" sizes="(max-width: 740px) 100vw, 740px" />
关闭弹出的消息窗口后,红灯标识显示到30行上了。
<img class="alignnone size-medium wp-image-6489" src="//pic.ikafan.com/imgp/L3Byb3h5L2h0dHAvd3d3LmJhaWR1c2FwLmNvbS93cC1jb250ZW50L3VwbG9hZHMvMjAxOS0wNi0xM18xNy0yMy0zMy03NDB4MjcwLmpwZw==.jpg" width="740" height="270" srcset="http://www.baidusap.com/wp-content/uploads/2019-06-13_17-23-33-740x270.jpg 740w, http://www.baidusap.com/wp-content/uploads/2019-06-13_17-23-33-768x280.jpg 768w, http://www.baidusap.com/wp-content/uploads/2019-06-13_17-23-33.jpg 777w" sizes="(max-width: 740px) 100vw, 740px" />
2,问题解决
查看代码发现在宏 mpur_message_forced之前漏掉了一句话,
ABAP
mmpur_business_obj_id ls_item-id.
1 |
mmpur_business_obj_id ls_item-id. |
宏mmpur_business_obj_id就是用来确定错误消息显示到哪个行项目上的。
完整的代码:
DATA:lt_po_item TYPE purchase_order_items, ls_po_item LIKE LINE OF lt_po_item, ls_item TYPE mepoitem. lt_po_item = im_header->get_items( ). LOOP AT lt_po_item INTO ls_po_item. ls_item = ls_po_item-item->get_data( ). * .... IF ls_item-lifnr IS INITIAL. mmpur_business_obj_id ls_item-id. "确定错误消息显示到哪个行项目上 mmpur_message_forced ‘E‘ ‘ZMM001‘ ‘003‘ lv_message ‘‘ ‘‘ ‘‘. "收集错误消息 CALL METHOD ls_po_item-item->invalidate( ). "将发生错误的行设置为无效行 ch_failed = ‘X‘. ENDIF. ENDLOOP.
修改后测试效果:错误消息不在显示在最后一个行项目30上了,改到了20上。
<img class="alignnone size-medium wp-image-6492" src="//pic.ikafan.com/imgp/L3Byb3h5L2h0dHAvd3d3LmJhaWR1c2FwLmNvbS93cC1jb250ZW50L3VwbG9hZHMvMjAxOS0wNi0xM18xNy0yOC00Ny0xLTc0MHgyMzcuanBn.jpg" width="740" height="237" srcset="http://www.baidusap.com/wp-content/uploads/2019-06-13_17-28-47-1-740x237.jpg 740w, http://www.baidusap.com/wp-content/uploads/2019-06-13_17-28-47-1-768x246.jpg 768w, http://www.baidusap.com/wp-content/uploads/2019-06-13_17-28-47-1-1024x328.jpg 1024w, http://www.baidusap.com/wp-content/uploads/2019-06-13_17-28-47-1.jpg 1045w" sizes="(max-width: 740px) 100vw, 740px" />
以上。
原文地址:https://www.cnblogs.com/datie/p/11428404.html