Untitled diff

Created Diff never expires
8 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
578 lines
23 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
590 lines
create or replace PACKAGE BODY CSE_BULK_IMPORT_PVT
create or replace PACKAGE BODY CSE_BULK_IMPORT_PVT
AS
AS
/*$Header: fusionapps/scm/cse/db/plsql/cse_bulk_import_pvt.pkb sikumar_bug-25242966/2 2016/12/15 14:56:41 sikumar Exp $*/
/*$Header: fusionapps/scm/cse/db/plsql/cse_bulk_import_pvt.pkb /st_fusionapps_pt-v2mibscmoal/15 2016/12/29 23:59:25 soumdutt Exp $*/
-- Maximum Partition Size Constants
-- Maximum Partition Size Constants
C_MAX_PARTITION_SIZE CONSTANT NUMBER := 1000;
C_MAX_PARTITION_SIZE CONSTANT NUMBER := 1000;
C_MAX_BUFFER_SIZE CONSTANT NUMBER := 1000;
C_MAX_BUFFER_SIZE CONSTANT NUMBER := 1000;
C_CREATE_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_CREATE';
C_CREATE_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_CREATE';
C_UPDATE_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_UPDATE';
C_UPDATE_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_UPDATE';
C_DELETE_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_DELETE';
C_DELETE_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_DELETE';
C_ADD_REL_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_ADD';
C_ADD_REL_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_ADD';
C_REM_REL_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_REMOVE';
C_REM_REL_ACTION_CODE CONSTANT VARCHAR2(30) := 'ORA_REMOVE';
C_INT_READY CONSTANT VARCHAR2(30) := 'READY';
C_INT_READY CONSTANT VARCHAR2(30) := 'READY';
C_INT_VALID CONSTANT VARCHAR2(30) := 'VALID';
C_INT_VALID CONSTANT VARCHAR2(30) := 'VALID';
C_INT_ERROR CONSTANT VARCHAR2(30) := 'ERROR';
C_INT_ERROR CONSTANT VARCHAR2(30) := 'ERROR';
C_ASSETS_INT_TBL_NAME CONSTANT VARCHAR2(30) := 'CSE_ASSETS_INT';
C_ASSETS_INT_TBL_NAME CONSTANT VARCHAR2(30) := 'CSE_ASSETS_INT';
C_ASSET_CHGS_TBL_NAME CONSTANT VARCHAR2(30) := 'CSE_ASSET_CHARGES_INT';
C_ASSET_CHGS_TBL_NAME CONSTANT VARCHAR2(30) := 'CSE_ASSET_CHARGES_INT';
C_MESSAGE_TOKEN_NAME CONSTANT VARCHAR2(30) := 'ATTRIBUTE_NAME';
C_MESSAGE_TOKEN_NAME CONSTANT VARCHAR2(30) := 'ATTRIBUTE_NAME';
C_SEVERITY_ERROR CONSTANT VARCHAR2(1) := 'E';
C_SEVERITY_ERROR CONSTANT VARCHAR2(1) := 'E';
C_SEVERITY_WARNING CONSTANT VARCHAR2(1) := 'W';
C_SEVERITY_WARNING CONSTANT VARCHAR2(1) := 'W';
C_NULL_STRING CONSTANT VARCHAR2(5) := '#NULL';
C_NULL_STRING CONSTANT VARCHAR2(5) := '#NULL';
C_NULL_DATE CONSTANT DATE := TO_DATE('5','j');
C_NULL_DATE CONSTANT DATE := TO_DATE('5','j');


/*=============================================================================
/*=============================================================================
| PROCEDURE - trigger_customer_asset_events()
| PROCEDURE - trigger_customer_asset_events()
|
|
| DESCRIPTION
| DESCRIPTION
| This procedure is used to analyze when to raise customer asset business events
| This procedure is used to analyze when to raise customer asset business events
| PARAMETERS
| PARAMETERS
| p_partition_number - Input parameter patrition number
| p_partition_number - Input parameter patrition number
| p_batch_id - Input parameter of batch id
| p_batch_id - Input parameter of batch id
| p_operation_code - Input parameter of batch operation code
| p_operation_code - Input parameter of batch operation code
| x_error_message - Out parameter with error message if any
| x_error_message - Out parameter with error message if any
| x_return_status - Out parameter with Success or failure status of proc
| x_return_status - Out parameter with Success or failure status of proc
*============================================================================*/
*============================================================================*/


PROCEDURE trigger_customer_asset_events(
PROCEDURE trigger_customer_asset_events(
p_partition_number IN NUMBER,
p_partition_number IN NUMBER,
p_batch_id IN NUMBER,
p_batch_id IN NUMBER,
p_operation_code IN VARCHAR2,
p_operation_code IN VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2);
x_return_status OUT NOCOPY VARCHAR2);


/*=============================================================================
/*=============================================================================
| PROCEDURE - create_batch()
| PROCEDURE - create_batch()
|
|
| DESCRIPTION
| DESCRIPTION
| This procedure is used to create a batch and associate assets and partlist
| This procedure is used to create a batch and associate assets and partlist
| for which no batch name and code is provided
| for which no batch name and code is provided
| PARAMETERS
| PARAMETERS
| p_batch_type - Input parameter identifying ALM product family
| p_batch_type - Input parameter identifying ALM product family
| x_batch_id - Output parameter of batch id that is created by default
| x_batch_id - Output parameter of batch id that is created by default
| x_batch_code - Out parameter of batch code that is created by default
| x_batch_code - Out parameter of batch code that is created by default
| x_error_message - Out parameter with error message if any
| x_error_message - Out parameter with error message if any
| x_return_status - Out parameter with Success or failure status of proc
| x_return_status - Out parameter with Success or failure status of proc
|
|
|
|
*============================================================================*/
*============================================================================*/


PROCEDURE create_batch(
PROCEDURE create_batch(
p_batch_type IN VARCHAR2,
p_batch_type IN VARCHAR2,
x_batch_id OUT NOCOPY NUMBER,
x_batch_id OUT NOCOPY NUMBER,
x_batch_code OUT NOCOPY VARCHAR2,
x_batch_code OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2)
x_return_status OUT NOCOPY VARCHAR2)
IS
IS
l_validate_batch_needed VARCHAR2(1):= 'N';
l_validate_batch_needed VARCHAR2(1):= 'N';
l_current_location_type1 VARCHAR2(30);
l_current_location_type1 VARCHAR2(30);
l_current_location_type2 VARCHAR2(30);
l_current_location_type2 VARCHAR2(30);
l_interface_batch_id NUMBER;
l_interface_batch_id NUMBER;
l_load_request_id NUMBER;
l_load_request_id NUMBER;
l_source_system_code VARCHAR2(30);
l_source_system_code VARCHAR2(30);
l_api_name VARCHAR2(300) := 'cse_bulk_import_pvt.create_batch';
l_api_name VARCHAR2(300) := 'cse_bulk_import_pvt.create_batch';

