Order Management Introduction: Oracle Order management Suite,you can enter the sales orders,calculate price

of items on order lines,fulfill the orders(for example shipping the items) and send the information to Account Receibles(so that invoices are created). Order Management comes from the Oracle Supply Chain family. Enter the Orders 1.1.1 Enter the header information. Nav: Orders,Returns =>Sales Orders Enter header level information like Customer Name ,Customer PO,Ship To,Bill To Locations,Price List,Sales Rep and Currency of the Order. Fig 1.1 Order Entry .

These Fileds can be setup to default from a variety of sources such as the Order Type, Customer or Customer address record.All defaults can be overridden unless the business unit defines constraints preventing update. Enter Other Header information like sales channel, warehouse, payment term, ship method, Line set ( ship or Arrival), FOB, shipping and packing instructions, Tax exempt number and reason etc. select * from oe_order_headers_all where order_number=57363 open_flag='Y',cancelled_flag='C',Booked_flag='N',order_category_code='MIXED' transaction_phase_code='F',tax_exempt_flag='S' ,flow_status_code='ENTERED' 1.1.2 Enter the Line Information. Enter the line information like Item,Quantity,Request Date ,Schedule Ship Date...etc. Other line information like Line Type, Cancelled Qty, Shipped Qty, Sales Rep, Order Source, Tax code etc. get defaulted based on defaulting rules. Fig 1.2 Order Line Inf .

select * from oe_order_lines_all where header_id=98626 source_type_code='INTERNAL",cancelled_flag='N',open_flag='Y',Booked_flga='N',

tax_exempt_flag='S',Shipped_interface_flag='N',Shippable_flag='Y' ,flow_status_code='ENTERED',calculate_price_flag='Y',transaction_phase_code='F' 1.1.3 Line Shipping Information. Shipping Tab shows information like Ware house,Receiving Org(Drop Ship Orders),Schedule Ship date ,Schedule arrival date,Source Type(External for drop ship orders and internal otherwise.),Ship set,Arrival set,Shipping Method,shipment priority, Freight terms, Shipping and Packing Instructions etc. Fig 1.3 Shipping Line Inf. 1.1.4 Line Pricing Information Pricing tab shows information like Unit Selling Price, Extended Price, Price List, List Price, Line Charges, Tax Amount, Payment terms, Pricing Agreement etc. In view price adjustments we will see the adjustments and charges applied on the list price, after applying all these the unit selling price is derived. Fig 1.4 Line Pricing Info. Once we enter the Header and Line inforamtion book the order.It shows the below fig 1.5 Order Booked. Here the tables get effected oe_order_headers_all and oe_order_lines_all In Header information Screen shows the status will be “BOOKED” and Line information screen shows the status will be “AWAITING SHIPPING” .And also booked _flag Updated to Y

Fig 1.5 Order Booked. Fig 1.6 Order Booked This Above Fig 1.6 Order Booked shows the status is booked. After the book the order what happened in header and line information and ware house tables(BOOKED STATUS) Here Below metioned what tables will affect after booking select * from oe_order_headers_all where order_number=57363 open_flag='Y',cancelled_flag='C',Booked_flag='Y',order_category_code='MIXED' transaction_phase_code='F',tax_exempt_flag='S' ,flow_status_code='BOOKED',booked_date 2) Line Level Information select * from oe_order_lines_all where header_id=98626 1)Header Level Information

