DBA Data[Home] [Help]

APPS.QP_PRICE_BOOK_UTIL SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 8

  Procedure to insert Price Book related error and warning messages into
  qp_price_book_messages table.
*****************************************************************************/
PROCEDURE Insert_Price_Book_Messages (
                       p_price_book_messages_tbl IN  price_book_messages_tbl)
IS

i NUMBER;
Line: 49

    INSERT INTO qp_price_book_messages
    (message_id,
     message_type,
     message_code,
     message_text,
     pb_input_header_id,
     price_book_header_id,
     price_book_line_id,
     creation_date,
     created_by,
     last_update_date,
     last_updated_by,
     last_update_login
    )
    VALUES
     (qp_price_book_messages_s.nextval,
      l_message_type_tbl(i),
      l_message_code_tbl(i),
      l_message_text_tbl(i),
      l_pb_input_header_id_tbl(i),
      l_price_book_header_id_tbl(i),
      l_price_book_line_id_tbl(i),
      sysdate,
      l_user_id,
      sysdate,
      l_user_id,
      l_login_id);
Line: 81

END Insert_Price_Book_Messages;
Line: 90

  SELECT list_header_id
  INTO   x_return
  FROM   qp_list_headers_vl
  WHERE  name = p_price_list_name
  AND    list_type_code = 'PRL'
  AND    rownum = 1;
Line: 110

  SELECT agreement_id
  INTO   x_return
  FROM   oe_agreements_vl a
  WHERE  name = p_agreement_name
  AND    trunc(nvl(p_pricing_effective_date, sysdate))
           between trunc(nvl(a.start_date_active,
                             p_pricing_effective_date))
           and trunc(nvl(a.end_date_active,
                         p_pricing_effective_date))
  AND    rownum = 1;
Line: 133

  SELECT header_id
  INTO   x_return
  FROM   oe_blanket_headers_all
  WHERE  order_number = p_bsa_name;
Line: 150

  SELECT cust_account_id
  INTO   x_cust_account_id
  FROM   hz_cust_accounts
  WHERE  party_id = p_customer_attr_value;
Line: 208

      SELECT template_code
      INTO   p_pb_input_header_rec.pub_template_code
      FROM   xdo_templates_vl
      WHERE  template_name = p_pb_input_header_rec.pub_template_name
      AND    application_short_name = 'QP'
      AND    rownum = 1;
Line: 242

      SELECT customer_id
      INTO   l_customer_id
      FROM   fnd_user
      WHERE  user_id = l_user_id;
Line: 275

        SELECT customer_id
        INTO   l_customer_id
        FROM   fnd_user
        WHERE  user_id = l_user_id;
Line: 311

      SELECT party_id
      INTO   p_pb_input_header_rec.customer_attr_value
      FROM   hz_cust_accounts
      WHERE  cust_account_id = p_pb_input_header_rec.cust_account_id;
Line: 323

    SELECT application_id
    INTO   l_application_id
    FROM   fnd_application
    WHERE  application_short_name =
             p_pb_input_header_rec.pricing_perspective_code;
Line: 387

            SELECT currency_code
            INTO   p_pb_input_header_rec.currency_code
            FROM   qp_list_headers_b
            WHERE  list_header_id = p_pb_input_header_rec.pl_agr_bsa_id;
Line: 523

      Insert_Price_Book_Messages (l_price_book_messages_tbl);
Line: 524

      l_price_book_messages_tbl.delete;
Line: 537

        Insert_Price_Book_Messages (l_price_book_messages_tbl);
Line: 538

        l_price_book_messages_tbl.delete;
Line: 556

    Insert_Price_Book_Messages (l_price_book_messages_tbl);
Line: 557

    l_price_book_messages_tbl.delete;
Line: 562

      SELECT application_id
      INTO   l_application_id
      FROM   fnd_application
      WHERE  application_short_name =
                 p_pb_input_header_rec.pricing_perspective_code;
Line: 582

        Insert_Price_Book_Messages (l_price_book_messages_tbl);
Line: 583

        l_price_book_messages_tbl.delete;
Line: 599

      Insert_Price_Book_Messages (l_price_book_messages_tbl);
Line: 600

      l_price_book_messages_tbl.delete;
Line: 627

      Insert_Price_Book_Messages (l_price_book_messages_tbl);
Line: 628

      l_price_book_messages_tbl.delete;
Line: 633

    UPDATE qp_pb_input_headers_b
    SET    request_type_code = l_request_type_code
    WHERE  pb_input_header_id = p_pb_input_header_rec.pb_input_header_id;
Line: 638

      SELECT pte_code
      INTO   l_pte_code
      FROM   qp_pte_request_types_v
      WHERE  request_type_code = l_request_type_code;
Line: 702

    SELECT customer_id
    INTO   l_customer_id
    FROM   fnd_user
    WHERE  user_id = l_user_id;
Line: 716

      SELECT 'Y'
      INTO   l_party_id_match
      FROM   dual
      WHERE  EXISTS (
               SELECT 'x'
               FROM   hz_relationships rel, hz_parties party3,
                      hz_parties party4, hz_parties party5
               WHERE rel.party_id = party5.party_id
               AND   party5.party_type = 'PARTY_RELATIONSHIP'
               AND   party5.status = 'A'
               AND   trunc(rel.start_date) <= trunc(sysdate)
               AND   trunc(nvl(rel.end_date, sysdate)) >= trunc(sysdate)
               AND   rel.subject_id = party3.party_id
               AND   party3.party_type = 'PERSON'
               AND   party3.status = 'A'
               AND   rel.object_id = party4.party_id
               AND   party4.party_type = 'ORGANIZATION'
               AND   party4.status = 'A'
               AND   rel.subject_table_name = 'HZ_PARTIES'
               AND   rel.object_table_name = 'HZ_PARTIES'
               AND   rel.relationship_id IN
                    (SELECT party_relationship_id
                     FROM   hz_org_contacts org_con
                     WHERE  rel.relationship_id =
                                      org_con.party_relationship_id
                     AND org_con.status ='A' )
               AND party5.party_id = l_customer_id
               AND party4.party_id = p_pb_input_header_rec.customer_attr_value);
