This topic was raised many times, I always found it's not possible to (or at least to hard to try) to update components allocation for routing operations. Fortunately I had to do it somehow and I manage to do it in two ways :
1) with BDC (yeah I know, creepy but possible)
2) using EWB FM's basing on the SAP note 488765 - "Do it yourself EWB programming".
Today I will present program which is using EWB, in future I will post an example of doing this by BDC.
This program reads data from Excel file with proper structure (you can find Excel template in attachment). After reading data it collects all routings which needs to be updated to be sure that each routing is updated only once. Then the most important part is done in following way:
1) We need to load each routing and connected BOM to memory with and ,
2) Next step is to get the BOM into internal table using . BOM table contains also a explosion of sub-assemblies which are not phantoms which at the beginning seem to be useless, but after a while you'll notice that we need all levels of multilevel BOM in order to calculate Path (PLMZ-KANTE) and order level (PLMZ-STLST). If you have to do components allocation for single level BOM then reworking the table is not needed, but in my example I did it as I needed to allocate components from multi-level BOM. You'll find here a form ITEM_CHECK which do the manipulation of the table.
3) After it's done we need load operation data () and current allocation of components (). We need to do it in order to delete current allocation.
4) Deletion is done with and saved with . Deletion is committed as in other case there is no possibility to create new allocation.
5) Allocation is deleted, so we can now recreate it with new values. Firstly we need to reload again operation data to memory with and then create allocation with . Again we need to save allocation with .
Bellow you'll find the code of the program. You can download also NUGG file for it!.
Program works in two steps, firstly it displays reading log, if it is ok you have to press first button on the toolbar
to create allocation.