source_type_code='INTERNAL",cancelled_flag='N",open_flag='Y',Booked_flga='Y', tax_exempt_flag='S',Shipped_interface_flag='Y',Shippable_flag='Y' ,flow_status_code='AWAITING SHIPPING',calculate_price_flag='Y' ,transaction_phase_code='F',re_source_flag='N' 3) WareHouse Delivery Details select * from wsh_delivery_details where source_header_id=98626 delivery_detail_id=270234,customer_id,inventory_id,item_description, requested_quantity =2,shipped_quantity(NULL),delivery_quantity(null), release_status='R' (Ready to Release) ,oe_interfaced_flag='N' (not interfaced to om), mvt_stat_status='NEW" ,inv_interfaced_flag='N' (Not interfaced to INV) ,inspetion_flag='N', pickable_flag='Y' 4)Warehouse Delivery Assignments select * from wsh_delivery_assignments where delivery_detail_id=270234 Records are created with delivery id null delivery_assignment_id,delivery_detail_id,active_flag(NULL),parent_delivery_id (null), parent_delivery_detail_id null 1)Query to find out the customer, line item, ordered qty and price information of the Order. select Distinct h.order_number ,hp.party_name "Customer Name" ,hp.party_number "Customer Number" ,hp.address1||','||hp.state||','||hp.city||'.'||hp.country "Customer Address" ,h.ordered_date ,h.flow_status_code "Header Status" ,ot.name order_type ,transactional_curr_code CURRENCY ,l.line_id ,l.line_number ,l.inventory_item_id ,l.ordered_quantity ,l.unit_selling_price ,nvl(l.ordered_quantity,0)*nvl(l.unit_selling_price,0) AMOUNT ,l.flow_status_code "Line Status" ,msib.segment1 ,msib.description from oe_order_headers_all h ,oe_order_lines_all l ,mtl_system_items_b msib ,hz_parties hp ,hz_cust_accounts hca ,oe_transaction_types_tl ot

where h.header_id=l.header_id and l.inventory_item_id=msib.inventory_item_id and hp.party_id=hca.party_id and hca.cust_account_id=h.sold_to_org_id and ot.transaction_type_id=h.order_type_id and h.order_number=57340 and h.org_id=204 and h.open_flag='Y' and l.open_flag='Y' and (h.cancelled_flag is null or h.cancelled_flag = 'N') 2)Query to find customer, ship to and bill to information of an order select distinct h.order_number ,hp.party_name "Customer Name" ,ol.meaning "Freight Terms" ,ol1.meaning "FOB" ,bill_loc.address1||','||bill_loc.city "Bill To" ,ship_loc.address1||','||ship_loc.city "Ship To" from oe_order_headers_all h ,hz_parties hp ,oe_lookups ol ,oe_lookups ol1 ,hz_cust_accounts hca ,hz_cust_acct_sites_all hcasa ,hz_cust_site_uses_all hzsua ,hz_party_sites hps ,hz_locations bill_loc ,hz_locations ship_loc where hp.party_id=hca.party_id and hca.CUST_ACCOUNT_ID=h.sold_to_org_id and h.freight_terms_code = ol.lookup_code(+) and ol1.lookup_code(+)=h.fob_point_code and ol1.lookup_type(+)='FOB' and ol.lookup_type(+) = 'FREIGHT_TERMS' and hcasa.cust_acct_site_id= hzsua.cust_acct_site_id and hcasa.cust_account_id=hca.cust_account_id and hcasa.party_site_id= hps.party_site_id and hps.location_id=bill_loc.location_id and hps.location_id=ship_loc.location_id and h.ship_to_org_id=hcasa.org_id and h.order_number=57340 and h.org_id=204; How ever when an order is booked,it is automatically scheduled.That is if scheduling is fails that order is not booked. Once the order has been BOOKED,that is the flow status code of order header and line changes to BOOKED,then that particular can be the PICK RELEASED.