BEGIN
BEGIN

x_return_status := fnd_api.g_ret_sts_success;
x_return_status := fnd_api.g_ret_sts_success;
cse_int_utils_pvt.log_messages(fnd_log.level_severe, l_api_name, 'Entering API'||l_api_name);
cse_int_utils_pvt.log_messages(fnd_log.level_severe, l_api_name, 'Entering API'||l_api_name);
IF p_batch_type = 'CA' THEN
IF p_batch_type = 'CA' THEN
l_current_location_type1 := 'ORA_CUSTOMER';
l_current_location_type1 := 'ORA_CUSTOMER';
l_current_location_type2 := 'ORA_CUSTOMER';
l_current_location_type2 := 'ORA_CUSTOMER';
l_source_system_code := 'CSI';
l_source_system_code := 'CSI';
ELSIF p_batch_type = 'MA' THEN
ELSIF p_batch_type = 'MA' THEN
l_current_location_type1 := 'ORA_WORK_CENTER';
l_current_location_type1 := 'ORA_WORK_CENTER';
l_current_location_type2 := 'ORA_UNKNOWN';
l_current_location_type2 := 'ORA_UNKNOWN';
l_source_system_code := 'MNT';
l_source_system_code := 'MNT';
END IF;
END IF;

BEGIN
BEGIN

SELECT 'Y'
SELECT 'Y'
INTO l_validate_batch_needed
INTO l_validate_batch_needed
FROM dual
FROM dual
WHERE EXISTS
WHERE EXISTS
(SELECT 1
(SELECT 1
FROM cse_assets_int
FROM cse_assets_int
WHERE interface_status_code = 'READY'
WHERE interface_status_code = 'READY'
AND interface_batch_id IS NULL
AND interface_batch_id IS NULL
AND interface_batch_code IS NULL
AND interface_batch_code IS NULL
AND current_location_context IN ( l_current_location_type1,l_current_location_type2)
AND current_location_context IN ( l_current_location_type1,l_current_location_type2)
);
);
EXCEPTION
EXCEPTION
WHEN NO_DATA_FOUND THEN
WHEN NO_DATA_FOUND THEN
l_validate_batch_needed:=NULL;
l_validate_batch_needed:=NULL;
END;
END;
IF l_validate_batch_needed = 'Y' THEN
IF l_validate_batch_needed = 'Y' THEN
l_interface_batch_id := CSE_INT_S.NEXTVAL;
l_interface_batch_id := CSE_INT_S.NEXTVAL;
l_load_request_id := CSE_INT_S.NEXTVAL;
l_load_request_id := CSE_INT_S.NEXTVAL;
x_batch_id := l_interface_batch_id;
x_batch_id := l_interface_batch_id;
x_batch_code := SUBSTR(p_batch_type||l_interface_batch_id,1,30);
x_batch_code := SUBSTR(p_batch_type||l_interface_batch_id,1,30);
INSERT
INSERT
INTO cse_int_batches_b
INTO cse_int_batches_b
(
(
interface_batch_id ,
interface_batch_id ,
object_version_number ,
object_version_number ,
interface_batch_code ,
interface_batch_code ,
interface_batch_status ,
interface_batch_status ,
source_system_type ,
source_system_type ,
source_system_code ,
source_system_code ,
internal_batch_type ,
internal_batch_type ,
created_by ,
created_by ,
creation_date ,
creation_date ,
last_updated_by ,
last_updated_by ,
last_update_date ,
last_update_date ,
last_update_login ,
last_update_login ,
load_request_id ,
load_request_id ,
request_id ,
request_id ,
job_definition_name ,
job_definition_name ,
job_definition_package
job_definition_package
)
)
VALUES
VALUES
(
(
l_interface_batch_id ,
l_interface_batch_id ,
1 ,
1 ,
x_batch_code ,
x_batch_code ,
'READY' ,
'READY' ,
'ORA_INTERNAL' ,
'ORA_INTERNAL' ,
l_source_system_code ,
l_source_system_code ,
p_batch_type ,
p_batch_type ,
fnd_global.who_user_name ,
fnd_global.who_user_name ,
sysdate ,
sysdate ,
fnd_global.who_user_name ,
fnd_global.who_user_name ,
sysdate ,
sysdate ,
fnd_global.user_guid ,
fnd_global.user_guid ,
l_load_request_id ,
l_load_request_id ,
fnd_job.REQUEST_ID ,
fnd_job.REQUEST_ID ,
fnd_job.JOB_DEFINITION_NAME ,
fnd_job.JOB_DEFINITION_NAME ,
fnd_job.JOB_PACKAGE_NAME
fnd_job.JOB_PACKAGE_NAME
);
);
INSERT
INSERT
INTO cse_int_batches_tl
INTO cse_int_batches_tl
(
(
interface_batch_id ,
interface_batch_id ,
language ,
language ,
object_version_number ,
object_version_number ,
source_lang ,
source_lang ,
interface_batch_name ,
interface_batch_name ,
interface_batch_description ,
interface_batch_description ,
load_request_id ,
load_request_id ,
created_by ,
created_by ,
creation_date ,
creation_date ,
last_updated_by ,
last_updated_by ,
last_update_date ,
last_update_date ,
last_update_login
last_update_login
)
)
VALUES
VALUES
(
(
l_interface_batch_id ,
l_interface_batch_id ,
USERENV('LANG') ,
USERENV('LANG') ,
1 ,
1 ,
USERENV('LANG') ,
USERENV('LANG') ,
x_batch_code ,
x_batch_code ,
x_batch_code ,
x_batch_code ,
l_load_request_id ,
l_load_request_id ,
fnd_global.who_user_name ,
fnd_global.who_user_name ,
sysdate ,
sysdate ,
fnd_global.who_user_name ,
fnd_global.who_user_name ,
sysdate ,
sysdate ,
fnd_global.user_guid
fnd_global.user_guid
);
);
UPDATE cse_assets_int
UPDATE cse_assets_int
SET interface_batch_id = l_interface_batch_id ,
SET interface_batch_id = l_interface_batch_id ,
interface_batch_code = x_batch_code
interface_batch_code = x_batch_code
WHERE interface_status_code = 'READY'
WHERE interface_status_code = 'READY'
AND interface_batch_id IS NULL
AND interface_batch_id IS NULL
AND interface_batch_code IS NULL
AND interface_batch_code IS NULL
AND current_location_context IN ( l_current_location_type1,l_current_location_type2);
AND current_location_context IN ( l_current_location_type1,l_current_location_type2);
END IF;
END IF;
EXCEPTION
EXCEPTION
WHEN OTHERS THEN
WHEN OTHERS THEN
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_error_message := sqlerrm;
x_error_message := sqlerrm;
cse_int_utils_pvt.log_messages(fnd_log.level_severe, l_api_name, sqlerrm);
cse_int_utils_pvt.log_messages(fnd_log.level_severe, l_api_name, sqlerrm);
END create_batch;
END create_batch;

