CREATE OR REPLACE PROCEDURE APPS.xx_customer_details_upload
--********************************************************************************
--
--
-- ********************************************************************************
-- Project : SaaS
-- Application : Customers
-- Script :
-- Created by : Sachin Ingle
-- Creation date : 29-Jul-2013
-- Description : upload customers from stating table to base tables
-- Parameters : None
-- Inputs : None
-- Outputs : None
-- Database :
-- Apps. Release : Oracle Applications 12.1.3
--
-- Development and Maintenance History :
--
-- Date Version Author Description
-- ----------------------------------------------------------------------------
-- 29-Jul-2013 1.0 Sachin Ingle Initial
-- *********************************************************************************
IS
v_ref VARCHAR2 (300);
v_ref1 VARCHAR2 (300);
v_cust VARCHAR2 (300);
v_cnt NUMBER := 0;
CURSOR c1
IS
SELECT *
FROM xx_cust_stg_tl where ORIG_SYSTEM_REF is NULL ;
BEGIN
FOR j IN c1
LOOP
SELECT 'JUL-24-'||orig_system_customer_ref_seq.NEXTVAL
INTO v_ref
FROM DUAL;
SELECT 'JUL-24-'||orig_system_address_ref.NEXTVAL
INTO v_ref1
FROM DUAL;
BEGIN
v_cnt := 1;
INSERT INTO ar.ra_customers_interface_all
(orig_system_customer_ref, customer_name,
orig_system_address_ref, address1, address2, address3,
address4, city, county, state, province, country,
postal_code, site_use_code, primary_site_use_flag,
customer_status, insert_update_flag, last_updated_by,
last_update_date, created_by, creation_date,
customer_category_code, customer_type, validated_flag,
org_id
)
VALUES (v_ref, j.cust_name,
v_ref1, j.address1, NULL, NULL,
NULL, j.city, -- CITY
NULL, -- COUNTY
j.state, -- STATE
j.province, -- PROVICE
'IN', -- COUNTRY
NULL, -- POSTAL_CODE
'BILL_TO', -- SITE USE
DECODE (v_cnt, 1, 'Y', 'N'),
-- PRIMARY_SITE_USE_FLAG
'A', -- CUSTOMER_STAUS
'I', -- INSERT_UPDATE_FLAG
1110, -- LAST_UPDATED_BY
SYSDATE, -- LAST_UPDATE_DATE
1110, -- CREATED_BY
SYSDATE, -- CREATION_DATE
'CUSTOMER', -- CUSTOMER_CATEGORY_CODE
'R', 'Y',
85
);
INSERT INTO ar.ra_customer_profiles_int_all
(orig_system_customer_ref, insert_update_flag,
orig_system_address_ref, customer_profile_class_name,
credit_hold, last_updated_by, last_update_date,
created_by, creation_date, validated_flag, org_id,
overall_credit_limit,standard_term_name
)
VALUES (v_ref, -- ORIG_SYSTEM_CUSTOMER_REF
'I',
NULL, -- INSERT_UPDATE_FLAG
'DEFAULT', -- SHOULD BE VALID PROFILE CLASS
'N', -- THIS CAN BE 'Y','N' NOT NULL.
1110, -- LAST_UPDATED_BY
SYSDATE, -- LAST_UPDATE_DATE
1110, -- CREATED_BY
SYSDATE, -- CREATED_BY
'Y', 85,
NULL,j.PAYMENT_TERM
);
END;
BEGIN
INSERT INTO ra_customers_interface_all
(orig_system_customer_ref, customer_name,
orig_system_address_ref, address1, address2, address3,
address4, city, county, state, province, country,
postal_code, site_use_code, primary_site_use_flag,
customer_status, insert_update_flag, last_updated_by,
last_update_date, created_by, creation_date,
customer_category_code, customer_type, validated_flag,
org_id, bill_to_orig_address_ref
)
VALUES (v_ref, j.cust_name,
v_ref1, j.address1, NULL, NULL,
NULL, j.city, -- CITY
NULL, -- COUNTY
j.state, -- STATE
j.province, -- PROVICE
'IN', -- COUNTRY
NULL, -- POSTAL_CODE
'SHIP_TO', -- SITE USE
DECODE (v_cnt, 1, 'Y', 'N'),
-- PRIMARY_SITE_USE_FLAG
'A', -- CUSTOMER_STAUS
'I', -- INSERT_UPDATE_FLAG
1110, -- LAST_UPDATED_BY
SYSDATE, -- LAST_UPDATE_DATE
1110, -- CREATED_BY
SYSDATE, -- CREATION_DATE
'CUSTOMER', -- CUSTOMER_CATEGORY_CODE
'R', 'Y',
85, v_ref1
);
commit;
UPDATE XX_CUST_STG_TL set ORIG_SYSTEM_REF =V_REF1 where sr_no=j.SR_NO;
commit;
END;
END LOOP;
END;
/
--********************************************************************************
--
--
-- ********************************************************************************
-- Project : SaaS
-- Application : Customers
-- Script :
-- Created by : Sachin Ingle
-- Creation date : 29-Jul-2013
-- Description : upload customers from stating table to base tables
-- Parameters : None
-- Inputs : None
-- Outputs : None
-- Database :
-- Apps. Release : Oracle Applications 12.1.3
--
-- Development and Maintenance History :
--
-- Date Version Author Description
-- ----------------------------------------------------------------------------
-- 29-Jul-2013 1.0 Sachin Ingle Initial
-- *********************************************************************************
IS
v_ref VARCHAR2 (300);
v_ref1 VARCHAR2 (300);
v_cust VARCHAR2 (300);
v_cnt NUMBER := 0;
CURSOR c1
IS
SELECT *
FROM xx_cust_stg_tl where ORIG_SYSTEM_REF is NULL ;
BEGIN
FOR j IN c1
LOOP
SELECT 'JUL-24-'||orig_system_customer_ref_seq.NEXTVAL
INTO v_ref
FROM DUAL;
SELECT 'JUL-24-'||orig_system_address_ref.NEXTVAL
INTO v_ref1
FROM DUAL;
BEGIN
v_cnt := 1;
INSERT INTO ar.ra_customers_interface_all
(orig_system_customer_ref, customer_name,
orig_system_address_ref, address1, address2, address3,
address4, city, county, state, province, country,
postal_code, site_use_code, primary_site_use_flag,
customer_status, insert_update_flag, last_updated_by,
last_update_date, created_by, creation_date,
customer_category_code, customer_type, validated_flag,
org_id
)
VALUES (v_ref, j.cust_name,
v_ref1, j.address1, NULL, NULL,
NULL, j.city, -- CITY
NULL, -- COUNTY
j.state, -- STATE
j.province, -- PROVICE
'IN', -- COUNTRY
NULL, -- POSTAL_CODE
'BILL_TO', -- SITE USE
DECODE (v_cnt, 1, 'Y', 'N'),
-- PRIMARY_SITE_USE_FLAG
'A', -- CUSTOMER_STAUS
'I', -- INSERT_UPDATE_FLAG
1110, -- LAST_UPDATED_BY
SYSDATE, -- LAST_UPDATE_DATE
1110, -- CREATED_BY
SYSDATE, -- CREATION_DATE
'CUSTOMER', -- CUSTOMER_CATEGORY_CODE
'R', 'Y',
85
);
INSERT INTO ar.ra_customer_profiles_int_all
(orig_system_customer_ref, insert_update_flag,
orig_system_address_ref, customer_profile_class_name,
credit_hold, last_updated_by, last_update_date,
created_by, creation_date, validated_flag, org_id,
overall_credit_limit,standard_term_name
)
VALUES (v_ref, -- ORIG_SYSTEM_CUSTOMER_REF
'I',
NULL, -- INSERT_UPDATE_FLAG
'DEFAULT', -- SHOULD BE VALID PROFILE CLASS
'N', -- THIS CAN BE 'Y','N' NOT NULL.
1110, -- LAST_UPDATED_BY
SYSDATE, -- LAST_UPDATE_DATE
1110, -- CREATED_BY
SYSDATE, -- CREATED_BY
'Y', 85,
NULL,j.PAYMENT_TERM
);
END;
BEGIN
INSERT INTO ra_customers_interface_all
(orig_system_customer_ref, customer_name,
orig_system_address_ref, address1, address2, address3,
address4, city, county, state, province, country,
postal_code, site_use_code, primary_site_use_flag,
customer_status, insert_update_flag, last_updated_by,
last_update_date, created_by, creation_date,
customer_category_code, customer_type, validated_flag,
org_id, bill_to_orig_address_ref
)
VALUES (v_ref, j.cust_name,
v_ref1, j.address1, NULL, NULL,
NULL, j.city, -- CITY
NULL, -- COUNTY
j.state, -- STATE
j.province, -- PROVICE
'IN', -- COUNTRY
NULL, -- POSTAL_CODE
'SHIP_TO', -- SITE USE
DECODE (v_cnt, 1, 'Y', 'N'),
-- PRIMARY_SITE_USE_FLAG
'A', -- CUSTOMER_STAUS
'I', -- INSERT_UPDATE_FLAG
1110, -- LAST_UPDATED_BY
SYSDATE, -- LAST_UPDATE_DATE
1110, -- CREATED_BY
SYSDATE, -- CREATION_DATE
'CUSTOMER', -- CUSTOMER_CATEGORY_CODE
'R', 'Y',
85, v_ref1
);
commit;
UPDATE XX_CUST_STG_TL set ORIG_SYSTEM_REF =V_REF1 where sr_no=j.SR_NO;
commit;
END;
END LOOP;
END;
/
No comments:
Post a Comment