如何利用BADI干预MRP中的货源确定过程并使用自己逻辑确定PR的供应源

如何利用BADI干预MRP中的货源确定过程并使用自己逻辑确定PR的供应源

作者:袁云飞(AlbertYuan)- 微信号yuanalbert

以下内容均为原创,希望对初学者有一些辅助作用,本人主要从事MM/QM/WM的相关工作,不专业处请多多指点,十足干货,码字不易,且行且珍惜,你们的关注就是我努力的动力,转载请引用出处,感激不尽;

这个BADI就是“MD_MODIFY_SOURCE”。

这里注意,只要物料被设置了配额协议,该物料就不会被在MRP的时候传入这个增强中去的,换句话说配额大于一切;

而且如果你的物料的采购类型是X或E,也就是默认MRP先产生计划订单的情况下,这个增强也不会被调用,其实就很舒服了,我们只考虑外部获取的情况,包括对供应商和转库单业务;
在这里插入图片描述
里面有两个方法可以用,我们使用第一个方法来完成MRP确定供应源的功能;看看下面对这个BADI的一个说明:

Source determination occurs for external procurement with determination of the vendor, or assignment of the outline agreement via the order book in the planning run (total planning) for the following areas:

Material requirements planning

Master production scheduling

Long-term planning

The Business Add-In (BAdI) MD_MODIFY_SOURCE allows you to assign user-defined sources of supply according to user-defined selection criteria and a user-defined priority determination procedure.

Standard settings

• The Business Add-In is not active in the standard system.
• The Business Add-In is not filter dependent.
• The Business Add-In cannot be used multiple times.

Example

• Using the BAdI you can define your own selection criteria and priority determination procedure for determining the source of supply. You could, for example, have the selection of regular vendors listed from the entries in the order book. You can find additional examples in the sample coding.

虽然用这个BADI可以介入MRP的货源确定,但要主要注意,如果仅仅是对PR的外购部分进行介入,要先通过一些传入参数排除那些转库PR或其他工厂生产的计划订单才行;

这个BADI虽然说是在后台MRP运行的时候介入,不过在测试阶段还是可以通过设置断点的方式介入看看的,但正式使用后,就不行罗;

对于MRP来说,对于GR处理时间是通过物料上确定的,这个在BADI里就传入了的;
在这里插入图片描述
增强里这两个表很重要,MDKP主要传入物料工厂等数据信息,而MDPS主要传递的时间和供应源信息,MDPS里的供应商是按标准程序确定逻辑确定后的供应源,但注意,这里不包含日期的计算,也就是GR处理时间和计划交货时间,不在这里计算;

GR处理时间只是从物料里带过来,但计划交货时间是不会被带到MDPS表和IM_MDPSM里的计划交货时间的,而真正计算后得到的计划交货时间和GR处理时间是在字段

CH_PLIFZ
CH_WEBAZ

里可以取到的,这个是系统计算后得到的时间,如果你设置的计划交货时间从信息记录中取,则带的就是那个时间;

但我们在通过增强修改供应源的时候也可以设置自己的计划交货时间和GR处理时间哦;

我们能修改的数据如下:
在这里插入图片描述
在这里插入图片描述
如何设置,还有看后面的介绍;

这个BADI如果你激活后,设置了CH_CHANGED指示器为X,即便其他修改自动不赋值,系统会依然按照标准逻辑进行货源分配;这点比较好;

这里要强调一下,上面列的这些可以修改的字段,如果不和货源确定有关,则即便你修改了系统也不会采用的,比如计划交货时间和GR处理时间;

而且如果你违反一致性,输入了计划交货时间,比如,则系统根本不会产生PR,这个一定要注意;

下面我们就来看哪些字段在哪种情况下该如何设置:

下面列出的字段是可以被修改,且有作用的;

先看看这段话:

The changed sources of supply are only transferred to structure MDPSN if the parameter CH_CHANGED is set in the method. Otherwise the changes are not adopted and the standard supply source determination remains active.

If you make a change via the method, the indicator ‘BAdI active’ is set in the header details of the stock/requirements list or the MRP list.
在这里插入图片描述
Notes

• Make sure that the fields that can be changed are filled consistently. In principle the following cases occur:

o Non-assigned order proposals (CH_LIFNR and CH_EBELN/CH_EBELP blank).

o Assigned order proposals with info record (CH_LIFNR filled, CH_EBELN/CH_EBELP blank).

o Assigned order proposal with outline agreement, scheduling agreement, or contract (CH_LIFNR, CH_EBELN, and CH_EBELP filled).

o Special procurement types (CH_SOBES) external procurement, subcontracting, and stock transfer (CH_SOBES = 0, 3, or 7) are in principle still possible for these cases.

总体上说如果你不想分配任何供应源,则将供应商,采购凭证号,行项目号字段社会自为空即可,这时增强生效后,即便前面标准程序确定了供应源,再次之后都会没有供应源的;

如果要设置的供应源是信息记录,则可以设置供应商,采购组织也可以设置的;

如果你想将框架协议或合同设置为供应源,则可以设置供应商,和对应的框架协议字段,这个似乎应该是PR里用框架协议作为货源的处理办法;

如果你要产生何种类型的PR,比如标准,分包,寄售等就可以设置该字段;

• In the case of stock transfer, the transfer plant (CH_WRK02) must also be entered.

如果发现MRP跑的这个物料是转库业务这个判断很简单,传入物料的特殊获取类型就能决定,则必须设置传输工厂字段;

但如果物料本身不是从其他工厂转库而来,也就是说没有设置对应的特殊获取类型,则即便你设置了该字段也没有任何作用,这样就知道这个字段只是在物料是作为转库需求跑MRP的情况下可以改变其供应工厂的;

• The planned delivery time CH_PLIFZ and the goods receipt processing time CH_WEBAZ must be redetermined specially. Compare to the sample code for this.

这个字段设置了似乎没有任何作用;

• Parameter CH_AUTET controls, as in the case of the order book, whether the supply source is relevant for MRP (CH_AUTET = 1) and whether scheduling agreement schedule lines are to be automatically created for a scheduling agreement (CH_AUTET = 2). If CH_AUTET is blank, the source of supply is not considered in MRP.

这个字段的作用其实主要是为了让我们设置计划协议作为供应源的目的,如果我们想将产生的需求直接指向计划协议的计划交货行,则就将该字段设置为2,然后指定计划协议号和行项目号在前面的字段,这样系统会自动产生计划协议计划交货行,而不是PR里面将计划协议当成供应源那形式;

• The planning run is a performance critical application, therefore check performance quality before implementing the method. Avoid unnecessary database access, for example by using suitable buffering. Make sure that database access occurs via a suitable index.

• The planning run is a memory intensive mass transaction. Make sure that no internal tables increase uncontrollably in size during implementation of the method. If, for example, you use internal tables to buffer database access, you must make sure that these tables cannot become too large.

• Since the planning run is usually executed in the background, you must not implement any dialog functions (popups and so on) in the Business Add-In.

以上为本章全部内容,希望对小伙伴们有所帮助;

发布了151 篇原创文章 · 获赞 2 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_44853659/article/details/104614167