DBA Data[Home] [Help]

APPS.OKS_AUTH_UTIL_PVT SQL Statements

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

Line: 12

    g_clvl_selections_tbl  clvl_selections_tbl;
Line: 22

        SELECT unit_selling_price
        FROM   oe_order_lines_all
        WHERE  line_id = p_order_line_id;
Line: 45

        SELECT name, description
        FROM   OKX_SYSTEM_ITEMS_V
        WHERE  id1 = p_inv_id
        AND  TRUNC(SYSDATE) BETWEEN trunc(nvl(start_date_active, SYSDATE)) AND trunc(nvl(end_date_active, SYSDATE)) ;
Line: 72

        SELECT id1, name
        FROM okx_parties_v
        WHERE id1 = p_party_id;
Line: 78

        SELECT P.id1, P.name
        FROM   OKX_PARTIES_V P,
               OKX_CUSTOMER_ACCOUNTS_V CA1
        WHERE  P.id1 = CA1.party_id
        AND    CA1.id1  IN(SELECT  A.related_cust_account_id
                           FROM   OKX_CUST_ACCT_RELATE_ALL_V A,
                           OKX_CUSTOMER_ACCOUNTS_V  B
                           WHERE  B.ID1 = A.CUST_ACCOUNT_ID
                           AND    B.party_id = p_party_id
                           AND    B.status = 'A'
                           AND    A.status = 'A'
                           AND    A.org_id = p_org_id)
        AND CA1.status = 'A';
Line: 94

        SELECT id1, name
        FROM   okx_parties_v
        WHERE  id1 = p_party_id
        UNION
        SELECT P.id1, p.name
        FROM   OKX_PARTIES_V P,
               OKX_CUSTOMER_ACCOUNTS_V CA1
        WHERE  P.id1 = CA1.party_id
        AND    CA1.id1  IN(SELECT  A.related_cust_account_id
                           FROM   OKX_CUST_ACCT_RELATE_ALL_V A,
                           OKX_CUSTOMER_ACCOUNTS_V  B
                           WHERE  B.ID1 = A.CUST_ACCOUNT_ID
                           AND    B.party_id = p_party_id
                           AND    B.status = 'A'
                           AND    A.status = 'A'
                           AND    A.org_id = p_org_id)
        AND CA1.status = 'A';
Line: 178

        SELECT CA1.Id1, CA1.name
        FROM   OKX_CUSTOMER_ACCOUNTS_V CA1
        WHERE  CA1.party_id = p_party_id
        AND    CA1.status = 'A'
        ORDER BY ca1.name ;
Line: 187

        SELECT CA2.id1, CA2.name
        FROM   OKX_CUSTOMER_ACCOUNTS_V CA2
        WHERE  CA2.id1 IN(SELECT A.RELATED_CUST_ACCOUNT_ID
                          FROM   OKX_CUST_ACCT_RELATE_ALL_V A,
                          OKX_CUSTOMER_ACCOUNTS_V  B
                          WHERE  B.ID1 = A.CUST_ACCOUNT_ID
                          AND    B.party_id = p_party_id
                          AND    B.status = 'A'
                          AND    A.status = 'A'
                          AND    A.org_id = p_org_id)
        AND CA2.status = 'A'
        ORDER BY ca2.name ;
Line: 202

        SELECT CA1.Id1, CA1.name
        FROM   OKX_CUSTOMER_ACCOUNTS_V CA1
        WHERE  CA1.party_id = p_party_id
        AND    CA1.status = 'A'
        UNION
        SELECT CA2.id1, CA2.name
        FROM   OKX_CUSTOMER_ACCOUNTS_V CA2
        WHERE  CA2.id1 IN(SELECT A.RELATED_CUST_ACCOUNT_ID
                          FROM   OKX_CUST_ACCT_RELATE_ALL_V A,
                          OKX_CUSTOMER_ACCOUNTS_V  B
                          WHERE  B.ID1 = A.CUST_ACCOUNT_ID
                          AND    B.party_id = p_party_id
                          AND    B.status = 'A'
                          AND    A.status = 'A'
                          AND    A.org_id = p_org_id)
       AND CA2.status = 'A'
       ORDER BY 2 ;
Line: 286

    /* Select Products for a single customer or for all  customers belonging to a Party */
    -- This cursor is not used --
    CURSOR l_csr_party_products(p_party_id IN NUMBER,
                                p_organization_id IN NUMBER)
        IS
        SELECT CII.instance_id id1,
               CII.install_location_id,
               CII.quantity,
               CII.instance_number,
               CII.unit_of_measure,
                    0,
               CII.inventory_item_id,
               CII.serial_number,
               '#' id2,
               CII.last_oe_order_line_id
            FROM   CSI_ITEM_INSTANCES CII,
               CSI_INSTANCE_STATUSES CIS
        WHERE  CII.owner_party_account_id IN
                             (SELECT id1 FROM okx_customer_accounts_v
                              WHERE  party_id = p_party_id)
        AND  CII.Instance_status_id = CIS.instance_status_id
        AND    CIS.service_order_allowed_flag = 'Y';
Line: 332

        get_prod_sql := ' SELECT CII.instance_id id1    '
        ||', CII.install_location_id install_location_id '
        ||', CII.quantity quantity '
        ||', CII.instance_number instance_number '
        ||', CII.unit_of_measure unit_of_measure '
        ||', 0  '
        ||', CII.inventory_item_id   inventory_item_id'
        ||', CII.serial_number serial_number '
        ||', ''#'' id2 '
        ||', CII.last_oe_order_line_id '
        ||', CII.external_reference ' -- new bug 4372877
        ||'  FROM   CSI_ITEM_INSTANCES CII, CSI_INSTANCE_STATUSES  CIS '
        ||'  WHERE   '
        ||'  CIS.instance_status_id = CII.instance_status_id '
        ||'  AND    CIS.service_order_allowed_flag = ''Y''' ;
Line: 353

        get_prod_sql_cust := ' SELECT CII.instance_id id1    '
        ||', CII.install_location_id install_location_id '
        ||', CII.quantity quantity '
        ||', CII.instance_number instance_number '
        ||', CII.unit_of_measure unit_of_measure '
        ||', 0  unit_selling_price '
        ||', CII.inventory_item_id   inventory_item_id'
        ||', CII.serial_number serial_number '
        ||', ''#'' id2 '
        ||', CII.last_oe_order_line_id '
        ||', CII.external_reference ' -- new bug 4372877
        ||'  FROM   CSI_ITEM_INSTANCES CII, CSI_INSTANCE_STATUSES  CIS , MTL_SYSTEM_ITEMS_KFV IT'
        ||'  WHERE IT.inventory_item_id = CII.inventory_item_id '
        ||'  AND  IT.serviceable_product_flag = ''Y'''
        ||'  AND  IT.organization_id = :p_organization_id '
        ||'  AND  CIS.instance_status_id = CII.instance_status_id '
        ||'  AND  CIS.service_order_allowed_flag = ''Y'''
        ||'  AND    CII.owner_party_account_id in (select id1 '
        ||' from okx_customer_accounts_v '
        ||' where party_id =  :l_party_id ) ';
Line: 377

        get_prod_sql_rel := ' SELECT CII.instance_id id1    '
        ||', CII.install_location_id install_location_id '
        ||', CII.quantity quantity '
        ||', CII.instance_number instance_number '
        ||', CII.unit_of_measure unit_of_measure '
        ||', 0  unit_selling_price '
        ||', CII.inventory_item_id   inventory_item_id'
        ||', CII.serial_number serial_number '
        ||', ''#'' id2 '
        ||', last_oe_order_line_id '
        ||', CII.external_reference ' -- new bug 4372877
        ||'  FROM   CSI_ITEM_INSTANCES CII, CSI_INSTANCE_STATUSES  CIS , MTL_SYSTEM_ITEMS_KFV IT'
        ||'  WHERE IT.inventory_item_id = CII.inventory_item_id '
        ||'  AND  IT.serviceable_product_flag = ''Y'''
        ||'  AND  IT.organization_id = :p_organization_id '
        ||'  AND  '
        ||'     CIS.instance_status_id = CII.instance_status_id '
        ||'  AND  CIS.service_order_allowed_flag = ''Y'''
        ||'  AND    CII.owner_party_account_id in  '
        ||'  (select A.RELATED_CUST_ACCOUNT_ID '
        ||'   FROM   OKX_CUST_ACCT_RELATE_ALL_V A, '
        ||'          OKX_CUSTOMER_ACCOUNTS_V  B '
        ||'   WHERE  B.ID1 = A.CUST_ACCOUNT_ID '
        ||'   AND    B.party_id =   :l_party_id '
        ||'   AND    B.status = ''A'''
        ||'   AND    A.status = ''A'''
        ||'   AND    A.org_id =  :l_org_id '
        ||'  ) '                        ;
Line: 408

        get_prod_sql_both := ' SELECT CII.instance_id id1    '
        ||', CII.install_location_id install_location_id '
        ||', CII.quantity quantity '
        ||', CII.instance_number instance_number '
        ||', CII.unit_of_measure unit_of_measure '
        ||',0  unit_selling_price '
        ||', CII.inventory_item_id   inventory_item_id'
        ||', CII.serial_number serial_number '
        ||', ''#'' id2 '
        ||', last_oe_order_line_id '
        ||', CII.external_reference ' -- new bug 4372877
        ||'  FROM   CSI_ITEM_INSTANCES CII, CSI_INSTANCE_STATUSES  CIS , MTL_SYSTEM_ITEMS_KFV IT'
        ||'  WHERE IT.inventory_item_id = CII.inventory_item_id '
        ||'  AND  IT.serviceable_product_flag = ''Y'''
        ||'  AND  IT.organization_id = :p_organization_id '
        ||'  AND   '
        ||'     CIS.instance_status_id = CII.instance_status_id '
        ||'  AND  CIS.service_order_allowed_flag = ''Y'''
        ||'  AND    CII.owner_party_account_id in (select id1 '
        ||' from okx_customer_accounts_v '
        ||' where party_id = to_char(:l_party_id) '
        ||' UNION '
        ||'  select A.RELATED_CUST_ACCOUNT_ID '
        ||'   FROM   OKX_CUST_ACCT_RELATE_ALL_V A, '
        ||'          OKX_CUSTOMER_ACCOUNTS_V  B '
        ||'   WHERE  B.ID1 = A.CUST_ACCOUNT_ID '

        ||'   AND    B.party_id = :l_party_id'
        ||'   AND    B.status = ''A'''
        ||'   AND    A.status = ''A'''
        ||'   AND    A.org_id =  :l_org_id '
        ||'  ) ';
Line: 442

        get_prod_sql_all := ' SELECT CII.instance_id id1    '
        ||', CII.install_location_id install_location_id '
        ||', CII.quantity quantity '
        ||', CII.instance_number instance_number '
        ||', CII.unit_of_measure unit_of_measure '
        ||', 0  unit_selling_price '
        ||', CII.inventory_item_id   inventory_item_id'
        ||', CII.serial_number serial_number '
        ||', ''#'' id2 '
        ||', CII.last_oe_order_line_id '
        ||', CII.external_reference ' -- new bug 4372877
        ||'  FROM   CSI_ITEM_INSTANCES CII, CSI_INSTANCE_STATUSES  CIS ,  MTL_SYSTEM_ITEMS_KFV IT'
        ||'  WHERE IT.inventory_item_id = CII.inventory_item_id '
        ||'  AND  IT.serviceable_product_flag = ''Y'''
        ||'  AND  IT.organization_id = :p_organization_id '
        ||'  AND   '
        ||'         CIS.instance_status_id = CII.instance_status_id '
        ||'  AND  CIS.service_order_allowed_flag = ''Y''';
Line: 665

        SELECT S.DESCRIPTION
        FROM   OKX_PARTY_SITES_V S
        WHERE  S.ID1 = p_install_location_id;
Line: 670

             SELECT
  SUBSTR(replace(arp_addr_label_pkg.format_address
  (NULL,HZ.ADDRESS1,HZ.ADDRESS2,HZ.ADDRESS3,HZ.ADDRESS4,HZ.CITY,HZ.COUNTY,HZ.STATE,HZ.PROVINCE,HZ.POSTAL_CODE,NULL,HZ.COUNTRY,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'N','N',80,1,1),fnd_global.local_chr(10)),1,80)
             FROM HZ_LOCATIONS HZ
             WHERE HZ.LOCATION_ID=p_install_location_id;
Line: 678

            SELECT
   SUBSTR(replace(arp_addr_label_pkg.format_address
   (NULL,vs.address_line1,vs.address_line2,vs.address_line3,vs.address_line4,vs.city,VS.COUNTY,vs.state,VS.PROVINCE, vs.zip,NULL,VS.COUNTRY,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'N','N',80,1,1),fnd_global.local_chr(10)),1,80)
            FROM PO_VENDOR_SITES_ALL vs
            WHERE vs.VENDOR_SITE_ID  =p_install_location_id;
Line: 686

            SELECT
     SUBSTR(replace(arp_addr_label_pkg.format_address
     (NULL,hr.address_line_1,hr.address_line_2,hr.address_line_3,null,hr.town_or_city,null,hr.region_2,null,hr.postal_code,NULL,hr.COUNTRY,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'N','N',80,1,1),fnd_global.local_chr(10)),1,80)
            FROM hr_locations hr
            WHERE hr.LOCATION_ID =p_install_location_id;
Line: 694

          SELECT INSTALL_LOCATION_TYPE_CODE INTO l_install_loc_type FROM csi_item_instances WHERE instance_id=p_instance_id;
Line: 744

                             x_prod_selections_tbl  IN OUT NOCOPY  prod_selections_tbl )
    IS
    l_price              NUMBER;
Line: 760

        SELECT S.DESCRIPTION
        FROM   OKX_PARTY_SITES_V S
        WHERE  S.ID1 = l_install_site_id;
Line: 766

        SELECT unit_of_measure_tl
        FROM OKX_UNITS_OF_MEASURE_V
        WHERE uom_code = p_uom_code ;
Line: 780

            x_prod_selections_tbl(rowcount).rec_type := 'C';
Line: 781

            x_prod_selections_tbl(rowcount).rec_name := p_filter;
Line: 782

            x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 783

            x_prod_selections_tbl(rowcount).cp_id := p_prod_tbl(j).id1;
Line: 786

                x_prod_selections_tbl(rowcount).config_parent_id := p_prod_tbl(j).config_parent_id;
Line: 787

                x_prod_selections_tbl(rowcount).model_level := p_prod_tbl(j).model_level;
Line: 791

            x_prod_selections_tbl(rowcount).cp_id2 := p_prod_tbl(j).id2;
Line: 792

            x_prod_selections_tbl(rowcount).ser_number := p_prod_tbl(j).serial_number ;
Line: 793

            x_prod_selections_tbl(rowcount).ref_number := p_prod_tbl(j).instance_number ;
Line: 794

            x_prod_selections_tbl(rowcount).quantity := p_prod_tbl(j).quantity;
Line: 795

            x_prod_selections_tbl(rowcount).orig_net_amt := p_prod_tbl(j).unit_selling_price;
Line: 799

            x_prod_selections_tbl(rowcount).ext_reference := p_prod_tbl(j).external_reference;
Line: 813

            x_prod_selections_tbl(rowcount).price := l_price;
Line: 814

            x_prod_selections_tbl(rowcount).inventory_item_id := p_prod_tbl(j).inventory_item_id;
Line: 815

            x_prod_selections_tbl(rowcount).site_id := p_prod_tbl(j).install_location_id;
Line: 816

            x_prod_selections_tbl(rowcount).uom_code := p_prod_tbl(j).unit_of_measure;
Line: 828

            x_prod_selections_tbl(rowcount).orig_net_amt := get_selling_price(p_prod_tbl(j).oe_line_id);
Line: 841

                x_prod_selections_tbl(rowcount).name := l_gen_name;
Line: 842

                x_prod_selections_tbl(rowcount).description := l_gen_desc;
Line: 845

                x_prod_selections_tbl(rowcount).name := l_gen_desc;
Line: 846

                x_prod_selections_tbl(rowcount).description := l_gen_name;
Line: 849

            x_prod_selections_tbl(rowcount).site_name := l_install_site_name;
Line: 858

                  l_display_name := x_prod_selections_tbl(rowcount).name||'; '||g_serial_number ||
Line: 866

            x_prod_selections_tbl(rowcount).display_name := l_display_name;
Line: 885

                        x_prod_selections_tbl IN OUT NOCOPY OKS_AUTH_UTIL_PVT.prod_selections_tbl)

    IS
    /* Cursor to select all Model  having Covered Products for a given Party ID */
    CURSOR l_csr_all_models(p_party_id IN NUMBER,
                            p_organization_id IN NUMBER)
        IS
        SELECT DISTINCT id1,
               name,
               description
        FROM okx_system_items_v it
        WHERE id1 IN
        (SELECT  inventory_item_id FROM
         csi_item_instances
         WHERE instance_id IN (SELECT PR.object_id
                               FROM csi_ii_relationships PR
                               WHERE relationship_type_code = 'COMPONENT-OF'
                               AND NOT EXISTS (SELECT cp.subject_id FROM csi_ii_relationships cp
                                               WHERE pr.object_id = cp.subject_id )))
        AND IT.serviceable_product_flag = 'Y'
        --And IT.organization_id = p_organization_id
        AND SYSDATE BETWEEN nvl(it.start_date_active, SYSDATE) AND nvl(it.end_date_active, SYSDATE)  ;
Line: 914

        SELECT ciir.object_id  config_parent_id,
               ciir.subject_id cp_id,
               LEVEL
        FROM   csi_ii_relationships ciir
        WHERE active_end_date IS NULL
        START WITH subject_id
                      IN (SELECT ciir_pr.subject_id
                          FROM   csi_ii_relationships ciir_pr
                          WHERE  object_id  IN
                          (SELECT instance_id
                           FROM   csi_item_instances
                           WHERE  inventory_item_id = p_inventory_id
                           AND    owner_party_account_id IN (SELECT id1
                                                             FROM okx_customer_accounts_v
                                                             WHERE party_id = p_party_id)))
        CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ;
Line: 931

    /** Cursor to get product + system item details for select instance id ***/


    CURSOR l_csr_model_products(p_instance_id IN NUMBER,
                                p_organization_id       IN NUMBER
                                )
        IS
        SELECT CII.instance_id
              , IT.name
              , IT.description
              , CII.install_location_id
              , CII.quantity
              , CII.instance_number
              , CII.unit_of_measure
              , CII.inventory_item_id
              , CII.serial_number
              , OOL.unit_selling_price
              , '#' id2
              , CII.external_reference -- bug 4372877
        FROM  CSI_ITEM_INSTANCES CII
           , CSI_INSTANCE_STATUSES CIS
           , OE_ORDER_LINES_ALL OOL
           , OKX_SYSTEM_ITEMS_V IT
        WHERE CII.INSTANCE_ID = p_instance_id
        AND   CII.inventory_item_id = IT.id1
        AND   IT.serviceable_product_flag = 'Y'
        AND   IT.organization_id = p_organization_id
        AND   SYSDATE BETWEEN nvl(it.start_date_active, SYSDATE) AND nvl(it.end_date_active, SYSDATE)
        AND   CII.last_oe_order_line_id = OOL.line_id ( + )
        AND   CII.instance_status_id = CIS.instance_status_id
        AND   CIS.service_order_allowed_flag = 'Y'   ;
Line: 990

        l_config_cust := 'SELECT ciir.object_id  config_parent_id,'
        ||'ciir.subject_id cp_id,'
        ||'level '
        ||' FROM   csi_ii_relationships ciir '
        ||' WHERE active_end_date IS NULL '
        ||' START WITH subject_id '
        ||' IN (SELECT ciir_pr.subject_id '
        ||' FROM   csi_ii_relationships ciir_pr '
        ||' WHERE  object_id  IN '
        ||' ( SELECT instance_id '
        ||' FROM   csi_item_instances '
        ||' WHERE  inventory_item_id = to_char(:l_id)'
        ||' AND    owner_party_account_id in (select id1 '
        ||' from okx_customer_accounts_v '
        ||' where party_id =  to_char(:p_party_id) ))) '
        ||'CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ' ;
Line: 1008

        l_config_rel := 'SELECT ciir.object_id  config_parent_id,'
        ||'ciir.subject_id cp_id,'
        ||'level '
        ||' FROM   csi_ii_relationships ciir '
        ||' WHERE active_end_date IS NULL '
        ||' START WITH subject_id '
        ||' IN (SELECT ciir_pr.subject_id '
        ||' FROM   csi_ii_relationships ciir_pr '
        ||' WHERE  object_id  IN '
        ||' ( SELECT instance_id '
        ||' FROM   csi_item_instances '
        ||' WHERE  inventory_item_id =  to_char(:l_id ) '
        ||' AND    owner_party_account_id in  '
        ||'  (select A.RELATED_CUST_ACCOUNT_ID '
        ||'   FROM   OKX_CUST_ACCT_RELATE_ALL_V A, '
        ||'          OKX_CUSTOMER_ACCOUNTS_V  B '
        ||'   WHERE  B.ID1 = A.CUST_ACCOUNT_ID '
        ||'   AND    B.party_id =   to_char(:p_party_id) '
        ||'   AND    B.status = ''A'''
        ||'   AND    A.status = ''A'''
        ||'   AND    A.org_id =  to_char(:p_org_id) '
        ||'  ))) '
        ||'CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ' ;
Line: 1032

        l_config_both := 'SELECT ciir.object_id  config_parent_id,'
        ||'ciir.subject_id cp_id,'
        ||'level '
        ||' FROM   csi_ii_relationships ciir '
        ||' WHERE active_end_date IS NULL '
        ||' START WITH subject_id '
        ||' IN (SELECT ciir_pr.subject_id '
        ||' FROM   csi_ii_relationships ciir_pr '
        ||' WHERE  object_id  IN '
        ||' ( SELECT instance_id '
        ||' FROM   csi_item_instances '
        ||' WHERE  inventory_item_id =  to_char(:l_id)'
        ||' AND    owner_party_account_id in (select id1 '
        ||' from okx_customer_accounts_v '
        ||' where party_id = to_char(:p_party_id)) '
        ||' UNION '
        ||'  (select A.RELATED_CUST_ACCOUNT_ID '
        ||'   FROM   OKX_CUST_ACCT_RELATE_ALL_V A, '
        ||'          OKX_CUSTOMER_ACCOUNTS_V  B '
        ||'   WHERE  B.ID1 = A.CUST_ACCOUNT_ID '
        ||'   AND    B.party_id = to_char(:p_party_id)'
        ||'   AND    B.status = ''A'''
        ||'   AND    A.status = ''A'''
        ||'   AND    A.org_id =  to_Char(:p_org_id) '
        ||'  ))) '
        ||'CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ' ;
