Monday, 4 January 2016

View for Purchase order print depedent tables relations as APPS.XXPOPRINTING_REPORT





CREATE OR REPLACE FORCE VIEW APPS.XXPOPRINTING_REPORT
AS
SELECT pha.po_header_id,
--##############################################################################--
--#                                                                            #--
--#   View Name : XXPOPRINTING_REPORT                                          #--
--#                                                                            #--
--#  Description    :                                                          #--
--#  Office  Standard Purchase Order Printing  By Joining Dependent Tables     #--
--#  Initial Verion       Created By                  Last_Update_Date         #--
--#  --------------       ----------                  ----------------         #--
--#      1.0              Santosh                      05-JAN-2016             #--
--#                                                                            #--
--##############################################################################--
       pha.segment1 po_number,
       pha.creation_date po_date,
       pha.vendor_id,
       pha.comments,
       pv.vendor_name,
       pha.vendor_site_id,
          pvsa.address_line1
       || ' '
       || pvsa.address_line2
       || ' '
       || pvsa.address_line3
       || ' '
       || pvsa.city
       || ' '
       || ftt.territory_short_name
          address,
       pvsa.address_line1,
       pvsa.address_line2,
       pvsa.address_line3,
       pvsa.city,
       ftt.territory_short_name,
       pvsa.fax,
       pha.terms_id,
       apt.description pay_terms,
       pha.currency_code,
       pha.rate,
       pla.po_line_id,
       pla.line_num,
       pla.item_description,
       pla.unit_meas_lookup_code,
       pla.unit_price,
       LTRIM (pla.quantity) quantity,
       pv.segment1,
       pla.quantity * pla.unit_price * NVL (pha.rate, 1) amount,
       mtl_categories_b.segment1 catdesc
  FROM po_headers_all pha,
       po_lines_all pla,
       ap_terms apt,
       po_vendors pv,
       po_vendor_sites_all pvsa,
       fnd_territories_tl ftt,
       mtl_categories_b,
       po_line_locations_all poll,
       po_distributions_all pod,
       ap_invoice_distributions_all apid
 WHERE     pha.org_id = 81  ---  Pass the ORG_ID
       AND pha.segment1 = pha.segment1  --pass the PO Number
       AND pha.po_header_id = pla.po_header_id
       AND pha.terms_id = apt.term_id
       AND pha.vendor_id = pv.vendor_id
       AND pha.vendor_site_id = pvsa.vendor_site_id
       AND pvsa.country = ftt.territory_code(+)
       AND ftt.language(+) = 'AR'
       AND mtl_categories_b.category_id = pla.category_id
       AND pla.po_line_id = poll.po_line_id
       AND poll.line_location_id = pod.line_location_id
       AND pod.po_distribution_id = apid.po_distribution_id(+);


No comments:

Post a Comment