/*=============================================================================
/*=============================================================================
| PROCEDURE - partition_batch()
| PROCEDURE - partition_batch()
|
|
| DESCRIPTION
| DESCRIPTION
| This procedure is used to partition a batch into similar bucket size
| This procedure is used to partition a batch into similar bucket size
| for better performance.
| for better performance.
|
|
| PARAMETERS
| PARAMETERS
| p_batch_id - Input parameter of batch id that need to be processed
| p_batch_id - Input parameter of batch id that need to be processed
| x_partition_numbers - Out parameter with table of partitions assigned
| x_partition_numbers - Out parameter with table of partitions assigned
| to a batch
| to a batch
| x_error_message - Out parameter with error message if any
| x_error_message - Out parameter with error message if any
| x_return_status - Out parameter with Success or failure status of proc
| x_return_status - Out parameter with Success or failure status of proc
|
|
|
|
*============================================================================*/
*============================================================================*/

PROCEDURE partition_batch(
PROCEDURE partition_batch(
px_batch_id IN OUT NOCOPY NUMBER,
px_batch_id IN OUT NOCOPY NUMBER,
p_batch_code IN VARCHAR2,
p_batch_code IN VARCHAR2,
x_partition_numbers OUT NOCOPY FND_TABLE_OF_NUMBER,
x_partition_numbers OUT NOCOPY FND_TABLE_OF_NUMBER,
x_record_count OUT NOCOPY NUMBER,
x_record_count OUT NOCOPY NUMBER,
x_error_message OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2)
x_return_status OUT NOCOPY VARCHAR2)
IS
IS
CURSOR c_update_partList( cp_partition_number NUMBER , cp_batch_id NUMBER , cp_batch_code VARCHAR2 )
CURSOR c_update_partList( cp_partition_number NUMBER , cp_batch_id NUMBER , cp_batch_code VARCHAR2 )
IS
IS
SELECT cseai.partition_number ,
SELECT cseai.partition_number ,
cseai.asset_number ,
cseai.asset_number ,
cseai.interface_record_number ,
cseai.interface_record_number ,
cseai.interface_batch_id ,
cseai.interface_batch_id ,
cseai.item_organization_code
cseai.item_organization_code
FROM cse_assets_int cseai
FROM cse_assets_int cseai
WHERE cseai.partition_number = cp_partition_number
WHERE cseai.partition_number = cp_partition_number
AND cseai.interface_status_code = 'READY'
AND cseai.interface_status_code = 'READY'
AND (cseai.interface_batch_id = cp_batch_id
AND (cseai.interface_batch_id = cp_batch_id
OR cseai.interface_batch_code = cp_batch_code);
OR cseai.interface_batch_code = cp_batch_code);
CURSOR c_update_actv_asset_partList( cp_partition_number NUMBER , cp_batch_id NUMBER , cp_batch_code VARCHAR2 )
CURSOR c_update_actv_asset_partList( cp_partition_number NUMBER , cp_batch_id NUMBER , cp_batch_code VARCHAR2 )
IS
IS
SELECT cseai.partition_number ,
SELECT cseai.partition_number ,
cseai.interface_record_number ,
cseai.interface_record_number ,
cseai.interface_batch_id ,
cseai.interface_batch_id ,
cseai.asset_number ,
cseai.asset_number ,
cseai.item_organization_code ,
cseai.item_organization_code ,
(SELECT cseb.item_organization_id
(SELECT cseb.item_organization_id
FROM cse_assets_b cseb
FROM cse_assets_b cseb
WHERE cseb.asset_number=cseai.asset_number
WHERE cseb.asset_number=cseai.asset_number
) AS asset_org_id ,
) AS asset_org_id ,
(SELECT iorgp.organization_id
(SELECT iorgp.organization_id
FROM inv_org_parameters iorgp
FROM inv_org_parameters iorgp
WHERE cseai.item_organization_code=iorgp.organization_code
WHERE cseai.item_organization_code=iorgp.organization_code
) AS organization_id
) AS organization_id
FROM cse_assets_int cseai
FROM cse_assets_int cseai
WHERE cseai.interface_status_code = 'READY'
WHERE cseai.interface_status_code = 'READY'
AND cseai.partition_number = cp_partition_number
AND cseai.partition_number = cp_partition_number
AND (cseai.interface_batch_id = cp_batch_id
AND (cseai.interface_batch_id = cp_batch_id
OR cseai.interface_batch_code = cp_batch_code);
OR cseai.interface_batch_code = cp_batch_code);
CURSOR c_get_int_batch_type( cp_batch_id NUMBER ,cp_batch_code VARCHAR2)
CURSOR c_get_int_batch_type( cp_batch_id NUMBER ,cp_batch_code VARCHAR2)
IS
IS
SELECT INTERNAL_BATCH_TYPE
SELECT INTERNAL_BATCH_TYPE
FROM CSE_INT_BATCHES_B cseIntBatch
FROM CSE_INT_BATCHES_B cseIntBatch
WHERE (cseIntBatch.interface_batch_id = cp_batch_id
WHERE (cseIntBatch.interface_batch_id = cp_batch_id
OR cseIntBatch.interface_batch_code = cp_batch_code);
OR cseIntBatch.interface_batch_code = cp_batch_code);
/*Cursor to get the records trying perforn more than one operation on the same asset in the same batch*/
/*Cursor to get the records trying perforn more than one operation on the same asset in the same batch*/
CURSOR c_get_records_dup_asset
CURSOR c_get_records_dup_asset
IS
IS
SELECT interface_record_number
SELECT interface_record_number
FROM cse_assets_int
FROM cse_assets_int
WHERE (interface_batch_code = p_batch_code
WHERE (interface_batch_code = p_batch_code
OR interface_batch_id = px_batch_id)
OR interface_batch_id = px_batch_id)
AND interface_status_code = 'READY'
AND interface_status_code = 'READY'
AND NVL(RELATIONSHIP_ACTION_CODE,C_REM_REL_ACTION_CODE) = C_ADD_REL_ACTION_CODE
AND NVL(RELATIONSHIP_ACTION_CODE,C_REM_REL_ACTION_CODE) = C_ADD_REL_ACTION_CODE
AND ACTION_CODE = C_UPDATE_ACTION_CODE
AND asset_number IN
AND asset_number IN
(SELECT asset_number
(SELECT asset_number
FROM cse_assets_int
FROM cse_assets_int
WHERE interface_status_code = 'READY'
WHERE interface_status_code = 'READY'
AND (interface_batch_code =p_batch_code
AND (interface_batch_code =p_batch_code
OR interface_batch_id =px_batch_id)
OR interface_batch_id =px_batch_id)
GROUP BY asset_number
GROUP BY asset_number
HAVING COUNT(*) >1
HAVING COUNT(*) >1
);
);
TYPE l_update_partList_tbl_type
TYPE l_update_partList_tbl_type
IS
IS
TABLE OF c_update_partList%ROWTYPE;
TABLE OF c_update_partList%ROWTYPE;
TYPE l_updt_actv_partList_tbl_type
TYPE l_updt_actv_partList_tbl_type
IS
IS
TABLE OF c_update_actv_asset_partList%ROWTYPE;
TABLE OF c_update_actv_asset_partList%ROWTYPE;
l_update_partList_tbl l_update_partList_tbl_type;
l_update_partList_tbl l_update_partList_tbl_type;
l_update_actv_partList_tbl l_updt_actv_partList_tbl_type;
l_update_actv_partList_tbl l_updt_actv_partList_tbl_type;
l_api_name VARCHAR2(300) := 'cse_bulk_import_pvt.partition_batch';
l_api_name VARCHAR2(300) := 'cse_bulk_import_pvt.partition_batch';
l_Count_records NUMBER;
l_Count_records NUMBER;
l_Number_of_Batches NUMBER;
l_Number_of_Batches NUMBER;
l_batch_code cse_int_batches_b.interface_batch_code%TYPE := p_batch_code;
l_batch_code cse_int_batches_b.interface_batch_code%TYPE := p_batch_code;
l_int_batch_type cse_int_batches_b.internal_batch_type%TYPE;
l_int_batch_type cse_int_batches_b.internal_batch_type%TYPE;
l_batch_id NUMBER := px_batch_id;
l_batch_id NUMBER := px_batch_id;
l_partition_num NUMBER;
l_partition_num NUMBER;
TYPE l_dup_asset_tbl_type
TYPE l_dup_asset_tbl_type
IS
IS
TABLE OF c_get_records_dup_asset%ROWTYPE;
TABLE OF c_get_records_dup_asset%ROWTYPE;
l_dup_asset_tbl l_dup_asset_tbl_type;
l_dup_asset_tbl l_dup_asset_tbl_type;