Line: 1059

        l_config_all := 'SELECT ciir.object_id  config_parent_id,'
        ||'ciir.subject_id cp_id,'
        ||'level '
        ||' FROM   csi_ii_relationships ciir '
        ||' WHERE active_end_date IS NULL '
        ||' START WITH subject_id '
        ||' IN (SELECT ciir_pr.subject_id '
        ||' FROM   csi_ii_relationships ciir_pr '
        ||' WHERE  object_id  IN '
        ||' ( SELECT instance_id '
        ||' FROM   csi_item_instances '
        ||' WHERE  inventory_item_id = to_char(:l_id))) '
        ||'CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ' ;
Line: 1076

            /* Select all Items for given party first */

            FOR l_get_all_models_rec IN l_csr_all_models(p_party_id, p_organization_id)
                LOOP /** 1st loop **/

                l_id := l_get_all_models_rec.id1;
Line: 1108

                                            x_prod_selections_tbl);
Line: 1110

                            l_prod_tbl.DELETE;
Line: 1116

                            /* select product details for config parent */
                            /** Build parent **/
                            OPEN l_csr_model_products(l_config_rec.config_parent_id,
                                                      p_organization_id);
Line: 1125

                                    x_prod_selections_tbl(rowcount).cp_id := l_model_prod_rec.instance_id;
Line: 1126

                                    x_prod_selections_tbl(rowcount).config_parent_id := '';
Line: 1127

                                    x_prod_selections_tbl(rowcount).name := l_model_prod_rec.name;
Line: 1129

                                    x_prod_selections_tbl(rowcount).description := l_model_prod_rec.description;
Line: 1134

                                        x_prod_selections_tbl(rowcount).description := l_model_prod_rec.name;
Line: 1135

                                        x_prod_selections_tbl(rowcount).name := l_model_prod_rec.description;
Line: 1139

                                    x_prod_selections_tbl(rowcount).name := l_name;
Line: 1140

                                    x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 1141

                                    x_prod_selections_tbl(rowcount).rec_name := 'Model';
Line: 1142

                                    x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 1143

                                    x_prod_selections_tbl(rowcount).model_level := l_config_rec.LEVEL;
Line: 1144

                                    x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 1145

                                    x_prod_selections_tbl(rowcount).ser_number := '';
Line: 1146

                                    x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 1147

                                    x_prod_selections_tbl(rowcount).quantity := '';
Line: 1148

                                    x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 1149

                                    x_prod_selections_tbl(rowcount).price := '';
Line: 1150

                                    x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 1151

                                    x_prod_selections_tbl(rowcount).site_id := '';
Line: 1152

                                    x_prod_selections_tbl(rowcount).uom_code := '';
Line: 1153

                                    x_prod_selections_tbl(rowcount).display_name := '';
Line: 1154

                                    x_prod_selections_tbl(rowcount).site_name := '';
Line: 1155

                                    x_prod_selections_tbl(rowcount).model_level :=  - 1;
Line: 1159

                                    x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 1258

                                        x_prod_selections_tbl);
Line: 1260

                        l_prod_tbl.DELETE;
Line: 1266

                        /* select product details for config parent */
                        /** Build parent **/
                        OPEN l_csr_model_products(l_config_rec.config_parent_id,
                                                  p_organization_id);
Line: 1275

                                x_prod_selections_tbl(rowcount).cp_id := l_model_prod_rec.instance_id;
Line: 1276

                                x_prod_selections_tbl(rowcount).config_parent_id := '';
Line: 1277

                                x_prod_selections_tbl(rowcount).name := l_model_prod_rec.name;
Line: 1279

                                x_prod_selections_tbl(rowcount).description := l_model_prod_rec.description;
Line: 1284

                                    x_prod_selections_tbl(rowcount).description := l_model_prod_rec.name;
Line: 1285

                                    x_prod_selections_tbl(rowcount).name := l_model_prod_rec.description;
Line: 1289

                                x_prod_selections_tbl(rowcount).name := l_name;
Line: 1290

                                x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 1291

                                x_prod_selections_tbl(rowcount).rec_name := 'Model';
Line: 1292

                                x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 1293

                                x_prod_selections_tbl(rowcount).model_level := l_config_rec.LEVEL;
Line: 1294

                                x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 1295

                                x_prod_selections_tbl(rowcount).ser_number := '';
Line: 1296

                                x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 1297

                                x_prod_selections_tbl(rowcount).quantity := '';
Line: 1298

                                x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 1299

                                x_prod_selections_tbl(rowcount).price := '';
Line: 1300

                                x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 1301

                                x_prod_selections_tbl(rowcount).site_id := '';
Line: 1302

                                x_prod_selections_tbl(rowcount).uom_code := '';
Line: 1303

                                x_prod_selections_tbl(rowcount).display_name := '';
Line: 1304

                                x_prod_selections_tbl(rowcount).site_name := '';
Line: 1305

                                x_prod_selections_tbl(rowcount).model_level :=  - 1;
Line: 1309

                                x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 1390

                                    x_prod_selections_tbl IN OUT NOCOPY OKS_AUTH_UTIL_PVT.prod_selections_tbl)

      IS
       /* Cursor to select all Model  having Covered Products for a given Party ID */
       CURSOR l_csr_all_models(p_party_id IN NUMBER, p_organization_id IN NUMBER) IS
         SELECT DISTINCT id1, name, description
           FROM okx_system_items_v it
          WHERE id1 IN
                (SELECT inventory_item_id
                   FROM csi_item_instances
                  WHERE instance_id IN
                        (SELECT PR.object_id
                           FROM csi_ii_relationships PR
                          WHERE relationship_type_code = 'COMPONENT-OF'
                            AND NOT EXISTS
                          (SELECT cp.subject_id
                                   FROM csi_ii_relationships cp
                                  WHERE pr.object_id = cp.subject_id)))
            AND IT.serviceable_product_flag = 'Y'
               --And IT.organization_id = p_organization_id
            AND SYSDATE BETWEEN nvl(it.start_date_active, SYSDATE) AND
                nvl(it.end_date_active, SYSDATE);
Line: 1415

         SELECT ciir.object_id config_parent_id, ciir.subject_id cp_id, LEVEL
           FROM csi_ii_relationships ciir
          WHERE active_end_date IS NULL
          START WITH subject_id IN
                     (SELECT ciir_pr.subject_id
                        FROM csi_ii_relationships ciir_pr
                       WHERE object_id IN
                             (SELECT instance_id
                                FROM csi_item_instances
                               WHERE inventory_item_id = p_inventory_id
                                 AND owner_party_account_id IN
                                     (SELECT id1
                                        FROM okx_customer_accounts_v
                                       WHERE party_id = p_party_id)))
         CONNECT BY ciir.object_id = PRIOR ciir.subject_id;
Line: 1431

       /** Cursor to get product + system item details for select instance id ***/

       CURSOR l_csr_model_products(p_instance_id IN NUMBER, p_organization_id IN NUMBER) IS
         SELECT CII.instance_id,
                IT.name,
                IT.description,
                CII.install_location_id,
                CII.quantity,
                CII.instance_number,
                CII.unit_of_measure,
                CII.inventory_item_id,
                CII.serial_number,
                OOL.unit_selling_price,
                '#' id2,
                CII.external_reference -- bug 4372877
           FROM CSI_ITEM_INSTANCES    CII,
                CSI_INSTANCE_STATUSES CIS,
                OE_ORDER_LINES_ALL    OOL,
                OKX_SYSTEM_ITEMS_V    IT
          WHERE CII.INSTANCE_ID = p_instance_id
            AND CII.inventory_item_id = IT.id1
            AND IT.serviceable_product_flag = 'Y'
            AND IT.organization_id = p_organization_id
            AND SYSDATE BETWEEN nvl(it.start_date_active, SYSDATE) AND
                nvl(it.end_date_active, SYSDATE)
            AND CII.last_oe_order_line_id = OOL.line_id(+)
            AND CII.instance_status_id = CIS.instance_status_id
            AND CIS.service_order_allowed_flag = 'Y';
Line: 1488

         SELECT a.customer_product_id
           FROM oks_ib_config_v a
          WHERE a.config_parent_id IS NULL
          START WITH a.customer_product_id = p_customer_prod_id
         CONNECT BY PRIOR a.config_parent_id = a.customer_product_id;
Line: 1500

        SELECT S.DESCRIPTION
        FROM   OKX_PARTY_SITES_V S
        WHERE  S.ID1 = l_install_site_id;
Line: 1506

        SELECT unit_of_measure_tl
        FROM OKX_UNITS_OF_MEASURE_V
        WHERE uom_code = p_uom_code ;
Line: 1533

       l_config_cust := 'SELECT ciir.object_id  config_parent_id,' ||
                        'ciir.subject_id cp_id,' || 'level ' ||
                        ' FROM   csi_ii_relationships ciir ' ||
                        ' WHERE active_end_date IS NULL ' ||
                        ' START WITH subject_id ' ||
                        ' IN (SELECT ciir_pr.subject_id ' ||
                        ' FROM   csi_ii_relationships ciir_pr ' ||
                        ' WHERE  object_id  IN ' || ' ( SELECT instance_id ' ||
                        ' FROM   csi_item_instances ' ||
                        ' WHERE  instance_id = to_char(:l_id)' ||
                        ' AND    owner_party_account_id in (select id1 ' ||
                        ' from okx_customer_accounts_v ' ||
                        ' where party_id =  to_char(:p_party_id) ))) ' ||
                        'CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ';
Line: 1548

       l_config_rel := 'SELECT ciir.object_id  config_parent_id,' ||
                       'ciir.subject_id cp_id,' || 'level ' ||
                       ' FROM   csi_ii_relationships ciir ' ||
                       ' WHERE active_end_date IS NULL ' ||
                       ' START WITH subject_id ' ||
                       ' IN (SELECT ciir_pr.subject_id ' ||
                       ' FROM   csi_ii_relationships ciir_pr ' ||
                       ' WHERE  object_id  IN ' || ' ( SELECT instance_id ' ||
                       ' FROM   csi_item_instances ' ||
                       ' WHERE  instance_id =  to_char(:l_id ) ' ||
                       ' AND    owner_party_account_id in  ' ||
                       '  (select A.RELATED_CUST_ACCOUNT_ID ' ||
                       '   FROM   OKX_CUST_ACCT_RELATE_ALL_V A, ' ||
                       '          OKX_CUSTOMER_ACCOUNTS_V  B ' ||
                       '   WHERE  B.ID1 = A.CUST_ACCOUNT_ID ' ||
                       '   AND    B.party_id =   to_char(:p_party_id) ' ||
                       '   AND    B.status = ''A''' ||
                       '   AND    A.status = ''A''' ||
                       '   AND    A.org_id =  to_char(:p_org_id) ' || '  ))) ' ||
                       'CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ';
Line: 1569

       l_config_both := 'SELECT ciir.object_id  config_parent_id,' ||
                        'ciir.subject_id cp_id,' || 'level ' ||
                        ' FROM   csi_ii_relationships ciir ' ||
                        ' WHERE active_end_date IS NULL ' ||
                        ' START WITH subject_id ' ||
                        ' IN (SELECT ciir_pr.subject_id ' ||
                        ' FROM   csi_ii_relationships ciir_pr ' ||
                        ' WHERE  object_id  IN ' || ' ( SELECT instance_id ' ||
                        ' FROM   csi_item_instances ' ||
                        ' WHERE  instance_id =  to_char(:l_id)' ||
                        ' AND    owner_party_account_id in ((select id1 ' ||
                        ' from okx_customer_accounts_v ' ||
                        ' where party_id = to_char(:p_party_id)) ' || ' UNION ' ||
                        '  (select A.RELATED_CUST_ACCOUNT_ID ' ||
                        '   FROM   OKX_CUST_ACCT_RELATE_ALL_V A, ' ||
                        '          OKX_CUSTOMER_ACCOUNTS_V  B ' ||
                        '   WHERE  B.ID1 = A.CUST_ACCOUNT_ID ' ||
                        '   AND    B.party_id = to_char(:p_party_id)' ||
                        '   AND    B.status = ''A''' ||
                        '   AND    A.status = ''A''' ||
                        '   AND    A.org_id =  to_Char(:p_org_id)) ' || '  ))) ' ||
                        'CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ';
Line: 1592

       l_config_all := 'SELECT ciir.object_id  config_parent_id,' ||
                       'ciir.subject_id cp_id,' || 'level ' ||
                       ' FROM   csi_ii_relationships ciir ' ||
                       ' WHERE active_end_date IS NULL ' ||
                       ' START WITH subject_id ' ||
                       ' IN (SELECT ciir_pr.subject_id ' ||
                       ' FROM   csi_ii_relationships ciir_pr ' ||
                       ' WHERE  object_id  IN ' || ' ( SELECT instance_id ' ||
                       ' FROM   csi_item_instances ' ||
                       ' WHERE  instance_id = to_char(:l_id))) ' ||
                       'CONNECT BY  ciir.object_id = PRIOR ciir.subject_id  ';
Line: 1634

                              x_prod_selections_tbl);
Line: 1637

               l_prod_tbl.DELETE;
Line: 1651

                              x_prod_selections_tbl);
Line: 1654

               l_prod_tbl.DELETE;
Line: 1662

               /* select product details for config parent */
               /** Build parent **/
               OPEN l_csr_model_products(l_config_rec.config_parent_id,
                                         p_organization_id);
Line: 1672

                   x_prod_selections_tbl(rowcount).cp_id := l_model_prod_rec.instance_id;
Line: 1673

                   x_prod_selections_tbl(rowcount).config_parent_id := '';
Line: 1674

                   x_prod_selections_tbl(rowcount).name := l_model_prod_rec.name;
Line: 1676

                   x_prod_selections_tbl(rowcount).description := l_model_prod_rec.description;
Line: 1683

                     x_prod_selections_tbl(rowcount).description := l_model_prod_rec.name;
Line: 1684

                     x_prod_selections_tbl(rowcount).name := l_model_prod_rec.description;
Line: 1689

                   x_prod_selections_tbl(rowcount).name := l_name;
Line: 1690

                   x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 1691

                   x_prod_selections_tbl(rowcount).rec_name := 'Configuration';
Line: 1692

                   x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 1693

                   x_prod_selections_tbl(rowcount).model_level := l_config_rec.LEVEL;
Line: 1694

                   x_prod_selections_tbl(rowcount).cp_id2 := l_model_prod_rec.id2;
Line: 1695

                   x_prod_selections_tbl(rowcount).ser_number := l_model_prod_rec.serial_number;
Line: 1696

                   x_prod_selections_tbl(rowcount).ref_number := l_model_prod_rec.instance_number;
Line: 1697

                   x_prod_selections_tbl(rowcount).quantity := l_model_prod_rec.quantity;
Line: 1699

                   x_prod_selections_tbl(rowcount).orig_net_amt := l_model_prod_rec.unit_selling_price;
Line: 1701

                     x_prod_selections_tbl(rowcount).price := 0;
Line: 1703

                   x_prod_selections_tbl(rowcount).price := l_model_prod_rec.unit_selling_price;
Line: 1705

                   x_prod_selections_tbl(rowcount).inventory_item_id := l_model_prod_rec.inventory_item_id;
Line: 1706

                   x_prod_selections_tbl(rowcount).site_id := l_model_prod_rec.install_location_id;
Line: 1707

                   x_prod_selections_tbl(rowcount).uom_code := l_model_prod_rec.unit_of_measure;
Line: 1708

                   x_prod_selections_tbl(rowcount).display_name := '';
Line: 1709

                   x_prod_selections_tbl(rowcount).site_name := '';
Line: 1710

                   x_prod_selections_tbl(rowcount).model_level := 0;
Line: 1714

                   x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 1730

                    x_prod_selections_tbl(rowcount).name := l_gen_name;
Line: 1731

                    x_prod_selections_tbl(rowcount).description := l_gen_desc;
Line: 1734

                    x_prod_selections_tbl(rowcount).name := l_gen_desc;
Line: 1735

                    x_prod_selections_tbl(rowcount).description := l_gen_name;
Line: 1738

                  x_prod_selections_tbl(rowcount).site_name := l_install_site_name;
Line: 1742

                    l_display_name := x_prod_selections_tbl(rowcount).name||'; '||g_serial_number ||
Line: 1750

                    x_prod_selections_tbl(rowcount).display_name := l_display_name;
Line: 1828

    PROCEDURE get_product_selection(p_clvl_filter_rec IN clvl_filter_rec,
                                    x_prod_selections_tbl OUT NOCOPY prod_selections_tbl)
    IS

    l_param_organization_id  NUMBER := okc_context.get_okc_organization_id;
Line: 1870

    l_select_for_name VARCHAR2(2000);
Line: 1871

    l_select_for_desc VARCHAR2(2000);
Line: 1888

    l_prod_selections_tbl prod_selections_tbl;
Line: 1948

                select inventory_item_id, concatenated_segments name  ,  description description */

                l_select_for_name := 'select inventory_item_id, concatenated_segments name  ,  description description ';
Line: 1951

                l_select_for_desc := 'select inventory_item_id,   description description , concatenated_segments name  ';
Line: 1960

                ||' where inventory_item_id in ( select inventory_item_id from csi_item_instances  '
                ||' where owner_party_account_id in (select id1  '
                ||'  FROM okx_customer_accounts_v '
                ||'  WHERE party_id = :l_party_id)) '
                ||' and organization_id = :l_organization_id '
                ||' and serviceable_product_flag = ''Y''';
Line: 1968

                ||' where inventory_item_id in ( select inventory_item_id from csi_item_instances  '
                ||' where owner_party_account_id in   (select A.RELATED_CUST_ACCOUNT_ID  '
                ||' FROM   OKX_CUST_ACCT_RELATE_ALL_V A,  '
                ||'        OKX_CUSTOMER_ACCOUNTS_V  B  '
                ||' WHERE  B.ID1 = A.CUST_ACCOUNT_ID  '
                ||' AND    B.party_id =  :l_party_id '
                ||' AND    B.status = ''A'''
                ||' AND    A.status = ''A'''
                ||' AND    A.org_id =  :l_org_id '
                ||' )) '
                ||' and organization_id = :l_organization_id '
                ||' and serviceable_product_flag = ''Y''';
Line: 1982

                ||' where inventory_item_id in ( select inventory_item_id from csi_item_instances  '
                ||' where owner_party_account_id in  (select id1  '
                ||' FROM okx_customer_accounts_v '
                ||' WHERE party_id = :p_party_id '
                ||' UNION '
                ||' select A.RELATED_CUST_ACCOUNT_ID  '
                ||' FROM   OKX_CUST_ACCT_RELATE_ALL_V A,  '
                ||' OKX_CUSTOMER_ACCOUNTS_V  B  '
                ||' WHERE  B.ID1 = A.CUST_ACCOUNT_ID '
                ||' AND    B.party_id =  :l_party_id '
                ||' AND    B.status = ''A'''
                ||' AND    A.status = ''A'''
                ||' AND    A.org_id =  :l_org_id '
                ||' )) '
                ||' and organizatioN_id = :l_organization_id '
                ||' and serviceable_product_flag = ''Y''';
Line: 2004

                    /* Select all Items for given party first */
                    IF l_default = 'CUSTOMER' THEN
                        IF l_display_pref = 'NAME' THEN
                            l_item_cust := l_select_for_name ||' '|| l_item_cust ||' '|| l_order_by_name;
Line: 2009

                            l_item_cust := l_select_for_desc ||' '|| l_item_cust ||' '|| l_order_by_desc;
Line: 2016

                            l_item_rel := l_select_for_name ||' '|| l_item_rel ||' '|| l_order_by_name;
Line: 2018

                            l_item_rel := l_select_for_desc ||' '|| l_item_rel ||' '|| l_order_by_desc;
Line: 2025

                            l_item_both := l_select_for_name ||' '|| l_item_both ||' '|| l_order_by_name;
Line: 2027

                            l_item_both := l_select_for_desc ||' '|| l_item_both ||' '|| l_order_by_desc;
Line: 2033

                            l_item_all := l_select_for_name ||' '|| l_item_all ||' '|| l_order_by_name;
Line: 2035

                            l_item_all := l_select_for_desc ||' '|| l_item_all ||' '|| l_order_by_desc;
Line: 2063

                                x_prod_selections_tbl(rowcount).cp_id := l_items_rec.inventory_item_id;
Line: 2064

                                x_prod_selections_tbl(rowcount).name := l_items_rec.name;
Line: 2065

                                x_prod_selections_tbl(rowcount).description := l_items_rec.description;
Line: 2073

                                x_prod_selections_tbl(rowcount).name := l_name;
Line: 2074

                                x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2075

                                x_prod_selections_tbl(rowcount).rec_name := 'Item';
Line: 2076

                                x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2077

                                x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2078

                                x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2079

                                x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2080

                                x_prod_selections_tbl(rowcount).quantity := '';
Line: 2081

                                x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2082

                                x_prod_selections_tbl(rowcount).price := '';
Line: 2083

                                x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2084

                                x_prod_selections_tbl(rowcount).site_id := '';
Line: 2085

                                x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2086

                                x_prod_selections_tbl(rowcount).display_name := '';
Line: 2087

                                x_prod_selections_tbl(rowcount).site_name := '';
Line: 2091

                                x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2102

                                                x_prod_selections_tbl);
Line: 2126

                        x_prod_selections_tbl(rowcount).cp_id := l_clvl_id;
Line: 2129

                        x_prod_selections_tbl(rowcount).name := rpad(p_clvl_filter_rec.clvl_name, 30,' ') || rpad(p_clvl_filter_rec.clvl_description, 40,' ');
Line: 2130

                        x_prod_selections_tbl(rowcount).description := p_clvl_filter_rec.clvl_description;
