How pricing informations are stored in Oracle Apps R12?

(Query involving tables under pricing module)
SELECT qph.list_header_id ,qph.name ,qph.description ,qphh.start_date_active ,qphh.currency_code ,qphh.source_system_code ,qphh.active_flag ,qphh.orig_system_header_ref ,qphh.orig_org_id ,qphh.global_flag ,qpl.list_line_id ,qpl.start_date_active ,qpl.end_date_active ,qpl.arithmetic_operator ,qpl.operand ,qpl.orig_sys_line_ref ,qpp.pricing_attribute_id ,qpp.product_attribute_context ,qpp.product_attribute ,qpp.product_attr_value ,qpp.product_uom_code ,qpp.comparison_operator_code ,qpp.orig_sys_pricing_attr_ref ,mtl.inventory_item_id ,mtl.segment1 ,mtlc.cross_reference_type ,mtlc.cross_reference FROM apps.qp_list_headers_b qphh ,apps.qp_list_headers_tl qph ,apps.qp_list_lines qpl ,apps.qp_pricing_attributes qpp ,apps.mtl_system_items_b mtl ,apps.mtl_cross_references_b mtlc WHERE qph.list_header_id = qphh.list_header_id AND qph.list_header_id = qpl.list_header_id AND qph.list_header_id = qpp.list_header_id AND qpl.list_line_id = qpp.list_line_id AND mtl.inventory_item_id = qpp.product_attr_value AND mtl.organization_id = (SELECT UNIQUE master_organization_id FROM mtl_parameters) AND mtl.inventory_item_id = mtlc.inventory_item_id AND SYSDATE BETWEEN qpl.start_date_active AND NVL(qpl.end_date_active,SYSDATE) AND SYSDATE BETWEEN qphh.start_date_active AND NVL(qphh.end_date_active,SYSDATE) AND qph.name LIKE '%&priceListName%';

Query to find the Discount amount related to an order (R12)
Below query gives you the information about order and if any discounts available against the order. I have tested this query in R12.1.1.
SELECT h.order_number ,l.line_number ,l.unit_list_price ,l.ordered_quantity ,pa.list_line_type_code ,pa.arithmetic_operator ,pa.operand ,pa.modifier_level_code ,pa.adjusted_amount ,DECODE(pa.modifier_level_code ,'ORDER', l.unit_list_price*l.ordered_quantity*pa.operand*SIGN(pa.adjusted_amount)/100 ,(pa.adjusted_amount*NVL(l.ordered_quantity,0)) ) Discount_Amount FROM oe_order_headers_all h ,oe_order_lines_all l ,oe_price_adjustments pa WHERE h.header_id = l.header_id AND h.org_id = l.org_id AND h.header_id = pa.header_id AND l.line_id = pa.line_id(+) AND h.order_number='&order_number';

Below query gives you the info about the DELIVERY LEGS and its associated TRIPS based on delivery id. I have tested this query in R12.1.1.
SELECT wt.trip_id ,wt.name ,wt.status_code ,wt.vehicle_item_id ,wt.vehicle_number ,wt.carrier_id ,wt.ship_method_code ,wtp.stop_id pick_stop_id ,wtp.stop_location_id pick_stop_location_id ,wtp.status_code pick_status_code ,wtp.stop_sequence_number pick_stop_sequence_number ,wtp.planned_arrival_date pick_planned_arrival_date ,wtp.planned_departure_date pick_planned_departure_date ,wtp.actual_arrival_date pick_actual_arrival_date ,wtp.actual_departure_date pick_actual_departure_date ,wtp.departure_net_weight pick_departure_net_weight ,wtp.weight_uom_code pick_weight_uom_code ,wtd.stop_id drop_stop_id ,wtd.stop_location_id drop_stop_location_id ,wtd.status_code drop_status_code ,wtd.stop_sequence_number drop_stop_sequence_number ,wtd.planned_arrival_date drop_planned_arrival_date ,wtd.planned_departure_date drop_planned_departure_date ,wtd.actual_arrival_date drop_actual_arrival_date ,wtd.actual_departure_date drop_actual_departure_date ,wtd.departure_net_weight drop_departure_net_weight ,wtd.weight_uom_code drop_weight_uom_code ,wdl.delivery_leg_id ,wdl.delivery_id ,wdl.sequence_number ,wdl.pick_up_stop_id ,wdl.drop_off_stop_id ,wdl.shipper_title ,wdl.shipper_phone ,wdl.delivered_quantity ,wdl.loaded_quantity ,wdl.received_quantity FROM wsh_trips wt ,wsh_trip_stops wtp ,wsh_trip_stops wtd ,wsh_delivery_legs wdl WHERE wt.trip_id =wtp.trip_id AND wt.trip_id =wtd.trip_id AND wtp.stop_id =wdl.pick_up_stop_id AND wtd.stop_id =wdl.drop_off_stop_id AND wdl.delivery_id='&delivery_id';

