这是很早以前做的一个开发,这里记录一下,做个备忘。
业务背景:1000公司的销售订单经过 MRP 运算后订单的每行都会转换成一个对应的采购申请单(对2000公司),生产计划人员需要按销售单汇集采购申请制作一张对2000公司的采购订单。问题就出在这里,当用 me21n建采购单,查找采购申请时,没有相应的按销售订单查询的条件,如下图:
如果要增强 me21n 程序,理论上可以但难度较大。于是从另一个角度来解决这个问题,见上图: 每个采购申请行都会有一个 "需求跟踪号" , 如果在采购申请创建时,能够把相应的订单及行号填到 需求跟踪号 这个栏位里,那就能解决这个问题了。延着这个思路,我们去找 mrp 运算相关的增强,进后台配置,如下图:
找到一个可用的 badi ,按照它的说明(后面附了说明),创建这个 badi 的实例, 可以用 se19 直接进入,如下图:
实现 Before_save 的方法:
测试结果very good:
这样就可以用 需求跟踪号 来查找了.
参考英文帮助: ( 其实 sap 的帮助本身是很详细的,仔细阅读一般都有所帮助 )
SIMGMD_PURREQ_CHANGE
Use
Application components: PP-MRP-PP, MM-PUR
Function groups: M61P, M61U
You can use the Business Add-In (BAdI) MD_PURREQ_CHANGE to change data, before posting, for purchase requisitions, which have been created, changed, or deleted as a result of the materials planning of a material, or which have been created as a result of conversion of a planned order.
You can use the Business Add-In to fill and change fields from purchase requisitions in tables EBAN and EBKN: Customer include CI_EBANDB also supports filling customer-specific fields when changing fields in the table structure EBAN.
You can execute the Business Add-In in the planning run in the following areas:
Standard settings
Activities
To activate the Business Add-In, you must create an active implementation. To do this, choose the following path in the SAP Menu: Tools -> ABAP Workbench -> Utilities -> Business Add-Ins -> Implementation
For more information about this procedure, see the SAP Library under
Example
In the sample coding provided, the fields business area, controlling area and profit center are filled for purchase requisitions with account assignment to a sales order. The system reads the relevant data from the sales order and transfers it to the purchase requisition.
This sample implementation thus replaces the modification proposals from SAP Notes 303243 and 357713.
Further notes
Documentation on the BAdI method CHANGE_BEFORE_SAVE_MRP
Documentation on the BAdI method CHANGE_BEFORE_SAVE_CONV
You can also call the documentation on the BAdI method via the menu, by carrying out the following steps: