Hi Mastan,
Well, it is because you were asking about routing selection and according to you, the operations in the production order were selected based on effectivity parameter that is assigned to each operation. You asked it as a separate question:
How to select the routing which is called in material (production order) if having different routing for same material?
For your another question, regarding the component usage, here are my answers:
Case 1
(1) You can use data from AUFM table. For the same component's material number just do the addition (for each "261") and substraction (for eac 531) to get the actual consumption.
(2) You can also get it from a table, but it depends on the stock type of your X-part. Use transaction MB52 or MMBE to see the stock overview. Is the stock managed per sales order? If yes, then use MSKA table. If not, then use MARD table. Raw material is usually not managed as sales order stock, but just check.
(3) You need to know which production order is generated to fulfill each sales order. If you are using make-to-order strategy, then your sales order is usually tied to the production order. You can find it in AFPO-KDAUF. If not, then you have to find alternative link, such as WBS element, program name, etc. Once you know the production order for each sales order, you can calculate the requirements of X that have been fulfilled by totaling the quantity withdrawn (ENMNG) in RESB table.
Case 2
Like my answer (2), if they are managed as sales older stock, use MSKA table to get the stock. If they are common stock, use MARD table. Then compare the available stock with the requirement from sales order.
Regards,
Julian