Monday 1 June 2015

SQL to check Order Line Pricing

When we do a pricing of a Sales Order  on a bulk level we may need to check the Re-Pricing Status to see if all the lines have been re-priced successfully or not.

In order to see the if the line pricing is successful or not we can use the below SQL

    select distinct ooh.org_id,ool.creation_date,ool.line_id,ooh.order_number,ool.line_number,ool.ordered_item,ool.unit_selling_price,qlh.name,qll.operand,qll.start_date_active,ool.flow_status_code
 ,ool.calculate_price_flag,ool.unit_list_price
 from oe_order_headers_all ooh,
      oe_order_lines_all ool,
      wsh_delivery_details wdd,
      qp_list_headers qlh,
       qp_list_lines qll,
       qp_pricing_attributes qpa,
       mtl_system_items_b msib
 where ooh.header_id = ool.header_id
 and ool.line_id = wdd.source_line_id
 and wdd.released_status in ('R','B')
 and qlh.list_header_id = qpa.list_header_id
 and qpa.product_attr_value = to_char(msib.inventory_item_id)
 and msib.organization_id = :warehouse_id
 and msib.segment1 = ool.ordered_item
 and qpa.list_line_id = qll.list_line_id
 and ool.price_list_id = qlh.list_header_id
and ooh.order_number = :order_number
 and ool.unit_selling_price <>qll.operand
;

For the rows returned by the SQL we need to check the value of calculate_price_flag.
If Calculate_price_flag = N , if we see on front end the value will be Freeze which means that the item re-pricing will not be allowed,

If there are some records where calculate_price_flag = Y and no re-pricing is done please check if any manual modifier is applied on order line, If any modifier is applied overrding the Price List Price then re-pricing will not take place

No comments:

Post a Comment