Line: 2131

                        x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2132

                        x_prod_selections_tbl(rowcount).rec_name := 'Item';
Line: 2133

                        x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2134

                        x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2135

                        x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2136

                        x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2137

                        x_prod_selections_tbl(rowcount).quantity := '';
Line: 2138

                        x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2139

                        x_prod_selections_tbl(rowcount).price := '';
Line: 2140

                        x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2141

                        x_prod_selections_tbl(rowcount).site_id := '';
Line: 2142

                        x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2143

                        x_prod_selections_tbl(rowcount).display_name := '';
Line: 2144

                        x_prod_selections_tbl(rowcount).site_name := '';
Line: 2148

                        x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2158

                                        x_prod_selections_tbl);
Line: 2172

                    l_get_all_systems_sql_c := ' SELECT CSB.system_Id Id1 , CST.name name , CST.description description '
                    || ' FROM   CSI_SYSTEMS_B   CSB, '
                    || '        CSI_SYSTEMS_TL  CST '
                    || ' WHERE  CSB.system_id = CST.system_id  '
                    || ' AND    CSB.system_id IN  (Select CII.system_id '
                    || ' From   CSI_ITEM_INSTANCES CII, '
                    || '        CSI_INSTANCE_STATUSES  CIS '
                    || '       , MTL_SYSTEM_ITEMS_B IT '
                    || ' WHERE IT.inventory_item_id = CII.inventory_item_id '
                    || ' AND   IT.serviceable_product_flag = ''Y'''
                    || ' AND   IT.organization_id = :l_organization_id '
                    || ' AND  CII.owner_party_account_id in (select cust_account_id '
                    ||' from hz_cust_accounts '
                    ||' where party_id =  :p_party_id ) '
                    || ' And    CIS.instance_status_id = CII.instance_status_id '
                    || ' And    CIS.service_order_allowed_flag = ''Y'''
                    || ' And    sysdate between Nvl(CIS.start_date_active, sysdate) and  Nvl(CIS.end_date_active, sysdate) '
                    || ' And    CII.system_id is not null ) '
                    || ' And    sysdate between Nvl(CSB.start_date_active, sysdate) and   Nvl(CSB.end_date_active, sysdate) '
                    || ' Order by CST.name ';
Line: 2195

                    l_get_all_systems_sql_b := ' SELECT CSB.system_Id Id1 , CST.name name , CST.description description '
                    || ' FROM   CSI_SYSTEMS_B   CSB, '
                    || '        CSI_SYSTEMS_TL  CST '
                    || ' WHERE  CSB.system_id = CST.system_id  '
                    || ' AND    CSB.system_id IN  '
                    ||' (SELECT CII.system_id '
                    ||'  FROM   CSI_ITEM_INSTANCES CII, '
                    ||'         CSI_INSTANCE_STATUSES  CIS '
                    ||'       , MTL_SYSTEM_ITEMS_B IT '
                    || ' WHERE IT.inventory_item_id = CII.inventory_item_id '
                    || ' AND   IT.serviceable_product_flag = ''Y'''
                    || ' AND   IT.organization_id = :l_organization_id '
                    || ' AND   CII.owner_party_account_id in (select cust_account_id '
                    ||' from HZ_CUST_ACCOUNTS '
                    ||' where party_id =  :p_party_id  '
                    ||' UNION ALL'
                    ||'  select A.RELATED_CUST_ACCOUNT_ID '
                    ||'   FROM   HZ_CUST_ACCT_RELATE_ALL A, '
                    ||'          HZ_CUST_ACCOUNTS  B '
                    ||'   WHERE  B.cust_account_id = A.CUST_ACCOUNT_ID '
                    ||'   AND    B.party_id =   :p_party_id '
                    ||'   AND    B.status = ''A'''
                    ||'   AND    A.status = ''A'''
                    ||'   AND    A.org_id =  :p_org_id '
                    ||'  ) '
                    || ' And    CIS.instance_status_id = CII.instance_status_id '
                    || ' And    CIS.service_order_allowed_flag = ''Y'''
                    || ' And    sysdate between Nvl(CIS.start_date_active, sysdate) and  Nvl(CIS.end_date_active, sysdate) '
                    || ' And    CII.system_id is not null ) '
                    || ' And    sysdate between Nvl(CSB.start_date_active, sysdate) and   Nvl(CSB.end_date_active, sysdate) '
                    || ' Order by CST.name ';
Line: 2228

                    l_get_all_systems_sql_r := ' SELECT CSB.system_Id Id1 , CST.name name , CST.description description '
                    || ' FROM   CSI_SYSTEMS_B   CSB, '
                    || '        CSI_SYSTEMS_TL  CST '
                    || ' WHERE  CSB.system_id = CST.system_id  '
                    || ' AND    CSB.system_id IN  (Select CII.system_id '
                    || ' From  CSI_ITEM_INSTANCES CII, '
                    || '       CSI_INSTANCE_STATUSES  CIS '
                    ||' ,       MTL_SYSTEM_ITEMS_B IT '
                    || ' WHERE IT.inventory_item_id = CII.inventory_item_id '
                    || ' AND   IT.serviceable_product_flag = ''Y'''
                    || ' AND   IT.organization_id = :l_organization_id '
                    || ' AND   CII.owner_party_account_id in  '
                    ||'  (select A.RELATED_CUST_ACCOUNT_ID '
                    ||'   FROM   HZ_CUST_ACCT_RELATE_ALL A, '
                    ||'          HZ_CUST_ACCOUNTS  B '
                    ||'   WHERE  B.cust_account_id = A.CUST_ACCOUNT_ID '
                    ||'   AND    B.party_id =   :p_party_id '
                    ||'   AND    B.status = ''A'''
                    ||'   AND    A.status = ''A'''
                    ||'   AND    A.org_id =  :p_org_id '
                    ||'  ) '
                    || ' And    CIS.instance_status_id = CII.instance_status_id '
                    || ' And    CIS.service_order_allowed_flag = ''Y'''
                    || ' And    sysdate between Nvl(CIS.start_date_active, sysdate) and  Nvl(CIS.end_date_active, sysdate) '
                    || ' And    system_id is not null ) '
                    || ' And    sysdate between Nvl(CSB.start_date_active, sysdate) and   Nvl(CSB.end_date_active, sysdate) '
                    || ' Order by CST.name ';
Line: 2257

                    l_get_all_systems_sql_a := ' SELECT CSB.system_Id Id1 , CST.name name , CST.description description '
                    || ' FROM   CSI_SYSTEMS_B   CSB, '
                    || '        CSI_SYSTEMS_TL  CST '
                    || ' WHERE  CSB.system_id = CST.system_id  '
                    || ' AND    CSB.system_id IN  (Select CII.system_id '
                    || ' From   CSI_ITEM_INSTANCES CII, '
                    || '        CSI_INSTANCE_STATUSES  CIS '
                    ||' ,       MTL_SYSTEM_ITEMS_B IT '
                    || ' WHERE IT.inventory_item_id = CII.inventory_item_id '
                    || ' AND   IT.serviceable_product_flag = ''Y'''
                    || ' AND   IT.organization_id = :l_organization_id '
                    || ' AND   CIS.instance_status_id = CII.instance_status_id '
                    || ' And   CIS.service_order_allowed_flag = ''Y'''
                    || ' And   sysdate between Nvl(CIS.start_date_active, sysdate) and  Nvl(CIS.end_date_active, sysdate) '
                    || ' And   CII.system_id is not null ) '
                    || ' And    sysdate between Nvl(CSB.start_date_active, sysdate) and   Nvl(CSB.end_date_active, sysdate) '
                    || ' Order by CST.name ';
Line: 2275

                    /* Select all Items for given party first */

                    IF l_default = 'CUSTOMER' THEN
                        ------------------------------errorout_an(l_get_all_systems_sql_c);
Line: 2305

                        FOR  id_counter IN 1 .. x_prod_selections_tbl.COUNT LOOP
                            IF x_prod_selections_tbl(id_counter).rec_type = 'P' THEN

                                IF x_prod_selections_tbl(id_counter).cp_id = l_id THEN
                                    l_chk_id_flag := 'Y';
Line: 2330

                                x_prod_selections_tbl(rowcount).cp_id := l_get_all_systems_rec.id1;
Line: 2332

                                x_prod_selections_tbl(rowcount).name := l_name;
Line: 2333

                                x_prod_selections_tbl(rowcount).description := l_get_all_systems_rec.description;
Line: 2334

                                x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2335

                                x_prod_selections_tbl(rowcount).rec_name := 'System';
Line: 2336

                                x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2337

                                x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2338

                                x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2339

                                x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2340

                                x_prod_selections_tbl(rowcount).quantity := '';
Line: 2341

                                x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2342

                                x_prod_selections_tbl(rowcount).price := '';
Line: 2343

                                x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2344

                                x_prod_selections_tbl(rowcount).site_id := '';
Line: 2345

                                x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2346

                                x_prod_selections_tbl(rowcount).display_name := '';
Line: 2347

                                x_prod_selections_tbl(rowcount).site_name := '';
Line: 2351

                                x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2361

                                                x_prod_selections_tbl);
Line: 2383

                        x_prod_selections_tbl(rowcount).cp_id := l_clvl_id;
Line: 2386

                        x_prod_selections_tbl(rowcount).name := l_name;
Line: 2387

                        x_prod_selections_tbl(rowcount).description := p_clvl_filter_rec.clvl_description;
Line: 2388

                        x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2389

                        x_prod_selections_tbl(rowcount).rec_name := 'System';
Line: 2390

                        x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2391

                        x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2392

                        x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2393

                        x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2394

                        x_prod_selections_tbl(rowcount).quantity := '';
Line: 2395

                        x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2396

                        x_prod_selections_tbl(rowcount).price := '';
Line: 2397

                        x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2398

                        x_prod_selections_tbl(rowcount).site_id := '';
Line: 2399

                        x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2400

                        x_prod_selections_tbl(rowcount).display_name := '';
Line: 2401

                        x_prod_selections_tbl(rowcount).site_name := '';
Line: 2405

                        x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2414

                                        x_prod_selections_tbl);
Line: 2422

                    /* Select all Items for given party first */
		    -- Bug 5004778 --
	            -- Modified Query to reduce shared memory Usage
		    -- Replaced views to base tables where ever possible
                    l_get_all_sites_sql_c := ' SELECT  SI.Id1 id1 , SI.name name , SI.Party_Site_Number party_site_number , SI.description description '
                    || ' FROM    OKX_PARTY_SITES_V   SI '
                    || ' WHERE  exists   (SELECT CII.install_location_Id '
                    ||'  FROM   CSI_ITEM_INSTANCES CII, '
                    ||'         CSI_INSTANCE_STATUSES   CIS, '
                    ||'         MTL_SYSTEM_ITEMS_B IT '
                    ||'  WHERE IT.inventory_item_id = CII.inventory_item_id '
                    ||'  AND   IT.serviceable_product_flag = ''Y'''
                    ||'  AND   IT.organization_id = :l_organization_id '
                    ||'  AND   CII.install_location_id = SI.id1 '
                    ||'  AND   CII.owner_party_account_id in '
                    ||'(select cust_account_id '
                    ||' from hz_cust_accounts '
                    ||' where party_id =  :p_party_id ) '
                    ||'        And    CIS.instance_Status_id = CII.instance_status_id '
                    ||'        And    CIS.service_order_allowed_flag = ''Y'''
                    ||'        And    sysdate between Nvl(CIS.start_date_active, sysdate) and '
                    ||'                               Nvl(CIS.end_date_active, sysdate)) '
                    -- TCA Changes --
                    /*  ||'        And    sysdate between Nvl(SI.start_date_active, sysdate) and '
                    ||'                               Nvl(SI.end_date_active, sysdate) '  */
                    || 'AND SI.STATUS = ''A'''
                    -- TCA Changes --
                    ||' ORDER BY si.party_site_number, si.name ';
Line: 2454

                    l_get_all_sites_sql_r := ' SELECT  SI.Id1 id1 , SI.name name , SI.Party_Site_Number party_site_number , SI.description description '
                    || ' FROM    OKX_PARTY_SITES_V   SI '
                    || ' WHERE  exists  (SELECT CII.install_location_Id '
                    ||'   FROM   CSI_ITEM_INSTANCES CII, '
                    ||'          CSI_INSTANCE_STATUSES   CIS '
                    ||' ,        MTL_SYSTEM_ITEMS_B IT '
                    ||'   WHERE IT.inventory_item_id = CII.inventory_item_id '
                    ||'   AND   IT.serviceable_product_flag = ''Y'''
                    ||'   AND   IT.organization_id = :l_organization_id '
                    ||'   AND   CII.install_location_id = SI.id1 '
                    ||'   AND   CII.owner_party_account_id in '
                    ||'  (select A.RELATED_CUST_ACCOUNT_ID '
                    ||'   FROM   HZ_CUST_ACCT_RELATE_ALL A, '
                    ||'          HZ_CUST_ACCOUNTS  B '
                    ||'   WHERE  B.cust_account_id = A.CUST_ACCOUNT_ID '
                    ||'   AND    B.party_id =   :l_party_id '
                    ||'   AND    B.status = ''A'''
                    ||'   AND    A.status = ''A'''
                    ||'   AND    A.org_id =  :p_org_id '
                    ||'  ) '
                    ||'        And    CIS.instance_Status_id = CII.instance_status_id '
                    ||'        And    CIS.service_order_allowed_flag = ''Y'''
                    ||'        And    sysdate between Nvl(CIS.start_date_active, sysdate) and '
                    ||'                               Nvl(CIS.end_date_active, sysdate)) '
                    -- TCA Changes --
                    /* ||'        And    sysdate between Nvl(SI.start_date_active, sysdate) and '
                    ||'                               Nvl(SI.end_date_active, sysdate) '  */
                    || 'AND SI.STATUS = ''A'''
                    -- TCA Changes --
                    ||' ORDER BY si.party_site_number, si.name ';
Line: 2488

                    l_get_all_sites_sql_b := ' SELECT  SI.Id1 id1 , SI.name name , SI.Party_Site_Number party_site_number , SI.description description '
                    || ' FROM    OKX_PARTY_SITES_V   SI '
                    || ' WHERE  exists   (SELECT CII.install_location_Id '
                    || '   FROM   CSI_ITEM_INSTANCES CII, '
                    ||'           CSI_INSTANCE_STATUSES   CIS '
                    ||'  ,        MTL_SYSTEM_ITEMS_B IT '
                    ||'   WHERE IT.inventory_item_id = CII.inventory_item_id '
                    ||'   AND   IT.serviceable_product_flag = ''Y'''
                    ||'   AND   IT.organization_id = :l_organization_id '
                    ||'   AND     CII.install_location_id = SI.id1 '
                    ||'  AND    CII.owner_party_account_id in '
                    ||' (select cust_account_id '
                    ||' from hz_cust_accounts '
                    ||' where party_id =  :p_party_id  '
                    ||' UNION '
                    ||'  select  A.RELATED_CUST_ACCOUNT_ID '
                    ||'   FROM   HZ_CUST_ACCT_RELATE_ALL A, '
                    ||'          HZ_CUST_ACCOUNTS  B '
                    ||'   WHERE  B.cust_account_id = A.CUST_ACCOUNT_ID '
                    ||'   AND    B.party_id =   :p_party_id '
                    ||'   AND    B.status = ''A'''
                    ||'   AND    A.status = ''A'''
                    ||'   AND    A.org_id =  :p_org_id '
                    ||'  ) '
                    ||'        And    CIS.instance_Status_id = CII.instance_status_id '
                    ||'        And    CIS.service_order_allowed_flag = ''Y'''
                    ||'        And    sysdate between Nvl(CIS.start_date_active, sysdate) and '
                    ||'                               Nvl(CIS.end_date_active, sysdate)) '
                    -- TCA Changes --
                    /* ||'        And    sysdate between Nvl(SI.start_date_active, sysdate) and '
                    ||'                               Nvl(SI.end_date_active, sysdate) '  */
                    || 'AND SI.STATUS = ''A'''
                    -- TCA Changes --
                    ||' ORDER BY si.party_site_number, si.name ';
Line: 2524

                    l_get_all_sites_sql_a := ' SELECT  SI.Id1 id1 , SI.name name , SI.Party_Site_Number party_site_number , SI.description description '
                    || ' FROM    OKX_PARTY_SITES_V   SI '
                    || ' WHERE  exists   (SELECT CII.install_location_Id '
                    || '   FROM   CSI_ITEM_INSTANCES CII, '
                    ||'           CSI_INSTANCE_STATUSES   CIS '
                    ||'  ,        MTL_SYSTEM_ITEMS_KFV IT '
                    ||'   WHERE IT.inventory_item_id = CII.inventory_item_id '
                    ||'   AND   IT.serviceable_product_flag = ''Y'''
                    ||'   AND   IT.organization_id = :l_organization_id '
                    ||'   AND   CII.install_location_id = SI.id1 '
                    ||'   AND   CIS.instance_Status_id = CII.instance_status_id '
                    ||'        And    CIS.service_order_allowed_flag = ''Y'''
                    ||'        And    sysdate between Nvl(CIS.start_date_active, sysdate) and '
                    ||'                               Nvl(CIS.end_date_active, sysdate)) '
                    -- TCA Changes --
                    /* ||'        And    sysdate between Nvl(SI.start_date_active, sysdate) and '
                    ||'                               Nvl(SI.end_date_active, sysdate) '  */
                    || 'AND SI.STATUS = ''A''';
Line: 2574

                        FOR  id_counter IN 1 .. x_prod_selections_tbl.COUNT LOOP
                            IF x_prod_selections_tbl(id_counter).rec_type = 'P' THEN

                                IF x_prod_selections_tbl(id_counter).cp_id = l_id THEN
                                    l_chk_id_flag := 'Y';
Line: 2599

                                x_prod_selections_tbl(rowcount).cp_id := l_get_all_sites_rec.id1;
Line: 2607

                                x_prod_selections_tbl(rowcount).name := l_name;
Line: 2608

                                x_prod_selections_tbl(rowcount).description := l_get_all_sites_rec.description;
Line: 2609

                                x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2610

                                x_prod_selections_tbl(rowcount).rec_name := 'Site';
Line: 2611

                                x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2612

                                x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2613

                                x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2614

                                x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2615

                                x_prod_selections_tbl(rowcount).quantity := '';
Line: 2616

                                x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2617

                                x_prod_selections_tbl(rowcount).price := '';
Line: 2618

                                x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2619

                                x_prod_selections_tbl(rowcount).site_id := '';
Line: 2620

                                x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2621

                                x_prod_selections_tbl(rowcount).display_name := '';
Line: 2622

                                x_prod_selections_tbl(rowcount).site_name := '';
Line: 2626

                                x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2636

                                                x_prod_selections_tbl);
Line: 2658

                        x_prod_selections_tbl(rowcount).cp_id := l_clvl_id;
Line: 2660

                        x_prod_selections_tbl(rowcount).name := l_name;
Line: 2661

                        x_prod_selections_tbl(rowcount).description := p_clvl_filter_rec.clvl_description;
Line: 2662

                        x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2663

                        x_prod_selections_tbl(rowcount).rec_name := 'Site';
Line: 2664

                        x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2665

                        x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2666

                        x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2667

                        x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2668

                        x_prod_selections_tbl(rowcount).quantity := '';
Line: 2669

                        x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2670

                        x_prod_selections_tbl(rowcount).price := '';
Line: 2671

                        x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2672

                        x_prod_selections_tbl(rowcount).site_id := '';
Line: 2673

                        x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2674

                        x_prod_selections_tbl(rowcount).display_name := '';
Line: 2675

                        x_prod_selections_tbl(rowcount).site_name := '';
Line: 2679

                        x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2689

                                        x_prod_selections_tbl);
Line: 2699

                    /* Select all Items for given party first */
                    get_customer_id(p_default => l_default,
                                    p_party_id => l_party_id,
                                    p_org_id => l_org_id,
                                    x_cust_id_tbl => l_cust_id_tbl);
Line: 2726

                            x_prod_selections_tbl(rowcount).cp_id := l_id;
Line: 2727

                            x_prod_selections_tbl(rowcount).name := l_name;
Line: 2729

                            x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2730

                            x_prod_selections_tbl(rowcount).rec_name := 'Customer';
Line: 2731

                            x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2732

                            x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2733

                            x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2734

                            x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2735

                            x_prod_selections_tbl(rowcount).quantity := '';
Line: 2736

                            x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2737

                            x_prod_selections_tbl(rowcount).price := '';
Line: 2738

                            x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2739

                            x_prod_selections_tbl(rowcount).site_id := '';
Line: 2740

                            x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2741

                            x_prod_selections_tbl(rowcount).display_name := '';
Line: 2742

                            x_prod_selections_tbl(rowcount).site_name := '';
Line: 2746

                            x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2756

                                            x_prod_selections_tbl);
Line: 2777

                        x_prod_selections_tbl(rowcount).cp_id := l_customer_id;
Line: 2778

                        x_prod_selections_tbl(rowcount).name := p_clvl_filter_rec.clvl_name;
Line: 2780

                        x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2781

                        x_prod_selections_tbl(rowcount).rec_name := 'Customer';
Line: 2782

                        x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2783

                        x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2784

                        x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2785

                        x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2786

                        x_prod_selections_tbl(rowcount).quantity := '';
Line: 2787

                        x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2788

                        x_prod_selections_tbl(rowcount).price := '';
Line: 2789

                        x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2790

                        x_prod_selections_tbl(rowcount).site_id := '';
Line: 2791

                        x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2792

                        x_prod_selections_tbl(rowcount).display_name := '';
Line: 2793

                        x_prod_selections_tbl(rowcount).site_name := '';
Line: 2797

                        x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2807

                                        x_prod_selections_tbl);
Line: 2822

                          x_prod_selections_tbl );
Line: 2833

                          x_prod_selections_tbl );
Line: 2866

                    x_prod_selections_tbl(rowcount).cp_id := l_party_id;
Line: 2867

                    x_prod_selections_tbl(rowcount).name := l_name;
Line: 2868

                    x_prod_selections_tbl(rowcount).description := l_name;
Line: 2869

                    x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2870

                    x_prod_selections_tbl(rowcount).rec_name := 'Party';