Line: 839

          SELECT 1
          INTO   l_count
          FROM   hz_parties
          WHERE  party_id = p_pb_input_header_rec.customer_attr_value
          AND    rownum = 1;
Line: 887

        SELECT 1
        INTO   l_count
        FROM   hz_cust_accounts
        WHERE  cust_account_id = p_pb_input_header_rec.cust_account_id
        AND    party_id = p_pb_input_header_rec.customer_attr_value;
Line: 981

      SELECT 1
      INTO   l_count
      FROM   qp_price_book_headers_vl
      WHERE  price_book_name = p_pb_input_header_rec.price_book_name
      AND    price_book_type_code = 'F'
      AND    customer_id = p_pb_input_header_rec.customer_attr_value
      AND    rownum = 1;
Line: 1243

      SELECT 1
      INTO   l_count
      FROM   xdo_templates_vl
      WHERE  template_code = p_pb_input_header_rec.pub_template_code
      AND    application_short_name = 'QP'
      AND    rownum = 1;
Line: 1268

      SELECT 1
      INTO   l_count
      FROM   xdo_lobs tmpl, xdo_templates_vl t
      WHERE  t.APPLICATION_SHORT_NAME = 'QP'
      AND    t.TEMPLATE_CODE = tmpl.LOB_CODE
      AND    tmpl.LOB_TYPE in ('TEMPLATE','MLS_TEMPLATE')
      AND    tmpl.FILE_STATUS = 'E'
      AND    t.template_code = p_pb_input_header_rec.pub_template_code
      AND    lower(tmpl.LANGUAGE) = lower(p_pb_input_header_rec.pub_language)
      AND    upper(tmpl.TERRITORY) = upper(p_pb_input_header_rec.pub_territory);
Line: 1352

        SELECT 1
        INTO   l_count
        FROM   ecx_tp_headers eth, ecx_tp_details etd,
               ecx_ext_processes eep, ecx_transactions et,
               hz_parties hp, hz_party_sites hps, hz_locations hl
        WHERE eth.party_id = p_pb_input_header_rec.customer_attr_value
        AND   eth.party_site_id = p_pb_input_header_rec.dlv_xml_site_id
        AND   eth.tp_header_id = etd.tp_header_id
        AND   etd.EXT_PROCESS_ID = eep.EXT_PROCESS_ID
        AND   eth.party_id = hp.party_id
        AND   eth.party_site_id = hps.party_site_id
        AND   hps.location_id = hl.location_id
        AND   eep.transaction_id = et.transaction_id
        AND   et.transaction_type = 'QP'
        AND   et.transaction_subtype = 'CATSO'
        AND   eep.direction = 'OUT';
Line: 1394

      SELECT 1
      INTO   l_count
      FROM   qp_price_book_headers_vl
      WHERE  price_book_name = p_pb_input_header_rec.price_book_name
      AND    price_book_type_code = p_pb_input_header_rec.price_book_type_code
      AND    customer_id = p_pb_input_header_rec.customer_attr_value
      AND    rownum = 1;
Line: 1426

      SELECT 1
      INTO   l_count
      FROM   qp_price_book_headers_vl
      WHERE  price_book_name = p_pb_input_header_rec.price_book_name
      AND    price_book_type_code = p_pb_input_header_rec.price_book_type_code
      AND    customer_id = p_pb_input_header_rec.customer_attr_value
      AND    rownum = 1;
Line: 1459

      SELECT 1
      INTO   l_count2
      FROM   qp_price_book_headers_all_b b, qp_price_book_headers_tl t
      WHERE  b.price_book_header_id = t.price_book_header_id
      AND    t.language = userenv('LANG')
      AND    b.price_book_type_code = p_pb_input_header_rec.price_book_type_code
      AND    b.customer_id = p_pb_input_header_rec.customer_attr_value
      AND    t.price_book_name = p_pb_input_header_rec.price_book_name
      AND    rownum = 1;
Line: 1573

            SELECT 1
            INTO   l_count
            FROM   mtl_system_items_kfv
            WHERE  inventory_item_id =
                       to_number(p_pb_input_header_rec.product_attr_value)
            AND    organization_id = QP_UTIL.Get_Item_Validation_Org
            AND    purchasing_enabled_flag =
                    decode(p_pb_input_header_rec.pricing_perspective_code,
                           'PO', 'Y', purchasing_enabled_flag)
            AND    rownum = 1;
Line: 1662

            SELECT pte_code
            INTO   l_pte_code
            FROM   qp_pte_request_types_b
            WHERE  request_type_code = l_request_type_code;
Line: 1792

            SELECT 1
            INTO   l_count
            FROM   qp_list_headers_vl
            WHERE  list_type_code = 'PRL'
            AND    nvl(list_source_code, 'X') <> 'BSO'
            AND    nvl(active_flag, 'N') = 'Y'
            AND    (global_flag = 'Y' OR
                      orig_org_id = p_pb_input_header_rec.org_id)
            AND    source_system_code IN (SELECT application_short_name
                                          FROM   qp_pte_source_systems
                                          WHERE  pte_code = l_pte_code)
            AND    list_header_id = p_pb_input_header_rec.pl_agr_bsa_id
            AND    rownum = 1;
Line: 1873

              SELECT 1
              INTO   l_count
              FROM   qp_list_headers_vl
              WHERE  list_type_code = 'PRL'
              AND    nvl(list_source_code, 'X') <> 'BSO'
              AND    nvl(active_flag, 'N') = 'Y'
              AND    (global_flag = 'Y' OR
                        orig_org_id = p_pb_input_header_rec.org_id)
              AND    source_system_code IN (SELECT application_short_name
                                            FROM   qp_pte_source_systems
                                            WHERE  pte_code = l_pte_code)
              AND    list_header_id = p_pb_input_header_rec.pl_agr_bsa_id
              AND    rownum = 1;
