Search This Blog

Wednesday, September 9, 2015

Query for Standard and Blanket Purchase order Details

Below query can be handy to retrieve details for Standard Purchase order and Blanket Purchase order with releases. The query is not completely tested and is only for reference.

SELECT poh.segment1 po_number
     , poh.type_lookup_code
     , pr.release_num
     , poh.creation_date
     , pv.vendor_name supplier
     , pvs.vendor_site_code supplier_site_code
     , hl.location_code ship_to_location_code
     , pb.agent_name buyer_name
     , msi.segment1 item_number
     , msi.description item_desc
     , msi.inventory_item_status_code item_status
     , pll.quantity
     , pll.quantity_received
     , pll.quantity_cancelled
     , pll.quantity_billed
     , pol.unit_price
     , mp.organization_code receiving_org_code
     , (SELECT mc.concatenated_segments
        FROM mtl_categories_kfv mc, mtl_item_categories mic, mtl_category_sets mcs
        WHERE mcs.category_set_name = 'PURCHASING'
          AND mcs.category_set_id = mic.category_set_id
          AND mic.inventory_item_id = msi.inventory_item_id
          AND mic.organization_id = msi.organization_id
          AND mic.category_id = mc.category_id)
          po_category
FROM po_headers_all poh
   , po_lines_all pol
   , po_line_locations_all pll
   , po_releases_all pr
   , mtl_system_items msi
   , org_organization_definitions mp
   , po_vendors pv
   , po_vendor_sites_all pvs
   , po_agents_v pb
   , hr_locations hl
   , hr_operating_units hou
WHERE poh.type_lookup_code IN ('BLANKET', 'STANDARD')
  AND msi.inventory_item_id = pol.item_id
  AND msi.organization_id = pll.ship_to_organization_id
  AND mp.organization_id = msi.organization_id
  AND poh.po_header_id = pol.po_header_id
  AND pol.po_line_id = pll.po_line_id
  AND pr.po_header_id(+) = poh.po_header_id
  AND NVL (pll.po_release_id, 1) = NVL (pr.po_release_id, 1)
  AND poh.vendor_id = pv.vendor_id
  AND poh.vendor_site_id = pvs.vendor_site_id
  AND pvs.vendor_id = pv.vendor_id
  AND pb.agent_id = poh.agent_id
  AND hl.location_id = poh.ship_to_location_id
  AND poh.org_id = hou.organization_id
  AND hou.short_code = 'VIS-US'
ORDER BY poh.segment1, pr.release_num

Thursday, March 19, 2015

Query for Drop Ship Order

Below query can be helpful to get integrated information for drop ship orders

SELECT h.order_number
     , l.line_number so_line_number
     , ph.segment1 po_number
     , l.ordered_item
     , l.ordered_quantity
     , por.release_num
     , pl.line_num po_line_number
     , ph.authorization_status
     , prh.interface_source_code
     , prh.segment1 requisition_number
     , prl.line_num requisition_line_number
     , ph.closed_date
     , ph.closed_code
     , ods.header_id so_header_id
     , ods.line_id so_line_id
     , prh.requisition_header_id
     , prl.requisition_line_id
     , ph.po_header_id
     , pl.po_line_id
     , pll.line_location_id po_line_location_id
     , por.po_release_id
FROM oe_drop_ship_sources ods
   , oe_order_headers_all h
   , oe_order_lines_all l
   , po_line_locations_all pll
   , po_lines_all pl
   , po_headers_all ph
   , po_requisition_headers_all prh
   , po_requisition_lines_all prl
   , po_releases_all por
WHERE h.header_id = l.header_id
  AND h.header_id = ods.header_id
  AND l.line_id = ods.line_id
  AND por.po_release_id(+) = ods.po_release_id
  AND ods.line_location_id = pll.line_location_id(+)
  AND ods.po_header_id = pl.po_header_id(+)
  AND ods.po_line_id = pl.po_line_id(+)
  AND ph.po_header_id(+) = pl.po_header_id
  AND prl.requisition_header_id(+) = ods.requisition_header_id
  AND prl.requisition_line_id(+) = ods.requisition_line_id
  AND prh.requisition_header_id(+) = prl.requisition_header_id
  AND h.order_number = :sales_order;


Friday, July 25, 2014

Understanding Cycle count and best practices