Line: 2871

                    x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2872

                    x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2873

                    x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2874

                    x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2875

                    x_prod_selections_tbl(rowcount).quantity := '';
Line: 2876

                    x_prod_selections_tbl(rowcount).price := '';
Line: 2877

                    x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2878

                    x_prod_selections_tbl(rowcount).site_id := '';
Line: 2879

                    x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2880

                    x_prod_selections_tbl(rowcount).display_name := '';
Line: 2881

                    x_prod_selections_tbl(rowcount).site_name := '';
Line: 2885

                    x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2895

                                    x_prod_selections_tbl);
Line: 2900

                /* Select all Items for given party first */

                get_party_id(p_default => l_default,
                             p_party_id => l_party_id,
                             p_org_id => l_org_id,
                             x_party_id_tbl => l_party_id_tbl );
Line: 2924

                        x_prod_selections_tbl(rowcount).cp_id := l_party_id_tbl(i).party_id;
Line: 2925

                        x_prod_selections_tbl(rowcount).name := l_party_id_tbl(i).party_name;
Line: 2926

                        x_prod_selections_tbl(rowcount).description := l_party_id_tbl(i).party_name;
Line: 2927

                        x_prod_selections_tbl(rowcount).rec_type := 'P';
Line: 2928

                        x_prod_selections_tbl(rowcount).rec_name := 'Party';
Line: 2929

                        x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 2930

                        x_prod_selections_tbl(rowcount).cp_id2 := '';
Line: 2931

                        x_prod_selections_tbl(rowcount).ser_number := '';
Line: 2932

                        x_prod_selections_tbl(rowcount).ref_number := '' ;
Line: 2933

                        x_prod_selections_tbl(rowcount).quantity := '';
Line: 2934

                        x_prod_selections_tbl(rowcount).orig_net_amt := '';
Line: 2935

                        x_prod_selections_tbl(rowcount).price := '';
Line: 2936

                        x_prod_selections_tbl(rowcount).inventory_item_id := '';
Line: 2937

                        x_prod_selections_tbl(rowcount).site_id := '';
Line: 2938

                        x_prod_selections_tbl(rowcount).uom_code := '';
Line: 2939

                        x_prod_selections_tbl(rowcount).display_name := '';
Line: 2940

                        x_prod_selections_tbl(rowcount).site_name := '';
Line: 2944

                        x_prod_selections_tbl(rowcount).ext_reference := '';
Line: 2954

                                        x_prod_selections_tbl);
Line: 2976

    PROCEDURE Get_customer_selections(p_clvl_filter_rec IN clvl_filter_rec,
                                      x_clvl_selections_tbl   OUT   NOCOPY   clvl_selections_tbl)
    IS

    CURSOR l_csr_get_customer(p_party_id IN NUMBER ) IS
        SELECT cust_acc.party_id party_id, parties.name party_name, parties.description description,
               cust_acc.id1 id1, cust_acc.name name, cust_acc.id2 id2, cust_acc.description account_number
        FROM   OKX_CUSTOMER_ACCOUNTS_V cust_acc,
               OKX_PARTIES_V parties
        WHERE  cust_acc.party_id = p_party_id
        AND    cust_acc.party_id = parties.id1
        AND    cust_acc.status = 'A';
Line: 2990

        SELECT parties.id1 party_id, parties.name party_name
        FROM OKX_PARTIES_V parties
        WHERE parties.id1 = p_party_id ;
Line: 2995

        SELECT cust_acc.party_id party_id, parties.name party_name, parties.description description,
               cust_acc.id1 id1, cust_acc.name name, cust_acc.id2 id2, cust_acc.description account_number
        FROM   OKX_CUSTOMER_ACCOUNTS_V cust_acc,
               OKX_PARTIES_V parties
        WHERE  cust_acc.party_id = parties.id1
        AND    cust_acc.status = 'A';
Line: 3015

    l_party_selected OKX_PARTIES_V.ID1%TYPE;
Line: 3020

        l_party_selected := p_clvl_filter_rec.clvl_find_id;
Line: 3022

        l_party_id := NVL(l_party_selected, l_party_id);
Line: 3024

        IF l_party_selected IS NOT NULL THEN
            OPEN l_csr_get_party_name(l_party_selected);
Line: 3031

            x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3032

            x_clvl_selections_tbl(rowcount).rec_name := 'Customer';
Line: 3033

            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3034

            x_clvl_selections_tbl(rowcount).id1 := l_csr_party_rec.party_id;
Line: 3035

            x_clvl_selections_tbl(rowcount).name := l_csr_party_rec.party_name;
Line: 3036

            x_clvl_selections_tbl(rowcount).lse_id := 35;
Line: 3037

            x_clvl_selections_tbl(rowcount).lse_name := 'Customer';
Line: 3041

            FOR l_cust_csr_rec IN l_csr_get_customer(l_party_selected) LOOP

                x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3044

                x_clvl_selections_tbl(rowcount).rec_name := 'Customer';
Line: 3045

                x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3046

                x_clvl_selections_tbl(rowcount).id1 := l_cust_csr_rec.id1;
Line: 3047

                x_clvl_selections_tbl(rowcount).id2 := l_cust_csr_rec.id2;
Line: 3048

                x_clvl_selections_tbl(rowcount).name := l_cust_csr_rec.name;
Line: 3049

                x_clvl_selections_tbl(rowcount).clvl_id := l_cust_csr_rec.id1;
Line: 3050

                x_clvl_selections_tbl(rowcount).clvl_name := l_cust_csr_rec.name;
Line: 3051

                x_clvl_selections_tbl(rowcount).display_name := l_cust_csr_rec.name || ',' || l_cust_csr_rec.account_number;
Line: 3052

                x_clvl_selections_tbl(rowcount).party_id := l_cust_csr_rec.party_id;
Line: 3053

                x_clvl_selections_tbl(rowcount).party_name := l_cust_csr_rec.party_name;
Line: 3054

                x_clvl_selections_tbl(rowcount).description := l_cust_csr_Rec.description;
Line: 3055

                x_clvl_selections_tbl(rowcount).lse_id := 35;
Line: 3056

                x_clvl_selections_tbl(rowcount).lse_name := 'Customer';
Line: 3069

                    l_party_selected := l_party_id_tbl(i).party_id;
Line: 3071

                    FOR l_cust_csr_rec IN l_csr_get_customer(l_party_selected) LOOP
                        l_party_id := l_cust_csr_rec.party_id;
Line: 3074

                            x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3075

                            x_clvl_selections_tbl(rowcount).rec_name := 'Customer';
Line: 3076

                            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3077

                            x_clvl_selections_tbl(rowcount).id1 := l_cust_csr_rec.party_id;
Line: 3078

                            x_clvl_selections_tbl(rowcount).name := l_cust_csr_rec.party_name;
Line: 3079

                            x_clvl_selections_tbl(rowcount).lse_id := 35;
Line: 3080

                            x_clvl_selections_tbl(rowcount).lse_name := 'Customer';
Line: 3088

                        x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3089

                        x_clvl_selections_tbl(rowcount).rec_name := 'Customer';
Line: 3090

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3091

                        x_clvl_selections_tbl(rowcount).id1 := l_cust_csr_rec.id1;
Line: 3092

                        x_clvl_selections_tbl(rowcount).id2 := l_cust_csr_rec.id2;
Line: 3093

                        x_clvl_selections_tbl(rowcount).name := l_cust_csr_rec.name;
Line: 3094

                        x_clvl_selections_tbl(rowcount).clvl_id := l_cust_csr_rec.id1;
Line: 3095

                        x_clvl_selections_tbl(rowcount).clvl_name := l_cust_csr_rec.name;
Line: 3096

                        x_clvl_selections_tbl(rowcount).display_name := l_cust_csr_rec.name || ',' || l_cust_csr_rec.account_number;
Line: 3097

                        x_clvl_selections_tbl(rowcount).party_id := l_cust_csr_rec.party_id;
Line: 3098

                        x_clvl_selections_tbl(rowcount).party_name := l_cust_csr_rec.party_name;
Line: 3099

                        x_clvl_selections_tbl(rowcount).description := l_cust_csr_Rec.description;
Line: 3100

                        x_clvl_selections_tbl(rowcount).lse_id := 35;
Line: 3101

                        x_clvl_selections_tbl(rowcount).lse_name := 'Customer';
Line: 3114

                        x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3115

                        x_clvl_selections_tbl(rowcount).rec_name := 'Customer';
Line: 3116

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3117

                        x_clvl_selections_tbl(rowcount).id1 := l_cust_csr_rec.party_id;
Line: 3118

                        x_clvl_selections_tbl(rowcount).name := l_cust_csr_rec.party_name;
Line: 3119

                        x_clvl_selections_tbl(rowcount).lse_id := 35;
Line: 3120

                        x_clvl_selections_tbl(rowcount).lse_name := 'Customer';
Line: 3127

                    x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3128

                    x_clvl_selections_tbl(rowcount).rec_name := 'Customer';
Line: 3129

                    x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3130

                    x_clvl_selections_tbl(rowcount).clvl_id := l_cust_csr_rec.id1;
Line: 3131

                    x_clvl_selections_tbl(rowcount).id2 := l_cust_csr_rec.id2;
Line: 3132

                    x_clvl_selections_tbl(rowcount).clvl_name := l_cust_csr_rec.name;
Line: 3133

                    x_clvl_selections_tbl(rowcount).display_name := l_cust_csr_rec.name || ',' || l_cust_csr_rec.account_number;
Line: 3134

                    x_clvl_selections_tbl(rowcount).party_id := l_cust_csr_rec.party_id;
Line: 3135

                    x_clvl_selections_tbl(rowcount).party_name := l_cust_csr_rec.party_name;
Line: 3136

                    x_clvl_selections_tbl(rowcount).description := l_cust_csr_Rec.account_number;
Line: 3137

                    x_clvl_selections_tbl(rowcount).lse_id := 35;
Line: 3138

                    x_clvl_selections_tbl(rowcount).lse_name := 'Customer';
Line: 3144

    END get_customer_selections;
Line: 3151

    PROCEDURE Get_party_selections(p_clvl_filter_rec IN clvl_filter_rec,
                                   x_clvl_selections_tbl   OUT   NOCOPY   clvl_selections_tbl)
    IS

    CURSOR l_csr_party_customer(p_party_id IN NUMBER ) IS
        SELECT id1, id2, Name, Description
        FROM   OKX_PARTIES_V
        WHERE  id1 = p_party_id
        AND    status = 'A';
Line: 3163

        SELECT P1.id1, P1.id2, P1.name, P1.description
        FROM OKX_PARTIES_V P1, OKX_CUSTOMER_ACCOUNTS_V CA1
        WHERE P1.id1 = CA1.party_id
        AND CA1.id1 IN (SELECT rel_acc.cust_account_id
                        FROM  OKX_CUSTOMER_ACCOUNTS_V    cust_acc,
                        OKX_CUST_ACCT_RELATE_ALL_V rel_acc
                        WHERE rel_acc.related_cust_account_id = cust_acc.id1
                        AND   cust_acc.party_id = p_party_id
                        AND   cust_acc.status = 'A'
                        AND   rel_acc.org_id = p_org_id
                        AND   rel_acc.status = 'A')
        AND P1.status = 'A'
        AND CA1.status = 'A';
Line: 3179

        SELECT id1, id2, Name, Description
        FROM   OKX_PARTIES_V
        WHERE  id1 = p_party_id
        AND    status = 'A'
        UNION
        SELECT P1.id1, P1.id2, P1.name, P1.description
        FROM OKX_PARTIES_V P1, OKX_CUSTOMER_ACCOUNTS_V CA1
        WHERE P1.id1 = CA1.party_id
        AND CA1.id1 IN (SELECT rel_acc.cust_account_id
                        FROM  OKX_CUSTOMER_ACCOUNTS_V    cust_acc,
                        OKX_CUST_ACCT_RELATE_ALL_V rel_acc
                        WHERE rel_acc.related_cust_account_id = cust_acc.id1
                        AND   cust_acc.party_id = p_party_id
                        AND   cust_acc.status = 'A'
                        AND   rel_acc.org_id = p_org_id
                        AND   rel_acc.status = 'A')
        AND P1.status = 'A'
        AND CA1.status = 'A';
Line: 3199

        SELECT id1, id2, Name, Description
        FROM   OKX_PARTIES_V
        WHERE  status = 'A';
Line: 3210

    l_party_selected NUMBER;
Line: 3216

        l_party_selected := p_clvl_filter_rec.clvl_find_id;
Line: 3219

        IF l_default = 'CUSTOMER' OR l_party_selected IS NOT NULL THEN
            IF l_party_selected IS NOT NULL THEN
                l_party_id := l_party_selected ;
Line: 3225

                x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3226

                x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3227

                x_clvl_selections_tbl(rowcount).rec_name := 'Party';
Line: 3228

                x_clvl_selections_tbl(rowcount).clvl_id := l_csr_party_rec_c.id1;
Line: 3229

                x_clvl_selections_tbl(rowcount).clvl_name := l_csr_party_rec_c.name;
Line: 3230

                x_clvl_selections_tbl(rowcount).id2 := l_csr_party_rec_c.id2;
Line: 3231

                x_clvl_selections_tbl(rowcount).name := l_csr_party_rec_c.name;
Line: 3232

                x_clvl_selections_tbl(rowcount).display_name := l_csr_party_rec_c.name || ',' || l_csr_party_Rec_c.description;
Line: 3233

                x_clvl_selections_tbl(rowcount).party_id := l_csr_party_rec_c.id1;
Line: 3234

                x_clvl_selections_tbl(rowcount).party_name := l_csr_party_rec_c.name;
Line: 3235

                x_clvl_selections_tbl(rowcount).description := l_csr_party_Rec_c.description;
Line: 3236

                x_clvl_selections_tbl(rowcount).lse_id := 8;
Line: 3237

                x_clvl_selections_tbl(rowcount).lse_name := 'Party'  ;
Line: 3244

                    x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3245

                    x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3246

                    x_clvl_selections_tbl(rowcount).rec_name := 'Party';
Line: 3247

                    x_clvl_selections_tbl(rowcount).id1 := l_csr_party_rec.id1;
Line: 3248

                    x_clvl_selections_tbl(rowcount).id2 := l_csr_party_rec.id2;
Line: 3249

                    x_clvl_selections_tbl(rowcount).name := l_csr_party_rec.name;
Line: 3250

                    x_clvl_selections_tbl(rowcount).display_name := l_csr_party_rec.name || ',' || l_csr_party_Rec.description;
Line: 3251

                    x_clvl_selections_tbl(rowcount).clvl_id := l_csr_party_rec.id1;
Line: 3252

                    x_clvl_selections_tbl(rowcount).clvl_name := l_csr_party_rec.name;
Line: 3253

                    x_clvl_selections_tbl(rowcount).party_id := l_csr_party_rec.id1;
Line: 3254

                    x_clvl_selections_tbl(rowcount).party_name := l_csr_party_rec.name;
Line: 3255

                    x_clvl_selections_tbl(rowcount).description := l_csr_party_Rec.description;
Line: 3256

                    x_clvl_selections_tbl(rowcount).lse_id := 8;
Line: 3257

                    x_clvl_selections_tbl(rowcount).lse_name := 'Party'  ;
Line: 3263

                x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3264

                x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3265

                x_clvl_selections_tbl(rowcount).rec_name := 'Party';
Line: 3266

                x_clvl_selections_tbl(rowcount).id1 := l_csr_party_rec_r.id1;
Line: 3267

                x_clvl_selections_tbl(rowcount).id2 := l_csr_party_rec_r.id2;
Line: 3268

                x_clvl_selections_tbl(rowcount).name := l_csr_party_rec_r.name;
Line: 3269

                x_clvl_selections_tbl(rowcount).clvl_id := l_csr_party_rec_r.id1;
Line: 3270

                x_clvl_selections_tbl(rowcount).clvl_name := l_csr_party_rec_r.name;
Line: 3271

                x_clvl_selections_tbl(rowcount).display_name := l_csr_party_rec_r.name || ',' || l_csr_party_Rec.description;
Line: 3272

                x_clvl_selections_tbl(rowcount).party_id := l_csr_party_rec_r.id1;
Line: 3273

                x_clvl_selections_tbl(rowcount).party_name := l_csr_party_rec_r.name;
Line: 3274

                x_clvl_selections_tbl(rowcount).description := l_csr_party_Rec_r.description;
Line: 3275

                x_clvl_selections_tbl(rowcount).lse_id := 8;
Line: 3276

                x_clvl_selections_tbl(rowcount).lse_name := 'Party'  ;
Line: 3281

                x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3282

                x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3283

                x_clvl_selections_tbl(rowcount).rec_name := 'Party';
Line: 3284

                x_clvl_selections_tbl(rowcount).id1 := l_csr_party_rec_b.id1;
Line: 3285

                x_clvl_selections_tbl(rowcount).id2 := l_csr_party_rec_b.id2;
Line: 3286

                x_clvl_selections_tbl(rowcount).name := l_csr_party_rec_b.name;
Line: 3287

                x_clvl_selections_tbl(rowcount).clvl_id := l_csr_party_rec_b.id1;
Line: 3288

                x_clvl_selections_tbl(rowcount).id2 := l_csr_party_rec_b.id2;
Line: 3289

                x_clvl_selections_tbl(rowcount).clvl_name := l_csr_party_rec_b.name;
Line: 3290

                x_clvl_selections_tbl(rowcount).display_name := l_csr_party_rec_b.name || ',' || l_csr_party_Rec.description;
Line: 3291

                x_clvl_selections_tbl(rowcount).party_id := l_csr_party_rec_b.id1;
Line: 3292

                x_clvl_selections_tbl(rowcount).party_name := l_csr_party_rec_b.name;
Line: 3293

                x_clvl_selections_tbl(rowcount).description := l_csr_party_Rec_b.description;
Line: 3294

                x_clvl_selections_tbl(rowcount).lse_id := 8;
Line: 3295

                x_clvl_selections_tbl(rowcount).lse_name := 'Party'  ;
Line: 3300

    END get_party_selections;
Line: 3302

    PROCEDURE Get_site_selections(p_clvl_filter_rec IN clvl_filter_rec,
                                  x_clvl_selections_tbl   OUT   NOCOPY   clvl_selections_tbl)
    IS

    CURSOR l_csr_get_site(p_party_id IN NUMBER ) IS
        SELECT DISTINCT parties.name party_name, parties.id1 party_id,
               party_site.id1 id1, party_site.party_site_number, party_site.id2,
               party_site.name party_site_name, party_site.description
        FROM   OKX_PARTIES_V parties,
               OKX_PARTY_SITES_V party_site
        WHERE  parties.id1 = p_party_id
        AND    party_site.party_id = parties.id1
        AND    party_site.status = 'A'
        ORDER BY parties.name ;
Line: 3318

        SELECT DISTINCT parties.name party_name, parties.id1 party_id,
               party_site.id1 id1, party_site.party_site_number, party_site.id2,
               party_site.name  party_site_name, party_site.description
        FROM   OKX_PARTIES_V parties,
               OKX_PARTY_SITES_V party_site
        WHERE  party_site.party_id = parties.id1
        AND    party_site.status = 'A'
        ORDER BY parties.name ;
Line: 3339

    l_party_selected VARCHAR2(15);
Line: 3366

                l_party_selected := l_party_Id;
Line: 3371

        IF p_clvl_filter_rec.clvl_find_id IS NOT NULL THEN /* If default = CUSTOMER, or find id has a value then select covered sites only for given party id */
            -- BUG 4915711 --
            --  FOR l_site_csr_rec IN l_csr_get_site(l_party_id) LOOP
            OPEN l_csr_get_site(l_party_id);
Line: 3382

                    x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3383

                    x_clvl_selections_tbl(rowcount).rec_name := 'Site';
Line: 3384

                    x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3387

                    x_clvl_selections_tbl(rowcount).id1 := l_get_all_sites_rec.party_id1;
Line: 3388

                    x_clvl_selections_tbl(rowcount).name := l_get_all_sites_rec.party_name;
Line: 3389

                    x_clvl_selections_tbl(rowcount).lse_id := 10;
Line: 3390

                    x_clvl_selections_tbl(rowcount).lse_name := 'Site';
Line: 3395

                x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3396

                x_clvl_selections_tbl(rowcount).rec_name := 'Site';
Line: 3397

                x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3399

                x_clvl_selections_tbl(rowcount).id1 := l_get_all_sites_rec.party_sites_id1;
Line: 3400

                x_clvl_selections_tbl(rowcount).id2 := l_get_all_sites_rec.party_sites_id2;
Line: 3401

                x_clvl_selections_tbl(rowcount).name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name;
Line: 3402

                x_clvl_selections_tbl(rowcount).display_name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name ||' '|| l_get_all_sites_rec.party_desc;
Line: 3403

                x_clvl_selections_tbl(rowcount).clvl_id := l_get_all_sites_rec.party_sites_id1;
Line: 3404

                x_clvl_selections_tbl(rowcount).clvl_name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name;
Line: 3405

                x_clvl_selections_tbl(rowcount).description := l_get_all_sites_rec.party_desc;
Line: 3407

                x_clvl_selections_tbl(rowcount).lse_id := 10;
Line: 3409

                x_clvl_selections_tbl(rowcount).lse_name := 'Site';
Line: 3439

                            x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3440

                            x_clvl_selections_tbl(rowcount).rec_name := 'Site';
Line: 3441

                            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3444

                            x_clvl_selections_tbl(rowcount).id1 := l_get_all_sites_rec.party_id1;
Line: 3445

                            x_clvl_selections_tbl(rowcount).name := l_get_all_sites_rec.party_name;
Line: 3447

                            x_clvl_selections_tbl(rowcount).lse_id := 10;
Line: 3448

                            x_clvl_selections_tbl(rowcount).lse_name := 'Site';
Line: 3455

                        x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3456

                        x_clvl_selections_tbl(rowcount).rec_name := 'Site';
Line: 3457

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3459

                        x_clvl_selections_tbl(rowcount).id1 := l_get_all_sites_rec.party_sites_id1;
Line: 3460

                        x_clvl_selections_tbl(rowcount).id2 := l_get_all_sites_rec.party_sites_id2;
