You are on page 1of 6

7/18/2015

Usefulqueries/code/scriptsinOracleAppsOrderManagement

Usefulqueries/code/scriptsinOracle
AppsOrderManagement
Usefulqueries/code/scriptsinOracleAppsOrderManagement
Followingaresomeofthemostfrequentlyusedqueriesinoracleappsordermanagement:

Orderheaderinfo
Select*fromoe_order_headers_allooh
whereorder_number=:p_order_number
Operatingunitinfo
select*fromhr_operating_units
whereorganization_id=oe_order_headers_all.org_id
Ordertypeinfo
select*fromapps.oe_transaction_types_tl
wheretransaction_type_id=oe_order_headers_all.order_type_id
Pricelistinfo
select*fromapps.qp_list_headers_tl
wherelist_header_id=oe_order_headers_all.price_list_id
select*fromapps.qp_list_lines
wherelist_header_id=oe_order_headers_all.price_list_id
Findcustomerinfo
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22articleheader%22%20style%3D%22margin%3A%200px%3B%20outline%3A%20none%3B%20paddin

1/6

7/18/2015

Usefulqueries/code/scriptsinOracleAppsOrderManagement

select*fromhz_cust_accountshca
wherecust_account_id=oe_order_headers_all.sold_to_org_id
select*fromapps.hz_parties
whereparty_id=hz_cust_accounts.party_id
FindShiptolocationinfo
select*fromhz_cust_site_uses_all
wheresite_use_id=oe_order_headers_all.ship_to_org_id
select*fromapps.hz_cust_acct_sites_all
wherecust_acct_site_id=hz_cust_site_uses_all.cust_acct_site_id
select*fromhz_party_sites
whereparty_site_id=hz_cust_acct_sites_all.party_site_id
FindBilltolocation
select*fromhz_cust_site_uses_all
wheresite_use_id=oe_order_headers_all.invoice_to_org_id

select*fromhz_cust_acct_sites_all
wherecust_acct_site_id=hz_cust_site_uses_all.cust_acct_site_id

select*fromhz_party_sites
whereparty_site_id=hz_cust_acct_sites_all.party_site_id
actualaddress
select*fromhz_locations
wherelocation_id=hz_party_sites.location_id
Salesrepid
selectnamefromapps.ra_salesreps_allsalerepwhere
salesrep_id=oe_order_headers_all.salesrep_idandrownum=1
Paymentterms
selectnamefromapps.ra_terms_tl
whereterm_id=oe_order_headers_all.payment_term_id
andlanguage='US'
Ordersource
selectnamefromapps.oe_order_sources
whereorder_source_id=oe_order_headers_all.order_source_id
andenabled_flag='Y'
OrderSourceReference
selectorig_sys_document_reffromoe_order_headers_allooh
whereorder_number='&oracleordernumber'

data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22articleheader%22%20style%3D%22margin%3A%200px%3B%20outline%3A%20none%3B%20paddin

2/6

7/18/2015

Usefulqueries/code/scriptsinOracleAppsOrderManagement

FOBPointCode
selectlookup_codefromar_lookups
wherelookup_type='FOB'andenabled_flag='Y'
andupper(meaning)=upper(oe_order_headers_all.fob_point_code)
Freightterms
selectlookup_codefromapps.oe_lookups
whereupper(lookup_type)='FREIGHT_TERMS'andenabled_flag='Y'
andupper(lookup_code)=upper(oe_order_headers_all.freight_terms_code)
Forsaleschannelcodevalidation
selectlookup_codefromapps.oe_lookups
wherelookup_type='SALES_CHANNEL'andenabled_flag='Y'
upper(lookup_code)=upper(oe_order_headers_all.sales_channel_code)
Shipmethod
selectship_method_codefromwsh.wsh_carrier_services
whereship_method_code=oe_order_headers_all.shipping_method_code
WarehouseInfo
select*fromorg_organization_definitions
whereorganization_id=oe_order_headers_all.ship_from_org_id
SalesorderLinesDetails
select*fromapps.oe_order_lines_all
whereheader_id=oe_order_headers_all.header_id
Transactionalcurrencycode
selectota.price_list_id,qhb.currency_code
fromont.oe_transaction_types_allota,qp.qp_list_headers_bqhb
whereota.transaction_type_id=oe_order_headers_all.order_type_id
andota.price_list_id=qhb.list_header_id(+)
andNVL(qhb.list_type_code,'PRL')='PRL'
andqhb.currency_code=oe_order_headers_all.transactional_curr_code
Iteminfo
select*fromapps.mtl_system_items_b
wheresegment1likeoe_order_lines_all.ordered_item
andorganization_id=oe_order_lines_all.ship_from_org_id
UOM
selectuom_codefrominv.mtl_units_of_measure_tl
whereupper(uom_code)=upper(oe_order_lines_all.order_quantity_uom)
andlanguage='US'andnvl(disable_date,(sysdate+1))>sysdate
Itemtypecodevalidation
selectlookup_codefromapps.oe_lookups
whereupper(lookup_type)='ITEM_TYPE'
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22articleheader%22%20style%3D%22margin%3A%200px%3B%20outline%3A%20none%3B%20paddin

3/6

7/18/2015

Usefulqueries/code/scriptsinOracleAppsOrderManagement