Meaning of Each released status wsh_delivery_details table RELEASED_STATUS RELEASED_STATUS RELEASED_STATUS RELEASED_STATUS RELEASED_STATUS RELEASED_STATUS 2.1 Pick Rlease Pick Release is a process where we choose that particular inventory item that we want to ship. For Example, let us assume we have an item of which we have the quantity on hand as 50. No of items on Hand :50 No of items to reserve :50 No of items to transact :50 Now let us say we placed an order which has a line item and the we ordered 2 units of that item, then once the Pick release process has completed No of items on Hand :50 No of items to reserve :48 No of items to transact :48 We can see all this information in Inventory using the menu option. On-hand,Availability => On-hand,Availability select * from mtl_onhand_quantities where inventory_item_id=2356 select * from mtl_onhand_quantities_detail where inventory_item_id=2356 Nav:Shipping =>Release Sales Orders =>Release Sales Orders Pick Release is the process of putting reservation on on-hand quantity available in the inventory and pick them for particular sales order. Pick release can be done from 'Release Sales Order' form or 'Pick release SRS' program can be scheduled in background. In both of these cases all lines of the order gets pick released depending on the Picking rule used. If specific line/s needs to be pick release it can be done from 'Shipping Transaction form. For this case Pick Release is done from 'Release Sales Order' form with Pick Confirm=NO. N R Not Ready to Release Line is not ready to be released Ready to Release Line is ready to be released Line has been released Line has been picked

S Released to Warehouse to Inventory for processing Y Staged/Pick Confirmed and staged by Inventory

B Backordered Line failed to be allocated in Inventory C Shipped Line has been shipped

Fig 2.1 Pick Release In the pick release form we enter the order number press the tab.In the line level we mention the the Schedule Ship Dates is mandtory ,other wise leave it blank.Requested dates Also we provided or leave it optional. Once entering the order number we getting the default values order type,destination type,customer name Once it is over click the tab Inventory. In this we enter the Warehouse,Auto Allocate=YES,other degault values are getting. Fig 2.2 Pick Release Fig 2.2 Pick Release

Fig:2.3 Pick Release In Above fig:2.3 Pick Release the Shipping tab Autocreate Delivery=YES,Auto Pick Confirm=YES Autopack Delivery=NO and the click the Concurrent. It will give the concurrent request id and click OK. Fig :2.4 Pick Release In the below Fig 2.4 Pick Release shows 1) pick selection list generation report 2)pick slip report 3)Shipping Execption Report

Once pick release is done these are the tables get affected

Ware House New Deliveries wsh_new_deliveries (one record gets inserted with source_header_id= order header_id, status_code=OP =>open) wsh_delivery_assignments (delivery_id gets assigned which comes from wsh_new_deliveries) wsh_delivery_details (released_status ‘S’ ‘submitted for release’) mtl_txn_request_lines (line_id goes as txn_source_line_id) Move order tables,here request is generated to move item from Source (RM or FG) sub-inventory to staging sub-inventory. NOTE:In shipping transaction form order status remains "Released to Warehouse" and all the material still remains in source sub-inventory. We need to do Move Order Transaction for this order. Till this no material transaction has been posted to mtl_material_transactions.

3)Pick Confirm: Items are transferred from source sub-inventory to staging Sub-inventory. Here material transaction occurs. Order line status becomes 'Picked' on Sales Order and 'Staged/Pick Confirmed' on Shipping Transaction Form. 1) oe_order_lines_all => In Line level information the flow_status_code ‘PICKED’ . 2) mtl_material_transactions => line_id goes as txn_source_line_id 3) wsh_delivery_details =>released_status becomes ‘Y’ => ‘Released’ select * from wsh_delivery_details where source_header_id=98626 delivery_detail_id,source_code,source_header_id,soucr_line_id, source_header_type_name,customer_id,inventory_id,item_description, requested_quantity,cancelled_quantity(NULL),shipped_quantity(null), delivery_quantity(null),move_order_line_id=222815,subinventory, released_status='Y'(RELEASED),oe_interfaced_flag='N',mvt_stat_status=new, inv_interfaced_flag='N',inspection_flag='N',pickable_flag='Y', picked_quantity,batch_id=102241,transaction_id=11161381 4)wsh_delivery_assignments select * from wsh_delivery_assignments where delivery_detail_id=270234 delivery_detail_id=347613,delivery_id=113896,delivery_detail_id=270234 5)mtl_onhand_quantities select * from tml_onhand_quantities where create_transaction_id=11161382 inventory_item_id,organization_id,transaction_quantity,subinventory_code, create_transaction_id,update_transaction_id,lot_number NOTE:This step can be eliminated if we set Pick Confirm=YES at the time of Pick Release NOTE :After Pick Release and Pick confirmThese are the tables will be effected .