Line: 3461

                        x_clvl_selections_tbl(rowcount).name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name;
Line: 3462

                        x_clvl_selections_tbl(rowcount).display_name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name ||' '|| l_get_all_sites_rec.party_desc;
Line: 3463

                        x_clvl_selections_tbl(rowcount).clvl_id := l_get_all_sites_rec.party_sites_id1;
Line: 3464

                        x_clvl_selections_tbl(rowcount).clvl_name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name;
Line: 3465

                        x_clvl_selections_tbl(rowcount).description := l_get_all_sites_rec.party_desc;
Line: 3467

                        x_clvl_selections_tbl(rowcount).lse_id := 10;
Line: 3468

                        x_clvl_selections_tbl(rowcount).lse_name := 'Site';
Line: 3492

                        x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3493

                        x_clvl_selections_tbl(rowcount).rec_name := 'Site';
Line: 3494

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3496

                        x_clvl_selections_tbl(rowcount).id1 := l_site_csr_rec.party_id;
Line: 3497

                        x_clvl_selections_tbl(rowcount).name := l_site_csr_rec.party_name;
Line: 3499

                        x_clvl_selections_tbl(rowcount).id1 := l_get_all_sites_rec.party_id1;
Line: 3500

                        x_clvl_selections_tbl(rowcount).name := l_get_all_sites_rec.party_name;
Line: 3502

                        x_clvl_selections_tbl(rowcount).lse_id := 10;
Line: 3503

                        x_clvl_selections_tbl(rowcount).lse_name := 'Site';
Line: 3510

                    x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3511

                    x_clvl_selections_tbl(rowcount).rec_name := 'Site';
Line: 3512

                    x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3514

                    x_clvl_selections_tbl(rowcount).clvl_id := l_get_all_sites_rec.party_sites_id1;
Line: 3515

                    x_clvl_selections_tbl(rowcount).id2 := l_get_all_sites_rec.party_sites_id2;
Line: 3516

                    x_clvl_selections_tbl(rowcount).clvl_name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name;
Line: 3517

                    x_clvl_selections_tbl(rowcount).display_name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name ||' '|| l_get_all_sites_rec.party_desc;
Line: 3518

                    x_clvl_selections_tbl(rowcount).id1 := l_get_all_sites_rec.party_sites_id1;
Line: 3519

                    x_clvl_selections_tbl(rowcount).name := l_get_all_sites_rec.party_sites_number || '-' || l_get_all_sites_rec.party_sites_name;
Line: 3520

                    x_clvl_selections_tbl(rowcount).description := l_get_all_sites_rec.party_desc;
Line: 3522

                    x_clvl_selections_tbl(rowcount).lse_id := 10;
Line: 3523

                    x_clvl_selections_tbl(rowcount).lse_name := 'Site';
Line: 3531

    END get_site_selections;
Line: 3533

    PROCEDURE Get_system_selections(p_clvl_filter_rec IN clvl_filter_rec,
                                    x_clvl_selections_tbl   OUT   NOCOPY   clvl_selections_tbl)
    IS

    -- BUG 4171350 --
    -- Added check for Language used for Session

    /** Covered Systems by customer */
    CURSOR l_csr_get_cust_system(p_customer_id IN NUMBER ) IS
        SELECT cust_acc.id1, cust_acc.name,
               CSB.system_id, '#' id2, CSB.system_number,
               CST.description, CST.name system_name
        FROM   CSI_SYSTEMS_B CSB, CSI_SYSTEMS_TL CST, OKX_CUSTOMER_ACCOUNTS_V cust_acc
        WHERE cust_acc.id1 = p_customer_id
        AND   CSB.system_id = CST.system_id
        AND   CSB.Customer_id = cust_acc.id1
        AND   CST.language = userenv('lang') -- new
        AND   SYSDATE BETWEEN NVL(CSB.start_date_active, SYSDATE) AND NVL(CSB.end_date_active, SYSDATE)

        ORDER BY cust_acc.id1, CSB.system_id;
Line: 3556

        SELECT cust_acc.id1, cust_acc.name,
               CSB.system_id, '#' id2, CSB.system_number,
               CST.description, CST.name system_name
        FROM   CSI_SYSTEMS_B CSB, CSI_SYSTEMS_TL CST, OKX_CUSTOMER_ACCOUNTS_V cust_acc
        WHERE  CSB.system_id = CST.system_id
        AND    CSB.Customer_id = cust_acc.id1
        AND    SYSDATE BETWEEN NVL(CSB.start_date_active, SYSDATE)  AND NVL(CSB.end_date_active, SYSDATE)
        AND    CST.language = userenv('lang') -- new
        ORDER  BY cust_acc.id1, CSB.system_id;
Line: 3569

        SELECT parties.id1, parties.name, CSB.system_id, parties.id2 id2,
               CST.name system_name, CST.description, CSB.system_number
        FROM   CSI_SYSTEMS_B CSB,
               CSI_SYSTEMS_TL CST,
               OKX_PARTIES_V parties,
               OKX_CUSTOMER_ACCOUNTS_V cust_acc
        WHERE parties.id1 = p_party_id
        AND   cust_acc.party_id = parties.id1
        AND   CSB.system_id = CST.system_id
        AND   CSB.customer_id = cust_acc.id1
        AND    CST.language = userenv('lang') -- new
        AND   SYSDATE BETWEEN NVL(CSB.start_date_active, SYSDATE) AND NVL(CSB.end_date_active, SYSDATE);
Line: 3584

        SELECT parties.id1, parties.name, CSB.system_id, parties.id2 id2,
               CST.name system_name, CST.description,
               CSB.system_number
        FROM CSI_SYSTEMS_B CSB,
             CSI_SYSTEMS_TL CST,
             OKX_PARTIES_V parties,
             OKX_CUSTOMER_ACCOUNTS_V cust_acc
        WHERE cust_acc.party_id = parties.id1
        AND   CSB.system_id = CST.system_id
        AND   CSB.customer_id = cust_acc.id1
        AND    CST.language = userenv('lang') -- new
        AND   SYSDATE BETWEEN NVL(CSB.start_date_active, SYSDATE)  AND NVL(CSB.end_date_active, SYSDATE);
Line: 3600

        SELECT party_site.id1, party_site.party_site_number || '-' || party_site.name party_site_name, CSB.system_id,
               '#', CST.name system_name, CST.description,
               CSB.system_number, party_site.id2 id2
        FROM   CSI_SYSTEMS_B CSB, CSI_SYSTEMS_TL CST, OKX_PARTY_SITES_V party_site
        WHERE  party_site.id1 = p_party_site_id
        AND    CSB.system_id = CST.system_id
        AND    SYSDATE BETWEEN  NVL(CSB.start_date_active, SYSDATE) AND NVL(CSB.end_date_active, SYSDATE)
        AND    CSB.install_site_use_id = party_site.id1
        AND    CST.language = userenv('lang') -- new
        ORDER BY  party_site.id1, CSB.system_id;
Line: 3612

        SELECT party_site.id1, party_site.party_site_number || '-' || party_site.name party_site_name, CSB.system_id,
               '#', CST.name system_name, CST.description,
               CSB.system_number, party_site.id2 id2
        FROM   CSI_SYSTEMS_B CSB, CSI_SYSTEMS_TL CST, OKX_PARTY_SITES_V party_site
        WHERE  party_site.party_id = p_party_id
        AND    CSB.system_id = CST.system_id
        AND    SYSDATE BETWEEN  NVL(CSB.start_date_active, SYSDATE) AND NVL(CSB.end_date_active, SYSDATE)
        AND    CSB.install_site_use_id = party_site.id1
        AND    CST.language = userenv('lang') -- new
        ORDER BY  party_site.id1, CSB.system_id;
Line: 3624

        SELECT party_site.id1, party_site.party_site_number || '-' || party_site.name party_site_name,
               CSB.system_id, party_site.id2 id2, CST.name system_name, CST.description,
               CSB.system_number
        FROM   CSI_SYSTEMS_B CSB, CSI_SYSTEMS_TL CST, OKX_PARTY_SITES_V party_site
        WHERE  CSB.system_id = CST.system_id
        AND    SYSDATE BETWEEN NVL(CSB.start_date_active, SYSDATE) AND NVL(CSB.end_date_active, SYSDATE)
        AND    CSB.install_site_use_id = party_site.id1
        AND    CST.language = userenv('lang') -- new
        ORDER BY  party_site.id1, CSB.system_id;
Line: 3648

    l_party_selected NUMBER;
Line: 3670

                        x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3671

                        x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3672

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3673

                        x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1 /** Customer id */ ;
Line: 3674

                        x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.name /* customer name */ ;
Line: 3675

                        x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3676

                        x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3684

                    x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3685

                    x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3686

                    x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3687

                    x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 3688

                    x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3689

                    x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 3690

                    x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 3691

                    x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 3692

                    x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1; /** customer id **/
Line: 3693

                    x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.name;  /** customer name **/
Line: 3694

                    x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 3695

                    x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3696

                    x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3720

                                x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3721

                                x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3722

                                x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3723

                                x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3724

                                x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.name;
Line: 3725

                                x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3726

                                x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3735

                            x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3736

                            x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3737

                            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3738

                            x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 3739

                            x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3740

                            x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 3741

                            x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 3742

                            x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 3743

                            x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1; /** customer id **/
Line: 3744

                            x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.name;  /** customer name **/
Line: 3745

                            x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 3746

                            x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3747

                            x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3751

                        END LOOP; /* Select systems for given customer id */
Line: 3752

                    END LOOP; /* Select customer id */
Line: 3760

                            x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3761

                            x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3762

                            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3763

                            x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3764

                            x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.name;
Line: 3765

                            x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3766

                            x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3775

                        x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3776

                        x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3777

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3778

                        x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 3779

                        x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3780

                        x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 3781

                        x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 3782

                        x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 3783

                        x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1; /** customer id **/
Line: 3784

                        x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.name;  /** customer name **/
Line: 3785

                        x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 3786

                        x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3787

                        x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3791

                    END LOOP;  /** Select systems for all customers **/
Line: 3806

                        x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3807

                        x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3808

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3809

                        x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3811

                        x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.party_site_name;
Line: 3812

                        x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1;
Line: 3813

                        x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.party_site_name;
Line: 3814

                        x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3815

                        x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3823

                    x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3824

                    x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3825

                    x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3826

                    x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 3827

                    x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 3828

                    x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 3829

                    x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 3830

                    x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1; /** party id **/
Line: 3831

                    x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3832

                    x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.party_site_name;  /** party name **/
Line: 3833

                    x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 3834

                    x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3835

                    x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3856

                                x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3857

                                x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3858

                                x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3859

                                x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3860

                                x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.party_site_name;
Line: 3861

                                x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1;
Line: 3863

                                x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.party_site_name;
Line: 3864

                                x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3865

                                x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3875

                            x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3876

                            x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3877

                            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3878

                            x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 3879

                            x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 3880

                            x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 3881

                            x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1; /** party id **/
Line: 3882

                            x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 3883

                            x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3884

                            x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.party_site_name;  /** party name **/
Line: 3885

                            x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 3886

                            x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3887

                            x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3891

                        END LOOP; /* Select systems for given customer id */
Line: 3892

                    END LOOP; /* Select customer id */
Line: 3899

                            x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3900

                            x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3901

                            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3902

                            x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1;
Line: 3903

                            x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.party_site_name;
Line: 3904

                            x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3905

                            x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.party_site_name;
Line: 3906

                            x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3907

                            x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3916

                        x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3917

                        x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3918

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3919

                        x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 3920

                        x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 3921

                        x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 3922

                        x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1; /** party id **/
Line: 3923

                        x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 3924

                        x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3925

                        x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.party_site_name;  /** party name **/
Line: 3926

                        x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 3927

                        x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3928

                        x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3932

                    END LOOP;  /** Select systems for all customers **/
Line: 3940

                l_party_selected := l_party_id;
Line: 3942

                l_party_selected := p_clvl_filter_rec.clvl_find_id;
Line: 3945

            IF l_party_selected IS NOT NULL THEN

                FOR l_system_csr_rec IN l_csr_get_party_system(l_party_selected) LOOP
                    IF rowcount = 1 THEN
                        x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3950

                        x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3951

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3952

                        x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3953

                        x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 3954

                        x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.name;
Line: 3955

                        x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1;
Line: 3956

                        x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.name;
Line: 3957

                        x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3958

                        x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3965

                    x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 3966

                    x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 3967

                    x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 3968

                    x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 3969

                    x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 3970

                    x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 3971

                    x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 3972

                    x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 3973

                    x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1; /** party id **/
Line: 3974

                    x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.name;  /** party name **/
Line: 3975

                    x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 3976

                    x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 3977

                    x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 3992

                        l_party_selected := l_party_id_tbl(i).party_id;
Line: 3995

                        FOR l_system_csr_rec IN l_csr_get_party_system(l_party_selected) LOOP

                            IF rowcount = 1 THEN
                                x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 3999

                                x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 4000

                                x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 4001

                                x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 4002

                                x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.name;
Line: 4003

                                x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1;
Line: 4004

                                x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.name;
Line: 4005

                                x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 4006

                                x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 4015

                            x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 4016

                            x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 4017

                            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 4018

                            x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 4019

                            x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 4020

                            x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 4021

                            x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 4022

                            x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 4023

                            x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1;
Line: 4024

                            x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.name;  /** party name **/
Line: 4025

                            x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 4026

                            x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 4027

                            x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 4031

                        END LOOP; /* Select systems for given customer id */
Line: 4032

                    END LOOP; /* Select customer id */
Line: 4039

                            x_clvl_selections_tbl(rowcount).rec_type := 'P';
Line: 4040

                            x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 4041

                            x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 4042

                            x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 4043

                            x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 4044

                            x_clvl_selections_tbl(rowcount).name := l_system_csr_rec.name;
Line: 4045

                            x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1;
Line: 4046

                            x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.name;
Line: 4047

                            x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 4048

                            x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 4058

                        x_clvl_selections_tbl(rowcount).rec_type := 'C';
Line: 4059

                        x_clvl_selections_tbl(rowcount).rec_name := 'System';
Line: 4060

                        x_clvl_selections_tbl(rowcount).rec_no := rowcount;
Line: 4061

                        x_clvl_selections_tbl(rowcount).id2 := l_system_csr_rec.id2;
Line: 4062

                        x_clvl_selections_tbl(rowcount).id1 := l_system_csr_rec.id1;
Line: 4063

                        x_clvl_selections_tbl(rowcount).clvl_id := l_system_csr_rec.system_id;
Line: 4064

                        x_clvl_selections_tbl(rowcount).clvl_name := l_system_csr_rec.system_name;
Line: 4065

                        x_clvl_selections_tbl(rowcount).display_name := l_system_csr_rec.system_name ||' , '|| l_system_csr_rec.description ||' , '|| l_system_csr_rec.system_number;
Line: 4066

                        x_clvl_selections_tbl(rowcount).party_id := l_system_csr_rec.id1; /** party id **/
Line: 4067

                        x_clvl_selections_tbl(rowcount).party_name := l_system_csr_rec.name;  /** party name **/
Line: 4068

                        x_clvl_selections_tbl(rowcount).description := l_system_csr_Rec.description;
Line: 4069

                        x_clvl_selections_tbl(rowcount).lse_id := 11;
Line: 4070

                        x_clvl_selections_tbl(rowcount).lse_name := 'System';
Line: 4074

                    END LOOP;  /** Select systems for all customers **/
Line: 4080

    END get_system_selections;
Line: 4082

    PROCEDURE GetSelections_Prod(p_api_version         IN  NUMBER
                                 , p_init_msg_list       IN  VARCHAR2
                                 , p_clvl_filter_rec     IN  clvl_filter_rec
                                 , x_return_status       OUT NOCOPY VARCHAR2
                                 , x_msg_count           OUT NOCOPY NUMBER
                                 , x_msg_data            OUT NOCOPY VARCHAR2
                                 , x_prod_selections_tbl OUT NOCOPY prod_selections_tbl)
    IS
    lf_prod_selections_tbl prod_selections_tbl;
Line: 4095

        get_product_selection(p_clvl_filter_rec,
                              lf_prod_selections_tbl);
Line: 4098

        FOR rowcount IN 1 .. lf_prod_selections_tbl.COUNT LOOP

            x_prod_selections_tbl(rowcount).rec_type := lf_prod_selections_tbl(rowcount).rec_type;
Line: 4102

            x_prod_selections_tbl(rowcount).rec_name := 'Item';
Line: 4104

            x_prod_selections_tbl(rowcount).rec_no := rowcount;
Line: 4106

            x_prod_selections_tbl(rowcount).cp_id := lf_prod_selections_tbl(rowcount).cp_id;
Line: 4108

            x_prod_selections_tbl(rowcount).cp_id2 := lf_prod_selections_tbl(rowcount).cp_id2;
Line: 4110

            x_prod_selections_tbl(rowcount).ser_number := lf_prod_selections_tbl(rowcount).ser_number;
Line: 4112

            x_prod_selections_tbl(rowcount).ref_number := lf_prod_selections_tbl(rowcount).ref_number ;
Line: 4114

            x_prod_selections_tbl(rowcount).quantity := lf_prod_selections_tbl(rowcount).quantity;
Line: 4116

            x_prod_selections_tbl(rowcount).orig_net_amt := lf_prod_selections_tbl(rowcount).orig_net_amt;
Line: 4118

            x_prod_selections_tbl(rowcount).price := lf_prod_selections_tbl(rowcount).price;
Line: 4120

            x_prod_selections_tbl(rowcount).inventory_item_id := lf_prod_selections_tbl(rowcount).inventory_item_id;
Line: 4122

            x_prod_selections_tbl(rowcount).site_id := lf_prod_selections_tbl(rowcount).site_id;
Line: 4124

            x_prod_selections_tbl(rowcount).uom_code := lf_prod_selections_tbl(rowcount).uom_code;
Line: 4126

            x_prod_selections_tbl(rowcount).name := lf_prod_selections_tbl(rowcount).name;
Line: 4128

            x_prod_selections_tbl(rowcount).display_name := lf_prod_selections_tbl(rowcount).display_name;
Line: 4130

            x_prod_selections_tbl(rowcount).description := lf_prod_selections_tbl(rowcount).description;
Line: 4132

            x_prod_selections_tbl(rowcount).model_level := lf_prod_selections_tbl(rowcount).model_level;
Line: 4133

            x_prod_selections_tbl(rowcount).site_name := lf_prod_selections_tbl(rowcount).site_name;
Line: 4134

            x_prod_selections_tbl(rowcount).model_level := lf_prod_selections_tbl(rowcount).model_level;
Line: 4139

            x_prod_selections_tbl(rowcount).ext_reference := lf_prod_selections_tbl(rowcount).ext_reference;
Line: 4149

    END GetSelections_Prod;
Line: 4152

    PROCEDURE GetSelections_other(p_api_version         IN  NUMBER
                                  , p_init_msg_list       IN  VARCHAR2
                                  , p_clvl_filter_rec     IN  clvl_filter_rec
                                  , x_return_status       OUT NOCOPY VARCHAR2
                                  , x_msg_count           OUT NOCOPY NUMBER
                                  , x_msg_data            OUT NOCOPY VARCHAR2
                                  , x_clvl_selections_tbl OUT  NOCOPY clvl_selections_tbl)
    IS
    l_clvl_selections_tbl  clvl_selections_tbl ;
Line: 4166

            get_party_selections(p_clvl_filter_rec,
                                 l_clvl_selections_tbl);
Line: 4169

            FOR rowcount IN 1 .. l_clvl_selections_tbl.COUNT LOOP

                x_clvl_selections_tbl(rowcount).rec_no := l_clvl_selections_tbl(rowcount).rec_no;
Line: 4173

                x_clvl_selections_tbl(rowcount).rec_name := l_clvl_selections_tbl(rowcount).rec_name;
Line: 4175

                x_clvl_selections_tbl(rowcount).rec_type := l_clvl_selections_tbl(rowcount).rec_type;
Line: 4177

                x_clvl_selections_tbl(rowcount).id1 := l_clvl_selections_tbl(rowcount).id1;
Line: 4179

                x_clvl_selections_tbl(rowcount).name := l_clvl_selections_tbl(rowcount).name;
Line: 4181

                x_clvl_selections_tbl(rowcount).id2 := l_clvl_selections_tbl(rowcount).id2;
Line: 4183

                x_clvl_selections_tbl(rowcount).Party_id := l_clvl_selections_tbl(rowcount).party_id;
Line: 4185

                x_clvl_selections_tbl(rowcount).party_name := l_clvl_selections_tbl(rowcount).party_name;
Line: 4187

                x_clvl_selections_tbl(rowcount).description := l_clvl_selections_tbl(rowcount).description;
Line: 4189

                x_clvl_selections_tbl(rowcount).display_name := l_clvl_selections_tbl(rowcount).display_name;
Line: 4191

                x_clvl_selections_tbl(rowcount).clvl_id := l_clvl_selections_tbl(rowcount).clvl_id;
Line: 4193

                x_clvl_selections_tbl(rowcount).clvl_name := l_clvl_selections_tbl(rowcount).clvl_name;
Line: 4195

                x_clvl_selections_tbl(rowcount).lse_id := l_clvl_selections_tbl(rowcount).lse_id;
Line: 4197

                x_clvl_selections_tbl(rowcount).lse_name := l_clvl_selections_tbl(rowcount).lse_name;
Line: 4204

            get_customer_selections(p_clvl_filter_rec,
                                    l_clvl_selections_tbl);
Line: 4207

            FOR rowcount IN 1 .. l_clvl_selections_tbl.COUNT LOOP

                x_clvl_selections_tbl(rowcount).rec_no := l_clvl_selections_tbl(rowcount).rec_no;
Line: 4211

                x_clvl_selections_tbl(rowcount).rec_name := l_clvl_selections_tbl(rowcount).rec_name;
Line: 4213

                x_clvl_selections_tbl(rowcount).rec_type := l_clvl_selections_tbl(rowcount).rec_type;
Line: 4215

                x_clvl_selections_tbl(rowcount).id1 := l_clvl_selections_tbl(rowcount).id1;
Line: 4217

                x_clvl_selections_tbl(rowcount).name := l_clvl_selections_tbl(rowcount).name;
