Thursday 17 May 2012

po direct link with GL r12

/* Formatted on 2012/05/17 17:40 (Formatter Plus v4.8.8) */
SELECT hl.location_code, ood.organization_name,
       TO_CHAR (gjb.posted_date, 'DD-Mon-YY') gl_posted_date,
       gjb.NAME batch_name, gjb.default_period_name period_name,
       gjl.entered_dr debit, poh.segment1 po_number,
       TO_CHAR (poh.creation_date, 'DD-Mon-YY') po_creation_date,
       NVL (poh.attribute1, poh.comments) job_number, pov.segment1 supplier,
       pov.vendor_name supplier_name, pvs.vendor_site_code supplier_site,
       pll.unit_meas_lookup_code uom, pol.item_description item_description,
       ood.organization_name shipment_org,
       ood.organization_code organization_code,
       pll.quantity_received shipment_quantity, pol.unit_price unit_price,
       pll.quantity_received * pol.unit_price shipment_amount,
       pll.quantity_received quantity_received, gjl.entered_dr accrued_amount,
       DECODE
          (pda.project_id,
           NULL, 'NOT-PROJ-RELATED',
           (SELECT NAME
              FROM pa_projects
              WHERE project_id = pda.project_id)
          ) project,
          gcc.segment1
       || '.'
       || gcc.segment2
       || '.'
       || gcc.segment3
       || '.'
       || gcc.segment4
       || '.'
       || gcc.segment5 charge_account,
       DECODE (gjb.status, 'P', 'Posted', 'U', 'Unposted', '') batch_status,
       pll.po_header_id                        
                       ,
       pll.po_line_id                         
                     ,
       pll.line_location_id                   
                           ,
       pda.po_distribution_id                  
  FROM apps.po_headers_all poh,
       apps.po_vendors pov,
       apps.po_vendor_sites_all pvs,
       apps.po_lines_all pol,
       apps.po_line_locations_all pll,
       apps.org_organization_definitions ood,
       apps.po_distributions_all pda,
       apps.gl_code_combinations gcc,
       apps.gl_je_batches gjb,
       apps.gl_je_headers gjh,
       apps.hr_locations hl,
       apps.gl_je_lines gjl
 WHERE 1 = 1
   AND poh.vendor_id = pov.vendor_id
   AND poh.po_header_id = pol.po_header_id
   AND pll.po_header_id = pol.po_header_id
   AND pll.po_line_id = pol.po_line_id
   AND pov.vendor_id = pvs.vendor_id
   AND poh.vendor_site_id = pvs.vendor_site_id
   AND pll.ship_to_organization_id = ood.organization_id
   AND poh.po_header_id = pda.po_header_id
   AND pol.po_line_id = pda.po_line_id
   AND pll.line_location_id = pda.line_location_id
   AND pda.code_combination_id = gcc.code_combination_id
   AND gjl.code_combination_id = gcc.code_combination_id
   AND gjl.je_header_id = gjh.je_header_id
   AND poh.ship_to_location_id = hl.location_id
   AND gcc.segment1 = :p_segment1

No comments:

Post a Comment