SO Query

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

SELECT

ooh.order_number,
ooh.ORDERED_DATE,
ooh.FLOW_STATUS_CODE SO_Status,
ool.line_number,
msi.SEGMENT1 Item_Name,
ool.ordered_quantity,
rct.TRX_NUMBER Invoice_Num,
rct.TRX_date Invoice_Date,
rct.STATUS_TRX,
decode(rct.COMPLETE_FLAG,'Y','Completed','In Complete') Inv_Status,
ool.UNIT_SELLING_price*ool.ordered_quantity line_total
from
oe_order_headers_all ooh,
oe_order_lines_all ool,
hz_cust_accounts hca,
ra_customer_trx_lines_all rctl,
ra_customer_trx_all rct,
mtl_system_items msi
where
ooh.header_id=ool.header_id
and ooh.sold_to_org_id=hca.cust_account_id
and msi.INVENTORY_ITEM_ID=ool.INVENTORY_ITEM_ID
and msi.ORGANIZATION_ID=ool.SHIP_FROM_ORG_ID
and rct.CUSTOMER_TRX_ID = rctl.CUSTOMER_TRX_ID
and rctl.LINE_TYPE = 'LINE'
and rctl.interface_line_attribute1 = to_char(ooh.ORDER_NUMBER)
and rctl.QUANTITY_invoiced = ool.ORDERED_QUANTITY
--and ooh.order_number=
order by ool.line_number;

-----------------------------------------------------------------------------------
----------------------------------------------

SELECT DISTINCT msib.segment1,


msib.description,
(SELECT SEGMENT1
|| '.'
|| SEGMENT2
|| '.'
|| SEGMENT3
|| '.'
|| SEGMENT4
|| '.'
|| SEGMENT5
|| '.'
|| SEGMENT6
|| '.'
|| SEGMENT7
|| '.'
|| SEGMENT8
|| '.'
|| SEGMENT9
FROM apps.gl_code_combinations
WHERE code_Combination_id = msib.SALES_ACCOUNT
) "SALES ACCOUNT",
csettl.CATEGORY_SET_NAME,
--csettl.DESCRIPTION,
--csetb.CONTROL_LEVEL,
cat.segment1,
cat.segment2,
cat.segment3,
cat.segment4,
cat.segment5
--select distinct mic.*
FROM apps.mtl_system_items_b msib,
INV.MTL_ITEM_CATEGORIES mic,
inv.mtl_category_sets_tl csettl,
inv.mtl_categories_b cat,
inv.mtl_category_sets_b csetb
WHERE msib.END_DATE_ACTIVE IS NULL
AND msib.INVENTORY_ITEM_STATUS_CODE = 'Active'
--and msib.inventory_item_id = msib1.inventory_item_id
AND msib.inventory_item_id = mic.INVENTORY_ITEM_ID
AND mic.CATEGORY_ID = cat.CATEGORY_ID
AND mic.CATEGORY_SET_ID = csetb.CATEGORY_SET_ID
AND csettl.language = 'US'
AND csetb.category_set_id = csettl.category_set_id
AND csetb.STRUCTURE_ID = cat.structure_id
AND csettl.category_set_id = 1100000081 -- ategory Set Name: RH Revenue Hierarchy
AND cat.END_DATE_ACTIVE IS NULL
--AND msib.segment1 = 'RH00004'
AND msib.organization_id = 118
AND mic.organization_id = msib.organization_id
AND cat.DISABLE_DATE IS NULL
--and cat.segment3 is not null
ORDER BY msib.segment1,
csettl.CATEGORY_SET_NAME,
cat.segment1,
cat.segment2,
cat.segment3,
cat.segment4,
cat.segment5

You might also like