Saturday, May 24, 2014

How to link OTL Time Attributes with Purchase Order, PO Lines

Following SQL Statement is a sample to link a specific Purchase Order(PO), Purchase Order Line/s with Oracle Time and Labor Time Entry table:-


 Parameters :-

  P_PO_NUM - Purchase Order Number
  P_LINE_NUM - Purchase Order Line Number(Optional)

SELECT ph.segment1 po_num,
            pl.line_num po_line_num,
            tbbd.start_time,
            tbbd.stop_time
    FROM hxc_time_attribute_usages tau1,
             hxc_time_attributes ta1,
             hxc_time_building_blocks tbbde,
             hxc_time_building_blocks tbbd,
             hxc_timecard_summary hts,
             po_headers_all ph,
             po_lines_all pl
   WHERE  1 = 1
         AND tau1.time_building_block_id = tbbde.time_building_block_id
         AND tau1.time_building_block_ovn = tbbde.object_version_number
         AND tbbde.SCOPE = 'DETAIL'
         AND tbbde.parent_building_block_id = tbbd.time_building_block_id
         AND tbbde.parent_building_block_ovn = tbbd.object_version_number
         AND tbbd.SCOPE = 'DAY'
         AND tbbd.parent_building_block_id = hts.timecard_id
         AND tbbd.parent_building_block_ovn = hts.timecard_ovn
         AND tau1.time_attribute_id = ta1.time_attribute_id
         AND ta1.bld_blk_info_type_id = 61
         AND ph.po_header_id = TO_NUMBER (ta1.attribute8)
         AND pl.po_line_id = TO_NUMBER (ta1.attribute2)
         AND ph.po_header_id = pl.po_header_id
         AND ph.segment1 = '&P_PO_NUM'
         AND pl.line_num = NVL ('&P_LINE_NUM', pl.line_num)
ORDER BY tbbd.start_time, tbbd.stop_time;

No comments:

Post a Comment