BEGIN
BEGIN

cse_int_utils_pvt.log_messages(fnd_log.level_info, l_api_name, 'Beginning of procedure..');
cse_int_utils_pvt.log_messages(fnd_log.level_info, l_api_name, 'Beginning of procedure..');
x_return_status := fnd_api.g_ret_sts_success;
x_return_status := fnd_api.g_ret_sts_success;
IF px_batch_id IS NOT NULL AND p_batch_code IS NULL THEN
IF px_batch_id IS NOT NULL AND p_batch_code IS NULL THEN
BEGIN
BEGIN
SELECT DISTINCT cseib.interface_batch_code
SELECT DISTINCT cseib.interface_batch_code
INTO l_batch_code
INTO l_batch_code
FROM cse_int_batches_b cseib
FROM cse_int_batches_b cseib
WHERE cseib.interface_batch_id = px_batch_id;
WHERE cseib.interface_batch_id = px_batch_id;
END;
END;
ELSIF px_batch_id IS NULL AND p_batch_code IS NOT NULL THEN
ELSIF px_batch_id IS NULL AND p_batch_code IS NOT NULL THEN

BEGIN
BEGIN

SELECT DISTINCT cseib.interface_batch_id
SELECT DISTINCT cseib.interface_batch_id
INTO l_batch_id
INTO l_batch_id
FROM cse_int_batches_b cseib
FROM cse_int_batches_b cseib
WHERE cseib.interface_batch_code = p_batch_code;
WHERE cseib.interface_batch_code = p_batch_code;
END;
END;
END IF;
END IF;
px_batch_id := l_batch_id ;
px_batch_id := l_batch_id ;
SELECT COUNT(1)
SELECT COUNT(1)
INTO l_Count_records
INTO l_Count_records
FROM cse_assets_int csei
FROM cse_assets_int csei
WHERE (csei.interface_batch_id = l_batch_id
WHERE (csei.interface_batch_id = l_batch_id
OR csei.interface_batch_code = l_batch_code)
OR csei.interface_batch_code = l_batch_code)
AND csei.interface_status_code = 'READY';
AND csei.interface_status_code = 'READY';
x_record_count :=l_Count_records;
x_record_count :=l_Count_records;
IF l_Count_records > 0 THEN
IF l_Count_records > 0 THEN
l_Number_of_Batches := CEIL(l_Count_records/c_max_partition_size);
l_Number_of_Batches := CEIL(l_Count_records/c_max_partition_size);
x_partition_numbers := FND_TABLE_OF_NUMBER();
x_partition_numbers := FND_TABLE_OF_NUMBER();
FOR i IN 1..l_Number_of_Batches
FOR i IN 1..l_Number_of_Batches
LOOP
LOOP
l_partition_num := cse_int_s.nextval;
l_partition_num := cse_int_s.nextval;
x_partition_numbers.extend;
x_partition_numbers.extend;
x_partition_numbers(i) := l_partition_num;
x_partition_numbers(i) := l_partition_num;
UPDATE cse_assets_int cseai
UPDATE cse_assets_int cseai
SET partition_number = l_partition_num,
SET partition_number = l_partition_num,
asset_number = DECODE(asset_number,NULL, DECODE(action_code,C_CREATE_ACTION_CODE,TO_CHAR(cse_asset_numbers_s.nextval),asset_number),asset_number),
asset_number = DECODE(asset_number,NULL, DECODE(action_code,C_CREATE_ACTION_CODE,TO_CHAR(cse_asset_numbers_s.nextval),asset_number),asset_number),
last_updated_by = fnd_global.who_user_name,
last_updated_by = fnd_global.who_user_name,
last_update_date = sysdate,
last_update_date = sysdate,
last_update_login = fnd_global.user_guid,
last_update_login = fnd_global.user_guid,
job_definition_name = fnd_job.job_definition_name,
job_definition_name = fnd_job.job_definition_name,
job_definition_package = fnd_job.job_package_name,
job_definition_package = fnd_job.job_package_name,
interface_batch_id = l_batch_id
interface_batch_id = l_batch_id
WHERE ROWNUM BETWEEN 1 AND c_max_partition_size
WHERE ROWNUM BETWEEN 1 AND c_max_partition_size
AND cseai.partition_number IS NULL
AND cseai.partition_number IS NULL
AND cseai.interface_status_code = 'READY'
AND cseai.interface_status_code = 'READY'
AND (cseai.interface_batch_id = l_batch_id
AND (cseai.interface_batch_id = l_batch_id
OR cseai.interface_batch_code = l_batch_code);
OR cseai.interface_batch_code = l_batch_code);
/*Creating a new partition for records trying to perform more than one operation on the same asset
/*Creating a new partition for records trying to perform more than one operation on the same asset
*/
*/
OPEN c_get_records_dup_asset;
OPEN c_get_records_dup_asset;
LOOP
LOOP
FETCH c_get_records_dup_asset BULK COLLECT
FETCH c_get_records_dup_asset BULK COLLECT
INTO l_dup_asset_tbl LIMIT c_max_buffer_size ;
INTO l_dup_asset_tbl LIMIT c_max_buffer_size ;
EXIT
EXIT
WHEN l_dup_asset_tbl.count = 0;
WHEN l_dup_asset_tbl.count = 0;
l_partition_num := cse_int_s.nextval;
l_partition_num := cse_int_s.nextval;
x_partition_numbers.extend;
x_partition_numbers.extend;
x_partition_numbers(i+1) := l_partition_num;
x_partition_numbers(i+1) := l_partition_num;
FORALL j IN l_dup_asset_tbl.FIRST..l_dup_asset_tbl.LAST
FORALL i IN l_dup_asset_tbl.FIRST..l_dup_asset_tbl.LAST
UPDATE cse_assets_int cseai
UPDATE cse_assets_int cseai
SET partition_number = l_partition_num,
SET partition_number = l_partition_num,
asset_number = DECODE(asset_number,NULL, DECODE(action_code,C_CREATE_ACTION_CODE,TO_CHAR(cse_asset_numbers_s.nextval),asset_number),asset_number),
asset_number = DECODE(asset_number,NULL, DECODE(action_code,C_CREATE_ACTION_CODE,TO_CHAR(cse_asset_numbers_s.nextval),asset_number),asset_number),
last_updated_by = fnd_global.who_user_name,
last_updated_by = fnd_global.who_user_name,
last_update_date = sysdate,
last_update_date = sysdate,
last_update_login = fnd_global.user_guid,
last_update_login = fnd_global.user_guid,
job_definition_name = fnd_job.job_definition_name,
job_definition_name = fnd_job.job_definition_name,
job_definition_package = fnd_job.job_package_name,
job_definition_package = fnd_job.job_package_name,
interface_batch_id = l_batch_id
interface_batch_id = l_batch_id
WHERE interface_record_number = l_dup_asset_tbl(j).interface_record_number;
WHERE interface_record_number = l_dup_asset_tbl(i).interface_record_number;
END LOOP;
END LOOP;
CLOSE c_get_records_dup_asset;
CLOSE c_get_records_dup_asset;
-- bachandr: Check if the asset is Maintenance Asset or Customer Asset and update corresponding table.
-- bachandr: Check if the asset is Maintenance Asset or Customer Asset and update corresponding table.
OPEN c_get_int_batch_type(l_batch_id,l_batch_code);
OPEN c_get_int_batch_type(l_batch_id,l_batch_code);
FETCH c_get_int_batch_type INTO l_int_batch_type;
FETCH c_get_int_batch_type INTO l_int_batch_type;
CLOSE c_get_int_batch_type;
CLOSE c_get_int_batch_type;
FOR j IN x_partition_numbers.FIRST..x_partition_numbers.LAST
FOR j IN x_partition_numbers.FIRST..x_partition_numbers.LAST
LOOP
LOOP
IF l_int_batch_type IS NOT NULL AND l_int_batch_type = 'MA' THEN
IF l_int_batch_type IS NOT NULL AND l_int_batch_type = 'MA' THEN
OPEN c_update_actv_asset_partList(x_partition_numbers(j),l_batch_id,l_batch_code);
OPEN c_update_actv_asset_partList(x_partition_numbers(j),l_batch_id,l_batch_code);
FETCH c_update_actv_asset_partList BULK COLLECT
FETCH c_update_actv_asset_partList BULK COLLECT
INTO l_update_actv_partList_tbl;
INTO l_update_actv_partList_tbl;
CLOSE c_update_actv_asset_partList;
CLOSE c_update_actv_asset_partList;
FORALL i IN l_update_actv_partList_tbl.FIRST..l_update_actv_partList_tbl.LAST
FORALL i IN l_update_actv_partList_tbl.FIRST..l_update_actv_partList_tbl.LAST
UPDATE cse_parts_list_components_int cseparti
UPDATE cse_parts_list_components_int cseparti
SET partition_number = l_update_actv_partList_tbl(i).partition_number,
SET partition_number = l_update_actv_partList_tbl(i).partition_number,
item_organization_code = l_update_actv_partList_tbl(i).item_organization_code,
item_organization_code = l_update_actv_partList_tbl(i).item_organization_code,
asset_number = l_update_actv_partList_tbl(i).asset_number,
asset_number = l_update_actv_partList_tbl(i).asset_number,
interface_batch_id = l_update_actv_partList_tbl(i).interface_batch_id,
interface_batch_id = l_update_actv_partList_tbl(i).interface_batch_id,
item_organization_id = NVL(l_update_actv_partList_tbl(i).asset_org_id,l_update_actv_partList_tbl(i).organization_id)
item_organization_id = NVL(l_update_actv_partList_tbl(i).asset_org_id,l_update_actv_partList_tbl(i).organization_id)
WHERE cseparti.interface_record_number = l_update_actv_partList_tbl(i).interface_record_number
WHERE cseparti.interface_record_number = l_update_actv_partList_tbl(i).interface_record_number
AND cseparti.interface_status_code = 'READY'
AND cseparti.interface_status_code = 'READY'
AND (cseparti.interface_batch_id = l_batch_id
AND (cseparti.interface_batch_id = l_batch_id
OR cseparti.interface_batch_code = l_batch_code);
OR cseparti.interface_batch_code = l_batch_code);
ELSIF l_int_batch_type IS NOT NULL AND l_int_batch_type = 'CA' THEN
ELSIF l_int_batch_type IS NOT NULL AND l_int_batch_type = 'CA' THEN
OPEN c_update_partList(x_partition_numbers(j),l_batch_id,l_batch_code);
OPEN c_update_partList(x_partition_numbers(j),l_batch_id,l_batch_code);
FETCH c_update_partList BULK COLLECT INTO l_update_partList_tbl;
FETCH c_update_partList BULK COLLECT INTO l_update_partList_tbl;
CLOSE c_update_partList;
CLOSE c_update_partList;
FORALL i IN l_update_partList_tbl.FIRST..l_update_partList_tbl.LAST
FORALL i IN l_update_partList_tbl.FIRST..l_update_partList_tbl.LAST
UPDATE CSE_ASSET_CHARGES_INT cseAssetCharges
UPDATE CSE_ASSET_CHARGES_INT cseAssetCharges
SET partition_number = l_update_partList_tbl(i).partition_number,
SET partition_number = l_update_partList_tbl(i).partition_number,
interface_batch_id = l_update_partList_tbl(i).interface_batch_id
interface_batch_id = l_update_partList_tbl(i).interface_batch_id
WHERE cseAssetCharges.interface_record_number = l_update_partList_tbl(i).interface_record_number
WHERE cseAssetCharges.interface_record_number = l_update_partList_tbl(i).interface_record_number
AND cseAssetCharges.interface_status_code = 'READY'
AND cseAssetCharges.interface_status_code = 'READY'
AND (cseAssetCharges.interface_batch_id = l_batch_id
AND (cseAssetCharges.interface_batch_id = l_batch_id
OR cseAssetCharges.interface_batch_code = l_batch_code);
OR cseAssetCharges.interface_batch_code = l_batch_code);
END IF;
END IF;
END LOOP;
END LOOP;
END LOOP;
END LOOP;
END IF;
END IF;
cse_int_utils_pvt.log_messages(fnd_log.level_info, l_api_name, 'End of procedure..');
cse_int_utils_pvt.log_messages(fnd_log.level_info, l_api_name, 'End of procedure..');

