BOM Query
Need help in writing a query to fetch all the assembled items. I have requirement as part of which I will pass Item1, Item2, Item3.... need to get all the assembled items which are using all this items (not just one all the items).
Below query is fetching assembly items which are using any one items.
Select * from bom_bill_of_materials bom, bom_inventory_components bic, mtl_system_items_b msib
where bic.component_item_id = msib2.inventory_item_id
AND bom.bill_sequence_id = bic.bill_sequence_id
AND msib.segment1 IN ('Item1','Item2','Item3')
How can modify it to fetch only assembly items which are using all the 3 items.
As the above query 'IN' is acts like OR (condition1 or condition2....)
Thanks for your response
Hi,
User910243567 wrote:
Need help in writing a query to fetch all the assembled items. I have requirement as part of which I will pass Item1, Item2, Item3.... need to get all the assembled items which are using all this items (not just one all the items).That depends on your data.
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Always say which version of Oracle you're using.
Below query is fetching assembly items which are using any one items.Is it really doing that?
Usually, "bill of materials" means a recursive, multi-level parent-child relationship. For example, a wagon may consist of a body, a handle, and 2 axle assembiles. An axle assembly may consist of an axle and 2 wheel assemblies, and a wheel assembly may consist of a wheel, a bracket, and 4 XYZ screws. If you're interested in which products require XYZ screws, would that mean just a wheel assembly, or would it include axle assembly and wagon as well as wheel assembly? The query you posted seems to only look at parents and their children; there's nothing recursive or multi-level about it.
Select * from bom_bill_of_materials bom, bom_inventory_components bic, mtl_system_items_b msib
where bic.component_item_id = msib2.inventory_item_id
AND bom.bill_sequence_id = bic.bill_sequence_id
AND msib.segment1 IN ('Item1','Item2','Item3')
How can modify it to fetch only assembly items which are using all the 3 items.
As the above query 'IN' is acts like OR (condition1 or condition2....)
Thanks for your responseIf the query above really is finding all the objects that use any 1 of the 3 components, then the following will return objects that are using all 3 of them:
WITH got_cnt
SELECT ... -- list distinct columns needed for output
, COUNT (DISTINCT msib.segment1) OVER (PARTITION BY x) AS cnt
FROM bom_bill_of_materials bom
, bom_inventory_components bic
, mtl_system_items_b msib
WHERE bic.component_item_id = msib2.inventory_item_id
AND bom.bill_sequence_id = bic.bill_sequence_id
AND msib.segment1 IN ('Item1', 'Item2', 'Item3')
SELECT * -- or list all columns except cnt
FROM got_cnt
WHERE cnt = 3
;where x uniquely identifies the object that must include all 3. (X can be a single column, or some other expression, or a list of several columns and/or other expressions.)
If one of the target items is "XYZ screw", then neither query above would include wagon or axle assembly. To get those results, you could do a CONNECT BY query, using CONNECT_BY_ROOT. In this case, it's especially important to say which version of Oracle you have, because every version since Oracle 7 has had singnificant improvements in this area.
Similar Messages
-
Hi I have an requirement from the client to create a sales BOM for e.g I create a BOM in CS01 as shown in the e.g below. Please note the pricing, delivery & inventory is carried on sub item & the below qty. mentioned is as per a single set. Item Qty Item Category A 1 ZFST Main Item b 2 ZFTN Sub Item c 2 ZFTN Sub Item d 2 ZFTN Sub Item Now I have a query if the customer orders 5 set for the above qty they the qty would be as follows Item Qty Item Category A 5 ZFST Main Item b 10 ZFTN Sub Item c 10 ZFTN Sub Item d 10 ZFTN Sub Item Is there any possibility in the system wherein we can do some config if the customer wants multiple of sets & the qty changes in the SO & they dont have to change the set qty in CS02 every time. Can you please advice on this one if it is possible to maintain multiple of sets without DOING CHANGES IN cs02 evertytime. Thanks & Regards
Hi
This has nothing to do with copy control. I misunderstood this with free goods functionality. In free goods system changes quantity of sub items when we change of main item. In SD BOM you can't change quantity of sub items automatically. As per my testing this is not happening. You can create alternative BOM for same header material with different quantities and at the time of BOM explosion system will ask you to chose the relevant BOM. This is workable if there are fix sets of materials. IF sets are too much in number then this is not workable and you need to do some modification in MV45AFZZ in field modification userexit.
PS: Lakshmipathi sir, I have tested the way you suggested but it is not changing quantity of sub items automatically.
Thank$ -
Implosion BILL OF MATERIALS (BOM) Query
Hi ,
Can anyone help me with framing a BOM Implosion query. The query is expected to return me all the PARENT items for a particular CHILD item i give in the filter. It is like a query which returns the 'ITEM WHERE USED' data for a child item referring
to where all the child item has been used (In any parent items). Google-ing on the same we could only get queries which gives BOM explosions .. if anyone has any idea on the IMPLOSION query please do share .... woul
It would be helpful if the query has ERP tables which can be used rather than examples ThankyouTry this:
SELECT DISTINCT
LEVEL, mp.organization_code, msi1.inventory_item_id parent_item_id, msi1.segment1 parent_item , msi1.description parent_desc, msi1.item_type,
bic.COMPONENT_QUANTITY, sys_connect_by_path(msi2.segment1, '/') as "PATH"
FROM bom.bom_structures_b bbom ,
bom.bom_components_b bic , apps.mtl_system_items msi1, apps.mtl_system_items msi2, apps.mtl_parameters mp
WHERE bbom.bill_Sequence_id = bic.bill_sequence_id
AND bbom.organization_id = bic.pk2_value
AND bbom.assembly_item_id = msi1.inventory_item_id
AND bbom.organization_id = msi1.organization_id
AND bic.component_item_id = msi2.inventory_item_id
AND bbom.organization_id = msi2.organization_id
and bbom.organization_id = mp.organization_Id
AND NVL(bic.disable_date, SYSDATE+1) > SYSDATE
AND bbom.organization_id = :org_id
START WITH bic.component_item_id = :component_item_id --Start with the component_item_id
CONNECT BY NOCYCLE PRIOR bbom.assembly_item_id = bic.component_item_id AND PRIOR bbom.organization_id = bbom.organization_id -
hi ,
In bom,i jus want to display all the child items (including sub child components). i jus want the report to find the material cost, labour cost, and all the charges that is included in bom... pls help me in getting this query.
regards,
VigneshHi Rahul,
will explain u the scenario....actually we will get BOM report right , where it shows the parent and all child components,so from tht report i jus want to know
MATERIAL COST- LABOUR COST-SUB CONTRACT CHARGES-ELECTRICITY CHARGES----TOOL AMORTAZATION COST
for parent and all child components .... it should contain all the components like how it displays in BOM report(expanded format).
regards,
Vignesh -
i am not able to see variants of a bom when i try to display them by bom group what is the matter
Hi
Which Transaction You are using.
Regards,
Anand. -
Dear All,
After maintaining equipment BOM , i think we are only
able to issue (BOM Maintained)material against the
Maintenance Order but its not happening.?? ? i think i
am missing some customization, is it?.
Plz guide, n do tell me main benefits of maintaining
Equipment BOM.
Thanks a tonDeepak,
A BOM is used in PM to assign spares for a technical object. BOM provides you an overview of all components that make up an Equipment . The BOM is also used for material planning, and you can perform material planning when creating a maintenance task list or Work Order.
When you create a work order with an Equipment as reference object, you can access its BOM from the order component screen and assign an item to the order. The system generated material reservation/ PR based on the item category.
If you can elaborate your problem a bit more in detail I may be able to provide more specific answer.
Hope it helps.
Thanks,
PJ -
Query to showed all level of BOM details, sort by create/update date
Hi expert,
I need a query to display all the level of BOM and can be sort by create / update date.
The display of query should be as below:
A (1st level) Parent BOM
B (2nd level) Child BOM 1
B (2nd level) Child BOM 2
C (3rd level) Child BOM 2 - 1
C (3rd level) Child BOM 2 - 2
B (2nd level) Child BOM 3
B (2nd level) Child BOM 4
Below is the BOM query that can only display up to 2nd level and cannot sort by date.
Can someone please help to modify or there is a better query?
Thanks
Declare @BOMDetails table(TreeType Nvarchar(MAX),PItem NVARCHAR(Max),PName NVARCHAR(MAX),CItem NVARCHAR(Max),CName NVARCHAR(MAX),[Quantity] Numeric(18,2),[UoM] NVARCHAR(MAX),[WareHouse] NVARCHAR(MAX),[IssuMethod] NVARCHAR(MAX),[PriceList] NVARCHAR(MAX))
INSERT Into @BOMDetails
SELECT T1.TreeType ,T0.Father AS [Parent Code], T2.ItemName AS [Parent Description], T0.Code AS [Child Code],
T1.ItemName AS [Child Description], T0.Quantity ,T0.Uom ,T0.Warehouse ,T0.IssueMthd,T0.PriceList
FROM ITT1 T0 INNER JOIN OITM T1 ON T0.Code = T1.ItemCode
INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
Union All
SELECT ' ',T0.Father as [Parent Code], T2.ItemName AS [Parent Description], ' ', ' ', 0, ' ',' ',' ' , 0 FROM ITT1 T0 INNER JOIN OITM T1
ON T0.Code = T1.ItemCode INNER JOIN OITM T2 ON T0.Father = T2.ItemCode
Group By T0.Father,T2.ItemName
ORDER BY T0.Father,t0.Code
update @BOMDetails set PItem='' ,PName='' where TreeType='N' or TreeType='P'
Select PItem as[Parent Code] ,PName as [Parent Description],CItem as [Child Code],CName as [Child Description],Quantity,UoM,IssuMethod ,PriceList from @BOMDetailsHi,
Try this query and modify as per your requirement:
SELECT
T0.[Father] as
'Assembly',T0.[code] as 'Component1', t10.[ItemName]
'Description1',T1.[Code] as 'Component2', t11.[ItemName]
'Description2', T2.[Code] as 'Component3', t12.[ItemName]
'Description3', T3.[Code] as 'Component4', t13.[ItemName]
'Description4',T4.[Code] as 'Component5', t14.[ItemName]
'Description5', T5.[Code] as 'Component6', t15.[ItemName]
'Description6'
FROM
ITT1 T0 LEFT OUTER
JOIN ITT1 T1 on T0.Code = T1.Father LEFT OUTER JOIN ITT1 T2 on
T1.Code = T2.Father LEFT OUTER JOIN ITT1 T3 on T2.Code = T3.Father
LEFT OUTER JOIN ITT1 T4 on T3.Code = T4.Father LEFT OUTER JOIN ITT1
T5 on T4.Code = T5.Father LEFT OUTER JOIN ITT1 T6 on T5.Code =
T6.Father left outer join oitm t20 on t0.father = t20.itemcode left
outer join oitm t10 on t0.code = t10.itemcode left outer join oitm
t11 on t1.code = t11.itemcode left outer join oitm t12 on t2.code =
t12.itemcode left outer join oitm t13 on t3.code = t13.itemcode left
outer join oitm t14 on t4.code = t14.itemcode left outer join oitm
t15 on t5.code = t15.itemcode
Thanks & Regards,
Nagarajan -
BOM Query
Dear expert kindly help on following BOM example.
BOM Name Chain Sling
Component
Chain qty 1 mtr
Item A 2 No
Item B 2 No
Item C 4 No
Item D 1 No
this become FG Chain sling 1 mtr
Now if I want to make chain sling of 2 mtr and 9 mtr and 18 mtr and so on..... without changing any component and qty except length ( qty ) of component Chain changes.
example
BOM Name Chain Sling
Component
Chain qty 9 mtr
Item A 2 No
Item B 2 No
Item C 4 No
Item D 1 No
this become FG Chain sling 9 mtr and so on...
what would be your advice
can I use only one BOM for this ?Example
BOM Name XYZ
Item A 1 mtr
B 5
C 4
D 5
Item A 1 mtr only item A changes to 2 or 3 or 4 mtr ( qty)................. ALL OTHER Component REMAIN SAME
B 5
C 4
D 5
what is the esiest way to make such BOM -
XL Reporter - Can you create a hierarchy (e.g. BOM)
I'm looking for a way to create a report in XL Reporter that would show a full multi-level BOM.
Does anyone know if it is possible to use the output as inout as well in the same report? I.e. use the Output of level 1 of the BOM as the input for level2 of the BOM but with running the report only once.
Any ideas would be appreciated.Hi Gordon
I already have a query that builds the BOM hierarchy in Business One. It uses CTE (Common Table Expression) in SQL 2005. Sadly you lose the drill down functionality but it roughly does the job. I was hoping to find a way to create a BOM report that is a bit better formatted as the formatting/display options in the queries are limited.
Let me know if you need details on the BOM query.
Regards
Edu -
Query for BOM Allocations to Master Routes
I just acquired Query Building permissions and the involved transactions in SAP-PP. I have access to the sandbox (QAS) to build them before they go into production. I have a good technical background but never built a query in SAP. I should be able to catch on fairly quick.
**I would like to create a query that reports which material numbers have BOM components that are/aren't allocated. Is this possible where do I start?
**Are there any threads in this forum that show good query information in regards to production versions, master routes, BOMs, etc. that someone can point me to?Hi Lucas,
Sorry for the late reply. I was travelling yesterday. Was able to create your query in quickviewer.
Table I used for Joining are as follows:
Mast: Material to BOM Link
STPO: BOM Item
PLMZ: Allocation of BOM to operation
PLPO: Task List - operation/activity
Join Condition:
MAST-STLNR to STPO-SLNR
STPO-STLTY to PLMZ-STLTY
STPO-STLNR to PLMZ-STLNR
STPO-STLKN to PLMZ-ZUONR
PLMZ-PLNTY to PLPO-PLNTY
PLMZ-PLNNR to PLPO-PLNNR
Selection Screen:
Material Number: MAST-MATNR
Plant: MAST-WERKS
List Fields:
Material Number: MAST-MATNR
Plant: MAST-WERKS
BOM Item Number: STPO-POSNR
BOM Component: STPO-IDNRK
Component Quantity: STPO-MENGE
Component Unit: STPO-MEINS
Operation Assignment: PLPO-VORNR
I guess this will help you in getting your query set. In case you need to change the field you can do as per your requirement. As told earlier once you are ok with Quickviewer you can convert it to SAP Query from SQ01 transaction.
Hope this helps you out.
Best regards,
Kiran -
How to extract the list of BOM materials through ABAP query?
Hello Experts
I want to extract a report from SAP which should contains the following,
1). Main Material with description
2). Sub material with description and quantity
I have tried with the tables MAST, STKO AND STPO but i couldn't able to create the correct ABAP query.
Could you please advise what are the table i should take to get this report.
Thanks in advance.
Regards,
RaghuHi Raghu
Check this below link
how to get BOM Components using ABAP Code?
FM to get all Parent material/BOM of the given material
Let me know if your problem is solved
Regards
Pradeep -
How to calculate extended quantity in BOM IMPLOSION QUERY
Hi guys,
I have given an assignment to create BOM item where used report, For this purpose I am using an BOM implosion API (PACKAGE.PROCEDURE = BOMPIINQ.IMPLODER_USEREXIT)
I am calling this API like this-
declare
V_SEQUENCE_ID number;
v_err_msg VARCHAR2(80);
v_err_code NUMBER;
V_DATE VARCHAR2 (30);
begin
delete BOM_SMALL_IMPL_TEMP;
-- V_SEQUENCE_ID:=142354;
SELECT BOM_IMPLOSION_TEMP_S.NEXTVAL INTO V_SEQUENCE_ID FROM SYS.DUAL;
SELECT TO_CHAR (SYSDATE, 'YYYY/MM/DD HH24:MI') INTO V_DATE FROM DUAL;
BOMPIINQ.IMPLODER_USEREXIT (
SEQUENCE_ID => V_SEQUENCE_ID,
ENG_MFG_FLAG => 1,
ORG_ID => :org_id,
IMPL_FLAG => 1,
DISPLAY_OPTION => 1,
LEVELS_TO_IMPLODE => 10,
ITEM_ID =>:item_id, --34077520002
IMPL_DATE => V_DATE,
unit_number_from =>null,
unit_number_to=>null,
ERR_MSG => v_err_msg,
ERR_CODE =>v_err_code,
organization_option =>1,
organization_hierarchy =>null,
serial_number_from =>null,
serial_number_to =>null
end;
Now I query the table BOM_SMALL_IMPL_TEMP and it shows the data as per the structure of the item where used.
NOW ALL I WANT IS I WANT TO CALCULATE EXTENDED QUANTITY (PARENT-QTY * ITS_CHILD_QTY)
CURRENTLY IT SHOWS ONLY COMPONENT QUANTITY. HOW CAN I CALCULATE EXTENDED QUANTITY LIKE WE DO IN BOM EXPLOSION?
Can any one help me on this?
Thanks,
Himanshu GuptaThanks , Yes it works but need to work out.
I have used rather calling API and then query using this-
select t1.*,
DECODE(T1.PART,T1.PART,(SELECT DISTINCT SEGMENT1 FROM MSI WHERE INVENTORY_ITEM_ID = T1.PART)) LOWEST_ITEM,
DECODE(T1.PART,T1.PART,(SELECT DISTINCT DESCRIPTION FROM MSI WHERE INVENTORY_ITEM_ID = T1.PART)) LOWEST_ITEM_DESC,
t2.segment1 PARENT_ITEM,
T2.DESCRIPTION PARENT_DESCRIPTION,
T2.ITEM_TYPE PARENT_ITEM_TYPE,
DECODE(T2.ORGANIZATION_ID, 125, 'MU1', 126, 'MU2') ORG_CODE,
T3.ITEM_COST,
T1.QTY*T3.ITEM_COST EXTENDED_COST
from
(select t.*
from (WITH t AS (SELECT distinct SYS_CONNECT_BY_PATH(a.parent_item_id, '\') || '\' || a.current_item_id || '\' as path,
a.component_quantity qty_per_assembly
FROM BOM_SMALL_IMPL_TEMP1 a,
mtl_system_items_b b
where a.parent_item_id = b.inventory_item_id
and b.organization_id = a.organization_id
START WITH b.item_type IN ('SA','FG MFG')
--CONNECT BY a.current_item_id = PRIOR a.parent_item_id
CONNECT BY nocycle a.parent_item_id = PRIOR
a.current_item_id)
SELECT root_part, part, SUM(qty) AS qty
FROM (SELECT SUBSTR(t1.path,
2,
INSTR(t1.path,'\', 1, 2) -
INSTR(t1.path, '\', 1, 1) - 1) as ROOT_PART,
SUBSTR(t1.path,
INSTR(t1.path, '\', -1, 2) + 1,
INSTR(t1.path,'\', -1, 1) -
INSTR(t1.path, '\', -1, 2) - 1) as PART,
(SELECT EXP(SUM(LN(t2.qty_per_assembly)))
FROM t t2
WHERE t1.path LIKE t2.path || '%') AS qty
FROM t t1
GROUP BY t1.path)
GROUP BY root_part, part) t
where t.part = :lt_part
) t1,
mtl_system_items_b t2, CST_ITEM_COSTS T3
where t1.root_part = t2.inventory_item_id
AND T1.PART = T3.INVENTORY_ITEM_ID
AND T2.ORGANIZATION_ID = T3
.ORGANIZATION_ID
--and t2.item_type = 'FG MFG'
and t2.organization_id = :lt_org;
and now it is running perfectly -
How to Create Specific SAP Query for Sales BOM
Dear All Salute !!
How I can create a SAP Query which provide information from the Sales Order-Line Item, this specific material is having any BOM or not?
Suppose, user want Input,
Sales Order No., Product Category, Duration of Sales Order Release.
want Output,
Sales Order No., Customer No., Customer Description, Sales Order Line Item, Material No., Material Description, Delivery Date, Quantity, Sales Order release Date
Users requirement is, List of All Line Items for which BOM is yet to be Uploaded in the System.
Please provide complete detail with Table & field by using SAP Query.
Rgds
Srivastav
+91-9973504950If I am correct, in table KDST, you can see the details of Sales BOM with sale order. Since right now, I dont have access to SAP, I am unable to confirm this. You have to consider this table and develop on your own logic with the help of ABAPer.
thanks
G. Lakshmipathi -
Query to display BOMs Header and Item
Hello SAP gurus
I am trying to create a query to display BOMs with header and item. For that I am using tables MAST, STKO and STPO.
The table join is:
MAST -> STKO -> STPO
MAST - WERKS, STLNR and STLAL
STKO - STLNR and STPOZ
The system dont show anything...
Can someone help me?
Thanks in advance.
Adelmo SilvaYes, it works but...
If I have 2 alternatives, the system show everything even if i select alternative 1 or 2.
I am missing something... because system is showing all alternatives...
System is showing something like this:
Material BOM AltBOM BOM St Item ICt Component Valid from Quantity Un
726121012 00131075 1 01 0010 L 109219 17-12-2007 0,200 KG
726121012 00131075 1 01 0020 L 109230 17-12-2007 0,003 KG
726121012 00131075 1 01 0030 L 109232 17-12-2007 1,166 M2
726121012 00131075 1 01 0040 L 726004012 17-12-2007 0,120 M3
726121012 00131075 1 01 0010 L 109526 17-12-2007 0,200 KG
726121012 00131075 1 01 0020 L 109232 17-12-2007 1,166 M2
726121012 00131075 1 01 0030 L 726004012 17-12-2007 0,120 M3
Edited by: Adelmo Silva on Jan 9, 2008 9:07 AM -
Hello All,
I need to know how are the values for component materials which are entered through transaction ME39 captured and also how are they linked with the purchasing document?
I am writing a report for downloading the PO data in which i need to capture also the component items for the PO items(i.e child items).But when the BOM for that material is missing.when i check in transaction CS13,it says that the BOM for material does not exist.Also in transaction CS03,the message i get is "Logical system not defined".Maybe the BOM has got deleted or something like that,but i just need to know while entering the component materials manually,the values get stored in which tables and how is the linking to the purchasing document?
Thanks & Regards,
Deepti.Try this query:
SELECT T1.[Father], T1.[Code], T1.[Quantity]
FROM [dbo].[ITT1] T1
WHERE T1.[Code] =[%0]
Maybe you are looking for
-
Unable to launch application from my machine:Bad MIME Type
Hi, The following error message was printed when I tried to access the SwingSet2 demo from the Java Web Start site. An error occurred while launching/running the application. Title: SwingSet2 Vendor: Sun Microsystems, Inc. Category: Download Error Ba
-
Work Portal Authentication with MSAD
Hi, I have followed the document "Fuego Enterprise 5.1 and 5.5 Work Portal Authentication using microsoft Acive directory". I am using Aqualogic 5.7 Standalone. I have problems to log into the work portal with a MSAD user. Tomcat performs authenticat
-
Newbie Scrolling Image Gallery
can someone help me figure out why my site isn't loading an external image gallery? the tutorial i used can be found here: http://www.oman3d.com/tutorials/flash/imagegallery/ they made the image gallery is completely done with actionscript and it wor
-
We thought that we could travel with our apple tv so we could access Netflix. We have been struggling to do make it work. It keeps looking for our desk top. Is there anything we can do?
-
Email on E71 keeps asking for my password to log i...
Hi I had for a while Nokia Email working perfectly up to two weeks ago. i have a yahoo account and everytime I need to sync to get new emails, it asks me for my password. It happened one time ago, but it solved by itself the same day. Now, I have the