After Pick Release And Pick Confirm select * from wsh_delivery_details where source_header_id=98626 delivery_detail_id,source_code,source_header_id,soucr_line_id,source_header_type_name,customer_id, inventory_id, item_description,requested_quantity,cancelled_quantity(NULL),shipped_quantity(null),delivery_quantit y(null), move_order_line_id=222815,subinventory,released_status='Y'(RELEASED),oe_interfaced_flag='N',mvt _stat_status=new, inv_interfaced_flag='N',inspection_flag='N',pickable_flag='Y',picked_quantity,batch_id=102241, transaction_id=11161381 select * from wsh_delivery_assignments where delivery_detail_id=270234 delivery_detail_id=347613,delivery_id=113896,delivery_detail_id=270234 select * from MTL_MATERIAL_TRANSACTIONS_TEMP order by creation_date desc select * from mtl_demand where demand_source_line=197992 order by creation_date desc demand_id,organization_id,inventory_item_id,subinventory,demand_source_type,demand_source_heade r_id=114058 ,demand_source_line=197992,reservation_type select * from mtl_reservations where demand_source_line_id=197992 order by creation_date desc reservation_id=452412,organization_id,inventory_item_id,demand_source_header_id,demand_source_li ne_id,reservation_quantity primary_reservation_quantity,staged_flag='Y' select * from wsh_new_deliveries where delivery_id=113896 order by creation_date desc delivery_id=113896,planned_flag='N',status_code='OP'(ie open),customer_id,fob_code,ship_method_code,organization_id, select * from MTL_TXN_REQUEST_LINES where txn_source_line_id=197992 order by creation_date desc

line_id=222815,header_id=102291,line_number,organization_id,inventory_item_id,to_subinventory_cod e,uom_code,quantity, quantity_delivered,quantity_detailed,transaction_header_id=11161380,tnx_source_id=114058,txn_sourc e_line_id=197992, primary_quantity,pick_slip_date select * from MTL_TXN_REQUEST_HEADERS where header_id=102291 order by creation_date desc header_id=102291,move_order_type=3,organization_id select * from MTL_MATERIAL_TRANSACTIONS where trx_source_line_id=197992 order by creation_date desc select * from MTL_ONHAND_QUANTITIES where create_transaction_id=11161382 inventory_item_id,organization_id,transaction_quantity,subinventory_code, create_transaction_id,update_transaction_id,lot_number Query to find out order and line hold information. select distinct ohd.name ,ooh.hold_until_date ,ooh.hold_comment ,h.order_number ,l.item_identifier_type ,l.inventory_item_id ,l.ordered_item ,oh.header_id ,oh.line_id ,oh.order_hold_id from oe_hold_definitions ohd, oe_hold_sources_all ooh, oe_order_headers_all h, oe_order_lines_all l, oe_order_holds_all oh where ohd.hold_id = ooh.hold_id and oh.hold_source_id = ooh.hold_source_id and oh.header_id = h.header_id and h.header_id=l.header_id and l.open_flag='Y' and h.open_flag='Y' order by ohd.name,h.order_number;

