Fixed Asset Location creation script
------------------------------------------
/* Formatted on 2013/04/20 02:21 (Formatter Plus v4.8.8) */
DECLARE
l_application_short_name VARCHAR2 (50);
l_key_flex_code VARCHAR2 (4);
l_structure_number NUMBER;
l_validation_date DATE;
l_combination_id NUMBER;
l_keyval_status BOOLEAN;
l_concat_segments fnd_flex_ext.segmentarray;
CURSOR cur_syscomb
IS
SELECT DISTINCT country, region, wilatay, sbu, cost_centre,
asset_location
FROM oomco_fa_upload
WHERE country
|| '-'
|| region
|| '-'
|| wilatay
|| '-'
|| sbu
|| '-'
|| cost_centre
|| '-'
|| asset_location NOT IN (
SELECT segment1
|| '-'
|| segment2
|| '-'
|| segment3
|| '-'
|| segment4
|| '-'
|| segment5
|| '-'
|| segment6
FROM fa_locations)
ORDER BY 1;
BEGIN
fnd_global.apps_initialize (1131, 20563, 140, 0, -1);
FOR i_cur_outcomb IN cur_syscomb
LOOP
l_application_short_name := 'OFA';
l_key_flex_code := 'LOC#';
l_structure_number := 101;
l_validation_date := TO_DATE ('01-JAN-2013', 'DD-MON-YYYY');
--'USA-NY-SAN FRANCISCO-OFFICE1'
l_concat_segments (1) := i_cur_outcomb.country;
l_concat_segments (2) := i_cur_outcomb.region;
l_concat_segments (3) := i_cur_outcomb.wilatay;
l_concat_segments (4) := i_cur_outcomb.sbu;
l_concat_segments (5) := i_cur_outcomb.cost_centre;
l_concat_segments (6) := i_cur_outcomb.asset_location;
l_concat_segments (7) := null;
-- l_concat_segments (8) := i_cur_outcomb.segment8;
/* l_concat_segments (1) := '11';
l_concat_segments (2) := '111';
l_concat_segments (3) := '511105';
l_concat_segments (4) := '01';
l_concat_segments (5) := '1006';
l_concat_segments (6) := '102';
l_concat_segments (7) := '00000';
l_concat_segments (8) := '0000';*/
/* l_concat_segments (1) := 'USA';
l_concat_segments (2) := 'NY';
l_concat_segments (3) := 'BALA';
l_concat_segments (4) := '1';*/
DBMS_OUTPUT.put_line ('API Started');
fnd_flex_server1.set_debugging ('6');
DBMS_OUTPUT.put_line
( 'Delimiter:'
|| fnd_flex_ext.get_delimiter
(l_application_short_name,
l_key_flex_code,
101
)
);
IF fnd_flex_ext.get_combination_id
(application_short_name => l_application_short_name,
key_flex_code => l_key_flex_code,
structure_number => 101,
validation_date => l_validation_date,
n_segments => 7,
segments => l_concat_segments,
combination_id => l_combination_id
)
THEN
DBMS_OUTPUT.put_line ('API Combination Created' || l_combination_id);
ELSE
DBMS_OUTPUT.put_line (fnd_message.get);
DBMS_OUTPUT.put_line ( 'API Not Combination Created'
|| l_combination_id
);
END IF;
END LOOP;
COMMIT;
END;
------------------------------------------
/* Formatted on 2013/04/20 02:21 (Formatter Plus v4.8.8) */
DECLARE
l_application_short_name VARCHAR2 (50);
l_key_flex_code VARCHAR2 (4);
l_structure_number NUMBER;
l_validation_date DATE;
l_combination_id NUMBER;
l_keyval_status BOOLEAN;
l_concat_segments fnd_flex_ext.segmentarray;
CURSOR cur_syscomb
IS
SELECT DISTINCT country, region, wilatay, sbu, cost_centre,
asset_location
FROM oomco_fa_upload
WHERE country
|| '-'
|| region
|| '-'
|| wilatay
|| '-'
|| sbu
|| '-'
|| cost_centre
|| '-'
|| asset_location NOT IN (
SELECT segment1
|| '-'
|| segment2
|| '-'
|| segment3
|| '-'
|| segment4
|| '-'
|| segment5
|| '-'
|| segment6
FROM fa_locations)
ORDER BY 1;
BEGIN
fnd_global.apps_initialize (1131, 20563, 140, 0, -1);
FOR i_cur_outcomb IN cur_syscomb
LOOP
l_application_short_name := 'OFA';
l_key_flex_code := 'LOC#';
l_structure_number := 101;
l_validation_date := TO_DATE ('01-JAN-2013', 'DD-MON-YYYY');
--'USA-NY-SAN FRANCISCO-OFFICE1'
l_concat_segments (1) := i_cur_outcomb.country;
l_concat_segments (2) := i_cur_outcomb.region;
l_concat_segments (3) := i_cur_outcomb.wilatay;
l_concat_segments (4) := i_cur_outcomb.sbu;
l_concat_segments (5) := i_cur_outcomb.cost_centre;
l_concat_segments (6) := i_cur_outcomb.asset_location;
l_concat_segments (7) := null;
-- l_concat_segments (8) := i_cur_outcomb.segment8;
/* l_concat_segments (1) := '11';
l_concat_segments (2) := '111';
l_concat_segments (3) := '511105';
l_concat_segments (4) := '01';
l_concat_segments (5) := '1006';
l_concat_segments (6) := '102';
l_concat_segments (7) := '00000';
l_concat_segments (8) := '0000';*/
/* l_concat_segments (1) := 'USA';
l_concat_segments (2) := 'NY';
l_concat_segments (3) := 'BALA';
l_concat_segments (4) := '1';*/
DBMS_OUTPUT.put_line ('API Started');
fnd_flex_server1.set_debugging ('6');
DBMS_OUTPUT.put_line
( 'Delimiter:'
|| fnd_flex_ext.get_delimiter
(l_application_short_name,
l_key_flex_code,
101
)
);
IF fnd_flex_ext.get_combination_id
(application_short_name => l_application_short_name,
key_flex_code => l_key_flex_code,
structure_number => 101,
validation_date => l_validation_date,
n_segments => 7,
segments => l_concat_segments,
combination_id => l_combination_id
)
THEN
DBMS_OUTPUT.put_line ('API Combination Created' || l_combination_id);
ELSE
DBMS_OUTPUT.put_line (fnd_message.get);
DBMS_OUTPUT.put_line ( 'API Not Combination Created'
|| l_combination_id
);
END IF;
END LOOP;
COMMIT;
END;
No comments :
Post a Comment