Line: 1907

              SELECT 1
              INTO   l_count
              FROM   oe_agreements_vl
              WHERE  agreement_id = p_pb_input_header_rec.pl_agr_bsa_id
              AND    (sold_to_org_id = -1 OR
                      sold_to_org_id IN (SELECT cust_account_id
                                         FROM   hz_cust_accounts
                                         WHERE  party_id =
                                         p_pb_input_header_rec.customer_attr_value
                                         AND    cust_account_id =
                 nvl(p_pb_input_header_rec.cust_account_id, cust_account_id))
                     )
              AND    price_list_id IN (SELECT list_header_id
                                       FROM   qp_list_headers_vl
                                       WHERE  list_type_code IN ('PRL','AGR')
                                       AND    nvl(active_flag, 'N') = 'Y'
                                       AND    (global_flag = 'Y' OR
                                     orig_org_id = p_pb_input_header_rec.org_id)
                                       AND    source_system_code IN
                                           (SELECT application_short_name
                                            FROM   qp_pte_source_systems
                                            WHERE  pte_code = l_pte_code)
                                      )
              AND    (trunc(nvl(p_pb_input_header_rec.effective_date, sysdate))
                     between trunc(nvl(start_date_active,
                                 p_pb_input_header_rec.effective_date))
                     and trunc(nvl(end_date_active,
                             p_pb_input_header_rec.effective_date)))
              AND    rownum = 1;
Line: 1957

              SELECT 1
              INTO   l_count
              FROM   oe_blanket_headers_all a
              WHERE  a.header_id = p_pb_input_header_rec.pl_agr_bsa_id
              AND    (a.sold_to_org_id IS NULL OR
                      a.sold_to_org_id IN (SELECT cust_account_id
                                           FROM   hz_cust_accounts
                                           WHERE  party_id =
                                     p_pb_input_header_rec.customer_attr_value
                                           AND    cust_account_id =
                 nvl(p_pb_input_header_rec.cust_account_id, cust_account_id))
                     )
              AND    a.org_id = p_pb_input_header_rec.org_id
              AND    EXISTS (SELECT 'x'
                             FROM   qp_qualifiers
                             WHERE  qualifier_context = 'ORDER'
                             AND    qualifier_attribute = 'QUALIFIER_ATTRIBUTE5'
                             AND    qualifier_attr_value = a.header_id)
              AND    rownum = 1;
Line: 2038

        SELECT 1
        INTO   l_count
        FROM   fnd_currencies_vl
        WHERE  currency_flag = 'Y'
        AND    currency_code = p_pb_input_header_rec.currency_code
        AND    enabled_flag = 'Y'
        AND    trunc(NVL(start_date_active,
                         p_pb_input_header_rec.effective_date)
                    ) <= trunc(p_pb_input_header_rec.effective_date)
        AND    trunc(NVL(end_date_active, p_pb_input_header_rec.effective_date))
                      >= trunc(p_pb_input_header_rec.effective_date)
        AND    rownum = 1;
Line: 2136

            SELECT 1
            INTO   l_count
            FROM   qp_prc_contexts_b
            WHERE  prc_context_code = p_pb_input_lines_tbl(j).context
            AND    prc_context_type = p_pb_input_lines_tbl(j).attribute_type;
Line: 2162

            SELECT 1, nvl(user_valueset_id, seeded_valueset_id)
            INTO   l_count, l_valueset_id
            FROM   qp_segments_b s, qp_prc_contexts_b c,
                   qp_pte_segments ps, qp_pte_request_types_b pr
            WHERE  s.segment_mapping_column = p_pb_input_lines_tbl(j).attribute
            AND    s.prc_context_id = c.prc_context_id
            AND    c.prc_context_code = p_pb_input_lines_tbl(j).context
            AND    c.prc_context_type = p_pb_input_lines_tbl(j).attribute_type
            AND    c.prc_context_code <> 'ITEM'
            AND    NOT ((c.prc_context_code = 'CUSTOMER' AND
                         s.segment_code = 'PARTY_ID') OR
                        (c.prc_context_code = 'ASOPARTYINFO' AND
                         s.segment_code = 'CUSTOMER PARTY') OR
                        (c.prc_context_code = 'CUSTOMER' AND
                         s.segment_code = 'SOLD_TO_ORG_ID') OR
                        (c.prc_context_code = 'MODLIST' AND
                         s.segment_code = 'PRICE_LIST') OR
                        (c.prc_context_code = 'CUSTOMER' AND
                         s.segment_code = 'AGREEMENT_NAME') OR
                        (c.prc_context_code = 'ORDER' AND
                         s.segment_code = 'BLANKET_NUMBER') OR
                        (c.prc_context_code = 'ORDER' AND
                         s.segment_code = 'BLANKET_HEADER_ID')
                       )
            AND    s.segment_id = ps.segment_id
            AND    ps.pte_code = pr.pte_code
            AND    pr.request_type_code = l_request_type_code
            AND    (l_pricing_status = 'I' OR
                    l_pricing_status = 'S'  AND
                    s.availability_in_basic IN ('Y','F')
                   )
            AND    (nvl(ps.user_sourcing_method, ps.seeded_sourcing_method) =
                               'USER ENTERED'
                    OR
                    nvl(ps.user_sourcing_method, ps.seeded_sourcing_method) =
                               'ATTRIBUTE MAPPING'
                    AND EXISTS (SELECT 'X'
                                FROM   qp_attribute_sourcing a
                                WHERE a.request_type_code = pr.request_type_code
                                AND    a.segment_id = s.segment_id
                                AND    a.enabled_flag = 'Y'
                                AND    a.attribute_sourcing_level <> 'LINE'
                                AND    nvl(user_value_string,
                                           seeded_value_string)
                                       LIKE pr.order_level_global_struct||'%'
                               )
                   ) ;
Line: 2278

    Insert_Price_Book_Messages (l_price_book_messages_tbl);
Line: 2280

    l_price_book_messages_tbl.delete;
Line: 2304

    SELECT *
    INTO   l_pb_input_header_rec
    FROM   qp_pb_input_headers_vl
    WHERE  pb_input_header_id = p_pb_input_header_id;
