Monday, 24 September 2018

EAM Asset Number activity association creation API

API used for to maintain asset in proper manner during work order generation.
After generating work order for an asset . Users will follow the asset activities for an asset as per insertion of data.



create table XX_ASSET_ACT_ASC_TBL(activity_name varchar2(40),asset_number varchar2(30),serial_number varchar2(30),organition_id number,activity_id number,
inventory_item_id number,department_id number,error_flag varchar2(1),error_msg varchar2(1000))



declare
l_last_service_tbl eam_pm_last_service_pub.pm_last_service_tbl;
l_return_status VARCHAR2(240) ;
l_msg_count NUMBER ;
l_msg_data VARCHAR2(240);
cursor c1 is select rowid,e.* from XX_ASSET_ACT_ASC_TBL e where error_flag is null;
begin
--open c1 ;
--loop
--fetch c1 into CUR ;
--exit when c1%NOTFOUND ;
-- l_last_service_tbl(1).meter_id := 2 ;
-- l_last_service_tbl(1).LAST_SERVICE_READING := NULL ;
-- l_last_service_tbl(1).PREV_SERVICE_READING := NULL ;
-- l_last_service_tbl(1).WIP_ENTITY_ID := NULL ;
for r1 in c1 loop
eam_item_activities_pub.insert_item_activities (
p_api_version                 => 1,
x_return_status               => l_return_status ,
x_msg_count                   => l_msg_count ,
x_msg_data                    => l_msg_data ,
p_tmpl_flag                   => 'N' ,
p_asset_activity_id           => r1.ACTIVITY_ID,---112373,--CUR.Asset_Activity_ID,
P_Inventory_Item_ID           => r1.INVENTORY_ITEM_ID,--109585,--asset group inventory_item_id --CUR.Inventory_Item_ID ,
p_Organization_ID             => r1.ORGANITION_ID,--104,--CUR.Organization_ID ,
P_Owningdepartment_ID         => r1.DEPARTMENT_ID,--1,--CUR.Owning_Dep_ID ,
p_start_date_active           => sysdate,--CUR.start_date_active,
p_end_date_active             => null,--CUR.end_date_active,
p_Priority_Code               => null,--CUR.Priority_Code,
p_Activity_cause_code         => null,--CUR.Activity_cause_code,
p_Activity_Type_Code          => null,--.Activity_Type_Code,
p_Shutdown_Type_Code          => null,--CUR.Shutdown_Type_Code,
p_Class_Code                  => null,--CUR.WIP_Class_Code,
p_Activity_Source_Code        => null,--CUR.Activity_Source_Code,
p_Serial_Number               => r1.SERIAL_NUMBER,--'5017',--CUR.Serial_Number,
p_Tagging_Required_Flag       => null,--CUR.Tagging_Required_Flag,
p_pm_last_service_tbl         => l_last_service_tbl
) ;
dbms_output.put_line(l_return_status);
dbms_output.put_line(l_msg_count);
dbms_output.put_line(l_msg_data);
for i in 1..nvl(l_msg_count,0) loop
dbms_output.put_line(Fnd_Msg_Pub.Get(i, Fnd_Api.G_FALSE ));
end loop;
end loop;
commit;
end ;
/

No comments:

Post a Comment