Introduction:
Enterprise asset management (EAM) involves the management of the maintenance of physical assets of an organization throughout each asset’s life cycle.
Goal:
Add a New asset number at enterprise asset management using “EAM_AssetNumber_PUB.Insert_Asset_Number” API
Forms Or Pages:
Example:
API to create eam asset number in oracle apps r12
For update eam asset number you can find it here:API to update eam asset numbers
API IN/OUT Parameters :
— IN p_api_version NUMBER.
— IN p_validation_level NUMBER.
— IN p_init_msg_list VARCHAR2.
— IN p_commit VARCHAR2.
— IN p_inventory_item_id NUMBER.
— IN p_serial_number VARCHAR2.
— IN p_current_organization_id NUMBER.
— IN p_owning_department_id NUMBER.
— OUT x_return_status VARCHAR2.
— OUT x_msg_count NUMBER.
— OUT x_msg_data VARCHAR2.
API Parameters clarifications:
- @param p_api_version Version of the API (previous version 2.0, Initial version 1.0).
- @param p_validation_level Validation Level of the API
- @param p_init_msg_list Flag to indicate initialization of message list.
- @param p_commit Flag to indicate whether API should commit changes.
- @param p_inventory_item_id Asset Group Identifier.
- @param p_serial_number Asset Serial Number.
- @param p_current_organization_id Organization where the serial number is currently stored.
- @param p_owning_department_id Owning Department Identifier.
- @param x_return_status Return status of the procedure call.
- @param x_msg_count Count of the return messages that API returns.
- @param x_msg_data The collection of the messages.
- @param x_object_id The new object id, primary key of new record.
API Calling example:
DECLARE
l_inventory_item_id NUMBER;
l_owning_department_id NUMBER;
l_current_organization_id NUMBER;
l_serial_number VARCHAR2 (150);
l_output_mesg VARCHAR2 (4000);
o_return_status VARCHAR2 (1000);
o_msg_count NUMBER;
o_msg_data VARCHAR2 (1000);
o_object_id NUMBER;
BEGIN
--to initialize the global security context for a database session
fnd_global.apps_initialize (user_id => 1318, -- User ID
resp_id => 23118, -- Responsibility ID
resp_appl_id => 426); --Application ID to which responsibility belongs
l_inventory_item_id := 11039;
l_owning_department_id := 771;
l_current_organization_id := 4812;
l_serial_number := 'EQ10009';
eam_assetnumber_pub.insert_asset_number (p_api_version => 1.0
,p_validation_level => fnd_api.g_valid_level_full
,p_init_msg_list => fnd_api.g_false
,p_commit => fnd_api.g_false
, --in (required)
p_inventory_item_id => l_inventory_item_id
,p_serial_number => l_serial_number
,p_current_organization_id => l_current_organization_id
,p_owning_department_id => l_owning_department_id
, --out
x_return_status => o_return_status
,x_msg_count => o_msg_count
,x_msg_data => o_msg_data
,x_object_id => o_object_id);
--
IF (o_return_status = 'S') THEN
--
dbms_output.put_line ('***************************');
dbms_output.put_line ('Output information ....');
dbms_output.put_line ('EAM Asset Number Created Successfully ....');
dbms_output.put_line ('p_serial_number: ' || l_serial_number);
dbms_output.put_line ('x_return_status: ' || o_return_status);
dbms_output.put_line ('***************************');
--
COMMIT;
--
ELSIF (o_return_status IN ('E', 'U')) THEN
--
dbms_output.put_line ('***************************');
dbms_output.put_line ('Error informations ....');
FOR i IN 1 .. (o_msg_count)
LOOP
l_output_mesg := substr (fnd_msg_pub.get (fnd_msg_pub.g_next, fnd_api.g_false), 1, 250);
dbms_output.put_line (l_output_mesg);
END LOOP;
--
dbms_output.put_line ('***************************');
--
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line ('API Faild with error code: ' || sqlcode || ' and error message is: ' || sqlerrm);
END;
Final Result:
[convertkit form=1415728]Hope this helpful.
If you found it simple and easy to understand, we would love to provide you and your friends a simple solution for your problems.
Thanks.