Line: 2322

    Insert_Price_Book_Messages (l_price_book_messages_tbl);
Line: 2323

    l_price_book_messages_tbl.delete;
Line: 2329

  SELECT * BULK COLLECT
  INTO   l_pb_input_lines_tbl
  FROM   qp_pb_input_lines
  WHERE  pb_input_header_id = p_pb_input_header_id;
Line: 2344

  Procedure to insert Price Book Header info into qp_price_book_headers_b
  and _tl tables.
******************************************************************************/
PROCEDURE Insert_Price_Book_Header (
      p_pb_input_header_rec IN qp_pb_input_headers_vl%ROWTYPE,
      x_price_book_header_id OUT NOCOPY NUMBER)
IS
 l_application_id       NUMBER;
Line: 2364

    SELECT application_id
    INTO   l_application_id
    FROM   fnd_application
    WHERE  application_short_name =
               p_pb_input_header_rec.pricing_perspective_code;
Line: 2380

    SELECT 1
    INTO   l_count
    FROM   qp_price_book_headers_all_b b, qp_price_book_headers_tl t
    WHERE  b.price_book_header_id = t.price_book_header_id
    AND    t.language = userenv('LANG')
    AND    b.price_book_type_code = p_pb_input_header_rec.price_book_type_code
    AND    b.customer_id = p_pb_input_header_rec.customer_attr_value
    AND    t.price_book_name = p_pb_input_header_rec.price_book_name
    AND    rownum = 1;
Line: 2398

  INSERT INTO qp_price_book_headers_all_b (
      price_book_header_id,
      price_book_type_code,
      currency_code,
      effective_date,
      org_id,
      customer_id,
      cust_account_id,
      item_category,
      price_based_on,
      pl_agr_bsa_id,
      pricing_perspective_code,
      item_quantity,
      request_id,
      request_type_code,
      pb_input_header_id,
      creation_date,
      created_by,
      last_update_date,
      last_updated_by,
      last_update_login
     )
  VALUES
     (qp_price_book_headers_all_b_s.nextval,
      p_pb_input_header_rec.price_book_type_code,
      p_pb_input_header_rec.currency_code,
      p_pb_input_header_rec.effective_date,
      p_pb_input_header_rec.org_id,
      p_pb_input_header_rec.customer_attr_value,
      p_pb_input_header_rec.cust_account_id,
      decode(p_pb_input_header_rec.product_attribute,
             'PRICING_ATTRIBUTE2', p_pb_input_header_rec.product_attr_value,
             null),
      p_pb_input_header_rec.price_based_on,
      p_pb_input_header_rec.pl_agr_bsa_id,
      p_pb_input_header_rec.pricing_perspective_code,
      p_pb_input_header_rec.item_quantity,
      null, --Will be updated with the child request id later
      p_pb_input_header_rec.request_type_code,
      p_pb_input_header_rec.pb_input_header_id,
      sysdate,
      l_user_id,
      sysdate,
      l_user_id,
      fnd_global.conc_login_id
     ) RETURNING price_book_header_id INTO l_price_book_header_id;
Line: 2445

  INSERT INTO qp_price_book_headers_tl (
     price_book_header_id,
     price_book_name,
     pl_agr_bsa_name,
     creation_date,
     created_by,
     last_update_date,
     last_updated_by,
     last_update_login,
     language,
     source_lang
     )
  SELECT
     l_price_book_header_id,
     p_pb_input_header_rec.price_book_name,
     p_pb_input_header_rec.pl_agr_bsa_name,
     sysdate,
     l_user_id,
     sysdate,
     l_user_id,
     fnd_global.conc_login_id,
     l.language_code,
     userenv('LANG')
     FROM  FND_LANGUAGES L
     WHERE L.INSTALLED_FLAG in ('I','B')
     AND   NOT EXISTS (SELECT NULL
                       FROM   qp_price_book_headers_tl T
                       WHERE  t.price_book_header_id =
                                  l_price_book_header_id
                       AND    t.language = l.language_code);
Line: 2478

END Insert_Price_Book_Header;
Line: 2484

select meaning into l_meaning from qp_lookups where lookup_code = p_code and
lookup_type = p_type;
Line: 2496

select nvl(s.user_segment_name,s.seeded_segment_name) into l_attribute_name from qp_segments_v
s,qp_prc_contexts_v p where s.segment_mapping_column = p_attribute_code and
s.prc_context_id = p.prc_context_id and p.prc_context_code = p_context_code and
p.prc_context_type = p_attribute_type;
Line: 2511

              select concatenated_segments
                into l_attribute_value
                from mtl_system_items_kfv
                where inventory_item_id = to_number(p_attribute_value_code) and rownum = 1;
Line: 2518

              select concat_cat_parentage
                into l_attribute_value
                from eni_prod_den_hrchy_parents_v
                where category_id = to_number(p_attribute_value_code) and rownum = 1;
Line: 2523

              select concatenated_segments
                into l_attribute_value
                from mtl_categories_kfv
                where category_id = to_number(p_attribute_value_code);
Line: 2545

  select party_name into l_customer_name
  from hz_parties
  where party_id = to_number(p_attribute_value_code);
Line: 2551

select meaning into l_customer_name from ar_lookups where lookup_code=
p_attribute_value_code and lookup_type= 'CUSTOMER CLASS';
Line: 2568

    SELECT party_name INTO l_customer_name
    FROM hz_parties where party_id = to_number(p_customer_id);
Line: 2581

     select name into l_operating_unit
     from HR_ALL_ORGANIZATION_UNITS_TL
     WHERE ORGANIZATION_ID =  p_orgid
     AND LANGUAGE = userenv('LANG');
Line: 2594

select nvl(user_prc_context_name,seeded_prc_context_name) into l_context_name from qp_prc_contexts_v where prc_context_code =
p_context and prc_context_type = p_attribute_type;
Line: 2605

