Documente Academic
Documente Profesional
Documente Cultură
1. Create package procedure and use that while registering the webadi.
2. Based on the no of parameters of the procedure, columns will be displayed in the webadi.
3. Basic validations will be done by package and in case of any error ,it will be shown in the
WEBADI
4. For doing any complex process (eg calling API) ,a concurrent program was provided that
validate all the unprocessed records from the table and provide the status in the output and log
files.
Limitation of previous version of WEBADI
Only single record validation is possible
In case of group of record validation , only concurrent program functionality can be used. In case
of any validation error for group of record validation it cant be shown on the WEBADI.
User need to manually run the concurrent program to validate the records.
There is no provision to validate only records of a specific session through concurrent program.
Concurrent program picks all the unprocessed record and processed.
WHO columns needs to be populate manually using code.
2. Register the table and its columns in the oracle application using AD_DD API.Below is the
sample code
r_tabl c_tabl%ROWTYPE;
BEGIN
OPEN c_tabl;
IF c_tabl%FOUND
THEN
ad_dd.register_table (p_appl_short_name => g_appl_short_name,
p_tab_name => r_tabl.table_name,
p_tab_type => 'T');
END IF;
CLOSE c_tabl;
END xxindus_add_table;
ln_cnt NUMBER;
BEGIN
ln_cnt := 0;
r_tabl c_tabl%ROWTYPE;
BEGIN
OPEN c_tabl;
IF c_tabl%FOUND
THEN
ad_dd.delete_table (p_appl_short_name => g_appl_short_name,
p_tab_name => r_tabl.table_name);
END IF;
CLOSE c_tabl;
END xxindus_del_table;
6. Now this will come in the interface list.When we click on select radio button it will show all the
fields details of that table.
7. Now unselect displayed checkbox all the fields for which we dont want to display In WEBADI
layout.
8. Automatically WHO columns default values will be populated .
11. Click on the next and find out Group_id field.Group_id field value will be same for all records of
each run .In the default type select SQL Query and in default value field give SELECT
xxindus_e269_eam_webadi_s.NEXTVAL FROM DUAL
Click on update pencil button and check Required (To be included in all layouts) and Enabled
for Mapping .Trx_id is the unique key of the table.
12. Click on next button.Nothing is required.Click on next button.
15. In the Default value field provide below values and click on Apply button.
a. String : FLAGGED
b. Description : Flagged Rows
16. Click on update button of bne:validation and check values as per below screenshot
17 . Click on update button of bne:import and check values as per below screenshot
18 . Click on update button of bne:commitrows and check values as per below screenshot
In the Default value field provide below values and click on Apply button.
String : EACH_ROW
Description : Each Row
19. Click on Next button and select Importer type as PL/SQL API and provide importer name
20. Click on Group definition update pencil button and provide GROUP_ID in the interface attribute
and click on apply button.
21. Click on Document Row : Interface Attribute Mapping update pencil button and provide key
fields details of the records and click on apply.
22. Click on PL/SQL API call update pencil button.Select API type as PL/SQL Procedure and
provide package name and procedure names.Keep API returns blank.It will automatically
populate parameters of the API.
P_Group_id is the IN parameter and P_REQ_ID is OUT parameter.P_GROUP_ID will same for
each record of that group.In the API, based on P_GROUP_ID field, we validate the records and if
every thing will be fine then run a concurrent program that will call seeded API to create EAM
asset.Request id will be returned using that OUT parameter.
In the above screenshot ,set Source as Import and value as and click on APPLY button.
P_GROUP_ID : XXINDUS_E269_EAM_WEBADI_TAB.GROUP_ID
P_REQ_ID : P_REQ_ID
23. Click on Error Row Definition update pencil button and provide below details
SQL Query : SELECT * FROM XXINDUS_E269_EAM_WEBADI_TAB WHERE ERROR_NUM LIKE 'ERR
%' AND GROUP_ID =$PARAM$.P_GROUP_ID_NUM
20. Click on Error Message Lookup update pencil button and provide below details
SQL Query : SELECT distinct ERROR_MSG FROM XXINDUS_E269_EAM_WEBADI_TAB
WHERE GROUP_ID = $PARAM$.P_GROUP_ID AND ERROR_NUM=$PARAM$.P_ERROR_NUM
Provide reference name as ERROR_MSG and parmeter source as Interface table and value as and
click on APPLY button.
P_GROUP_ID : XXINDUS_E269_EAM_WEBADI_TAB.GROUP_ID
P_ERROR_NUM : XXINDUS_E269_EAM_WEBADI_TAB.ERROR_NUM
21. Click on Success Message Definition update pencil button and provide below details and click
on APPLY button
Success Message :
Request ID $IMPORT$.P_REQ_ID submitted for Concurrent program Indus EAM asset Import
Program
24. On the next screen provide the layout name and click on next.
25. On the next screen ,select Line in the field placement and select the checkbox of the items those
we want to display in the webadi and click on next.
26. Use the fields move up and move down to set the layout and change the width as per the
requirement and click on apply.
27. Register integrator using form function : Go to function form (using application developer or
system administrator responsibility) and register a function.Below are the additional fields details
other than mandatory fields
PROCEDURE xxindus_change_oat_status_prc (
p_instance_id csi_item_instances.instance_id%TYPE,
p_location_id NUMBER,
p_type IN NUMBER)
IS
l_location_type_code csi_item_instances.location_type_code%TYPE;
l_location_id csi_item_instances.location_id%TYPE;
l_instance_usage_code csi_item_instances.instance_usage_code%TYPE;
l_operational_status_code csi_item_instances.operational_status_code%TYPE;
l_instance_tbl cse_deployment_grp.txn_instances_tbl;
l_dest_location_tbl cse_deployment_grp.dest_location_tbl;
l_ext_attrib_values_tbl cse_deployment_grp.txn_ext_attrib_values_tbl;
l_txn_tbl cse_deployment_grp.transaction_tbl;
l_transaction_type_id csi_txn_types.transaction_type_id%TYPE;
l_txn_sub_type_id csi_transactions.txn_sub_type_id%TYPE;
l_return_status VARCHAR2 (1) := fnd_api.g_ret_sts_success;
l_error_message VARCHAR2 (2000);
CURSOR c_oat_detals
IS
SELECT cii.instance_id,
cii.serial_number,
cii.lot_number,
cii.inventory_item_id,
cii.operational_status_code,
cii.location_type_code,
cii.location_id,
cii.instance_usage_code,
cii.quantity,
cii.unit_of_measure,
NULL pa_project_id,
NULL pa_project_task_id
FROM csi_item_instances cii
WHERE cii.instance_id = p_instance_id;
cr_oat_detals c_oat_detals%ROWTYPE;
BEGIN
OPEN c_oat_detals;
CLOSE c_oat_detals;
BEGIN
IF p_type = 1
THEN
SELECT ctt.transaction_type_id, cts.sub_type_id
INTO l_transaction_type_id, l_txn_sub_type_id
FROM csi_txn_types ctt, csi_txn_sub_types cts
WHERE ctt.transaction_type_id = cts.transaction_type_id
AND ctt.source_transaction_type = 'IN_SERVICE';
ELSE
SELECT ctt.transaction_type_id, cts.sub_type_id
INTO l_transaction_type_id, l_txn_sub_type_id
FROM csi_txn_types ctt, csi_txn_sub_types cts
WHERE ctt.transaction_type_id = cts.transaction_type_id
AND ctt.source_transaction_type = 'ITEM_INSTALLED';
END IF;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_transaction_type_id := NULL;
l_txn_sub_type_id := NULL;
log_msg (
'Error Place:=> At Fetching OAT Transaction Type And Sub Type No Data - '
|| CHR (10)
|| 'Error Line :=>'
|| DBMS_UTILITY.format_error_backtrace
|| CHR (10)
|| 'Error:'
|| SUBSTR (SQLERRM, 1, 200));
WHEN OTHERS
THEN
log_msg (
'Error Place:=> At Fetching OAT Transaction Type And Sub Type - '
|| CHR (10)
|| 'Error Line :=>'
|| DBMS_UTILITY.format_error_backtrace
|| CHR (10)
|| 'Error:'
|| SUBSTR (SQLERRM, 1, 200));
END;
IF p_type = 1
THEN
l_instance_tbl (1).active_start_date := SYSDATE;
END IF;
BEGIN
cse_deployment_grp.process_transaction (
p_instance_tbl => l_instance_tbl,
p_dest_location_tbl => l_dest_location_tbl,
p_ext_attrib_values_tbl => l_ext_attrib_values_tbl,
p_txn_tbl => l_txn_tbl,
x_return_status => l_return_status,
x_error_msg => l_error_message);
log_msg (
'Retrun Status from In Service Procedure:=>'
|| l_error_message );
END IF;
EXCEPTION
WHEN OTHERS
THEN
log_msg (
'Error Place:=> At Calling OAT Process Transaction Procedure - '
|| CHR (10)
|| 'Error Line :=>'
|| DBMS_UTILITY.format_error_backtrace
|| CHR (10)
|| 'Error:'
|| SUBSTR (SQLERRM, 1, 200));
END;
ELSE
log_msg (
'No Details Found to Put In Serivce in OAT for the Instance id:=>'
|| p_instance_id);
END IF;
EXCEPTION
WHEN OTHERS
THEN
log_msg (
'Error Place:=> In xxindus_e052_inservice_oat_prc main Exception- '
|| CHR (10)
|| 'Error Line :=>'
|| DBMS_UTILITY.format_error_backtrace
|| CHR (10)
|| 'Error Message:'
|| SUBSTR (SQLERRM, 1, 200));
END xxindus_change_oat_status_prc;
p_item_type := l_item_type;
RETURN l_item_id;
END get_item_info;
RETURN l_organization_id;
END get_organization_info;
RETURN l_location_id;
END get_location_info;
p_asset_category_id := l_asset_category_id;
RETURN l_asset_id;
END get_fa_asset_info;
p_qty := l_qty;
RETURN l_flag;
END check_bom_info;
RETURN l_flag;
END check_asset_exists;
RETURN l_flag;
END validate_asset_eam_loc;
RETURN l_flag;
END validate_asset_eam_serial;
PROCEDURE xxindus_create_eam_asset_prc (
p_item_id IN NUMBER,
p_serial_number IN VARCHAR2,
p_organization_id IN NUMBER,
p_organization_code IN VARCHAR2,
p_porganization_code IN VARCHAR2,
p_porganization_id IN NUMBER,
p_pitem_id IN NUMBER,
p_pserial_number IN VARCHAR2,
p_add_batch_id IN NUMBER,
p_cost IN NUMBER,
p_location IN NUMBER,
p_fa_asset_id IN NUMBER,
p_asset_category_id IN NUMBER,
p_fa_sync_flag IN VARCHAR2,
p_rel_flag OUT VARCHAR2,
p_status_flag OUT VARCHAR2)
IS
l_return_status VARCHAR2 (1000);
l_msg_count NUMBER;
l_msg_data VARCHAR2 (1000);
l_object_id NUMBER;
l_api_error_msg VARCHAR2 (2000);
l_rel_flag VARCHAR2 (1) := 'N';
l_user_id NUMBER;
l_status_flag VARCHAR2 (1) := 'N';
l_instance_id NUMBER;
BEGIN
l_user_id := fnd_global.user_id;
eam_assetnumber_pub.insert_asset_number (
p_api_version => 1.0,
p_init_msg_list => fnd_api.g_true,
p_commit => fnd_api.g_false,
p_validation_level => fnd_api.g_valid_level_full,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
x_object_id => l_object_id,
p_inventory_item_id => p_item_id,
p_serial_number => p_serial_number,
p_instance_number => csi_item_instances_s.NEXTVAL,
p_current_status => 3,
p_descriptive_text => '',
p_current_organization_id => p_organization_id,
p_wip_accounting_class_code => NULL,
p_maintainable_flag => NULL,
p_owning_department_id => NULL,
p_network_asset_flag => NULL,
p_fa_asset_id => p_fa_asset_id,
p_pn_location_id => NULL,
p_eam_location_id => NULL,
p_asset_criticality_code => NULL,
p_category_id => NULL, p_fa_sync_flag => p_fa_sync_flag,
p_prod_organization_id => NULL,
p_equipment_item_id => NULL,
p_eqp_serial_number => NULL,
p_equipment_gen_object_id => NULL,
p_eam_linear_id => NULL,
p_attribute6 => p_cost,
p_location => p_location,
p_instantiate_flag => TRUE,
p_active_start_date => SYSDATE,
p_active_end_date => SYSDATE);
INSERT
INTO mtl_object_genealogy_interface (interface_header_id,
last_update_date,
last_updated_by,
creation_date,
created_by,
batch_id,
GROUP_ID,
object_type,
parent_object_type,
genealogy_origin,
genealogy_type,
process_status,
import_mode,
organization_id,
organization_code,
parent_organization_code,
inventory_item_id,
serial_number,
parent_organization_id,
parent_inventory_item_id,
parent_serial_number,
start_date_active)
VALUES (mtl_object_gen_interface_s.NEXTVAL,
SYSDATE,
l_user_id,
SYSDATE,
l_user_id,
p_add_batch_id,
NULL,
2,
2,
3,
5,
'P',
0,
p_organization_id,
p_organization_code,
p_porganization_code,
p_item_id,
p_serial_number,
p_porganization_id,
p_pitem_id,
p_pserial_number,
SYSDATE);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
NULL;
END;
END IF;
END IF;
p_rel_flag := l_rel_flag;
p_status_flag := l_status_flag;
END xxindus_create_eam_asset_prc;
l_batch_id NUMBER;
l_rel_flag VARCHAR2 (1);
l_rel_flag_t VARCHAR2 (1) := 'N';
l_request_id NUMBER;
l_phase VARCHAR2 (100);
l_status VARCHAR2 (100);
l_dev_phase VARCHAR2 (100);
l_dev_status VARCHAR2 (100);
l_message VARCHAR2 (1000);
l_req_return_status BOOLEAN;
l_request_submission VARCHAR2 (1);
l_user_id NUMBER;
l_resp_id NUMBER;
l_resp_appl_id NUMBER;
l_status_flag VARCHAR2 (1);
BEGIN
l_batch_id := xxindus_e269_eam_webadi_s.NEXTVAL;
l_user_id := fnd_global.user_id;
l_resp_id := fnd_global.resp_id;
l_resp_appl_id := fnd_global.resp_appl_id;
fnd_global.apps_initialize (user_id => l_user_id,
resp_id => l_resp_id,
resp_appl_id => l_resp_appl_id);
IF l_rel_flag = 'Y'
THEN
l_rel_flag_t := l_rel_flag;
END IF;
IF l_status_flag = 'Y'
THEN
UPDATE xxindus_e269_eam_webadi_tab
SET error_num = 'ERR100',
error_msg = 'API ERROR',
last_update_login = fnd_global.login_id,
last_update_date = SYSDATE,
last_updated_by = fnd_global.user_id
WHERE CURRENT OF c_validated_record;
ELSE
UPDATE xxindus_e269_eam_webadi_tab
SET error_num = 'PRC',
error_msg = 'Processed',
last_update_login = fnd_global.login_id,
last_update_date = SYSDATE,
last_updated_by = fnd_global.user_id
WHERE CURRENT OF c_validated_record;
END IF;
END LOOP;
IF l_rel_flag_t = 'Y'
THEN
l_request_id :=
fnd_request.submit_request (application => 'EAM',
program => 'EAMGEIMP',
description => NULL,
start_time => SYSDATE,
sub_request => FALSE,
argument1 => l_batch_id,
argument2 => 'N');
COMMIT;
IF l_request_id = 0
THEN
log_msg (
'Request Not Submitted due to "' || fnd_message.get || '".');
ELSE
log_msg (
'The Program PROGRAM_1 submitted successfully Request id :'
|| l_request_id);
LOOP
--To make process execution to wait for 1st program to complete
l_req_return_status :=
fnd_concurrent.wait_for_request (
request_id => l_request_id,
interval => 2,
max_wait => 120,
phase => l_phase,
status => l_status,
dev_phase => l_dev_phase,
dev_status => l_dev_status,
MESSAGE => l_message);
EXIT WHEN UPPER (l_phase) = 'COMPLETED'
OR UPPER (l_status) IN ('CANCELLED',
'ERROR',
'TERMINATED');
END LOOP;
END IF;
END IF;
END xxindus_process_eam_asset_prc;
IF l_err_num IS NULL
THEN
IF cr_get_record.asset_serial IS NULL
THEN
l_err_num := 'ERR002';
l_err_msg := 'Asset serial is blank';
ELSIF l_qr_code_enabled = 'Y'
AND LENGTH (cr_get_record.asset_serial) <> 11
THEN
l_err_num := 'ERR002.2';
l_err_msg := 'QR Coded Item must be of 11 digits';
END IF;
END IF;
IF l_organization_id IS NULL
THEN
l_err_num := 'ERR003';
l_err_msg := 'Invalid Organization';
END IF;
ELSIF l_err_num IS NULL
THEN
l_err_num := 'ERR003.1';
l_err_msg := 'Organization is blank';
END IF;
IF l_location_id IS NULL
THEN
l_err_num := 'ERR004';
l_err_msg := 'Invalid Site Id';
END IF;
ELSIF l_err_num IS NULL
THEN
l_err_num := 'ERR004.1';
l_err_msg := 'Site Id is null';
END IF;
IF cr_get_record.fa_number IS NOT NULL AND l_err_num IS NULL
THEN
l_asset_id :=
get_fa_asset_info (
p_asset_number => cr_get_record.fa_number,
p_asset_category_id => l_asset_category_id);
IF l_asset_id IS NULL
THEN
l_err_num := 'ERR005';
l_err_msg := 'Invalid FA Asset';
END IF;
ELSIF l_err_num IS NULL
THEN
l_err_num := 'ERR005.1';
l_err_msg := 'FA Asset is blank';
END IF;
IF l_err_num IS NULL
THEN
IF cr_get_record.asset_cost <= 0
THEN
l_err_num := 'ERR005.6';
l_err_msg := 'Invalid Cost';
END IF;
END IF;
IF l_already_exists = 'Y'
THEN
l_err_num := 'ERR005.2';
l_err_msg :=
'Item and serial combination already exists in EAM';
END IF;
END IF;
IF l_match_exists = 'N'
THEN
l_err_num := 'ERR007';
l_err_msg :=
'FA asset location and EAM Site location not matching';
END IF;
END IF;
IF l_err_num IS NULL
THEN
IF l_asset_id IS NOT NULL
THEN
l_match_exists :=
validate_asset_eam_serial (
p_asset_id => l_asset_id,
p_serial => cr_get_record.asset_serial);
IF l_match_exists = 'N'
THEN
l_err_num := 'ERR007.6';
l_err_msg := 'FA asset serial and EAM serial not matching';
END IF;
END IF;
END IF;
IF l_pinventory_item_id IS NULL
THEN
l_err_num := 'ERR006';
l_err_msg := 'Invalid Parent asset';
END IF;
END IF;
IF l_err_num IS NULL
THEN
IF l_pinventory_item_id IS NOT NULL
THEN
-- parent item exists check BOM
l_bom_exists :=
check_bom_info (p_item_id => l_item_id,
p_organization_id => l_organization_id,
p_pitem_id => l_pinventory_item_id,
p_qty => l_bom_qty);
IF l_bom_exists = 'N'
THEN
-- parent chaild mapping not exists in BOM
l_err_num := 'ERR010';
l_err_msg := 'Parent Child mapping not exists in BOM';
ELSIF l_bom_exists = 'Y'
THEN
BEGIN
SELECT SUM (total_asset)
INTO l_total_asset
FROM (SELECT COUNT (*) total_asset
FROM xxindus_e269_eam_webadi_tab a
WHERE asst_grp_item || organization_code IN (SELECT asst_grp_item
|| organization_code
FROM xxindus_e269_eam_webadi_tab a
WHERE record_id =
cr_get_record.record_id)
AND a.GROUP_ID = cr_get_record.GROUP_ID
UNION ALL
SELECT COUNT (*) total_asset
FROM mtl_eam_asset_numbers_all_v
WHERE inventory_item_id = l_item_id
AND current_organization_id =
l_organization_id);
NULL;
END IF;
END IF;
END IF;
IF l_err_num IS NULL
THEN
BEGIN
SELECT COUNT (*)
INTO l_flag
FROM xxindus_e269_eam_webadi_tab a
WHERE EXISTS
(SELECT NULL
FROM xxindus_e269_eam_webadi_tab b
WHERE b.GROUP_ID = a.GROUP_ID
AND b.trx_id <> a.trx_id
AND b.record_id <> a.record_id
AND b.asset_serial = a.asset_serial
AND b.asst_grp_item = a.asst_grp_item)
AND record_id = cr_get_record.record_id;
IF l_flag > 0
THEN
l_err_num := 'ERR007.1';
l_err_msg := 'Duplicate records';
END IF;
END;
END IF;
IF l_err_num IS NOT NULL
THEN
UPDATE xxindus_e269_eam_webadi_tab
SET error_num = l_err_num,
error_msg = l_err_msg,
last_update_login = fnd_global.login_id,
last_update_date = SYSDATE,
last_updated_by = fnd_global.user_id
WHERE CURRENT OF c_get_record;
l_error_flag := l_error_flag + 1;
ELSE
IF l_asset_id IS NOT NULL
THEN
l_fa_sync_flag := 'Y';
ELSE
l_fa_sync_flag := NULL;
l_asset_category_id := NULL;
END IF;
UPDATE xxindus_e269_eam_webadi_tab
SET asst_grp_item_id = l_item_id,
organization_id = l_organization_id,
porganization_code = l_porganization_code,
porganization_id = l_porganization_id,
passt_grp_item_id = l_pinventory_item_id,
passet_serial = l_pserial_number,
location_id = l_location_id,
fa_id = l_asset_id,
asset_category_id = l_asset_category_id,
item_type = l_item_type,
fa_sync_flag = l_fa_sync_flag,
error_num = 'SUCC',
error_msg = 'Success',
last_update_login = fnd_global.login_id,
last_update_date = SYSDATE,
last_updated_by = fnd_global.user_id
WHERE CURRENT OF c_get_record;
END IF;
END LOOP;
IF l_error_flag = 0
THEN
-- fire request
l_user_id := fnd_profile.VALUE ('USER_ID');
l_resp_id := fnd_profile.VALUE ('RESP_ID');
l_resp_appl_id := fnd_profile.VALUE ('RESP_APPL_ID');
l_request_id :=
fnd_request.submit_request ('XXINDUS',
'XXINDUS_E269_EAM_AST_INT',
NULL,
NULL,
FALSE,
p_group_id);