Below query joins the Order and Delivery tables.
This query is tested in R12.1.1.
SELECT wnd.delivery_id ,wnd.name ,wnd.customer_id ,wnd.volume ,wnd.status_code ,wnd.ship_method_code ,wnd.initial_pickup_date ,wdd.cust_po_number ,wdd.requested_quantity_uom ,wdd.shipped_quantity ,wdd.requested_quantity ,wdd.subinventory ,wdd.shipment_priority_code ,wdd.released_status ,wdd.serial_number ,wdd.lot_number ,h.order_number ,h.cust_po_number ,h.ship_from_org_id ,l.line_number ,l.ordered_item ,l.ordered_quantity ,l.shipped_quantity FROM wsh_new_deliveries wnd ,wsh_delivery_assignments wda ,wsh_delivery_details wdd ,oe_order_lines_all l ,oe_order_headers_all h WHERE wnd.delivery_id = wda.delivery_id AND wdd.delivery_detail_id = wda.delivery_detail_id AND wdd.source_line_id = l.line_id AND wdd.source_header_id = l.header_id AND l.header_id = h.header_id AND wnd.delivery_id ='&delivery_id‘;

Below query joins the Order, Delivery and Move order tables. This query is tested in R12.1.1.
SELECT mhl.request_number ,l.line_number ,h.order_number ,mrl.line_number ,mrl.line_id ,mrl.from_subinventory_code ,mrl.lot_number ,mrl.serial_number_start ,mrl.serial_number_end ,mrl.uom_code ,mrl.quantity ,mrl.quantity_delivered ,mrl.quantity_detailed ,wdd.source_header_number ,wdd.source_header_id ,wdd.source_line_id ,wdd.shipping_instructions ,wdd.inventory_item_id ,wdd.requested_quantity_uom ,wdd.ship_method_code ,wdd.subinventory ,wdd.shipment_priority_code ,wdd.organization_id ,wdd.released_status ,wdd.source_code ,wnd.delivery_id ,wnd.name ,wnd.initial_pickup_location_id ,wnd.creation_date ,msib.segment1 ,msib.description ,msib.revision_qty_control_code FROM mtl_txn_request_lines mrl ,mtl_txn_request_headers mhl ,wsh_delivery_details wdd ,wsh_new_deliveries wnd ,wsh_delivery_assignments wda ,oe_order_lines_all l ,oe_order_headers_all h ,mtl_system_items_b msib WHERE mhl.header_id =mrl.header_id AND mrl.line_id =wdd.move_order_line_id AND wda.delivery_id =wnd.delivery_id(+) AND wdd.delivery_detail_id = wda.delivery_detail_id AND wdd.source_header_id =l.header_id AND wdd.source_line_id =l.line_id AND h.header_id =l.header_id AND wdd.organization_id =msib.organization_id(+) AND wdd.inventory_item_id =msib.inventory_item_id(+)

AND wda.delivery_id

='&delivery_id' ;

Below query gives you the info about the Customer and its associated Sites based on order number. I have tested this query in R12.1.1.
SELECT h.order_number ,h.sold_to_org_id bill_cust_account_id ,h.ship_to_org_id ship_to_site_use_id ,h.invoice_to_org_id bill_to_site_use_id ,hp.party_name "Customer Name" ,hca.account_name ,hca.org_id ,hcasab.orig_system_reference BILL_TO_ORIG_REF ,hpb.status BILL_TO_STATUS ,'ADDRESS1 - '||bill_loc.address1||','||CHR(10)|| 'ADDRESS2 - '||bill_loc.address2||','||CHR(10)|| 'ADDRESS3 - '||bill_loc.address3||','||CHR(10)|| 'CITY - '||bill_loc.city||','||CHR(10)|| 'POSTAL CD- '||bill_loc.postal_code||','||CHR(10)|| 'COUNTRY - '|| bill_loc.country BILL_TO_ADDRESS ,hcasas.orig_system_reference SHIP_TO_ORIG_REF ,hps.status SHIP_TO_STATUS ,'ADDRESS1 - '||ship_loc.address1||','||CHR(10)|| 'ADDRESS2 - '||ship_loc.address2||','||CHR(10)|| 'ADDRESS3 - '||ship_loc.address3||','||CHR(10)|| 'CITY - '||ship_loc.city||','||CHR(10)|| 'POSTAL CD- '||ship_loc.postal_code||','||CHR(10)|| 'COUNTRY - '|| ship_loc.country SHIP_TO_ADDRESS FROM oe_order_headers_all h ,hz_parties hp ,hz_cust_accounts hca ,hz_cust_acct_sites_all hcasab ,hz_cust_acct_sites_all hcasas ,hz_cust_site_uses_all hzsuab ,hz_cust_site_uses_all hzsuas ,hz_party_sites hps ,hz_party_sites hpb ,hz_locations bill_loc ,hz_locations ship_loc WHERE 1 =1 AND hp.party_id = hca.party_id AND hca.CUST_ACCOUNT_ID = h.sold_to_org_id AND hcasab.cust_account_id = hca.cust_account_id AND hcasas.cust_account_id = hca.cust_account_id AND hpb.location_id = bill_loc.location_id AND hps.location_id = ship_loc.location_id AND hcasab.party_site_id = hpb.party_site_id AND hcasas.party_site_id = hps.party_site_id

AND AND AND AND AND

hcasab.cust_acct_site_id= hcasas.cust_acct_site_id= h.ship_to_org_id = h.invoice_to_org_id = h.order_number =

hzsuab.cust_acct_site_id hzsuas.cust_acct_site_id hzsuas.site_use_id hzsuab.site_use_id '&order_number';

Sign up to vote on this title
UsefulNot useful