Line: 4219

                x_clvl_selections_tbl(rowcount).id2 := l_clvl_selections_tbl(rowcount).id2;
Line: 4221

                x_clvl_selections_tbl(rowcount).Party_id := l_clvl_selections_tbl(rowcount).party_id;
Line: 4223

                x_clvl_selections_tbl(rowcount).party_name := l_clvl_selections_tbl(rowcount).party_name;
Line: 4225

                x_clvl_selections_tbl(rowcount).description := l_clvl_selections_tbl(rowcount).description;
Line: 4227

                x_clvl_selections_tbl(rowcount).display_name := l_clvl_selections_tbl(rowcount).display_name;
Line: 4229

                x_clvl_selections_tbl(rowcount).clvl_id := l_clvl_selections_tbl(rowcount).clvl_id;
Line: 4231

                x_clvl_selections_tbl(rowcount).clvl_name := l_clvl_selections_tbl(rowcount).clvl_name;
Line: 4233

                x_clvl_selections_tbl(rowcount).lse_id := l_clvl_selections_tbl(rowcount).lse_id;
Line: 4235

                x_clvl_selections_tbl(rowcount).lse_name := l_clvl_selections_tbl(rowcount).lse_name;
Line: 4241

            get_site_selections(p_clvl_filter_rec,
                                l_clvl_selections_tbl);
Line: 4244

            FOR rowcount IN 1 .. l_clvl_selections_tbl.COUNT LOOP

                x_clvl_selections_tbl(rowcount).rec_no := l_clvl_selections_tbl(rowcount).rec_no;
Line: 4248

                x_clvl_selections_tbl(rowcount).rec_name := l_clvl_selections_tbl(rowcount).rec_name;
Line: 4250

                x_clvl_selections_tbl(rowcount).rec_type := l_clvl_selections_tbl(rowcount).rec_type;
Line: 4252

                x_clvl_selections_tbl(rowcount).id1 := l_clvl_selections_tbl(rowcount).id1;
Line: 4254

                x_clvl_selections_tbl(rowcount).name := l_clvl_selections_tbl(rowcount).name;
Line: 4256

                x_clvl_selections_tbl(rowcount).id2 := l_clvl_selections_tbl(rowcount).id2;
Line: 4258

                x_clvl_selections_tbl(rowcount).Party_id := l_clvl_selections_tbl(rowcount).party_id;
Line: 4260

                x_clvl_selections_tbl(rowcount).party_name := l_clvl_selections_tbl(rowcount).party_name;
Line: 4262

                x_clvl_selections_tbl(rowcount).description := l_clvl_selections_tbl(rowcount).description;
Line: 4264

                x_clvl_selections_tbl(rowcount).display_name := l_clvl_selections_tbl(rowcount).display_name;
Line: 4266

                x_clvl_selections_tbl(rowcount).clvl_id := l_clvl_selections_tbl(rowcount).clvl_id;
Line: 4268

                x_clvl_selections_tbl(rowcount).clvl_name := l_clvl_selections_tbl(rowcount).clvl_name;
Line: 4270

                x_clvl_selections_tbl(rowcount).lse_id := l_clvl_selections_tbl(rowcount).lse_id;
Line: 4272

                x_clvl_selections_tbl(rowcount).lse_name := l_clvl_selections_tbl(rowcount).lse_name;
Line: 4280

            get_system_selections(p_clvl_filter_rec,
                                  l_clvl_selections_tbl);
Line: 4284

            FOR rowcount IN 1 .. l_clvl_selections_tbl.COUNT LOOP

                x_clvl_selections_tbl(rowcount).rec_no := l_clvl_selections_tbl(rowcount).rec_no;
Line: 4288

                x_clvl_selections_tbl(rowcount).rec_name := l_clvl_selections_tbl(rowcount).rec_name;
Line: 4290

                x_clvl_selections_tbl(rowcount).rec_type := l_clvl_selections_tbl(rowcount).rec_type;
Line: 4292

                x_clvl_selections_tbl(rowcount).id1 := l_clvl_selections_tbl(rowcount).id1;
Line: 4294

                x_clvl_selections_tbl(rowcount).name := l_clvl_selections_tbl(rowcount).name;
Line: 4296

                x_clvl_selections_tbl(rowcount).id2 := l_clvl_selections_tbl(rowcount).id2;
Line: 4298

                x_clvl_selections_tbl(rowcount).Party_id := l_clvl_selections_tbl(rowcount).party_id;
Line: 4300

                x_clvl_selections_tbl(rowcount).party_name := l_clvl_selections_tbl(rowcount).party_name;
Line: 4302

                x_clvl_selections_tbl(rowcount).description := l_clvl_selections_tbl(rowcount).description;
Line: 4304

                x_clvl_selections_tbl(rowcount).display_name := l_clvl_selections_tbl(rowcount).display_name;
Line: 4306

                x_clvl_selections_tbl(rowcount).clvl_id := l_clvl_selections_tbl(rowcount).clvl_id;
Line: 4308

                x_clvl_selections_tbl(rowcount).clvl_name := l_clvl_selections_tbl(rowcount).clvl_name;
Line: 4310

                x_clvl_selections_tbl(rowcount).lse_id := l_clvl_selections_tbl(rowcount).lse_id;
Line: 4312

                x_clvl_selections_tbl(rowcount).lse_name := l_clvl_selections_tbl(rowcount).lse_name;
Line: 4318

    END GetSelections_other;
Line: 4328

        SELECT name
        FROM OKX_SYSTEM_ITEMS_V
        WHERE id1 = p_inventory_item_id
        AND  TRUNC(SYSDATE) BETWEEN trunc(nvl(start_date_active, SYSDATE)) AND trunc(nvl(end_date_active, SYSDATE))
        AND ROWNUM < 2;
Line: 4354

        SELECT description
        FROM OKX_SYSTEM_ITEMS_V
        WHERE id1 = p_inventory_item_id
        AND  TRUNC(SYSDATE) BETWEEN trunc(nvl(start_date_active, SYSDATE)) AND trunc(nvl(end_date_active, SYSDATE))
        AND ROWNUM < 2;
Line: 4381

        SELECT description
        FROM OKX_SYSTEM_ITEMS_V
        WHERE inventory_item_id = p_inventory_item_id
        AND   organization_id = p_organization_id
        AND  TRUNC(SYSDATE) BETWEEN trunc(nvl(start_date_active, SYSDATE)) AND trunc(nvl(end_date_active, SYSDATE))
        AND ROWNUM < 2;
Line: 4409

        SELECT concatenated_segments name
        FROM MTL_SYSTEM_ITEMS_KFV
        WHERE inventory_item_id = p_inventory_item_id
        AND   organization_id = p_organization_id
        AND  TRUNC(SYSDATE) BETWEEN trunc(nvl(start_date_active, SYSDATE)) AND trunc(nvl(end_date_active, SYSDATE))
        AND ROWNUM < 2;
Line: 4434

        SELECT chr_id
              , cle_id
              , account_class
              , code_combination_id
              , PERCENT
        FROM  oks_rev_distributions
        WHERE cle_id = p_cle_id;
Line: 4453

            x_rev_tbl(i).last_updated_by := OKC_API.G_MISS_NUM;
Line: 4454

            x_rev_tbl(i).last_update_date := OKC_API.G_MISS_DATE;
Line: 4455

            x_rev_tbl(i).last_update_login := OKC_API.G_MISS_NUM;
Line: 4476

        OKS_REV_DISTR_PUB.insert_Revenue_Distr
        (p_api_version => l_api_version
         , x_return_status => x_status
         , x_msg_count => l_msg_count
         , x_msg_data => l_msg_data
         , p_rdsv_tbl => p_rev_tbl
         , x_rdsv_tbl => l_rev_tbl);
Line: 4489

        SELECT
          PERCENT,
          chr_id,
          ctc_id,
          sales_credit_type_id1,
          sales_credit_type_id2
        FROM OKS_K_SALES_CREDITS
        WHERE cle_id = p_cle_id;
Line: 4510

            x_scrv_tbl(i).last_updated_by := OKC_API.G_MISS_NUM;
Line: 4511

            x_scrv_tbl(i).last_update_date := OKC_API.G_MISS_DATE;
Line: 4531

        OKS_SALES_CREDIT_PUB.insert_Sales_credit(
                                                 p_api_version => l_api_version,
                                                 x_return_status => x_status,
                                                 x_msg_count => l_msg_count,
                                                 x_msg_data => l_msg_data,
                                                 p_scrv_tbl => p_scrv_tbl,
                                                 x_scrv_tbl => l_scrv_tbl);
Line: 4540

    PROCEDURE update_line_item(p_cle_id   IN NUMBER,
                               p_item_id  IN VARCHAR2,
                               x_status   OUT NOCOPY VARCHAR2) IS
    l_api_version   NUMBER := 1.0;
Line: 4549

        SELECT id
        FROM   okc_k_items_v
        WHERE  cle_id = p_cle_id;
Line: 4557

        OKC_CONTRACT_ITEM_PUB.update_contract_item(
                                                   p_api_version => l_api_version,
                                                   x_return_status => x_status,
                                                   x_msg_count => l_msg_count,
                                                   x_msg_data => l_msg_data,
                                                   p_cimv_rec => l_cimv_rec_in,
                                                   x_cimv_rec => l_cimv_rec_out);
Line: 4564

    END update_line_item;
Line: 4571

        SELECT COUNT( * )
        FROM  okc_k_lines_b
        WHERE cle_id = p_cle_id
        AND   lse_id IN (7, 8, 9, 10, 11, 35, 18, 25);
Line: 4577

        SELECT id, price_negotiated
        FROM okc_k_lines_b
        WHERE cle_id = p_cle_id
        AND lse_id IN (7, 8, 9, 10, 11, 35, 18, 25);
Line: 4610

        OKC_CONTRACT_PUB.update_contract_line(
                                              p_api_version => l_api_version,
                                              x_return_status => x_status,
                                              x_msg_count => l_msg_count,
                                              x_msg_data => l_msg_data,
                                              p_clev_tbl => l_clev_tbl_in,
                                              x_clev_tbl => l_clev_tbl_out);
Line: 4628

        SELECT inv_rule_id
        FROM okc_k_lines_b
        WHERE id = p_id;
Line: 4641

        SELECT id
              , chr_id
              , cle_id
              , dnz_chr_id
              , sequence_no
              , uom_code
              , start_date
              , end_date
              , level_periods
              , uom_per_period
              , advance_periods
              , level_amount
              , invoice_offset_days
              , interface_offset_days
              , comments
              , due_arr_yn
              , amount
              , lines_detailed_yn
        FROM oks_stream_levels_b
        WHERE cle_id = p_cle_id;
Line: 4663

        SELECT billing_schedule_type
        FROM OKS_K_LINES_V
        WHERE cle_id = p_cle_id;
Line: 4733

        SELECT COVERAGE_SCHEDULE_ID
        FROM   mtl_system_items_b
        WHERE  inventory_item_id = p_item_id
        AND    organization_id = nvl(l_org_id, -99) ;
Line: 4750

        SELECT id
        FROM   okc_k_lines_b
        WHERE  cle_id = p_cle_id
        AND    lse_id IN(2, 20);
Line: 4846

    PROCEDURE UpdateIRTRule(p_chr_id        IN  NUMBER
                            , p_cle_id        IN  NUMBER
                            , p_invoice_text  IN  VARCHAR2
                            , p_api_version   IN  NUMBER
                            , p_init_msg_list IN  VARCHAR2
                            , x_return_status OUT NOCOPY VARCHAR2
                            , x_tax_value     OUT NOCOPY NUMBER
                            , x_AMOUNT_INCLUDES_TAX_FLAG OUT NOCOPY VARCHAR2
                            , x_total         OUT NOCOPY NUMBER)

    IS

    l_khrv_tbl OKS_CONTRACT_HDR_PUB.khrv_tbl_type;
Line: 4866

        SELECT id, object_version_number --BUG#4066428 hkamdar 01/21/05 added object_version_number
        FROM OKS_K_HEADERS_V
        WHERE chr_id = p_chr_id;
Line: 4872

        SELECT id, object_version_number
        FROM OKS_K_LINES_V
        WHERE dnz_chr_id = p_dnz_chr_id
        AND cle_id = p_cle_id;
Line: 4880

        SELECT cle.id, SUM(kln.tax_amount)
        FROM OKS_K_LINES_V kln, OKC_K_LINES_V cle
        WHERE cle.dnz_chr_id = p_dnz_chr_id
        AND cle.cle_id IS NULL
        AND kln.cle_id = cle.id;
Line: 4890

        SELECT MAX(kln.tax_amount)
        FROM OKS_K_LINES_V kln, OKC_K_LINES_V cle
        WHERE cle.dnz_chr_id = p_dnz_chr_id
        AND cle.cle_id = p_cle_id
        AND kln.cle_id = cle.id;
Line: 4911

        SELECT	nvl(SUM(nvl(tax_amount, 0)), 0)
        FROM    okc_k_lines_b cle, oks_k_lines_b sle
        WHERE   cle.cle_id = p_cle_id
        AND     cle.lse_id IN (7, 8, 9, 10, 11, 18, 25, 35)
        AND     cle.id = sle.cle_id
        AND     cle.dnz_chr_id = sle.dnz_chr_id
        AND     cle.date_cancelled IS NULL;
Line: 4920

        SELECT  nvl(SUM(nvl(tax_amount, 0)), 0)
        FROM    okc_k_lines_b cle, oks_k_lines_b sle
        WHERE   cle.dnz_chr_id = p_chr_id
        AND     cle.lse_id IN (1, 12, 14, 19, 46)
        AND     cle.cle_id IS NULL
        AND     cle.id = sle.cle_id
        AND     cle.dnz_chr_id = sle.dnz_chr_id;
Line: 4958

        OKS_CONTRACT_LINE_PUB.update_line(
                                          p_api_version => p_api_version,
                                          p_init_msg_list => p_init_msg_list,
                                          x_return_status => l_return_status,
                                          x_msg_count => l_msg_count,
                                          x_msg_data => l_msg_data,
                                          p_klnv_tbl => l_klnv_tbl,
                                          x_klnv_tbl => lx_klnv_tbl,
                                          p_validate_yn => l_validate_yn);
Line: 4994

        OKS_CONTRACT_HDR_PUB.update_header(p_api_version => p_api_version,
                                           p_init_msg_list => p_init_msg_list,
                                           x_return_status => l_return_status,
                                           x_msg_count => l_msg_count,
                                           x_msg_data => l_msg_data,
                                           p_khrv_tbl => l_khrv_tbl,
                                           x_khrv_tbl => lx_khrv_tbl,
                                           p_validate_yn => l_validate_yn);
Line: 5013

    END UpdateIRTRule;
Line: 5017

    PROCEDURE UpdateIRTRule_Subline(p_cle_id        IN  NUMBER
                                    , p_item_desc     IN  VARCHAR2
                                    , p_start_date    IN  DATE
                                    , p_end_date      IN  DATE
                                    , x_return_status OUT NOCOPY VARCHAR2
                                    )
    IS

    l_klnv_tbl_in OKS_CONTRACT_LINE_PUB.klnv_tbl_type;
Line: 5030

        SELECT cle.lse_id
             , cle.id line_id
             , cle.start_date
             , cle.end_date
             , cle.price_negotiated amt
             , cle.dnz_chr_id chr_id
             , kln.id kln_id
             , kln.object_version_number
        FROM okc_k_lines_b cle,
             oks_k_lines_b kln
        WHERE cle.cle_id = p_cle_id
        AND  kln.cle_id = cle.id
        AND  lse_id NOT IN (2, 15, 20, 46);
Line: 5062

        SELECT jtot_object1_code
              , object1_id1
              , object1_id2
              , number_of_items
        FROM  okc_k_items
        WHERE cle_id = p_cle_id;
Line: 5146

            oks_contract_line_pub.update_line (
                                               p_api_version => 1.0,
                                               p_init_msg_list => l_init_msg_list,
                                               x_return_status => l_return_status,
                                               x_msg_count => l_msg_count,
                                               x_msg_data => l_msg_data,
                                               p_klnv_tbl => l_klnv_tbl_in,
                                               x_klnv_tbl => lx_klnv_tbl,
                                               p_validate_yn => l_validate_yn) ;
Line: 5160

    END UpdateIRTRule_Subline;
Line: 5166

    PROCEDURE update_header_amount(p_cle_id IN NUMBER,
                                   x_status  OUT NOCOPY VARCHAR2) IS
    l_api_version  CONSTANT NUMBER := 1.0;
Line: 5178

        SELECT nvl(SUM(price_negotiated), 0) SUM
        FROM okc_k_lines_b
        WHERE dnz_chr_id = p_chr_id
        AND lse_id IN (7, 8, 9, 10, 11, 35, 13, 18, 25)
        AND date_cancelled IS NULL; --ignore cancelled sublines
Line: 5191

                okc_contract_pub.update_contract_header (
                                                         p_api_version => l_api_version,
                                                         p_init_msg_list => l_init_msg_list,
                                                         x_return_status => l_return_status,
                                                         x_msg_count => l_msg_count,
                                                         x_msg_data => l_msg_data,
                                                         p_chrv_tbl => l_chrv_tbl_in,
                                                         x_chrv_tbl => l_chrv_tbl_out );
Line: 5202

    END update_header_amount;
Line: 5217

        SELECT dnz_chr_id, start_date, end_date, object_version_number, lse_id
        FROM   okc_k_lines_b
        WHERE  id = p_source_rec.cle_id;
Line: 5223

        SELECT contract_number_modifier
        FROM   okc_k_headers_b
        WHERE  id = p_chr_id;
Line: 5252

    l_select_renewal_flag BOOLEAN;
Line: 5286

    SELECT id
    FROM  okc_rule_groups_b
    WHERE cle_id = p_cle_id; */
Line: 5291

        SELECT object1_id1, object1_id2, jtot_object1_code
        FROM   okc_k_items
        WHERE cle_id = p_cle_id;
Line: 5300

        SELECT nvl(SUM(price_negotiated), 0) amt
        FROM   okc_k_lines_b
        WHERE  cle_id = p_cle_id
        AND	   date_cancelled IS NULL; ---Added condition to exclude cancelled sublines
Line: 5308

        SELECT nvl(SUM(price_negotiated), 0) amt
        FROM   okc_k_lines_b
        WHERE  dnz_chr_id = p_chr_id
        AND cle_id IS NULL
        AND	 date_cancelled IS NULL; ---Added condition to exclude cancelled lines
Line: 5316

        SELECT currency_code
        FROM   okc_k_headers_b
        WHERE  id = p_chr_id;
Line: 5331

        SELECT SUM(nvl(cancelled_amount, 0))
        FROM   okc_k_lines_b
        WHERE  dnz_chr_id = p_chr_id
        AND cle_id IS NULL;
Line: 5338

        SELECT nvl(SUM(nvl(price_negotiated, 0)), 0) --BUG FIX 4758886 --Forced to return this query 0 value
        FROM  okc_k_lines_b
        WHERE cle_id = p_cle_id
        AND   date_cancelled IS NOT NULL; --Condition to consider only the cancelled sublines
Line: 5353

                SELECT pm_program_id,pm_conf_req_yn,pm_sch_exists_yn
                FROM oks_k_lines_b WHERE cle_id=p_covtemp_id;
Line: 5358

                SELECT start_date,end_date
                FROM okc_k_lines_b WHERE id=p_cle_id;
Line: 5415

            SELECT nvl(MAX(to_number(line_number)), 0)
            INTO   l_top_line_number
            FROM   OKC_K_LINES_B
            WHERE  dnz_chr_id = g_chr_id
            AND    cle_id IS NULL;
Line: 5496

                UPDATE okc_k_lines_b SET line_number = l_top_line_number
                WHERE  id = l_target_tbl(idx).cle_id;
Line: 5532

            update_line_item(l_target_tbl(idx).cle_id, l_target_tbl(idx).item_id, l_return_status);
Line: 5583

                select_renewal_info
                (p_chr_id => g_chr_id,
                 x_operation_lines_tbl => l_operation_lines_tbl
                 );
Line: 5587

                l_select_renewal_flag := TRUE;
Line: 5589

                l_select_renewal_flag := FALSE;
Line: 5617

            IF l_select_renewal_flag
                THEN
                IF l_operation_lines_tbl.COUNT > 0
                    THEN
                    update_renewal_info
                    (p_operation_lines_tbl => l_operation_lines_tbl,
                     x_return_status => l_return_status,
                     x_msg_count => l_msg_count,
                     x_msg_data => l_msg_data
                     );
Line: 5671

                 UPDATE oks_k_lines_b
                 SET coverage_id = l_covtemp_id,
                    standard_cov_yn = 'Y',
                    pm_program_id   =l_pm_prg_id ,
                    pm_conf_req_yn  =l_pm_conf_req   ,
                    pm_sch_exists_yn =l_pm_sch_exists
                 WHERE cle_id = l_target_tbl(idx).cle_id;
Line: 5731

            UpdateIRTRule_Subline(p_cle_id => l_target_tbl(idx).cle_id
                                  , p_item_desc => l_target_tbl(idx).item_desc
                                  , p_start_date => l_start_date
                                  , p_end_date => l_end_date
                                  , x_return_status => l_return_status);
Line: 5744

            UpdateIRTRule(p_chr_id => g_chr_id
                          , p_cle_id => l_target_tbl(idx).cle_id --LLC ealier: p_source_rec.cle_id
                          , p_invoice_text => GetFormattedInvoiceText
                          (l_target_tbl(idx).item_desc, l_start_date, l_end_date)
                          , p_api_version => 1.0
                          , p_init_msg_list => l_init_msg_list
                          , x_return_status => l_return_status
                          , x_tax_value => l_tax_value
                          , x_AMOUNT_INCLUDES_TAX_FLAG => l_AMOUNT_INCLUDES_TAX_FLAG
                          , x_total => l_total);
Line: 5792

            UPDATE okc_k_lines_b
            SET	price_negotiated = l_curr_price_negotiated_amt,
             cancelled_amount = l_curr_cancelled_amt
            WHERE id = l_target_tbl(idx).cle_id;