EXCEPTION
EXCEPTION
WHEN OTHERS THEN
WHEN OTHERS THEN
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_error_message := sqlerrm;
x_error_message := sqlerrm;
IF c_get_int_batch_type%ISOPEN THEN
IF c_get_int_batch_type%ISOPEN THEN
CLOSE c_update_partList;
CLOSE c_update_partList;
END IF;
END IF;
cse_int_utils_pvt.log_messages(fnd_log.level_severe, l_api_name, sqlerrm);
cse_int_utils_pvt.log_messages(fnd_log.level_severe, l_api_name, sqlerrm);

END partition_batch;
END partition_batch;


/*=============================================================================
/*=============================================================================
| Local procedure for logging validation errors related to
| Local procedure for logging validation errors related to
| Customer Asset Interface records.
| Customer Asset Interface records.
=============================================================================*/
=============================================================================*/


PROCEDURE log_validation_error(
PROCEDURE log_validation_error(
p_interface_rowid_tbl IN cse_int_utils_pvt.interface_row_id_type,
p_interface_rowid_tbl IN cse_int_utils_pvt.interface_row_id_type,
p_batch_id IN NUMBER,
p_batch_id IN NUMBER,
p_partition_number IN NUMBER,
p_partition_number IN NUMBER,
p_table_name IN VARCHAR2,
p_table_name IN VARCHAR2,
p_column_name IN VARCHAR2,
p_column_name IN VARCHAR2,
p_program_name IN VARCHAR2,
p_program_name IN VARCHAR2,
p_message_severity IN VARCHAR2,
p_message_severity IN VARCHAR2,
p_message_name IN VARCHAR2,
p_message_name IN VARCHAR2,
p_message_token_names IN VARCHAR2,
p_message_token_names IN VARCHAR2,
p_message_token_values IN VARCHAR2,
p_message_token_values IN VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2 )
x_return_status OUT NOCOPY VARCHAR2 )
IS
IS
CURSOR c_get_asset_int_dtls( c_interface_row_id NUMBER)
CURSOR c_get_asset_int_dtls( c_interface_row_id NUMBER)
IS
IS
SELECT request_id,
SELECT request_id,
job_definition_name,
job_definition_name,
job_definition_package
job_definition_package
FROM CSE_ASSETS_INT
FROM CSE_ASSETS_INT
WHERE interface_row_id = c_interface_row_id;
WHERE interface_row_id = c_interface_row_id;
CURSOR c_get_asset_chg_int_dtls( c_interface_row_id NUMBER)
CURSOR c_get_asset_chg_int_dtls( c_interface_row_id NUMBER)
IS
IS
SELECT request_id,
SELECT request_id,
job_definition_name,
job_definition_name,
job_definition_package
job_definition_package
FROM CSE_ASSET_CHARGES_INT
FROM CSE_ASSET_CHARGES_INT
WHERE interface_row_id = c_interface_row_id;
WHERE interface_row_id = c_interface_row_id;
l_int_errors_tbl cse_int_utils_pvt.int_errors_tbl_type;
l_int_errors_tbl cse_int_utils_pvt.int_errors_tbl_type;
l_row_count NUMBER := 0;
l_row_count NUMBER := 0;
l_request_id NUMBER;
l_request_id NUMBER;
l_job_definition_name VARCHAR2(100);
l_job_definition_name VARCHAR2(100);
l_job_defintion_package VARCHAR2(900);
l_job_defintion_package VARCHAR2(900);
l_api_name VARCHAR2(300) := 'cse_bulk_import_pvt.log_validation_error';
l_api_name VARCHAR2(300) := 'cse_bulk_import_pvt.log_validation_error';
l_message_text VARCHAR2(2000);
l_message_text VARCHAR2(2000);