select description into l_item_description from mtl_system_items_tl where
language = userenv('LANG') and inventory_item_id = p_item_number and rownum =1;
Line: 2616

       select concat_cat_parentage into l_item_category from eni_prod_den_hrchy_parents_v
        where  category_id = p_item_category and  rownum = 1;
Line: 2620

      select concatenated_segments into l_item_category from mtl_categories_kfv where
      category_id = p_item_category ;
Line: 2632

       select category_desc into l_item_cat_description from eni_prod_den_hrchy_parents_v where
       category_id = p_item_category and rownum = 1;
Line: 2636

        select description into l_item_cat_description from mtl_categories_kfv  where
        category_id = p_item_category;
Line: 2648

select concatenated_segments into l_item_number from mtl_system_items_kfv where
inventory_item_id = p_item_number and rownum = 1;
Line: 2664

    SELECT cust_account_id
    INTO   l_cust_account_id
    FROM   qp_price_book_headers_b
    WHERE  price_book_header_id = p_pb_header_id;
Line: 2679

    SELECT master_organization_id
    INTO   l_master_org
    FROM   mtl_parameters
    WHERE  organization_id = QP_UTIL.Get_Item_Validation_Org;
Line: 2688

    SELECT ci.customer_item_number
    INTO   l_customer_item_number
    FROM   mtl_customer_item_xrefs xref, mtl_customer_items_all_v ci
    WHERE  xref.inventory_item_id = p_item_number
    AND    xref.master_organization_id = l_master_org
    AND    xref.inactive_flag = 'N'
    AND    ci.customer_item_id = xref.customer_item_id
    AND    ci.customer_id = l_cust_account_id
    AND    ci.address_id is null
    AND    ci.customer_category_code is null
    AND    ci.item_definition_level = 1;
Line: 2715

    SELECT cust_account_id
    INTO   l_cust_account_id
    FROM   qp_price_book_headers_b
    WHERE  price_book_header_id = p_pb_header_id;
Line: 2730

    SELECT master_organization_id
    INTO   l_master_org
    FROM   mtl_parameters
    WHERE  organization_id = QP_UTIL.Get_Item_Validation_Org;
Line: 2741

       SELECT MCI.CUSTOMER_ITEM_DESC
      INTO   l_customer_item_desc
      FROM MTL_CUSTOMER_ITEMS MCI,
      HZ_PARTIES HZP, HZ_CUST_ACCOUNTS HZC, (SELECT LOC.COUNTRY,
                                                    ACCT_SITE.CUST_ACCT_SITE_ID ADDRESS_ID
        FROM   HZ_LOC_ASSIGNMENTS LOC_ASSIGN,
               HZ_LOCATIONS LOC, HZ_CUST_ACCT_SITES_ALL ACCT_SITE,
               HZ_PARTY_SITES PARTY_SITE
        WHERE  ACCT_SITE.PARTY_SITE_ID = PARTY_SITE.PARTY_SITE_ID
               AND LOC.LOCATION_ID = PARTY_SITE.LOCATION_ID
               AND LOC.LOCATION_ID = LOC_ASSIGN.LOCATION_ID
               AND NVL(ACCT_SITE.ORG_ID,- 99) = NVL(LOC_ASSIGN.ORG_ID,- 99)
	       AND NVL(ACCT_SITE.ORG_ID,NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1,1), ' ', NULL,SUBSTRB(USERENV('CLIENT_INFO'),1, 10))),- 99)) =
                      NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1, 1),' ', NULL,SUBSTRB(USERENV('CLIENT_INFO'), 1,10))),- 99)) RAD,
               MTL_COMMODITY_CODES MCC,
               MTL_CUSTOMER_ITEMS MCIM, ( SELECT B.TERRITORY_CODE
                                          FROM  FND_TERRITORIES_TL T, FND_TERRITORIES B
                                          WHERE B.TERRITORY_CODE = T.TERRITORY_CODE
                                          AND T.LANGUAGE = USERENV('LANG')) TERR,
               AR_LOOKUPS ARL,
               MFG_LOOKUPS MFL, mtl_customer_item_xrefs xref
       WHERE  MCI.CUSTOMER_ID   = HZC.CUST_ACCOUNT_ID
       AND MCI.ADDRESS_ID   = RAD.ADDRESS_ID(+)
       AND MCI.COMMODITY_CODE_ID  = MCC.COMMODITY_CODE_ID
       AND MCI.MODEL_CUSTOMER_ITEM_ID    =     MCIM.CUSTOMER_ITEM_ID(+)
       AND TERR.TERRITORY_CODE(+)  = RAD.COUNTRY
       AND MCI.CUSTOMER_CATEGORY_CODE = ARL.LOOKUP_CODE(+)
       AND ARL.LOOKUP_TYPE(+)  = 'ADDRESS_CATEGORY'
       AND MCI.ITEM_DEFINITION_LEVEL = MFL.LOOKUP_CODE
       AND MFL.LOOKUP_TYPE   = 'INV_ITEM_DEFINITION_LEVEL'
       AND HZC.PARTY_ID = HZP.PARTY_ID
       AND xref.inventory_item_id = p_item_number
       AND xref.master_organization_id = l_master_org
       AND xref.inactive_flag = 'N'
       AND mci.customer_item_id = xref.customer_item_id
       AND mci.customer_id = l_cust_account_id
       AND mci.address_id is null
       AND mci.customer_category_code is null
       AND mci.item_definition_level = 1;
Line: 2805

   select concat_cat_parentage
                into l_attribute_value
                from eni_prod_den_hrchy_parents_v
                where category_id = to_number(p_attribute_value) and rownum = 1;
Line: 2810

   select concatenated_segments
                into l_attribute_value
                from mtl_categories_kfv
                where category_id = to_number(p_attribute_value);
Line: 2833

select name into l_list_name from qp_list_headers_tl
where list_header_id = p_list_header_id and
language = userenv('LANG');
Line: 2841

PROCEDURE Delete_PriceBook_Info(p_price_book_header_id in number)
is

l_pb_input_header_id  number := null;
Line: 2855