Line: 5824

            UPDATE okc_k_headers_b
            SET estimated_amount = l_curr_sum_negotiated_amt,
             cancelled_amount = l_curr_sum_cancelled_amt
            WHERE id = g_chr_id;
Line: 5851

            update_header_amount(p_source_rec.cle_id, l_return_status);
Line: 5972

    PROCEDURE Update_Contact_Points
    (
     p_api_version         IN   NUMBER,
     p_init_msg_list       IN   VARCHAR2,
     P_commit              IN   VARCHAR2,
     P_contact_point_rec   IN   contact_point_rec,
     x_return_status       OUT NOCOPY  VARCHAR2,
     x_msg_count           OUT NOCOPY  NUMBER,
     x_msg_data            OUT NOCOPY  VARCHAR2)
    IS
    l_object_Version_number  NUMBER := 1 ;
Line: 5989

        SELECT last_update_date, object_version_number, contact_point_type
        FROM   HZ_CONTACT_POINTS
        WHERE  contact_point_id = P_contact_point_rec.contact_point_id;
Line: 6027

        HZ_CONTACT_POINT_V2PUB.update_contact_point (
                                                     p_init_msg_list => p_init_msg_list,
                                                     p_contact_point_rec => l_contact_point_rec,
                                                     p_email_rec => l_email_rec_type,
                                                     p_phone_rec => l_phone_rec_type,
                                                     x_return_status => x_return_status,
                                                     x_msg_count => x_msg_count,
                                                     x_msg_data => x_msg_data,
                                                     p_object_version_number => l_object_version_number
                                                     );
Line: 6054

    END Update_Contact_Points;
Line: 6067

        SELECT id
        FROM   okc_class_operations
        WHERE  CLS_CODE = 'SERVICE'
        AND    OPN_CODE = 'SPLIT';
Line: 6217

        SELECT object1_id1, object1_id2, dnz_chr_id, uom_code
        FROM   okc_k_items
        WHERE  cle_id = p_cle_id;
Line: 6224

        SELECT party_site_id
        FROM   HZ_PARTY_SITES
        WHERE  party_id = p_party_id
        AND    identifying_address_flag = 'Y';
Line: 6232

        SELECT cust_acct_id
        FROM okc_k_lines_b
        WHERE id = p_cle_id;
Line: 6239

        SELECT party_id
        FROM   HZ_CUST_ACCOUNTS
        WHERE  cust_account_id = p_cust_acct_id;
Line: 6248

        SELECT revision_qty_control_code
        FROM mtl_system_items_kfv
        WHERE  inventory_item_id = p_item_id
        AND    organization_id = p_organization_id;
Line: 6256

        SELECT revision
        FROM   MTL_ITEM_REVISIONS_VL
        WHERE  inventory_item_id = p_item_id
        AND    organization_id = p_organization_id;
Line: 6286

        SELECT ship_to_site_use_id, bill_to_site_use_id
        FROM   okc_k_lines_b
        WHERE  id = p_cle_id;
Line: 6293

        SELECT party_site_id
        FROM okx_cust_site_uses_v
        WHERE id1 = p_shipto_or_billto ;
Line: 6623

        /* UPDATE csi_item_instances
        SET owner_party_source_table = 'OKC_K_ITEMS_B',
        security_group_id = p_cle_id
        WHERE instance_id = p_instance_rec.instance_id;
Line: 6641

    PROCEDURE DELETE_CII_FOR_SUBSCRIPTION
    (p_api_version   IN NUMBER,
     p_init_msg_list IN VARCHAR2,
     x_return_status OUT NOCOPY VARCHAR2,
     x_msg_count     OUT NOCOPY NUMBER,
     x_msg_data      OUT NOCOPY VARCHAR2,
     p_instance_id   IN NUMBER
     )
    IS
    BEGIN

        NULL;
Line: 6672

        SELECT FROM_TABLE, WHERE_CLAUSE
        FROM JTF_OBJECTS_B
        WHERE OBJECT_CODE = p_object_code;
Line: 6679

        SELECT description
        FROM   okx_cust_sites_v
        WHERE  id1 = p_cust_acct_site_id;
Line: 6689

        l_sql_stmt := 'SELECT name, cust_acct_site_id FROM ' || l_from_table ||
        ' WHERE ID1 = :id_1 AND ID2 = :id2';
Line: 6717

    PROCEDURE select_renewal_info
    (p_chr_id IN NUMBER,
     x_operation_lines_tbl OUT NOCOPY opn_lines_tbl
     )
    IS
    --select operation id for renewal of 'SERVICE'
    CURSOR class_operation_cur IS
        SELECT id
        FROM   okc_class_operations
        WHERE  opn_code = 'RENEWAL'
        AND    cls_code = 'SERVICE';
Line: 6732

        SELECT id
        FROM   okc_operation_instances
        WHERE  target_chr_id = p_chr_id
        AND    cop_id = p_cop_id;
Line: 6738

        SELECT creation_date, subject_chr_id, object_chr_id,
               subject_cle_id, object_cle_id
        FROM okc_operation_lines
        WHERE  oie_id = p_oie_id;
Line: 6757

            x_operation_lines_tbl.DELETE;
Line: 6770

    END select_renewal_info;
Line: 6773

    PROCEDURE update_renewal_info
    (p_operation_lines_tbl IN opn_lines_tbl,
     x_return_status       OUT NOCOPY  VARCHAR2,
     x_msg_count           OUT NOCOPY  NUMBER,
     x_msg_data            OUT NOCOPY  VARCHAR2
     )
    IS
    BEGIN
        IF p_operation_lines_tbl.COUNT > 0
            THEN
            FOR i IN p_operation_lines_tbl.FIRST..p_operation_lines_tbl.LAST
                LOOP
                IF p_operation_lines_tbl(i).object_cle_id IS NULL
                    THEN
                    UPDATE okc_k_headers_b
                    SET    date_renewed = TRUNC(p_operation_lines_tbl(i).creation_date)
                    WHERE  id = p_operation_lines_tbl(i).object_chr_id;
Line: 6791

                    UPDATE okc_k_lines_b
                    SET    date_renewed = TRUNC(p_operation_lines_tbl(i).creation_date)
                    WHERE  id = p_operation_lines_tbl(i).object_cle_id;
Line: 6809

    END update_renewal_info;
Line: 6820

        SELECT cle_id, line_number
        FROM   okc_k_lines_b
        WHERE  id = c_cle_id;
Line: 6825

        SELECT 'x'
        FROM   okc_price_adjustments
        WHERE  list_line_id = c_list_line_id
        AND    cle_id = c_cle_id;
Line: 6831

        SELECT 'x'
        FROM   okc_price_adjustments
        WHERE  list_line_id = c_list_line_id
        AND    chr_id = c_chr_id;
Line: 6837

        SELECT id, line_number
        FROM   okc_k_lines_b
        WHERE  cle_id = c_cle_id
        AND    lse_id IN(9, 25);
Line: 6914

    PROCEDURE Update_Line_Amount
    (p_line_id       IN   NUMBER,
     p_new_service_amount IN NUMBER,
     x_return_status OUT  NOCOPY VARCHAR2,
     x_msg_count     OUT  NOCOPY NUMBER,
     x_msg_data      OUT  NOCOPY VARCHAR2)
    IS
    l_clev_rec         OKC_CONTRACT_PUB.clev_rec_type;
Line: 6935

        SELECT nvl(SUM(nvl(price_negotiated, 0)), 0)
        FROM   okc_k_lines_b
        WHERE  cle_id = p_line_id
        AND    date_cancelled IS NULL; -- line Level Cancellation
Line: 6941

        SELECT SUM(nvl(tax_amount, 0)) amount
        FROM okc_k_lines_b cle, oks_k_lines_b kln
        WHERE cle.cle_id = p_cle_id
        AND   cle.id = kln.cle_id
        AND   cle.lse_id IN (7, 8, 9, 10, 11, 13, 35, 25, 46)
        AND   cle.date_cancelled IS NULL;
Line: 6951

        SELECT id, object_version_number, dnz_chr_id
        FROM oks_k_lines_b
        WHERE cle_id = p_cle_id ;
Line: 6968

        OKC_CONTRACT_PUB.Update_Contract_Line
        (
         p_api_version => l_api_version,
         p_init_msg_lISt => l_init_msg_lISt,
         x_return_status => x_return_status,
         x_msg_count => x_msg_count,
         x_msg_data => x_msg_data,
         p_restricted_update => 'F',
         p_clev_rec => l_clev_rec,
         x_clev_rec => x_clev_rec
         );
Line: 6999

        oks_contract_line_pub.update_line
        (
         p_api_version => l_api_version,
         p_init_msg_list => l_init_msg_list,
         x_return_status => l_return_status,
         x_msg_count => l_msg_count,
         x_msg_data => l_msg_data,
         p_klnv_tbl => l_klnv_tbl_in,
         x_klnv_tbl => l_klnv_tbl_out,
         p_validate_yn => 'N'
         );
Line: 7019

    END Update_Line_Amount;
Line: 7021

    PROCEDURE Update_Coverage_Levels
    (p_clvl_rec      IN   Clvl_Rec_Type,
     x_return_status OUT  NOCOPY VARCHAR2,
     x_msg_count     OUT  NOCOPY NUMBER,
     x_msg_data      OUT  NOCOPY VARCHAR2)
    IS

    l_clev_rec         OKC_CONTRACT_PUB.clev_rec_type;
Line: 7042

        OKC_CONTRACT_PUB.Update_Contract_Line
        (
         p_api_version => l_api_version,
         p_init_msg_lISt => l_init_msg_lISt,
         x_return_status => x_return_status,
         x_msg_count => x_msg_count,
         x_msg_data => x_msg_data,
         p_restricted_update => 'F',
         p_clev_rec => l_clev_rec,
         x_clev_rec => x_clev_rec
         );
Line: 7063

    END Update_Coverage_Levels;
Line: 7065

    PROCEDURE UPDATE_CONTRACT_AMOUNT(p_header_id IN NUMBER,
                                     x_return_status  OUT NOCOPY VARCHAR2) IS
    l_api_version     CONSTANT   NUMBER := 1.0;
Line: 7081

        SELECT nvl(SUM(price_negotiated), 0) SUM
        FROM okc_k_lines_b
        WHERE dnz_chr_id = p_header_id
        AND   cle_id IS NULL
        AND   date_cancelled IS NULL; -- line Level Cancellation
Line: 7091

        SELECT SUM(kln.tax_amount)  amount
        FROM okc_k_lines_b cle, oks_k_lines_b kln
        WHERE cle.dnz_chr_id = p_header_id
        AND   cle.id = kln.cle_id
        AND   cle.lse_id IN (7, 8, 9, 10, 11, 13, 35, 25, 46)
        AND   cle.date_cancelled IS NULL;
Line: 7101

        SELECT id, object_version_number
        FROM OKS_K_HEADERS_B
        WHERE chr_id = p_header_id ;
Line: 7110

            l_chrv_tbl_in.DELETE;
Line: 7115

                okc_contract_pub.update_contract_header (
                                                         p_api_version => l_api_version,
                                                         p_init_msg_list => l_init_msg_list,
                                                         x_return_status => l_return_status,
                                                         x_msg_count => l_msg_count,
                                                         x_msg_data => l_msg_data,
                                                         p_chrv_tbl => l_chrv_tbl_in,
                                                         x_chrv_tbl => l_chrv_tbl_out
                                                         );
Line: 7146

            oks_contract_hdr_pub.update_header(
                                               p_api_version => l_api_version,
                                               p_init_msg_list => l_init_msg_list,
                                               x_return_status => l_return_status,
                                               x_msg_count => l_msg_count,
                                               x_msg_data => l_msg_data,
                                               p_khrv_tbl => l_khrv_tbl_type_in,
                                               x_khrv_tbl => l_khrv_tbl_type_out,
                                               p_validate_yn => 'N');
Line: 7165

    END UPDATE_CONTRACT_AMOUNT;
Line: 7174

        SELECT NVL(lines.price_negotiated, 0) price_negotiated,
               lines.start_date,
               lines.end_date,
               lines.date_terminated,
               lines.price_unit,
               lines.price_unit_percent,
               lines.id
        FROM   okc_k_lines_b lines
        WHERE  lines.cle_id = p_contract_line_id
        AND    lines.lse_id IN(7, 8, 9, 10, 11, 18, 25, 35);
Line: 7227

        SELECT  nvl(SUM(NVL(price_negotiated, 0)), 0) service_amount
             , COUNT(price_negotiated)
        FROM    okc_k_lines_b lines
        WHERE   lines.cle_id = p_contract_line_id
        AND     lines.lse_id IN(7, 8, 9, 10, 11, 18, 25, 35)
        AND     lines.date_cancelled IS NULL; -- line Level Cancellation
Line: 7242

        SELECT  okc.id,
                price_negotiated,
                 price_unit,
                price_unit_percent,
                lse_id,
                okc.dnz_chr_id,
                currency_code,
                oks.id oks_id,
                oks.object_version_number
        FROM    okc_k_lines_b  okc, oks_k_lines_b oks
        WHERE   okc.Cle_id = p_contract_line_id
        AND     OKS.cle_id = okc.id
        AND     (okc.date_terminated IS NULL OR okc.date_terminated > TRUNC(SYSDATE))
        AND     lse_id NOT IN(2, 15, 20)
        AND     okc.date_cancelled IS NULL; -- line Level Cancellation
Line: 7260

    	SELECT  okc.id,
                price_negotiated,
                price_unit,
                price_unit_percent,
                lse_id,
                okc.dnz_chr_id,
                currency_code,
                oks.id oks_id,
                oks.object_version_number
        FROM    okc_k_lines_b  okc, oks_k_lines_b oks
        WHERE   okc.Cle_id = p_contract_line_id
        AND     OKS.cle_id = okc.id
        AND     (okc.date_terminated IS NULL OR okc.date_terminated > TRUNC(SYSDATE))
        AND     lse_id NOT IN(2, 15, 20)
        AND Nvl(price_negotiated, 0) <> 0
       ORDER BY To_Number(line_number) DESC;
Line: 7281

        SELECT id, object_version_number
        FROM   oks_k_lines_b
        WHERE  cle_id = p_cle_id;
Line: 7289

        SELECT Isa_Agreement_Id
        FROM   OKC_GOVERNANCES_V
        WHERE  dnz_chr_id = p_chr_id
        AND    cle_id IS NULL;
Line: 7351

        SELECT currency_code
       FROM   okc_k_headers_b
        WHERE  id = p_chr_id;
Line: 7363

        SELECT dnz_chr_id
        FROM   okc_k_lines_b
        WHERE  id = p_contract_line_id;
Line: 7457

                Update_Coverage_Levels
                (p_clvl_rec => l_clvl_rec,
                 x_return_status => x_return_status,
                 x_msg_count => x_msg_count,
                 x_msg_data => x_msg_data);
Line: 7465

                /* select price_negotiated into cp_price
                from okc_k_lines_b
                where id = clvl_rec.id; */
Line: 7537

                    OKS_CONTRACT_LINE_PUB.update_line(
                                                      p_api_version => p_api_version,
                                                      p_init_msg_list => p_init_msg_list,
                                                      x_return_status => l_return_status,
                                                      x_msg_count => l_msg_count,
                                                      x_msg_data => l_msg_data,
                                                      p_klnv_tbl => l_klnv_tbl,
                                                      x_klnv_tbl => lx_klnv_tbl,
                                                      p_validate_yn => l_validate_yn);
Line: 7557

                END IF; /* Calculate tax  - update IRT rule for non cov item , cov prod */
Line: 7643

            Update_Coverage_Levels(p_clvl_rec => l_clvl_rec,
                                   x_return_status => x_return_status,
                                   x_msg_count => x_msg_count,
                                   x_msg_data => x_msg_data);
Line: 7654

            /*** Calculate tax - update IRT rule for residual value **/
            -- Bug 5228352 --
            IF l_old_lse_id  IN (8, 10, 11, 12, 35 )
	    OR (   l_old_lse_id IN (7, 9, 18, 25)
		    AND
		    NVL(fnd_profile.VALUE('OKS_USE_QP_FOR_MANUAL_ADJ'), 'NO') = 'NO')
	    THEN
            -- Bug 5228352 --

                --       --------errorout_ad(' before calculating tax ');
Line: 7727

                OKS_CONTRACT_LINE_PUB.update_line(
                                                  p_api_version => p_api_version,
                                                  p_init_msg_list => p_init_msg_list,
                                                  x_return_status => l_return_status,
                                                  x_msg_count => l_msg_count,
                                                  x_msg_data => l_msg_data,
                                                  p_klnv_tbl => l_klnv_tbl,
                                                  x_klnv_tbl => lx_klnv_tbl,
                                                  p_validate_yn => l_validate_yn);
Line: 7745

                /*             oks_qp_int_pvt.UPDATE_RULE ( p_rule_rec         => l_rule_rec,
                p_line_id          => l_old_id,
                x_return_status    => l_return_status,
                x_msg_count        => x_msg_count,
                x_msg_data         => x_msg_data);
Line: 7753

            END IF; /* Calculate tax  - update IRT rule for non cov item , cov prod */
Line: 7798

        UPDATE_LINE_AMOUNT(p_contract_line_id,
                           p_new_service_price,
                           x_return_status,
                           x_msg_count,
                           x_msg_data  );
Line: 7811

        UPDATE_CONTRACT_AMOUNT(p_header_id => Get_Header_Id,
                               x_return_status => x_return_status);
Line: 7840

    PROCEDURE update_quantity(p_cle_id         IN NUMBER,
                              x_return_status      OUT NOCOPY VARCHAR2,
                              x_msg_count          OUT NOCOPY NUMBER,
                              x_msg_data           OUT NOCOPY VARCHAR2
                              )
    IS
    CURSOR get_all_instances_csr IS
        SELECT id
        FROM okc_k_lines_b
        WHERE cle_id = p_cle_id
        AND  lse_id IN (9, 25);
Line: 7853

        SELECT object1_id1, number_of_items
        FROM okc_k_items
        WHERE cle_id = p_item_cle_id;
Line: 7860

        SELECT cii.quantity
        FROM  CSI_ITEM_INSTANCES CII
        WHERE instance_id = TO_NUMBER(p_object1_id1);
Line: 7887

                UPDATE okc_k_items
                SET number_of_items = get_csi_item_qty_rec.quantity
                WHERE cle_id = get_all_instances_rec.id;
Line: 7946

    END update_quantity;
Line: 7993

    PROCEDURE update_person (
                             p_init_msg_list                    IN      VARCHAR2 := FND_API.G_FALSE,
                             p_person_tbl                       IN      PERSON_TBL_TYPE,
                             p_party_object_version_number      IN     NUMBER,
                             x_profile_id                       OUT NOCOPY     NUMBER,
                             x_return_status                    OUT NOCOPY     VARCHAR2,
                             x_msg_count                        OUT NOCOPY     NUMBER,
                             x_msg_data                         OUT NOCOPY     VARCHAR2
                             )IS
    l_person_rec                     HZ_PARTY_V2PUB.person_rec_type ;
Line: 8017

        HZ_PARTY_V2PUB.update_person(
                                     p_init_msg_list => l_init_msg_list,
                                     p_person_rec => l_person_rec,
                                     p_party_object_version_number => l_party_object_version_number,
                                     x_profile_id => x_profile_id,
                                     x_return_status => x_return_status,
                                     x_msg_count => x_msg_count,
                                     x_msg_data => x_msg_data);
Line: 8093

    PROCEDURE update_org_contact (
                                  p_init_msg_list                    IN       VARCHAR2 := FND_API.G_FALSE,
                                  p_org_contact_tbl                  IN       ORG_CONTACT_TBL_TYPE,
                                  p_relationship_tbl_type            IN       relationship_tbl_type,
                                  p_cont_object_version_number       IN OUT NOCOPY   NUMBER,
                                  p_rel_object_version_number        IN OUT NOCOPY   NUMBER,
                                  p_party_object_version_number      IN OUT NOCOPY   NUMBER,
                                  x_return_status                    OUT NOCOPY      VARCHAR2,
                                  x_msg_count                        OUT NOCOPY      NUMBER,
                                  x_msg_data                         OUT NOCOPY      VARCHAR2
                                  )IS
    l_init_msg_list        CONSTANT  VARCHAR2(1) := 'F';
Line: 8131

        HZ_PARTY_CONTACT_V2PUB.update_org_contact(
                                                  p_init_msg_list => l_init_msg_list,
                                                  p_org_contact_rec => org_contact_rec,
                                                  p_cont_object_version_number => l_cont_object_version_number,
                                                  p_rel_object_version_number => l_rel_object_version_number,
                                                  p_party_object_version_number => l_party_object_version_number,
                                                  x_return_status => x_return_status,
                                                  x_msg_count => x_msg_count,
                                                  x_msg_data => x_msg_data);
Line: 8215

    PROCEDURE update_party_site (
                                 p_init_msg_list                 IN          VARCHAR2 := FND_API.G_FALSE,
                                 p_party_site_tbl                IN          PARTY_SITE_TBL_TYPE,
                                 p_object_version_number         IN OUT NOCOPY      NUMBER,
                                 x_return_status                 OUT NOCOPY         VARCHAR2,
                                 x_msg_count                     OUT NOCOPY         NUMBER,
                                 x_msg_data                      OUT NOCOPY         VARCHAR2
                                 )IS
    party_site_rec                   hz_party_site_v2pub.PARTY_SITE_REC_TYPE;
Line: 8232

        HZ_PARTY_SITE_V2PUB.update_party_site(
                                              p_init_msg_list => l_init_msg_list,
                                              p_party_site_rec => party_site_rec,
                                              p_object_version_number => l_object_version_number,
                                              x_return_status => x_return_status,
                                              x_msg_count => x_msg_count,
                                              x_msg_data => x_msg_data);
Line: 8291

    PROCEDURE update_cust_account_role (
                                        p_init_msg_list                         IN     VARCHAR2 := FND_API.G_FALSE,
                                        p_cust_account_role_tbl                 IN     CUST_ACCOUNT_ROLE_tbl_TYPE,
                                        p_object_version_number                 IN OUT NOCOPY NUMBER,
                                        x_return_status                         OUT NOCOPY    VARCHAR2,
                                        x_msg_count                             OUT NOCOPY    NUMBER,
                                        x_msg_data                              OUT NOCOPY    VARCHAR2
                                        )IS
    l_init_msg_list        CONSTANT  VARCHAR2(1) := 'F';