BEGIN
BEGIN

FOR i IN 1 .. p_interface_rowid_tbl.COUNT
FOR i IN 1 .. p_interface_rowid_tbl.COUNT
LOOP
LOOP
l_message_text := cse_int_utils_pvt.get_message_details( p_prd_code => SUBSTR(p_message_name,1,3), p_msg_name => p_message_name, p_token_name => p_message_token_names, p_token_value => p_message_token_values );
l_message_text := cse_int_utils_pvt.get_message_details( p_prd_code => SUBSTR(p_message_name,1,3), p_msg_name => p_message_name, p_token_name => p_message_token_names, p_token_value => p_message_token_values );
--Collect interface row details required for logging the error.
--Collect interface row details required for logging the error.
IF p_table_name = C_ASSETS_INT_TBL_NAME THEN
IF p_table_name = C_ASSETS_INT_TBL_NAME THEN
OPEN c_get_asset_int_dtls(p_interface_rowid_tbl(i));
OPEN c_get_asset_int_dtls(p_interface_rowid_tbl(i));
FETCH c_get_asset_int_dtls
FETCH c_get_asset_int_dtls
INTO l_request_id,
INTO l_request_id,
l_job_definition_name,
l_job_definition_name,
l_job_defintion_package;
l_job_defintion_package;
CLOSE c_get_asset_int_dtls;
CLOSE c_get_asset_int_dtls;
ELSIF p_table_name = C_ASSET_CHGS_TBL_NAME THEN
ELSIF p_table_name = C_ASSET_CHGS_TBL_NAME THEN
OPEN c_get_asset_chg_int_dtls(p_interface_rowid_tbl(i));
OPEN c_get_asset_chg_int_dtls(p_interface_rowid_tbl(i));
FETCH c_get_asset_chg_int_dtls
FETCH c_get_asset_chg_int_dtls
INTO l_request_id,
INTO l_request_id,
l_job_definition_name,
l_job_definition_name,
l_job_defintion_package;
l_job_defintion_package;
CLOSE c_get_asset_chg_int_dtls;
CLOSE c_get_asset_chg_int_dtls;
END IF;
END IF;
CSE_INT_UTILS_PVT.log_messages( fnd_log.level_severe, l_api_name, 'Interface_row_id= '||p_interface_rowid_tbl(i)||' - '||l_message_text );
CSE_INT_UTILS_PVT.log_messages( fnd_log.level_severe, l_api_name, 'Interface_row_id= '||p_interface_rowid_tbl(i)||' - '||l_message_text );
l_row_count := l_row_count + 1;
l_row_count := l_row_count + 1;
l_int_errors_tbl(l_row_count).interface_error_id := cse_int_s.NEXTVAL;
l_int_errors_tbl(l_row_count).interface_error_id := cse_int_s.NEXTVAL;
l_int_errors_tbl(l_row_count).object_version_number := 1;
l_int_errors_tbl(l_row_count).object_version_number := 1;
l_int_errors_tbl(l_row_count).interface_row_id := p_interface_rowid_tbl(i);
l_int_errors_tbl(l_row_count).interface_row_id := p_interface_rowid_tbl(i);
l_int_errors_tbl(l_row_count).interface_batch_id := p_batch_id;
l_int_errors_tbl(l_row_count).interface_batch_id := p_batch_id;
l_int_errors_tbl(l_row_count).error_text := l_message_text;
l_int_errors_tbl(l_row_count).error_text := l_message_text;
l_int_errors_tbl(l_row_count).error_language := userenv('LANG');
l_int_errors_tbl(l_row_count).error_language := userenv('LANG');
l_int_errors_tbl(l_row_count).table_name := p_table_name;
l_int_errors_tbl(l_row_count).table_name := p_table_name;
l_int_errors_tbl(l_row_count).column_name := p_column_name;
l_int_errors_tbl(l_row_count).column_name := p_column_name;
l_int_errors_tbl(l_row_count).message_name := p_message_name;
l_int_errors_tbl(l_row_count).message_name := p_message_name;
l_int_errors_tbl(l_row_count).message_token_names := p_message_token_names;
l_int_errors_tbl(l_row_count).message_token_names := p_message_token_names;
l_int_errors_tbl(l_row_count).message_token_values := p_message_token_values;
l_int_errors_tbl(l_row_count).message_token_values := p_message_token_values;
l_int_errors_tbl(l_row_count).program_name := p_program_name;
l_int_errors_tbl(l_row_count).program_name := p_program_name;
l_int_errors_tbl(l_row_count).message_severity := C_SEVERITY_ERROR;
l_int_errors_tbl(l_row_count).message_severity := C_SEVERITY_ERROR;
l_int_errors_tbl(l_row_count).created_by := fnd_global.who_user_name;
l_int_errors_tbl(l_row_count).created_by := fnd_global.who_user_name;
l_int_errors_tbl(l_row_count).creation_date := sysdate;
l_int_errors_tbl(l_row_count).creation_date := sysdate;
l_int_errors_tbl(l_row_count).last_updated_by := fnd_global.who_user_name;
l_int_errors_tbl(l_row_count).last_updated_by := fnd_global.who_user_name;
l_int_errors_tbl(l_row_count).last_update_date := sysdate;
l_int_errors_tbl(l_row_count).last_update_date := sysdate;
l_int_errors_tbl(l_row_count).last_update_login := fnd_global.user_guid;
l_int_errors_tbl(l_row_count).last_update_login := fnd_global.user_guid;
l_int_errors_tbl(l_row_count).request_id := l_request_id;
l_int_errors_tbl(l_row_count).request_id := l_request_id;
l_int_errors_tbl(l_row_count).job_definition_name := l_job_definition_name;
l_int_errors_tbl(l_row_count).job_definition_name := l_job_definition_name;
l_int_errors_tbl(l_row_count).job_definition_package:= l_job_defintion_package;
l_int_errors_tbl(l_row_count).job_definition_package:= l_job_defintion_package;
END LOOP;
END LOOP;
CSE_INT_UTILS_PVT.log_errors( p_int_errors_tbl => l_int_errors_tbl, x_return_status => x_return_status , x_error_msg => x_error_message );
CSE_INT_UTILS_PVT.log_errors( p_int_errors_tbl => l_int_errors_tbl, x_return_status => x_return_status , x_error_msg => x_error_message );
-- update the interface table and set the record status to error
-- update the interface table and set the record status to error
IF p_table_name = C_ASSETS_INT_TBL_NAME THEN
IF p_table_name = C_ASSETS_INT_TBL_NAME THEN
FORALL i IN 1 .. p_interface_rowid_tbl.COUNT
FORALL i IN 1 .. p_interface_rowid_tbl.COUNT
UPDATE cse_assets_int assetInt
UPDATE cse_assets_int assetInt
SET assetInt.interface_status_code = C_INT_ERROR
SET assetInt.interface_status_code = C_INT_ERROR
WHERE assetInt.interface_batch_id = p_batch_id
WHERE assetInt.interface_batch_id = p_batch_id
AND assetInt.partition_number = p_partition_number
AND assetInt.partition_number = p_partition_number
AND assetInt.interface_row_id = p_interface_rowid_tbl(i);
AND assetInt.interface_row_id = p_interface_rowid_tbl(i);
ELSIF p_table_name = C_ASSET_CHGS_TBL_NAME THEN
ELSIF p_table_name = C_ASSET_CHGS_TBL_NAME THEN
FORALL i IN 1 .. p_interface_rowid_tbl.COUNT
FORALL i IN 1 .. p_interface_rowid_tbl.COUNT
UPDATE cse_asset_charges_int assetChgInt
UPDATE cse_asset_charges_int assetChgInt
SET assetChgInt.interface_status_code = C_INT_ERROR
SET assetChgInt.interface_status_code = C_INT_ERROR
WHERE assetChgInt.interface_batch_id = p_batch_id
WHERE assetChgInt.interface_batch_id = p_batch_id
AND assetChgInt.partition_number = p_partition_number
AND assetChgInt.partition_number = p_partition_number
AND assetChgInt.interface_row_id = p_interface_rowid_tbl(i);
AND assetChgInt.interface_row_id = p_interface_rowid_tbl(i);
END IF;
END IF;
-- A validation error has occured. Set return status to error.
-- A validation error has occured. Set return status to error.
x_return_status := fnd_api.g_ret_sts_error;
x_return_status := fnd_api.g_ret_sts_error;

