API to Create Locations:
------------------------------------
CREATE OR REPLACE PROCEDURE APPS.xxmfz_create_location
IS
l_row_id VARCHAR2 (500) := NULL;
l_location_id NUMBER := NULL;
l_object_version_number NUMBER := NULL;
l_err_msg VARCHAR2 (500) := NULL;
l_db_nls_language VARCHAR2 (500) := NULL;
-- declare
ex_loc_id number;
ex_object_version_number number;
CURSOR fetch_details
IS
-- create table xxmfz_locations as select * from hr_locations_all@prod
-- hr_locations_all
SELECT * FROM xxmfz_locations where process_flag = 'N';
BEGIN
FOR get_details IN fetch_details
LOOP
BEGIN
hr_location_api.create_location
( p_validate => false
,p_effective_date => sysdate
,p_language_code => NULL
,p_location_code =>get_details.LOCATION_CODE
,p_description => get_details.description
,p_timezone_code => 'Asia/Dacca'--get_details.timezone_code
,p_tp_header_id => NULL
,p_ece_tp_location_code => NULL
,p_address_line_1 => get_details.address_line_1
,p_address_line_2 => get_details.address_line_2
,p_address_line_3 => get_details.address_line_3
,p_bill_to_site_flag => 'Y'
,p_country => 'BD'
,p_designated_receiver_id => NULL
,p_in_organization_flag =>'Y'
,p_inactive_date => NULL
,p_operating_unit_id => NULL
,p_inventory_organization_id => NULL
,p_office_site_flag => 'Y'
,p_postal_code => NULL
,p_receiving_site_flag => 'Y'
,p_region_1 => NULL
,p_region_2 => NULL
,p_region_3 => NULL
,p_ship_to_location_id => NULL
,p_ship_to_site_flag => 'Y'
,p_style => 'BD'
,p_tax_name => NULL
,p_telephone_number_1 =>NULL
,p_telephone_number_2 => NULL--'234-763-098'
,p_telephone_number_3 => NULL
,p_town_or_city => get_details.town_or_city
,p_loc_information13 => 'Dhaka'--get_details.loc_information13
,p_loc_information14 => NULL
,p_loc_information15 => NULL
,p_loc_information16 => NULL
,p_loc_information17 => NULL
,p_loc_information18 => NULL
,p_loc_information19 => NULL
,p_loc_information20 => NULL
,p_attribute_category => NULL
,p_attribute1 => NULL
,p_attribute2 => NULL
,p_attribute3 => NULL
,p_attribute4 => NULL
,p_attribute5 => NULL
,p_attribute6 => NULL
,p_attribute7 => NULL
,p_attribute8 => NULL
,p_attribute9 => NULL
,p_attribute10 => NULL
,p_attribute11 => NULL
,p_attribute12 => NULL
,p_attribute13 => NULL
,p_attribute14 => NULL
,p_attribute15 => NULL
,p_attribute16 => NULL
,p_attribute17 => NULL
,p_attribute18 => NULL
,p_attribute19 => NULL
,p_attribute20 => NULL
,p_global_attribute_category => NULL
,p_global_attribute1 => NULL
,p_global_attribute2 => NULL
,p_global_attribute3 => NULL
,p_global_attribute4 => NULL
,p_global_attribute5 => NULL
,p_global_attribute6 => NULL
,p_global_attribute7 => NULL
,p_global_attribute8 => NULL
,p_global_attribute9 => NULL
,p_global_attribute10 => NULL
,p_global_attribute11 => NULL
,p_global_attribute12 => NULL
,p_global_attribute13 => NULL
,p_global_attribute14 => NULL
,p_global_attribute15 => NULL
,p_global_attribute16 => NULL
,p_global_attribute17 => NULL
,p_global_attribute18 => NULL
,p_global_attribute19 => NULL
,p_global_attribute20 => NULL
,p_business_group_id => NULL
,p_location_id => ex_loc_id
,p_object_version_number => ex_object_version_number
);
UPDATE xxmfz_locations
SET process_flag = 'Y'
WHERE LOCATION_CODE = get_details.LOCATION_CODE;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
UPDATE xxmfz_locations
SET process_flag = 'N', err_msg = l_err_msg
WHERE LOCATION_CODE = get_details.LOCATION_CODE;
COMMIT;
END;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END;
/
No comments:
Post a Comment