Thursday 8 August 2013


CREATE OR REPLACE PROCEDURE APPS.xx_cust_additionl_info_entry
-- ********************************************************************************
--            
-- ********************************************************************************
--    Project        :  SaaS
--     Application    :  Receivables
--     Script         :
--     Created by     :  Sachin Ingle
--     Creation date  :  5-AUG-2013
--     Description    :  This Package picks data from staging table / Customer Created for specific Operating unit and inserts Data into
--                       jai_cmn_cus_addresses/Additional info
--     Parameters     :  None
--     Inputs         :  None
--     Outputs        :  None
--     Database       :
--     Apps. Release  :  Oracle Applications 12.1.3
--
--     Development and Maintenance History :
--
--     Date                Version            Author               Description
--     ----------------------------------------------------------------------------
--     05-Aug-2013        1.0               Sachin Ingle              Initial
-- *********************************************************************************
AS
   ln_customer_id   NUMBER := 0;
   ln_address_id    NUMBER := 0;

   CURSOR customer_info
   IS
      SELECT DISTINCT hcas.cust_acct_site_id, hp.party_name,
                      hca.cust_account_id
                        --  hp.orig_system_reference,
                      --    hps.orig_system_reference,
                         -- hp.party_id,
                         -- hps.party_site_id
                 --    INTO l_address_id, l_customer_id,
                        --  l_address_ref,
                        --  l_customer_ref, l_party_id,
                        --  l_party_site_id
      FROM            hz_parties hp,
                      hz_party_sites hps,
                      hz_cust_accounts hca,
                      hz_cust_acct_sites_all hcas,
                      hz_cust_site_uses_all hcsu
                WHERE hca.party_id = hp.party_id
                  AND hp.party_id = hps.party_id
                  AND hca.cust_account_id = hcas.cust_account_id
                  AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id
                  AND hcsu.site_use_code = 'BILL_TO'
                  AND hcsu.primary_flag = 'Y'
                  --   AND UPPER (LTRIM (RTRIM (hp.party_name))) =
                  AND hcas.org_id = 85
                  -- AND ROWNUM = 1;
               --  and hca.cust_account_id =561604;
               AND hca.cust_account_id NOT IN (SELECT customer_id
                                                FROM jai_cmn_cus_addresses);
BEGIN
   FOR i IN customer_info
   LOOP
      BEGIN
      /* This Isert Statement Enter Value with customer address site*/
         INSERT INTO jai_cmn_cus_addresses
                     (customer_id,
                      address_id,
                      cst_reg_no,
                      st_reg_no,
                      vat_reg_no,
                      service_tax_regno,
                      tax_category_list, price_list_id,
                      customer_address_id,
                      last_updated_by, last_update_date,
                      created_by, creation_date
                     )
              VALUES (i.cust_account_id                          --customer_id
                                       ,
                      i.cust_acct_site_id                    --address_id
                                              ,
                      'Not Applicable'                            --cst_reg_no
                                      ,
                      'Not Applicable'                             --st_reg_no
                                      ,
                      'Not Applicable'                            --vat_reg_no
                                      ,
                      'Not Applicable'                     --SERVICE_TAX_REGNO
                                      ,
                      NULL                                 --tax_category_list
                          , NULL                               --price_list_id
                                ,
                      jai_cmn_cus_addresses_s.NEXTVAL    --customer_address_id
                                                     ,
                      1110                                   --last_updated_by
                          , SYSDATE                         --last_update_date
                                   ,
                      1110                                        --created_by
                          , SYSDATE                            --creation_date
                     );
           /* This Insert statement Enters Value without Customer address */
         INSERT INTO jai_cmn_cus_addresses
                     (customer_id, address_id,
                      cst_reg_no,
                      st_reg_no,
                      vat_reg_no,
                      service_tax_regno,
                      tax_category_list, price_list_id,
                      customer_address_id,
                      last_updated_by, last_update_date,
                      created_by, creation_date
                     )
              VALUES (i.cust_account_id                          --customer_id
                                       , 0                        --address_id
                                          ,
                      'Not Applicable'                            --cst_reg_no
                                      ,
                      'Not Applicable'                             --st_reg_no
                                      ,
                      'Not Applicable'                            --vat_reg_no
                                      ,
                      'Not Applicable'                     --SERVICE_TAX_REGNO
                                      ,
                      NULL                                 --tax_category_list
                          , NULL                               --price_list_id
                                ,
                      jai_cmn_cus_addresses_s.NEXTVAL    --customer_address_id
                                                     ,
                      1110                                   --last_updated_by
                          , SYSDATE                         --last_update_date
                                   ,
                      1110                                        --created_by
                          , SYSDATE                            --creation_date
                     );

         COMMIT;
      END;
   END LOOP;
END;
/

Query to find submitted Concurrent requests

  Query to find Concurrent Requests SELECT      user_concurrent_program_name,      responsibility_name,      request_date,      argument_tex...