EXCEPTION
EXCEPTION
WHEN OTHERS THEN
WHEN OTHERS THEN
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_return_status := fnd_api.g_ret_sts_unexp_error;
x_error_message := sqlerrm;
x_error_message := sqlerrm;
cse_int_utils_pvt.log_messages(fnd_log.level_severe, l_api_name, sqlerrm);
cse_int_utils_pvt.log_messages(fnd_log.level_severe, l_api_name, sqlerrm);

END log_validation_error;
END log_validation_error;


/*=============================================================================
/*=============================================================================
| PROCEDURE - get_batch_codes
| PROCEDURE - get_batch_codes
|
|
| DESCRIPTION
| DESCRIPTION
| Collects the batch ids to be processed if batch code is passed as null
| Collects the batch ids to be processed if batch code is passed as null
|
|
| PARAMETERS
| PARAMETERS
| x_batch_id - Batch Code Collection output to be processed
| x_batch_id - Batch Code Collection output to be processed
| p_batch_code- Input Batch Code
| p_batch_code- Input Batch Code
/*=============================================================================*/
/*=============================================================================*/


PROCEDURE get_batch_codes(
PROCEDURE get_batch_codes(
p_batch_code IN VARCHAR2,
p_batch_code IN VARCHAR2,
x_batch_codes OUT NOCOPY FND_TABLE_OF_VARCHAR2_120)
x_batch_codes OUT NOCOPY FND_TABLE_OF_VARCHAR2_120)
IS
IS
BEGIN
BEGIN
IF p_batch_code IS NULL THEN
IF p_batch_code IS NULL THEN
SELECT DISTINCT interface_batch_code BULK COLLECT
SELECT DISTINCT interface_batch_code BULK COLLECT
INTO x_batch_codes
INTO x_batch_codes
FROM cse_int_batches_b
FROM cse_int_batches_b
WHERE interface_batch_status='READY';
WHERE interface_batch_status='READY';
ELSE
ELSE
x_batch_codes:=FND_TABLE_OF_VARCHAR2_120();
x_batch_codes:=FND_TABLE_OF_VARCHAR2_120();
x_batch_codes.EXTEND;
x_batch_codes.EXTEND;
x_batch_codes(x_batch_codes.COUNT):= p_batch_code;
x_batch_codes(x_batch_codes.COUNT):= p_batch_code;
END IF;
END IF;