Line: 8311

        Hz_cust_account_role_v2pub.update_cust_account_role(
                                                            p_init_msg_list => l_init_msg_list,
                                                            p_cust_account_role_rec => cust_account_role_rec,
                                                            p_object_version_number => l_object_version_number,
                                                            x_return_status => x_return_status,
                                                            x_msg_count => x_msg_count,
                                                            x_msg_data => x_msg_data);
Line: 8368

    PROCEDURE update_cust_acct_site (
                                     p_init_msg_list                         IN     VARCHAR2 := FND_API.G_FALSE,
                                     p_cust_acct_site_tbl                    IN     CUST_ACCT_SITE_TBL_TYPE,
                                     p_object_version_number                 IN OUT NOCOPY NUMBER,
                                     x_return_status                         OUT NOCOPY    VARCHAR2,
                                     x_msg_count                             OUT NOCOPY    NUMBER,
                                     x_msg_data                              OUT NOCOPY    VARCHAR2
                                     )IS
    l_init_msg_list        CONSTANT  VARCHAR2(1) := 'F';
Line: 8385

        Hz_cust_account_site_v2pub.update_cust_acct_site(
                                                         p_init_msg_list => l_init_msg_list,
                                                         p_cust_acct_site_rec => cust_acct_site_rec,
                                                         p_object_version_number => l_object_version_number,
                                                         x_return_status => x_return_status,
                                                         x_msg_count => x_msg_count,
                                                         x_msg_data => x_msg_data);
Line: 8421

        SELECT 'Y' FROM OKC_K_LINES_B
        WHERE dnz_chr_id = p_contract_hdr_id
        AND   id = p_contract_line_id
        AND(date_terminated IS NULL OR date_terminated > TRUNC(SYSDATE))
        AND date_cancelled IS NULL
        AND end_date > NVL(oks_bill_util_pub.get_billed_upto(id, p_intent), end_date - 1);
Line: 8430

        SELECT ID, LSE_ID FROM OKC_K_LINES_B
        WHERE dnz_chr_id = p_contract_hdr_id
        AND cle_id IS NULL
        AND(date_terminated IS NULL OR date_terminated > TRUNC(SYSDATE))
        AND date_cancelled IS NULL
        AND end_date > NVL(oks_bill_util_pub.get_billed_upto(id, 'T'), end_date - 1);
Line: 8438

        SELECT  locked_price_list_id,
            locked_price_list_line_id
        FROM    OKS_k_LINES_B
        WHERE   dnz_chr_id = p_chr_id
        AND     cle_id = p_cle_id ;
Line: 8464

                UPDATE okc_k_lines_b
                SET price_list_id = p_price_list_id
                WHERE dnz_chr_id = p_contract_hdr_id
                AND cle_id IS NULL
                AND ID = CUR_REC.id;
Line: 8480

                        oks_qp_pkg.delete_locked_pricebreaks(l_api_version,
                                                             l_source_price_list_line_id,
                                                             l_init_msg_list,
                                                             l_return_status,
                                                             l_msg_count,
                                                             l_msg_data);
Line: 8493

                UPDATE OKS_K_LINES_B SET
                locked_price_list_id = NULL,
                locked_price_list_line_id = NULL
                WHERE dnz_chr_id = p_contract_hdr_id
                AND cle_id = cur_rec.id ;
Line: 8530

        It updates amount for a topline if and only if topline amount
        does not euqal to the sum of subline amounts. Similarly it
        updates the header amount if and only if, the header amount does
        not equal the sum of line amounts.

        This avoids unncessary updates to lines and prevents record locking
        when multiple users access the same contract. The example given below
        illustrates record locking in authoring and how it can be avoided in most cases

                    User 1 Action                       User 2 Action
        Time A      Open Contract K1                    Open same Contract K1

        Time B      Modify contract header              Modify topline 1
                    -Header record locked               -Top line record locked.
                    -No amount changes required.        -No amount changes required.

        Time C      Try to save contract K1             No action
                    -Application hangs as               -User 2 continues to hold lock
                    -unconditional update of topline    -on topline 1.
                    -amount waits for lock on topline
                    -1 to be released by User 2.
                    -Header and contract version number
                    -updated.

        Time D      No action                           Try to save contract K1
                                                        -Deadlock detected
                                                        -User 1 is waiting for lock on
                                                        -topline 1 held by user 2.
                                                        -User 2 is waiting for lock on
                                                        -version number held by user 1.

        To avoid, the above record locking and deadlock, we one needs to
            1. Conditionally update the topline amount and header amount. Do not
               update if amounts are in sync whith child entities.
            2. Do not update contract version as part of header/line or any other
               enitity update. Defer contract version update till all other updates
               are successful.

        Please note that if two users attempt to modify the same line or same entity
        in a contract, record locking cannot be and should not be prevented.

    */
       PROCEDURE CHECK_UPDATE_AMOUNTS
    (
     p_api_version                           IN NUMBER,
     p_init_msg_list                         IN VARCHAR2 DEFAULT FND_API.G_FALSE,
     p_commit                                IN VARCHAR2 DEFAULT FND_API.G_FALSE,
     p_chr_id                                IN NUMBER,
     x_msg_count                             OUT NOCOPY    NUMBER,
     x_msg_data                              OUT NOCOPY    VARCHAR2,
     x_return_status                         OUT NOCOPY    VARCHAR2
    )
    IS

      l_api_name CONSTANT VARCHAR2(30) := 'CHECK_UPDATE_AMOUNTS';
Line: 8609

        SELECT a.id, nvl(a.price_negotiated, 0) topline_amt,
        SUM(nvl(b.price_negotiated,0)) sum_subline_amt,
        nvl(c.tax_amount,0) topline_tax_amt,
        SUM(nvl(d.tax_amount,0)) sum_subline_tax_amt
        FROM okc_k_lines_b a, okc_k_lines_b b,
             oks_k_lines_b c, oks_k_lines_b d
        WHERE a.dnz_chr_id = cp_chr_id AND a.lse_id IN (1,12,14,19)
        AND b.dnz_chr_id = a.dnz_chr_id AND b.cle_id = a.id
        AND a.id=c.cle_id AND b.id=d.cle_id
        AND b.lse_id IN (7,8,9,10,11,35,13,18,25)
        AND a.date_cancelled is null
        AND b.date_cancelled is null
        GROUP BY a.id, a.price_negotiated,c.tax_amount
        HAVING nvl(a.price_negotiated, 0) <> SUM(nvl(b.price_negotiated,0))
              OR nvl(c.tax_amount, 0) <> SUM(nvl(d.tax_amount,0));
Line: 8627

        SELECT a.id, nvl(a.price_negotiated, 0) topline_amt,
        0 sum_subline_amt,
        nvl(c.tax_amount,0) topline_tax_amt,
        0 sum_subline_tax_amt
        FROM okc_k_lines_b a,
             oks_k_lines_b c
        WHERE a.dnz_chr_id = cp_chr_id
        AND a.lse_id IN (1,12,14,19)
        AND a.id=c.cle_id
        AND a.date_cancelled is null
        and not exists( select 1 from okc_k_lines_b b
            WHERE b.lse_id IN (7,8,9,10,11,35,13,18,25)
                AND b.date_cancelled is null
                AND b.dnz_chr_id=a.dnz_chr_id
                AND b.cle_id=a.id);
Line: 8644

        SELECT price_negotiated
        FROM okc_k_lines_b WHERE id = cp_id
        FOR UPDATE OF price_negotiated NOWAIT;
Line: 8649

        SELECT substr(RTRIM(RTRIM(line_number) || ', ' || RTRIM(lsev.name) || ' ' || RTRIM(clev.name)), 1, 2000) line_name
        FROM   okc_line_styles_v lsev, okc_k_lines_v clev
        WHERE  lsev.id = clev.lse_id
        AND    clev.id =  cp_id;
Line: 8655

        SELECT a.contract_number ||' '|| a.contract_number_modifier,
        nvl(a.estimated_amount, 0) hdr_amt,
        SUM(nvl(b.price_negotiated,0)) sum_tl_line_amt,
        nvl(c.tax_amount,0) hdr_tax_amt,
        SUM(nvl(d.tax_amount,0)) sum_tl_line_amt_tax
        FROM okc_k_headers_all_b a, okc_k_lines_b b,
             oks_k_headers_b c, oks_k_lines_b d
        WHERE a.id = cp_chr_id
        AND b.dnz_chr_id = a.id AND b.cle_id IS NULL
        AND d.dnz_chr_id = c.chr_id AND d.cle_id=b.id
        AND b.date_cancelled is null
        AND b.lse_id IN (1,12,14,19,46)
        GROUP BY a.contract_number, a.contract_number_modifier, a.estimated_amount,c.tax_amount;
Line: 8671

        SELECT a.contract_number ||' '|| a.contract_number_modifier,
        nvl(a.estimated_amount, 0) hdr_amt,
        0 sum_tl_line_amt,
        nvl(c.tax_amount,0) hdr_tax_amt,
        0 sum_tl_line_amt_tax
        FROM okc_k_headers_all_b a,
             oks_k_headers_b c
        WHERE a.id = cp_chr_id
        AND c.chr_id = a.id
        AND NOT EXISTS (SELECT 1 from okc_k_lines_b b
            WHERE  b.dnz_chr_id = a.id
            AND b.cle_id IS NULL
            AND b.date_cancelled is null
            AND b.lse_id IN (1,12,14,19,46));
Line: 8687

        SELECT estimated_amount
        FROM okc_k_headers_all_b WHERE id = cp_chr_id
        FOR UPDATE OF estimated_amount NOWAIT;
Line: 8693

        SELECT a.id, nvl(a.cancelled_amount, 0) topline_canceled_amt,           /*modified for bug:6765336*/
            SUM(nvl(b.cancelled_amount,0)) sum_subline_cancelled_amt
        FROM okc_k_lines_b a, okc_k_lines_b b
        WHERE a.dnz_chr_id = cp_chr_id AND a.lse_id IN (1,12,14,19)
	        AND b.dnz_chr_id = a.dnz_chr_id AND b.cle_id = a.id
        AND a.date_cancelled is null
        AND b.date_cancelled is not null
        GROUP BY a.id, a.cancelled_amount
        HAVING nvl(a.cancelled_amount, 0) <> SUM(nvl(b.cancelled_amount,0));       /*modified for bug:6765336*/
Line: 8705

        SELECT
            nvl(a.cancelled_amount, 0) hdr_cancelled_amt,
            SUM(nvl(b.cancelled_amount,0)) sum_tl_line_cancelled_amt
        FROM okc_k_headers_all_b a, okc_k_lines_b b
        WHERE a.id = cp_chr_id
        AND b.dnz_chr_id = a.id AND b.cle_id IS NULL
        AND b.lse_id IN (1,12,14,19,46)
        GROUP BY a.cancelled_amount;
Line: 8722

        SAVEPOINT check_update_amounts_PVT;
Line: 8775

                        l_tl_id_tbl.delete;
Line: 8776

                        l_tl_amt_tbl.delete;
Line: 8777

                        l_sl_amt_tbl.delete;
Line: 8778

                        l_tl_amt_tax_tbl.delete;
Line: 8779

                        l_sl_amt_tax_tbl.delete;
Line: 8788

                FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_line', 'able to lock all fetched toplines - updating amount');
Line: 8793

                UPDATE okc_k_lines_b
                    SET price_negotiated = l_sl_amt_tbl(j)
                    WHERE id = l_tl_id_tbl(j);
Line: 8798

                UPDATE oks_k_lines_b
                    SET tax_amount = l_sl_amt_tax_tbl(j)
                    WHERE cle_id = l_tl_id_tbl(j);
Line: 8803

                FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_line', 'amounts updated');
Line: 8808

        l_tl_id_tbl.delete;
Line: 8809

        l_tl_amt_tbl.delete;
Line: 8810

        l_sl_amt_tbl.delete;
Line: 8811

        l_tl_amt_tax_tbl.delete;
Line: 8812

        l_sl_amt_tax_tbl.delete;
Line: 8858

                        l_tl_id_tbl.delete;
Line: 8859

                        l_tl_amt_tbl.delete;
Line: 8860

                        l_sl_amt_tbl.delete;
Line: 8861

                        l_tl_amt_tax_tbl.delete;
Line: 8862

                        l_sl_amt_tax_tbl.delete;
Line: 8870

                FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_line', 'able to lock all fetched toplines - updating amount');
Line: 8875

                UPDATE okc_k_lines_b
                    SET price_negotiated = l_sl_amt_tbl(j)
                    WHERE id = l_tl_id_tbl(j);
Line: 8880

                UPDATE oks_k_lines_b
                    SET tax_amount = l_sl_amt_tax_tbl(j)
                    WHERE cle_id = l_tl_id_tbl(j);
Line: 8885

                FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_line', 'amounts updated');
Line: 8890

        l_tl_id_tbl.delete;
Line: 8891

        l_tl_amt_tbl.delete;
Line: 8892

        l_sl_amt_tbl.delete;
Line: 8893

        l_tl_amt_tax_tbl.delete;
Line: 8894

        l_sl_amt_tax_tbl.delete;
Line: 8902

            FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_hdr', 'db hdr amt='||l_hdr_amt||' , sum of toplines='||l_tl_amt);
Line: 8922

                    UPDATE okc_k_headers_all_b
                    SET estimated_amount = l_tl_amt
                    WHERE id = p_chr_id;
Line: 8928

                    UPDATE oks_k_headers_b
                    SET tax_amount = l_tl_amt_tax
                    where chr_id = p_chr_id;
Line: 8959

	            FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_hdr', 'db hdr amt='||l_hdr_amt||' , sum of toplines='||l_tl_amt);
Line: 8962

	        --update the header only if required
	         IF (l_hdr_amt <> l_tl_amt) OR(l_hdr_amt_tax <> l_tl_amt_tax) THEN

	            --before updating the header amount, first try to obtain a lock on the header
	            --if the lock fails, another user is holding the lock, exit with appropriate
	            --error message. If the lock succeeds, update the header amount
	            BEGIN

	                IF (FND_LOG.level_statement >= FND_LOG.g_current_runtime_level) THEN
	                    FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.lock_hdr', 'checking lock for header id='||p_chr_id);
Line: 8979

	                    UPDATE okc_k_headers_all_b
	                    SET estimated_amount = l_tl_amt
	                    WHERE id = p_chr_id;
Line: 8985

	                    UPDATE oks_k_headers_b
	                    SET tax_amount = l_tl_amt_tax
	                    where chr_id = p_chr_id;
Line: 9054

                        l_tl_id_tbl.delete;
Line: 9055

                        l_tl_amt_tbl.delete;
Line: 9056

                        l_sl_amt_tbl.delete;
Line: 9065

                FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_line', 'able to lock all fetched toplines - updating canceled amount');
Line: 9070

                update okc_k_lines_b
                    set cancelled_amount =l_sl_amt_tbl(j)
                    where id=l_tl_id_tbl(j);
Line: 9075

                FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_line', 'cancelled amounts updated');
Line: 9080

        l_tl_id_tbl.delete;
Line: 9081

        l_tl_amt_tbl.delete;
Line: 9082

        l_sl_amt_tbl.delete;
Line: 9086

                FND_LOG.string(FND_LOG.level_statement, l_mod_name || '.update_header', 'to update header cancelled amount not equal to sum of toplines.');
Line: 9109

                update okc_k_headers_all_b
                set cancelled_amount = l_topline_cancelled
                where id=p_chr_id;
Line: 9145

            ROLLBACK TO check_update_amounts_PVT;
Line: 9170

            ROLLBACK TO check_update_amounts_PVT;
Line: 9194

            ROLLBACK TO check_update_amounts_PVT;
Line: 9221

    END CHECK_UPDATE_AMOUNTS;
Line: 9228

     SELECT counter_value_id
     FROM   CSI_COUNTER_READINGS
     WHERE  counter_id = p_counter_id
     AND    value_timestamp in
        (select max(value_timestamp) from CSI_COUNTER_READINGS
         where counter_id = p_counter_id
         and disabled_flag='N');
Line: 9277

  SELECT max(request_id)
  FROM   fnd_concurrent_requests
	WHERE  program_application_id = l_prog_appl_id
	AND    concurrent_program_id  = l_prg_id
  AND    argument2=to_char(l_chr_id)
  AND    phase_code  NOT IN ('C');      --- IN ('P','R'); SKUCHIMA
Line: 9293

    SELECT concurrent_program_id, p.application_id
    INTO   program_id, prog_appl_id
    FROM   fnd_concurrent_programs P,
           fnd_application A
    WHERE  concurrent_program_name  = 'OKSREPCON'
    AND    P.application_id         = A.Application_ID
    AND    A.application_short_name = 'OKS';
Line: 9355

  SELECT max(request_id)
  FROM   fnd_concurrent_requests
	WHERE  program_application_id = l_prog_appl_id
	AND    concurrent_program_id  = l_prg_id
  AND    argument1=to_char(l_chr_id)
  AND    phase_code  NOT IN ('C');
Line: 9371

    SELECT concurrent_program_id, p.application_id
    INTO   program_id, prog_appl_id
    FROM   fnd_concurrent_programs P,
           fnd_application A
    WHERE  concurrent_program_name  = 'OKSCASCR'
    AND    P.application_id         = A.Application_ID
    AND    A.application_short_name = 'OKS';
Line: 9411

    SELECT ID, start_date, end_date, lse_id
      FROM okc_k_lines_b
     WHERE chr_id = p_chr_id
       AND lse_id IN (1, 14, 19, 46)
       AND date_cancelled IS NULL
       AND date_terminated IS NULL
     ORDER BY line_number;
Line: 9420

    SELECT ID, start_date, end_date, lse_id ,price_negotiated
      FROM okc_k_lines_b
     WHERE cle_id = p_cle_id
       AND lse_id IN (7, 8, 9, 10, 11, 18, 25, 35)
       AND date_cancelled IS NULL
       AND date_terminated IS NULL
     ORDER BY line_number;
Line: 9467

      SELECT SUM(price_negotiated) amount
        FROM okc_k_lines_b
       WHERE cle_id = p_line_id
         AND chr_id IS NULL
         AND lse_id IN (7, 8, 9, 10, 11, 18, 25, 35)
         AND date_cancelled IS NULL;
Line: 9475

      SELECT SUM(price_negotiated) amount
        FROM okc_k_lines_b
       WHERE chr_id = p_chr_id
         AND cle_id IS NULL
         AND date_cancelled IS NULL;
Line: 9519

      SELECT ID, object_version_number
        FROM okc_k_headers_all_b
       WHERE ID = p_id;
Line: 9524

      SELECT ID, object_version_number FROM okc_k_lines_b WHERE ID = p_id;
Line: 9527

      SELECT ID, object_version_number
        FROM oks_k_headers_b
       WHERE chr_id = p_id;
Line: 9532

      SELECT ID, object_version_number
        FROM oks_k_lines_b
       WHERE cle_id = p_id;
Line: 9611

  SELECT Nvl(conversion_rate, 1)
    INTO l_old_conversion_rate
    FROM okc_k_headers_all_b
   WHERE id = p_chr_id;*/
Line: 9632

      UPDATE okc_k_lines_b okl
         SET okl.price_negotiated = ((okl.price_negotiated *
                                    l_old_conversion_rate) /
                                    Nvl(p_new_conversion_rate, 1))
       WHERE okl.id = l_topline_rec.id;
Line: 9678

      okc_contract_pub.update_contract_line(p_api_version   => l_api_version,
                                            p_init_msg_list => 'T',
                                            x_return_status => x_return_status,
                                            x_msg_count     => l_msg_count,
                                            x_msg_data      => l_msg_data,
                                            p_clev_rec      => l_clev_rec_in,
                                            x_clev_rec      => l_clev_rec_out);
Line: 9704

       UPDATE okc_k_lines_b okl
           SET okl.price_negotiated = ((okl.price_negotiated *
                                      l_old_conversion_rate) /
                                      Nvl(p_new_conversion_rate, 1))
         WHERE okl.id = l_subline_rec.id;
Line: 9749

      okc_contract_pub.update_contract_line(p_api_version   => l_api_version,
                                            p_init_msg_list => 'T',
                                            x_return_status => x_return_status,
                                            x_msg_count     => l_msg_count,
                                            x_msg_data      => l_msg_data,
                                            p_clev_rec      => l_clev_rec_in,
                                            x_clev_rec      => l_clev_rec_out);
Line: 9784

  okc_contract_pub.update_contract_header(p_api_version       => l_api_version,
                                          p_init_msg_list     => 'T',
                                          x_return_status     => x_return_status,
                                          x_msg_count         => l_msg_count,
                                          x_msg_data          => l_msg_data,
                                          p_restricted_update => okc_api.g_false,
                                          p_chrv_rec          => l_chrv_rec_in,
                                          x_chrv_rec          => l_chrv_rec_out);
Line: 9835

    | Purpose:             Check to see if there is any active request runnning in the background for Mass Update
    |
    | In Parameters:       p_chr_id            the contract id
    | Out Parameters:      x_return_status     standard return status
    |
 +============================================================================*/

 PROCEDURE check_massupd_request(
   p_chr_id         IN NUMBER   ,
   x_return_status OUT NOCOPY VARCHAR2
 ) IS
    l_api_name CONSTANT VARCHAR2(30) := 'CHECK_MASSUPD_REQUEST';
Line: 9851

  This will check whether there is any active mass update request running in the background.
  If mass update request is running ,it will issue an error message
*/


  Program_ID    NUMBER;
Line: 9861

  SELECT max(request_id)
  FROM   fnd_concurrent_requests
	WHERE  program_application_id = l_prog_appl_id
	AND    concurrent_program_id  = l_prg_id
  AND    argument1=to_char(l_chr_id)
  AND    phase_code  NOT IN ('C');
Line: 9877

    SELECT concurrent_program_id, p.application_id
    INTO   program_id, prog_appl_id
    FROM   fnd_concurrent_programs P,
           fnd_application A
    WHERE  concurrent_program_name  = 'OKSLAUNCHMASSUPD'
    AND    P.application_id         = A.Application_ID
    AND    A.application_short_name = 'OKS';