如何利用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.

以上爲本章全部內容,希望對小夥伴們有所幫助;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章