SELECT CUSTOMER_ID,PB_INPUT_HEADER_ID,PRICE_BOOK_NAME,DOCUMENT_ID
	into l_customer_id,l_pb_input_header_id ,l_price_book_name,l_document_id
from QP_PRICE_BOOK_HEADERS_V
WHERE PRICE_BOOK_HEADER_ID = p_price_book_header_id;
Line: 2865

  SELECT PB_INPUT_HEADER_ID,PRICE_BOOK_HEADER_ID,DOCUMENT_ID
     into d_pb_input_header_id,d_price_book_header_id, d_document_id
  FROM QP_PRICE_BOOK_HEADERS_V
  WHERE PRICE_BOOK_HEADER_ID <> p_price_book_header_id AND
  PRICE_BOOK_NAME = l_price_book_name and
  PRICE_BOOK_TYPE_CODE = 'D' and
  CUSTOMER_ID = l_customer_id;
Line: 2879

 DELETE FROM QP_PRICE_BOOK_ATTRIBUTES WHERE PRICE_BOOK_HEADER_ID in (p_price_book_header_id,d_price_book_header_id);
Line: 2884

 DELETE FROM QP_PRICE_BOOK_BREAK_LINES WHERE PRICE_BOOK_HEADER_ID in (p_price_book_header_id,d_price_book_header_id);
Line: 2889

 DELETE FROM QP_PRICE_BOOK_LINE_DETAILS WHERE PRICE_BOOK_HEADER_ID  in (p_price_book_header_id,d_price_book_header_id);
Line: 2894

 DELETE FROM QP_PRICE_BOOK_LINES WHERE PRICE_BOOK_HEADER_ID   in (p_price_book_header_id,d_price_book_header_id);
Line: 2899

 DELETE FROM QP_PRICE_BOOK_HEADERS_TL WHERE PRICE_BOOK_HEADER_ID  in (p_price_book_header_id,d_price_book_header_id);
Line: 2904

 DELETE FROM QP_PRICE_BOOK_HEADERS_B WHERE PRICE_BOOK_HEADER_ID  in (p_price_book_header_id,d_price_book_header_id);
Line: 2909

 DELETE FROM QP_PB_INPUT_LINES WHERE PB_INPUT_HEADER_ID in (l_pb_input_header_id,  d_pb_input_header_id);
Line: 2914

 DELETE FROM QP_PB_INPUT_HEADERS_TL WHERE PB_INPUT_HEADER_ID in  (l_pb_input_header_id,  d_pb_input_header_id);
Line: 2919

 DELETE FROM QP_PB_INPUT_HEADERS_B WHERE PB_INPUT_HEADER_ID   in  (l_pb_input_header_id,  d_pb_input_header_id);
Line: 2924

 DELETE FROM QP_PRICE_BOOK_MESSAGES  WHERE PRICE_BOOK_HEADER_ID   in (p_price_book_header_id,d_price_book_header_id);
Line: 2930

 DELETE FROM QP_DOCUMENTS WHERE DOCUMENT_ID in (l_document_id,d_document_id);
Line: 2938

PROCEDURE Delete_Input_Criteria(p_pb_input_header_id in number)
is