END get_batch_codes;
END get_batch_codes;


/*=============================================================================
/*=============================================================================
| PROCEDURE - validate_custAsset_mand_attr
| PROCEDURE - validate_custAsset_mand_attr
|
|
| DESCRIPTION
| DESCRIPTION
| Validates the mandatory customer attributes
| Validates the mandatory customer attributes
|
|
| PARAMETERS
| PARAMETERS
| p_batch_id - Input parameter of batch id that need to be processed
| p_batch_id - Input parameter of batch id that need to be processed
| x_partition_numbers - Out parameter with table of partitions assigned
| x_partition_numbers - Out parameter with table of partitions assigned
| to a batch
| to a batch
| x_error_message - Out parameter with error message if any
| x_error_message - Out parameter with error message if any
| x_return_status - Out parameter with Success or failure status of proc
| x_return_status - Out parameter with Success or failure status of proc
|
|
*============================================================================*/
*============================================================================*/


PROCEDURE validate_custAsset_mand_attr(
PROCEDURE validate_custAsset_mand_attr(
p_batch_id IN NUMBER,
p_batch_id IN NUMBER,
p_partition_number IN NUMBER,
p_partition_number IN NUMBER,
x_error_message OUT NOCOPY VARCHAR2,
x_error_message OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2)
x_return_status OUT NOCOPY VARCHAR2)
IS
IS
/********************************************
/********************************************
-- Define mandatory validation cursors
-- Define mandatory validation cursors
*********************************************/
*********************************************/
-- Cursor for validating Asset Organization
-- Cursor for validating Asset Organization
CURSOR c_org_mandatory_cur
CURSOR c_org_mandatory_cur
IS
IS
SELECT assetInt.i
SELECT assetInt