Query to find the Shipper detial Information. select distinct 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 --,msib.segment1 -- ,msib.description -- ,msib.revision_qty_control_code from wsh_new_deliveries wnd, wsh_delivery_assignments wda, wsh_delivery_details wdd, -- mtl_system_items_b msib, 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.organization_id=msib.organization_id AND wdd.source_header_id = l.header_id AND l.header_id = h.header_id and wnd.delivery_id=9805 /* wnd.delivery_id=wda.delivery_id and wda.delivery_detail_id=wdd.delivery_detail_id --and wdd.organization_id=msib.organization_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 h.order_number=57363; --and wnd.delivery_id=113896;*/ Query to find out Move order line details : 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_ and wdd.organization_id=msib.organization_id(+) and wdd.inventory_item_id=msib.inventory_item_id(+) and mhl.request_number='102241' --order by wdd.creation_date desc --and wnd.delivery_id=113896 /* select * from mtl_txn_request_headers

where request_number='102241' select * from mtl_txn_request_lines where header_id=102291 select* from wsh_delivery_details where move_order_line_id=222815 select * from wsh_new_deliveries select * from wsh_delivery_assignments where delivery_detail_id=270234 select * from wsh_new_deliveries where delivery_id=113896 select delivery_id,name,initial_pickup_location_id from wsh_new_deliveries */ Query to find price discounts and surcharges on order lines : 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=57363; select modifier_level_code from oe_price_adjustments; Note:This step can be eliminated if we set Pick Confirm=YES at the time of Pick Release 4)Shipping:

we have to ship the sales order. NAV:Shipping-> Transactions Fig:4 Shipping Fig:4.1 shipping In the Above Fig:4.1 shipping here enter the Sales Order Number and click the find button.

Fig:4.2 Shipping In this above Screen show the line status Staged/Pick Confirmed.

Click the delivery Tab Choose the Ship Confirm from Actions LOV click GO(B) Fig:4.4 Shipping Click on the Delivery tab and the details button to see detailed delivery information. You can enter the waybill number & additional info etc. here.To ship confirm the order, select the Actions list in the Delivery Tab, choose Ship Confirm and GO The ship confirmation window will appear and give you the options to backorder, ship all or ship partial quantities and set user defined shipping documents to print. Enter the trip creation options viz: Ship method, departure date, close trip and defer interface.The ship confirm process triggers the inventory interface automatically to update quantities, and triggers the Order Management Interface to update the status of the order lines.

Fig:4.5 Shipping The items on the delivery gets shipped to the customer at this stage. The Sales order line information line level status becomes Shipped. oe_order_lines_all (flow_status_code ‘shipped’) wsh_delivery_details (released_status ‘C’ ‘Shipped’) mtl_material_TRANSACTIONS (linked through Transaction source header id) Item deducted from MTL_ONHAND_QUANTITIES Next Step we need to run the WORK FLOW BACKGROUND PROCESS TO POPULATE THE AR INTERFACE TABLE. NAV:Reports And Requests->Run Requests Process defered to set :Yes

Process time out :No

Fig:Work Flow Background Process. Click on Ok and click submit button. Query to find delivery leg and pick up stop info : select wt.name ,wt.status_code ,wt.vehicle_item_id ,wt.vehicle_number ,wt.carrier_id ,wt.ship_method_code ,wts.stop_id ,wts.trip_id ,wts.stop_location_id ,wts.status_code ,wts.stop_sequence_number ,wts.planned_arrival_date ,wts.planned_departure_date ,wts.actual_arrival_date ,wts.actual_departure_date ,wts.departure_net_weight ,wts.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 wts, wsh_delivery_legs wdl where wt.trip_id=wts.trip_id and wts.stop_id=wdl.pick_up_stop_id and wdl.delivery_id=118934 5)RUN AUTOINVOICE PROCESS. After shipping the order the order lines gets eligible to get transfered to

RA_INTERFACE_LINES_ALL. Workflow background engine picks those records and post it to RA_INTERFACE_LINES_ALL. This is also called Receivables interface, that mean information moved to accounting area for invoicing details. Invoicing workflow activity transfers shipped item information to Oracle Receivables. At the same time records also goes in the table RA_INTERFACE_SALESCREDITS_ALL which hold details of sales credit for the particular order. ra_interface_lines_all (interface table into which the data is transferred from order management) Then Autoinvoice program imports data from this table which get affected into this stage are receivables base table. At the same time records goes in. ra_customer_trx_all (cust_trx_id is primary key to link it to trx_lines table and trx_number is the invoice number) ra_customer_trx_lines_all (line_attribute_1 and line_attribute_6 are linked to order number and line_id of the orders)