BEGIN
--[prarasto]Deleting the Input Header and Lines is not required as the same header_id will be
--updated in case of an error. Commenting the code.
/*
-- Commiting after each delete as it will give rollback segment error if the data is huge
 DELETE FROM QP_PB_INPUT_LINES WHERE PB_INPUT_HEADER_ID in (p_pb_input_header_id);
Line: 2951

 DELETE FROM QP_PB_INPUT_HEADERS_TL WHERE PB_INPUT_HEADER_ID in (p_pb_input_header_id);
Line: 2956

 DELETE FROM QP_PB_INPUT_HEADERS_B WHERE PB_INPUT_HEADER_ID   in (p_pb_input_header_id);
Line: 2961

 DELETE FROM QP_PRICE_BOOK_MESSAGES  WHERE PB_INPUT_HEADER_ID in (p_pb_input_header_id);
Line: 2964

 null;	--Commit will be done only after successful insertion.
Line: 2974

select name into l_currency_name from fnd_currencies_vl where currency_code =
p_currency_code;
Line: 2983

PROCEDURE INSERT_PB_TL_RECORDS
(
  p_pb_input_header_id IN VARCHAR2,
  p_price_book_name IN VARCHAR2,
  p_pl_agr_bsa_name IN VARCHAR2
)
IS
BEGIN
  INSERT INTO QP_PB_INPUT_HEADERS_TL (
    PB_INPUT_HEADER_ID,
    CREATION_DATE,
    CREATED_BY,
    LAST_UPDATE_DATE,
    LAST_UPDATED_BY,
    LAST_UPDATE_LOGIN,
    PRICE_BOOK_NAME,
    PL_AGR_BSA_NAME,
    LANGUAGE,
    SOURCE_LANG
  ) SELECT
    p_pb_input_header_id,
    PBIH.CREATION_DATE,
    PBIH.CREATED_BY,
    PBIH.LAST_UPDATE_DATE,
    PBIH.LAST_UPDATED_BY,
    PBIH.LAST_UPDATE_LOGIN,
    p_price_book_name,
    p_pl_agr_bsa_name,
    L.LANGUAGE_CODE,
    userenv('LANG')
    FROM FND_LANGUAGES L, QP_PB_INPUT_HEADERS_B PBIH
    WHERE L.INSTALLED_FLAG in ('I', 'B')
    AND PBIH.PB_INPUT_HEADER_ID = p_pb_input_header_id
    AND NOT EXISTS
      (SELECT NULL
      FROM QP_PB_INPUT_HEADERS_TL T
      WHERE T.PB_INPUT_HEADER_ID = p_pb_input_header_id
      AND T.LANGUAGE = L.LANGUAGE_CODE);
Line: 3021

END INSERT_PB_TL_RECORDS;
Line: 3056

        SELECT inventory_item_id
        INTO   x_prod_attr_value
        FROM   mtl_system_items_vl
        WHERE  concatenated_segments = p_item_number
        AND    organization_id = p_org_id;
Line: 3078

        SELECT inventory_item_id
        INTO    x_prod_attr_value
        FROM (
          SELECT  Inventory_Item_Id
          FROM    MTL_CUSTOMER_ITEM_XREFS x, MTL_CUSTOMER_ITEMS i
          WHERE   i.customer_id = p_customer_id
          AND     i.customer_item_number = p_item_number_cust
          AND     i.Customer_Item_Id = x.customer_item_id
          AND     x.Master_Organization_Id  =
                          (SELECT Master_Organization_Id
                           FROM   MTL_PARAMETERS
                           WHERE  Organization_Id = p_org_id)
          ORDER BY Preference_Number ASC)
        WHERE     rownum = 1;
Line: 3103

        SELECT distinct category_id
        INTO   x_prod_attr_value
        FROM   qp_item_categories_v
        WHERE  category_name = p_item_category_name;
Line: 3181

  SELECT c.prc_context_code
  INTO   x_context_code
  FROM   qp_prc_contexts_v c
  WHERE  nvl(c.user_prc_context_name,c.seeded_prc_context_name) = p_context_name
  AND    prc_context_type = p_attribute_type;
Line: 3214

  SELECT sb.segment_mapping_column
  INTO   x_attribute_code
  FROM   qp_prc_contexts_b p, qp_segments_b sb, qp_segments_tl stl
  WHERE  p.prc_context_code = p_context_code
  AND    p.prc_context_type = p_attribute_type
  AND    sb.prc_context_id = p.prc_context_id
  AND    stl.segment_id = sb.segment_id
  AND    stl.language = userenv('LANG')
  AND    nvl(stl.user_segment_name,stl.seeded_segment_name) = p_attribute_name;
Line: 3270

  SELECT segment_code
  INTO   l_segment_code
  FROM   qp_prc_contexts_b p, qp_segments_b sb, qp_segments_tl stl
  WHERE  p.prc_context_code = p_context_code
  AND    p.prc_context_type = p_attribute_type
  AND    sb.prc_context_id = p.prc_context_id
  AND    stl.segment_id = sb.segment_id
  AND    stl.language = userenv('LANG')
  AND    sb.segment_mapping_column = p_attribute_code;
Line: 3424

    UPDATE QP_PRICE_BOOK_HEADERS_B
    SET PUB_STATUS_CODE = 'REQUESTED'
    WHERE PRICE_BOOK_HEADER_ID = p_price_book_header_id;
Line: 3453

          SELECT PUB_STATUS_CODE
          INTO l_status_code
          FROM QP_PRICE_BOOK_HEADERS_B
          WHERE PRICE_BOOK_HEADER_ID = p_price_book_header_id;
Line: 3577

    SELECT i.customer_attr_value, i.DLV_XML_SITE_ID
    INTO   party_id, party_site_id
    FROM   qp_price_book_headers_b p, qp_pb_input_headers_b i
    WHERE  p.price_book_header_id = p_price_book_header_id
    AND    p.pb_input_header_id = i.pb_input_header_id;
Line: 3588

    SELECT FND_PROFILE.VALUE('ORG_ID')
    INTO l_operating_unit_id
    FROM dual;
Line: 3652

      SELECT QP_XML_MESSAGES_S.NEXTVAL INTO l_syncctlg_seq FROM dual;
Line: 3658

      SELECT SYSDATE INTO l_date FROM dual;
Line: 3892

PROCEDURE CATSO_SELECTOR
( p_itemtype   in     varchar2,
  p_itemkey    in     varchar2,
  p_actid      in     number,
  p_funcmode   in     varchar2,
  p_x_result   in out NOCOPY /* file.sql.39 change */ varchar2
)
IS
  l_user_id             NUMBER;
Line: 3917

      QP_PREQ_GRP.engine_debug(  'ENTERING CATSO_SELECTOR PROCEDURE' ) ;
Line: 3982

        SELECT application_short_name
        INTO   l_application_code
        FROM   fnd_application
        WHERE  application_id = fnd_global.resp_appl_id; --Responsibility of user
Line: 4004

   WF_CORE.Context('QP_PRICE_BOOK_UTIL', 'CATSO_SELECTOR',
                    p_itemtype, p_itemkey, p_actid, p_funcmode);
Line: 4008

END CATSO_SELECTOR;
Line: 4027

  SELECT user_id
  INTO l_user_id
  FROM fnd_user
  WHERE user_name = upper(p_user_name);
Line: 4045

  SELECT a.application_id
  INTO   l_pricing_perspective_appl_id
  FROM   fnd_application a
  WHERE  a.application_short_name = l_pricing_perspective_code;
Line: 4063

  SELECT a.application_id, a.application_short_name
  INTO   l_resp_appl_id, l_resp_appl_name
  FROM   fnd_responsibility r, fnd_application a
  WHERE  r.responsibility_id = l_resp_id
  AND    a.application_id = r.application_id;
Line: 4085

PROCEDURE CATGI_UPDATE_PUBLISH_OPTIONS
(
  p_price_book_name     IN VARCHAR2,
  p_customer_attr_value IN NUMBER,
  p_effective_date      IN DATE,
  p_price_book_type_code IN VARCHAR2,
  p_dlv_xml_site_id     IN NUMBER,
  p_generation_time_code IN VARCHAR2,
  p_gen_schedule_date   IN DATE,
  x_pb_input_header_id  OUT NOCOPY NUMBER,
  x_return_status       OUT NOCOPY VARCHAR2,
  x_return_text         IN OUT NOCOPY VARCHAR2
)
IS
  l_pb_input_header_id NUMBER;
Line: 4102

  SELECT pb_input_header_id
  INTO l_pb_input_header_id
  FROM qp_pb_input_headers_vl
  WHERE price_book_name = p_price_book_name
  AND   customer_attr_value = p_customer_attr_value
  --AND   effective_date = p_effective_date
  AND   price_book_type_code = p_price_book_type_code;
