CREATE OR REPLACE PROCEDURE APPS.xx_asset_upload /*(
errbuff OUT VARCHAR2,
retcode OUT NUMBER
)*/
--********************************************************************************
--
--
-- ********************************************************************************
-- Project : SaaS
-- Application : Fixed Asset
-- Script :
-- Created by : Sachin Ingle
-- Creation date : 1-AUG-2013
-- Description : Inset Lines into FA_MASS_ADDITIONS using statging table
-- Parameters : None
-- Inputs : None
-- Outputs : None
-- Database :
-- Apps. Release : Oracle Applications 12.1.3
--
-- Development and Maintenance History :
--
-- Date Version Author Description
-- ----------------------------------------------------------------------------
-- 01-Aug-2013 1.0 Sachin Ingle Initial
-- *********************************************************************************
AS
CURSOR c1
IS
SELECT *
FROM xx_asset_load c
WHERE c.asset_number NOT IN (SELECT asset_number
FROM fa_additions a
WHERE a.asset_number = c.asset_number) and rownum=1;
p_category_id NUMBER;
p_cc VARCHAR2 (10 BYTE);
cc_id NUMBER;
p_locations NUMBER;
p_vendor_id VARCHAR2 (100);
BEGIN
FOR i IN c1
LOOP
BEGIN
SELECT create_ccid (i.expense_code_combination_code)
INTO p_cc
FROM DUAL;
EXCEPTION
WHEN OTHERS
THEN
p_cc := 'S';
END;
BEGIN
SELECT category_id
INTO p_category_id
FROM fa_categories_vl
WHERE UPPER (segment1) || '.' || UPPER (segment2) =
UPPER (i.asset_category_name);
EXCEPTION
WHEN OTHERS
THEN
p_category_id := 1;
END;
BEGIN
SELECT code_combination_id
INTO cc_id
FROM gl_code_combinations
WHERE segment1
|| '.'
|| segment2
|| '.'
|| segment3
|| '.'
|| segment4
|| '.'
|| segment5
|| '.'
|| segment6
|| '.'
|| segment7
|| '.'
|| segment8
|| '.'
|| segment9
|| '.'
|| segment10 = i.expense_code_combination_code;
EXCEPTION
WHEN OTHERS
THEN
cc_id := -1;
END;
BEGIN
SELECT location_id
INTO p_locations
FROM fa_locations
WHERE UPPER (segment1)
|| '.'
|| UPPER (segment2)
|| '.'
|| UPPER (segment3) = i.location_name;
EXCEPTION
WHEN OTHERS
THEN
p_locations := 0;
END;
BEGIN
SELECT vendor_id
INTO p_vendor_id
FROM ap_suppliers
WHERE vendor_name = i.supplier;
END;
INSERT INTO fa_mass_additions a
(a.mass_addition_id, a.asset_number,
a.description, a.asset_category_id,
a.book_type_code, a.date_placed_in_service,
a.fixed_assets_cost, a.fixed_assets_units,
a.expense_code_combination_id, a.location_id,
a.posting_status, a.queue_name, a.payables_cost,
a.depreciate_flag, a.asset_key_ccid, a.asset_type,
a.deprn_reserve, a.po_vendor_id
)
VALUES (fa_mass_additions_s.NEXTVAL, i.asset_number,
SUBSTR (i.description, 1, 80), p_category_id,
i.book_type_code, i.date_placed_in_service,
i.fixed_assets_cost, i.fixed_assets_units,
cc_id, p_locations,
i.posting_status, i.queue_name, i.payables_cost,
'YES', --i.DEPRECIATE_FLAG,
1, --i.ASSET_KEY_CCODE,
UPPER (i.asset_type),
i.deprn_reserve, p_vendor_id
);
/*INSERT INTO fa_additions_b a (a.ASSET_ID,
a.ASSET_NUMBER,
-- a.ASSET_TYPE,
--a.DESCRIPTION,
-- a.ASSET_CATEGORY_ID,
A.IN_USE_FLAG,
A.OWNED_LEASED,
A.NEW_USED,
A.UNIT_ADJUSTMENT_FLAG,
A.ADD_COST_JE_FLAG,
A.ATTRIBUTE_CATEGORY_CODE,
A.CONTEXT,
A.INVENTORIAL,
A.LAST_UPDATE_DATE,
A.lAST_UPDATED_BY,
A.CREATED_BY,
A.CREATION_DATE,
A.LAST_UPDATE_LOGIN,
--a.BOOK_TYPE_CODE,
-- a.DATE_PLACED_IN_SERVICE,
--a.FIXED_ASSETS_COST,
a.CURRENT_UNITS,
-- a.EXPENSE_CODE_COMBINATION_ID,
--a.LOCATION_ID,
--a.POSTING_STATUS,
--a.QUEUE_NAME,
--a.PAYABLES_COST ,
--a.DEPRECIATE_FLAG,
a.ASSET_KEY_CCID,
a.ASSET_TYPE)
VALUES (fa_mass_additions_s.NEXTVAL,
i.ASSET_NUMBER,
'YES',
'OWNED',
'NEW',
'NO',
'NO',
i.ASSET_CATEGORY_NAME,
i.ASSET_CATEGORY_NAME,
'YES',
SYSDATE,
1189,
1189,
SYSDATE,
20556932,
i.FIXED_ASSETS_UNITS,
1,
UPPER (i.ASSET_TYPE));*/
COMMIT;
END LOOP;
END;
/
errbuff OUT VARCHAR2,
retcode OUT NUMBER
)*/
--********************************************************************************
--
--
-- ********************************************************************************
-- Project : SaaS
-- Application : Fixed Asset
-- Script :
-- Created by : Sachin Ingle
-- Creation date : 1-AUG-2013
-- Description : Inset Lines into FA_MASS_ADDITIONS using statging table
-- Parameters : None
-- Inputs : None
-- Outputs : None
-- Database :
-- Apps. Release : Oracle Applications 12.1.3
--
-- Development and Maintenance History :
--
-- Date Version Author Description
-- ----------------------------------------------------------------------------
-- 01-Aug-2013 1.0 Sachin Ingle Initial
-- *********************************************************************************
AS
CURSOR c1
IS
SELECT *
FROM xx_asset_load c
WHERE c.asset_number NOT IN (SELECT asset_number
FROM fa_additions a
WHERE a.asset_number = c.asset_number) and rownum=1;
p_category_id NUMBER;
p_cc VARCHAR2 (10 BYTE);
cc_id NUMBER;
p_locations NUMBER;
p_vendor_id VARCHAR2 (100);
BEGIN
FOR i IN c1
LOOP
BEGIN
SELECT create_ccid (i.expense_code_combination_code)
INTO p_cc
FROM DUAL;
EXCEPTION
WHEN OTHERS
THEN
p_cc := 'S';
END;
BEGIN
SELECT category_id
INTO p_category_id
FROM fa_categories_vl
WHERE UPPER (segment1) || '.' || UPPER (segment2) =
UPPER (i.asset_category_name);
EXCEPTION
WHEN OTHERS
THEN
p_category_id := 1;
END;
BEGIN
SELECT code_combination_id
INTO cc_id
FROM gl_code_combinations
WHERE segment1
|| '.'
|| segment2
|| '.'
|| segment3
|| '.'
|| segment4
|| '.'
|| segment5
|| '.'
|| segment6
|| '.'
|| segment7
|| '.'
|| segment8
|| '.'
|| segment9
|| '.'
|| segment10 = i.expense_code_combination_code;
EXCEPTION
WHEN OTHERS
THEN
cc_id := -1;
END;
BEGIN
SELECT location_id
INTO p_locations
FROM fa_locations
WHERE UPPER (segment1)
|| '.'
|| UPPER (segment2)
|| '.'
|| UPPER (segment3) = i.location_name;
EXCEPTION
WHEN OTHERS
THEN
p_locations := 0;
END;
BEGIN
SELECT vendor_id
INTO p_vendor_id
FROM ap_suppliers
WHERE vendor_name = i.supplier;
END;
INSERT INTO fa_mass_additions a
(a.mass_addition_id, a.asset_number,
a.description, a.asset_category_id,
a.book_type_code, a.date_placed_in_service,
a.fixed_assets_cost, a.fixed_assets_units,
a.expense_code_combination_id, a.location_id,
a.posting_status, a.queue_name, a.payables_cost,
a.depreciate_flag, a.asset_key_ccid, a.asset_type,
a.deprn_reserve, a.po_vendor_id
)
VALUES (fa_mass_additions_s.NEXTVAL, i.asset_number,
SUBSTR (i.description, 1, 80), p_category_id,
i.book_type_code, i.date_placed_in_service,
i.fixed_assets_cost, i.fixed_assets_units,
cc_id, p_locations,
i.posting_status, i.queue_name, i.payables_cost,
'YES', --i.DEPRECIATE_FLAG,
1, --i.ASSET_KEY_CCODE,
UPPER (i.asset_type),
i.deprn_reserve, p_vendor_id
);
/*INSERT INTO fa_additions_b a (a.ASSET_ID,
a.ASSET_NUMBER,
-- a.ASSET_TYPE,
--a.DESCRIPTION,
-- a.ASSET_CATEGORY_ID,
A.IN_USE_FLAG,
A.OWNED_LEASED,
A.NEW_USED,
A.UNIT_ADJUSTMENT_FLAG,
A.ADD_COST_JE_FLAG,
A.ATTRIBUTE_CATEGORY_CODE,
A.CONTEXT,
A.INVENTORIAL,
A.LAST_UPDATE_DATE,
A.lAST_UPDATED_BY,
A.CREATED_BY,
A.CREATION_DATE,
A.LAST_UPDATE_LOGIN,
--a.BOOK_TYPE_CODE,
-- a.DATE_PLACED_IN_SERVICE,
--a.FIXED_ASSETS_COST,
a.CURRENT_UNITS,
-- a.EXPENSE_CODE_COMBINATION_ID,
--a.LOCATION_ID,
--a.POSTING_STATUS,
--a.QUEUE_NAME,
--a.PAYABLES_COST ,
--a.DEPRECIATE_FLAG,
a.ASSET_KEY_CCID,
a.ASSET_TYPE)
VALUES (fa_mass_additions_s.NEXTVAL,
i.ASSET_NUMBER,
'YES',
'OWNED',
'NEW',
'NO',
'NO',
i.ASSET_CATEGORY_NAME,
i.ASSET_CATEGORY_NAME,
'YES',
SYSDATE,
1189,
1189,
SYSDATE,
20556932,
i.FIXED_ASSETS_UNITS,
1,
UPPER (i.ASSET_TYPE));*/
COMMIT;
END LOOP;
END;
/
No comments:
Post a Comment