We need to logon Account Receivables Module to run the Auto Invoice Program. Receivables,Vision Operations Control ->Request-> Run Choose the auto invoice master program and pass the mandatory parameters.

Click ok button and Submit Button. The Below Screen shot view the concurrent request id 2968717 to view the auto invoice import program to check the transaction imported successfully or not.

Go to Order Management Responsibility Orders,returns->sales orders Query the information using the order number and click the LINES tab, click on the actions button lov,choose the Additional Line information, Click on the Invoice/Credit Memos tab here we have to seen the transaction number.

Go to the Receivables Responsibilities

TRANSACTIONS->TRANSACTIONS Query the information using the transaction number/order number(reference). It will shows the transaction details. And Click the line items button,it will shows the line information.

Create the Receipt using the Transaction Number. Receipts->Receipts

Click to Apply Button. The Application for opens up and check whether to filed showing the invoice number and amount applied filed and save the record close the window.

Receipt will be ceated to that particular transaction. Click the receipt history it will shows details of receipt.

This will shows the receipt history details. We can go to Collection Form and view the Amount detils from the customer. Collections->Account Details Here enter the customer number click on the Find Button.

This window will shows the account details of customer balance due amount and invoiced amount. Query to find the Invoice and Bank details information. select ra.trx_number ,ra.customer_trx_id ,ra.trx_date ,ra.ship_date_actual ,ral.description item_desc ,ral.quantity_ordered ,ral.quantity_invoiced ,ral.unit_selling_price ,ral.sales_order ,ral.sales_order_date ,ral.line_type ,ral.extended_amount ,ral.revenue_amount ,al.lookup_code ,al.lookup_type ,al.meaning ,rt.name ,bank_account_id ,bank_account_name ,bank_account_num ,bank_account_type ,account_holder_name ,abb.bank_name ,abb.bank_branch_name ,abb.address_line1||','||city||','||state||','||country Address ,abb.bank_num --,rct.name -- ,rct.description --,rct.type from ra_customer_trx_all ra ,ra_customer_trx_lines_all ral ,ar_lookups al ,ra_terms rt ,ap_bank_accounts ab ,ap_bank_branches abb --,ra_cust_trx_types_all rct where ra.customer_trx_id=ral.customer_trx_id and ra.fob_point=al.lookup_code(+) and rt.term_id(+)=ra.term_id and ra.CUSTOMER_BANK_ACCOUNT_ID=ab.BANK_ACCOUNT_ID(+) and ab.bank_branch_id=abb.bank_branch_id(+) --and rct.cust_trx_type_id=ra.cust_trx_type_id and ra.trx_number='10021460' and ral.line_type='LINE'

Query to find the Customer , Ship To and Bill To location Information select distinct h.order_number ,hp.party_name "Customer Name" ,ol.meaning "Freight Terms" ,ol1.meaning "FOB" ,bill_loc.address1||','||bill_loc.city "Bill To" ,ship_loc.address1||','||ship_loc.city "Ship To" from oe_order_headers_all h ,hz_parties hp ,oe_lookups ol ,oe_lookups ol1 ,hz_cust_accounts hca ,hz_cust_acct_sites_all hcasa ,hz_cust_site_uses_all hzsua ,hz_party_sites hps ,hz_locations bill_loc ,hz_locations ship_loc where hp.party_id=hca.party_id and hca.CUST_ACCOUNT_ID=h.sold_to_org_id and h.freight_terms_code = ol.lookup_code(+) and ol1.lookup_code(+)=h.fob_point_code and ol1.lookup_type(+)='FOB' and ol.lookup_type(+) = 'FREIGHT_TERMS' and hcasa.cust_acct_site_id= hzsua.cust_acct_site_id and hcasa.cust_account_id=hca.cust_account_id and hcasa.party_site_id= hps.party_site_id and hps.location_id=bill_loc.location_id and hps.location_id=ship_loc.location_id and h.ship_to_org_id=hcasa.org_id and h.order_number and h.org_id=204;