Best practices:
•    Oracle provides ABC analysis and “minimum per year” cycle counts based on the ABC value
•    The key here is “minimum per year” counts. The algorithm may cause an  item to be counted more than the number of counts required per year
•    Because the cycle count process is random, you may NOT get an evenly spaced occurrence of counts
•    You have no access to see when an item will be counted during the year
•    If a 4 count a year item is added during the middle of the year, it will still get counted at least 4 times that year
•    Counts are not always evenly spaced during the year
•    You can’t ever know when an item is to be counted
•    Oracle developed the Cycle Count process to pass compliance and adhere to best practices
•    Random  means Random. It doesn’t mean evenly divided. It doesn’t even mean logical.
•    You can defeat the “randomness” by using manual Cycle Counts for every item but then you are missing the point of Cycle Counting
•    Cycle counting is a measure of your inventory accuracy
•    If you manipulate the process and remove the randomness, you will manipulate the accuracy
•    Make sure you have Save output selected in the Request Set when you execute Perform full cycle count request set in the 3 requests in the set
•    Make sure you print to a valid printer
•    You may not want to display system quantity, it could influence a count entry

Some Insights on Cycle Count Formula:
The Oracle site, and some others have the actual formulas used, but then on top of that, there is some rounding formula used that does not seem to be published.
Logic for Cycle Count Auto Schedule (As given in metalink)
The first criteria of selecting the items to schedule, is whether these items are marked as a control group items or not and what is the criterion on which the Cycle count scheduler is being run (Include Control Group Items is checked or not). Based on this the scheduler will select the Control Group Items or Non Control Group Items to schedule counts.
The second criteria is Max items to Schedule, which is defined as:
MaxItemsToSchedule = (TotalItemsInClass * NWorkingDays) /ClassCountInterval + 1;
where,
TotalItemsInClass = the number of items defined in the class
NWorkingDays = BeginDate - EndDate + 1 (this will be printed in the concurrent log file of the scheduler).
ClassCountInterval = NumWorkDaysThisYear / NumCountsPerYear (these will also be printed in the concurrent log file of the scheduler).
Once MaxItemsToSchedule is calculated, these number of items are picked randomly and will get scheduled and will be marked, so that these not picked in the scheduled run.

Now lets consider the following possible cases :
CASE 1
No. of items in class = 100
Counts per year for class = 1
No. of working days in the year = 200 (taken, for easy calculation)
Count Frequency = Daily

Now since the count frequency is 'Daily' you can run the scheduler on every working day.Using the above formula, Maximum Items to schedule = ((100*1*1)/200)+1 = 0+1 = 1 The above formula has integer division and so instead of 0.5+1 we have 0+1.
So, in this case all the 100 items in the class will be counted twice in a year. But, now if you change the count frequency from 'Daily' to 'Weekly' as shown in Case 2.

CASE 2
No. of items in class = 100
Counts per year for class = 1
No. of working days in the year = 200 (taken, for easy calculation)
Count Frequency = Weekly (say 5 work days in a week)
Maximum Items to schedule = ((100*1*5)/200)+1 = 3

Here, all the 100 items will be counted at least once, but some of the items may be counted twice since in our formula we are doing the ROUNDING off.In this case 80 items were counted only once and 20 items got counted twice.

If we do not do the rounding off (using integer division and adding 1), then in the above case we will have 2.5 items to schedule. Now, we can schedule either 2 or 3 items.So, if we schedule 2 items then all the 100 items will not be scheduled at least once (20 items will be left out). So we do the rounding off so that all the items are scheduled at least once.

You can see that by changing the count frequency from 'Daily' to 'Weekly' the number of items that are getting counted twice have been reduced from 100 as in Case 1, to 20 in Case 2. Since we are doing 'Rounding off' in the formula, some items of the class may be counted more than the number of counts specified.But, as I have mentioned before, Counts per year is the minimum guaranteed number of counts per year for all items in the class.

In cases where you have very few items and count frequency is 'Daily', the magnitude of the difference between 'actual number of counts' and 'counts per year specified' will be much higher. In these cases, by changing the count frequency from 'Daily' to 'weekly/period', will reduce the magnitude of difference. Also, we allow the user to change the 'Counts per year' at any point in time in the year. So, once this value is changed then all the items in the class are scheduled afresh,
irrespective of their scheduling before the change of value for counts per year.

The logic for Cycle counting is forward looking.
1. The counts per year for a class ensures that all items in that class are scheduled at least that many items in a year. That is, if the counts per year for a class is 10 and the class has 100 items, then each of the 100 items in the class are scheduled at least 10 times.
2. In cases where you have very few items in the class and have high count frequency (say Daily), there are chances that it will be counted more number of times, then specified in its class. However, in those cases you would ideally like to reduce the count frequency (say, from 'daily' to 'weekly').
3. The counts per year for a class can be changed by the user at a later point in time. Cycle counting does not take into account the number of counts that have already been done before the change of value for 'counts per year'. It now takes into account the new value of 'counts per year' for all the items in the class

Copyright (c) All rights reserved. Presented by Suresh Vaishya