Showing posts with label Price List Extraction Query. Show all posts
Showing posts with label Price List Extraction Query. Show all posts

Monday, August 26, 2019

Price List Extraction Query

SELECT 'New' PRL_ACTION_CODE
       ,t.name prl_name
       ,qha.currency_code
       ,hou.NAME operating_unit
       ,global_flag
       ,t.description
       ,TO_CHAR (qha.start_date_active, 'DD-MON-YYYY') effective_start_date
       ,TO_CHAR (qha.end_date_active, 'DD-MON-YYYY') effective_end_date
       ,qha.comments
       ,'ITEM' item_category
       ,(SELECT concatenated_segments FROM apps.mtl_system_items_vl  WHERE inventory_item_id = TO_NUMBER (qppr.product_attr_value) AND ROWNUM = 1) item_cat_number
       ,qppr.product_uom_code uom_code
       ,qpll.list_line_type_code line_type
       ,qpll.price_break_type_code price_break_type
   ,CASE
          WHEN qpll.list_line_type_code = 'PLL'
            THEN qpll.pricing_attr_value_from
          ELSE qpbv.pricing_attr_value_from
        END value_from
   ,CASE
          WHEN qpll.list_line_type_code = 'PLL'
            THEN qpll.pricing_attr_value_to
          ELSE qpbv.pricing_attr_value_to
        END value_to
       ,CASE
          WHEN qpll.list_line_type_code = 'PLL'
            THEN qpll.operand
          ELSE qpbv.operand
        END value
       ,TO_CHAR (NVL(qpll.start_date_active,qha.start_date_active), 'DD-MON-YYYY') start_date
       ,TO_CHAR (qpll.end_date_active, 'DD-MON-YYYY') end_date
       ,NVL (qpll.product_precedence, 220) line_precedence
       ,qppr.attribute1
       ,qppr.attribute2
       ,qppr.attribute3
       ,qppr.attribute4
       ,qppr.attribute5
       ,qppr.attribute6
       ,qppr.attribute7
       ,qppr.attribute8
       ,qppr.attribute9
       ,qppr.attribute10
       ,qppr.attribute11
       ,qppr.attribute12
       ,qppr.attribute13
       ,qppr.attribute14
       ,qppr.attribute15
       ,SYSDATE
       ,1
       ,SYSDATE
       ,1
       ,1
       , (SELECT OOD.ORGANIZATION_CODE
          FROM apps.ORG_ORGANIZATION_DEFINITIONS  OOD
          WHERE OOD.organization_id = hou.organization_id ) ORG_CODE
FROM apps.QP_LIST_HEADERS_B   qha
      , apps.qp_list_lines_v  qpll
      , apps.qp_list_headers_tl  t
      , apps.qp_pricing_attributes  qppr
  ,apps.qp_price_breaks_v  qpbv
      , apps.HR_OPERATING_UNITs  hou
WHERE qha.LIST_HEADER_ID             =      qpll.LIST_HEADER_ID
AND qha.list_type_code               =      'PRL'
AND qha.list_header_id               =      t.list_header_id
AND qppr.list_line_id                =      qpll.list_line_id
AND qpll.list_line_type_code         in      ('PLL','PBH')
and qpll.PRODUCT_ATTRIBUTE_CONTEXT   =      'ITEM'
AND qpll.product_attribute           =      'PRICING_ATTRIBUTE1'
AND t.LANGUAGE                       =     USERENV ('LANG')
AND hou.organization_id (+)          =       qha.orig_org_id
--AND hou.organization_id            =      242
AND qha.active_flag                  =       'Y'
AND qpbv.parent_list_line_id (+) = qpll.list_line_id
AND t.name                           ='XX_PRICE_LIST_NAME'
AND ( trunc(nvl(qha.end_date_active,sysdate)) >= trunc(sysdate) OR (trunc(to_date('15-12-2013','DD/MM/YYYY')) <= trunc(NVL(qpll.end_date_active,sysdate)) ));

Query to find Templates details of XML publisher reports

SELECT distinct(XL.file_name )"File Name", xddv.data_source_code "Data Definition Code",        xddv.data_source_name ...