Line: 4110

  UPDATE QP_PB_INPUT_HEADERS_B
  SET PUB_TEMPLATE_CODE = NULL,
      PUB_LANGUAGE = NULL,
      PUB_TERRITORY = NULL,
      PUB_OUTPUT_DOCUMENT_TYPE = NULL,
      DLV_XML_FLAG = 'Y',
      DLV_XML_SITE_ID = p_dlv_xml_site_id,
      DLV_EMAIL_FLAG = 'N',
      DLV_EMAIL_ADDRESSES = NULL,
      DLV_PRINTER_FLAG = 'N',
      DLV_PRINTER_NAME = NULL,
      PUBLISH_EXISTING_PB_FLAG = 'Y',
      GENERATION_TIME_CODE = p_generation_time_code,
      GEN_SCHEDULE_DATE = p_gen_schedule_date,
      REQUEST_ORIGINATION_CODE = 'XML',
      LAST_UPDATE_DATE = SYSDATE,
      LAST_UPDATED_BY = FND_GLOBAL.USER_ID
  WHERE pb_input_header_id = l_pb_input_header_id;
Line: 4137

END CATGI_UPDATE_PUBLISH_OPTIONS;
Line: 4139

PROCEDURE CATGI_POST_INSERT_PROCESSING
(
  p_pb_input_header_id  IN NUMBER,
  x_return_status       OUT NOCOPY VARCHAR2,
  x_return_text         IN OUT NOCOPY VARCHAR2
)
IS
  l_pb_input_header_id NUMBER;
Line: 4163

    SELECT *
    INTO   l_pb_input_header_rec
    FROM   qp_pb_input_headers_vl
    WHERE  pb_input_header_id = p_pb_input_header_id;
Line: 4170

      x_return_text := 'CATGI_POST_INSERT_PROCESSING: pb not found - ' || SQLERRM;
Line: 4177

      UPDATE QP_PB_INPUT_HEADERS_B
      SET CUST_ACCOUNT_ID = l_cust_account_id
      WHERE pb_input_header_id = p_pb_input_header_id;
Line: 4186

      SELECT *
      INTO   l_full_pb_input_header_rec
      FROM   qp_pb_input_headers_vl
      WHERE  price_book_name = l_pb_input_header_rec.price_book_name
      AND    customer_attr_value = l_pb_input_header_rec.customer_attr_value
      AND    customer_context = l_pb_input_header_rec.customer_context
      AND    customer_attribute = l_pb_input_header_rec.customer_attribute
      AND    price_book_type_code = 'F';
Line: 4202

    UPDATE qp_pb_input_headers_b
    SET    customer_context     = l_full_pb_input_header_rec.customer_context,
           customer_attribute   = l_full_pb_input_header_rec.customer_attribute,
           customer_attr_value  = l_full_pb_input_header_rec.customer_attr_value,
           cust_account_id      = l_full_pb_input_header_rec.cust_account_id,
           currency_code        = l_full_pb_input_header_rec.currency_code,
           limit_products_by    = l_full_pb_input_header_rec.limit_products_by,
           product_context      = l_full_pb_input_header_rec.product_context,
           product_attribute    = l_full_pb_input_header_rec.product_attribute,
           product_attr_value   = l_full_pb_input_header_rec.product_attr_value,
           item_quantity        = l_full_pb_input_header_rec.item_quantity,
           org_id               = l_full_pb_input_header_rec.org_id,
           price_based_on       = l_full_pb_input_header_rec.price_based_on,
           pl_agr_bsa_id        = l_full_pb_input_header_rec.pl_agr_bsa_id,
           pricing_perspective_code = l_full_pb_input_header_rec.pricing_perspective_code,
           request_type_code    = l_full_pb_input_header_rec.request_type_code
    WHERE  pb_input_header_id = p_pb_input_header_id;
Line: 4220

    UPDATE qp_pb_input_headers_tl
    SET    pl_agr_bsa_name      = l_full_pb_input_header_rec.pl_agr_bsa_name
    WHERE  pb_input_header_id = p_pb_input_header_id;
Line: 4226

      SELECT context, attribute, attribute_value, attribute_type
      BULK COLLECT INTO l_context_tbl, l_attribute_tbl,
      l_attribute_value_tbl, l_attribute_type_tbl
      FROM   qp_pb_input_lines
      WHERE  pb_input_header_id = l_full_pb_input_header_rec.pb_input_header_id;
Line: 4243

          INSERT INTO qp_pb_input_lines
          (pb_input_line_id, pb_input_header_id,
           context, attribute, attribute_value,
           attribute_type, creation_date, created_by, last_update_date,
           last_updated_by, last_update_login
          )
          VALUES
          (qp_pb_input_lines_s.nextval,
           p_pb_input_header_id,
           l_context_tbl(k), l_attribute_tbl(k),
           l_attribute_value_tbl(k), l_attribute_type_tbl(k),
           l_sysdate, l_user_id, l_sysdate, l_user_id, l_login_id
          );
Line: 4259

          x_return_text := 'CATGI_POST_INSERT_PROCESSING: error while inserting lines - ' || SQLERRM;
Line: 4275

    x_return_text := 'CATGI_POST_INSERT_PROCESSING: general error - ' || SQLERRM;
Line: 4276

END CATGI_POST_INSERT_PROCESSING;
Line: 4278

PROCEDURE CATGI_UPDATE_CUST_ACCOUNT_ID
(
  p_pb_input_header_id  IN NUMBER,
  p_cust_account_id     IN NUMBER,
  x_return_status       OUT NOCOPY VARCHAR2,
  x_return_text         IN OUT NOCOPY VARCHAR2
)
IS
BEGIN
  UPDATE QP_PB_INPUT_HEADERS_B
  SET CUST_ACCOUNT_ID = p_cust_account_id
  WHERE pb_input_header_id = p_pb_input_header_id;
Line: 4298

    x_return_text := 'CATGI_UPDATE_MISC: general error - ' || SQLERRM;
Line: 4299

END CATGI_UPDATE_CUST_ACCOUNT_ID;
Line: 4307

  select   pte_code
  into     l_pte_code
  from     qp_pte_request_types_b
  where    request_type_code = p_request_type_code;