andenabled_flag='Y'
andupper(lookup_code)=oe_order_lines_all.item_type_code
Onhandquantities
select*fromapps.mtl_onhand_quantities
whereinventory_item_id=oe_order_lines_all.inventory_item_id
andorganization_id=oe_order_lines_all.ship_from_org_id
Shipping
select*fromwsh_delivery_details
wheresource_header_id=oe_order_headers_all.header_id
select*fromwsh_delivery_assignments
wheredelivery_detail_id=wsh_delivery_details.delivery_detail_id
select*fromwsh_new_deliveries
wheredelivery_id=wsh_delivery_assignments.delivery_id
select*fromwsh_delivery_legs
wheredelivery_id=wsh_new_deliveries.delivery_id
select*fromwsh_trip_stopswts
wherestop_id=wsh_delivery_legs.pick_up_stop_id
select*fromwsh_tripswt
wheretrip_id=wsh_trip_stops.trip_id
select*fromorg_organization_definitions
whereorganization_id=wsh_new_deliveries.organization_id
Materialtransactions
select*frommtl_material_transactions
whereinventory_item_id=oe_order_lines_all.inventory_item_id
andorganization_id=oe_order_lines_all.ship_from_org_id
select*frommtl_transaction_types
wheretransaction_type_id=mmt.transaction_type_id
select*fromapps.mtl_txn_source_types
wheretransaction_source_type_id=mmt.transaction_source_type_id
mmt=mtl_material_transactions

JoinbetweenOM,WSH,ARTables
SELECTooh.order_number
,ool.line_id
,ool.ordered_quantity
,ool.shipped_quantity
data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22articleheader%22%20style%3D%22margin%3A%200px%3B%20outline%3A%20none%3B%20paddin

4/6

7/18/2015

Usefulqueries/code/scriptsinOracleAppsOrderManagement

,ool.invoiced_quantity
,wdd.delivery_detail_id
,wnd.delivery_id
,rctl.interface_line_attribute1
,rctl.interface_line_attribute3
,rctl.interface_line_attribute6
,rct.org_id
,rct.creation_date
,trx_number
,rctl.quantity_ordered
,rct.interface_header_context
FROMoe_order_headers_allooh
,oe_order_lines_allool
,wsh_delivery_detailswdd
,wsh_new_deliverieswnd
,wsh_delivery_assignmentswda
,ra_customer_trx_allrct
,ra_customer_trx_lines_allrctl
WHEREooh.header_Id=ool.header_id
ANDwdd.source_header_id=ooh.header_id
ANDwdd.delivery_detail_Id=wda.delivery_detail_id
ANDwda.delivery_id=wnd.delivery_id
ANDrctl.interface_line_attribute1=to_char(ooh.order_number)
ANDrctl.interface_line_attribute6=to_char(ool.line_id)
ANDrctl.interface_line_attribute3=to_char(wnd.delivery_id)
ANDrctl.customer_trx_id=rct.customer_trx_id
ANDrct.interface_header_context='ORDERENTRY'

PurchasereleaseconcurrentprogramwilltransferthedetailsfromOMtoPO
requisitionsinterface.Thefollowingquerywillverifythesame:
SELECTinterface_source_code,

interface_source_line_id,
quantity,
destination_type_code,
transaction_id,
process_flag,
request_id,
TRUNC(creation_date)
FROMpo_requisitions_interface_all
WHEREinterface_source_code='ORDERENTRY'
ANDinterface_source_line_idIN(SELECTdrop_ship_source_id
FROMoe_drop_ship_sources
WHEREheader_id=&order_hdr_id
ANDline_id=&order_line_id)
Thefollowingsqlisusedtoreviewtherequisition,salesorder,andreceiptnumber.It
showsthejoinsbetweenvarioustablesinInternalSalesorder(ISO)

data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22articleheader%22%20style%3D%22margin%3A%200px%3B%20outline%3A%20none%3B%20paddin

5/6

7/18/2015

Usefulqueries/code/scriptsinOracleAppsOrderManagement

SELECTporh.segment1,
porl.line_num,
pord.distribution_num,
ooh.order_number
sales_order,
ool.line_numberso_line_num,
rsh.receipt_num,
rcv.transaction_type
FROMoe_order_headers_allooh,
po_requisition_headers_allporh,
po_requisition_lines_allporl,
po_req_distributions_allpord,
oe_order_lines_allool,
po_system_parameters_allposp,
rcv_shipment_headersrsh,
rcv_transactionsrcv
WHEREooh.order_source_id=posp.order_source_id
ANDporh.org_id=posp.org_id
ANDporh.requisition_header_id=ool.source_document_id
ANDporl.requisition_line_id=ool.source_document_line_id
ANDporh.requisition_header_id=porl.requisition_header_id
ANDporl.requisition_line_id=pord.requisition_line_id
ANDporl.requisition_line_id=rcv.requisition_line_id
ANDpord.distribution_id=rcv.req_distribution_id
ANDrcv.shipment_header_id=rsh.shipment_header_id

data:text/htmlcharset=utf8,%3Cdiv%20class%3D%22articleheader%22%20style%3D%22margin%3A%200px%3B%20outline%3A%20none%3B%20paddin

6/6

You might also like