Asset_Retirment_Api
/* Formatted On 2013/08/01 17:00 (Formatter Plus V4.8.8) */
Create Or Replace Procedure Apps.XxARK_Asset_Retirment_Api (
P_Asset_Id In Number,
P_Book_Type_Code In Varchar2,
P_Cost_Retired In Number,
P_Proceeds_Of_Sale In Number,
P_Cost_Of_Removal In Number
)
Is
Api_Error Exception;
/*Test Asset Info */
L_Asset_Id Number := P_Asset_Id;
L_Book_Type_Code Varchar2 (15) := P_Book_Type_Code;
L_User_Id Number := 1001;
L_Cost_Retired Number := P_Cost_Retired;
L_Proceeds_Of_Sale Number := P_Proceeds_Of_Sale;
L_Cost_Of_Removal Number := P_Cost_Of_Removal;
V_Request_Id Number;
-- User_Id Must Properly Be Set To Run Calc Gain/Loss
/* Define Local Record Types */
L_Trans_Rec Fa_Api_Types.Trans_Rec_Type;
L_Dist_Trans_Rec Fa_Api_Types.Trans_Rec_Type;
L_Asset_Hdr_Rec Fa_Api_Types.Asset_Hdr_Rec_Type;
L_Asset_Retire_Rec Fa_Api_Types.Asset_Retire_Rec_Type;
L_Asset_Dist_Tbl Fa_Api_Types.Asset_Dist_Tbl_Type;
L_Subcomp_Tbl Fa_Api_Types.Subcomp_Tbl_Type;
L_Inv_Tbl Fa_Api_Types.Inv_Tbl_Type;
/* Misc Info */
L_Api_Version Number := 1;
L_Init_Msg_List Varchar2 (1) := Fnd_Api.G_False;
L_Commit Varchar2 (1) := Fnd_Api.G_True;
L_Validation_Level Number := Fnd_Api.G_Valid_Level_Full;
L_Calling_Fn Varchar2 (80) := 'Retirement Aset wrapper';
L_Return_Status Varchar2 (1) := Fnd_Api.G_False;
L_Msg_Count Number := 0;
L_Msg_Data Varchar2 (512);
L_Count Number;
L_Request_Id Number;
I Number := 0;
Temp_Str Varchar2 (512);
Mesg_Count Number;
Begin
Dbms_Output.Disable;
Dbms_Output.Enable (1000000);
Dbms_Output.Put_Line ('begin');
Fa_Srvr_Msg.Init_Server_Message;
Fa_Debug_Pkg.Set_Debug_Flag (Debug_Flag => 'YES');
-- Get Standard Who Info
L_Request_Id := Fnd_Global.Conc_Request_Id;
Fnd_Profile.Get ('LOGIN_ID', L_Trans_Rec.Who_Info.Last_Update_Login);
Fnd_Profile.Get ('USER_ID', L_Trans_Rec.Who_Info.Last_Updated_By);
If (L_Trans_Rec.Who_Info.Last_Updated_By Is Null)
Then
L_Trans_Rec.Who_Info.Last_Updated_By := -1;
End If;
If (L_Trans_Rec.Who_Info.Last_Update_Login Is Null)
Then
L_Trans_Rec.Who_Info.Last_Update_Login := -1;
End If;
L_Trans_Rec.Who_Info.Last_Update_Date := Sysdate;
L_Trans_Rec.Who_Info.Creation_Date := L_Trans_Rec.Who_Info.Last_Update_Date;
L_Trans_Rec.Who_Info.Created_By := L_Trans_Rec.Who_Info.Last_Updated_By;
L_Trans_Rec.Transaction_Type_Code := Null;
-- This Will Be Determined Inside Api
L_Trans_Rec.Transaction_Date_Entered := Null;
L_Asset_Hdr_Rec.Asset_Id := L_Asset_Id;
L_Asset_Hdr_Rec.Book_Type_Code := L_Book_Type_Code;
L_Asset_Hdr_Rec.Period_Of_Addition := Null;
L_Asset_Retire_Rec.Retirement_Prorate_Convention := Null;
L_Asset_Retire_Rec.Date_Retired := Null;
-- Will Be Current Period By Default
L_Asset_Retire_Rec.Units_Retired := Null;
L_Asset_Retire_Rec.Cost_Retired := L_Cost_Retired;
L_Asset_Retire_Rec.Proceeds_Of_Sale := L_Proceeds_Of_Sale;
L_Asset_Retire_Rec.Cost_Of_Removal := L_Cost_Of_Removal;
L_Asset_Retire_Rec.Retirement_Type_Code := 'SALE';
L_Asset_Retire_Rec.Trade_In_Asset_Id := Null;
L_Asset_Retire_Rec.Calculate_Gain_Loss := Fnd_Api.G_False;
Fnd_Profile.Put ('USER_ID', L_User_Id);
L_Asset_Dist_Tbl.Delete;
Fa_Retirement_Pub.Do_Retirement (P_Api_Version => L_Api_Version,
P_Init_Msg_List => L_Init_Msg_List,
P_Commit => L_Commit,
P_Validation_Level => L_Validation_Level,
P_Calling_Fn => L_Calling_Fn,
X_Return_Status => L_Return_Status,
X_Msg_Count => L_Msg_Count,
X_Msg_Data => L_Msg_Data,
Px_Trans_Rec => L_Trans_Rec,
Px_Dist_Trans_Rec => L_Dist_Trans_Rec,
Px_Asset_Hdr_Rec => L_Asset_Hdr_Rec,
Px_Asset_Retire_Rec => L_Asset_Retire_Rec,
P_Asset_Dist_Tbl => L_Asset_Dist_Tbl,
P_Subcomp_Tbl => L_Subcomp_Tbl,
P_Inv_Tbl => L_Inv_Tbl
);
If L_Return_Status = Fnd_Api.G_False
Then
Raise Api_Error;
End If;
Dbms_Output.Put_Line ( 'Asset Retirement Done: Retirement_id: '
|| L_Asset_Retire_Rec.Retirement_Id
);
--Commit;
-- Dump Debug Messages When Run In Debug Mode To Log File
If (Fa_Debug_Pkg.Print_Debug)
Then
Fa_Debug_Pkg.Write_Debug_Log;
End If;
Fa_Srvr_Msg.Add_Message (Calling_Fn => L_Calling_Fn,
Name => 'FA_SHARED_END_SUCCESS',
Token1 => 'PROGRAM',
Value1 => 'RETIREMENT_API'
);
Mesg_Count := Fnd_Msg_Pub.Count_Msg;
If (Mesg_Count > 0)
Then
Temp_Str := Fnd_Msg_Pub.Get (Fnd_Msg_Pub.G_First, Fnd_Api.G_False);
Dbms_Output.Put_Line ('dump: ' || Temp_Str);
For I In 1 .. (Mesg_Count - 1)
Loop
Temp_Str := Fnd_Msg_Pub.Get (Fnd_Msg_Pub.G_Next, Fnd_Api.G_False);
Dbms_Output.Put_Line ('dump: ' || Temp_Str);
End Loop;
Else
Dbms_Output.Put_Line ('dump: NO MESSAGE !');
End If;
Exception
When Api_Error
Then
Rollback Work;
Fa_Srvr_Msg.Add_Message (Calling_Fn => L_Calling_Fn,
Name => 'FA_SHARED_PROGRAM_FAILED',
Token1 => 'PROGRAM',
Value1 => L_Calling_Fn
);
Mesg_Count := Fnd_Msg_Pub.Count_Msg;
If (Mesg_Count > 0)
Then
Temp_Str := Fnd_Msg_Pub.Get (Fnd_Msg_Pub.G_First, Fnd_Api.G_False);
Dbms_Output.Put_Line ('dump: ' || Temp_Str);
For I In 1 .. (Mesg_Count - 1)
Loop
Temp_Str := Fnd_Msg_Pub.Get (Fnd_Msg_Pub.G_Next, Fnd_Api.G_False);
Dbms_Output.Put_Line ('dump: ' || Temp_Str);
End Loop;
Else
Dbms_Output.Put_Line ('dump: NO MESSAGE !');
End If;
Begin
Fnd_Global.Apps_Initialize (User_Id => 1184,
Resp_Id => 50367,
Resp_Appl_Id => 7000
);
V_Request_Id :=
Fnd_Request.Submit_Request ('OFA',
'FARET',
Null,
Null,
False,
L_Book_Type_Code
);
Commit;
Dbms_Output.Put_Line (V_Request_Id);
End;
End;
/
Exec Apps.XxARK_Asset_Retirment_Api (
461,--P_Asset_Id In Number,
'CU1 ASSET BOOK',--P_Book_Type_Code In Varchar2,
500,--P_Cost_Retired In Number,
300,--P_Proceeds_Of_Sale In Number,
150--P_Cost_Of_Removal In Number
)
/* Formatted On 2013/08/01 17:00 (Formatter Plus V4.8.8) */
Create Or Replace Procedure Apps.XxARK_Asset_Retirment_Api (
P_Asset_Id In Number,
P_Book_Type_Code In Varchar2,
P_Cost_Retired In Number,
P_Proceeds_Of_Sale In Number,
P_Cost_Of_Removal In Number
)
Is
Api_Error Exception;
/*Test Asset Info */
L_Asset_Id Number := P_Asset_Id;
L_Book_Type_Code Varchar2 (15) := P_Book_Type_Code;
L_User_Id Number := 1001;
L_Cost_Retired Number := P_Cost_Retired;
L_Proceeds_Of_Sale Number := P_Proceeds_Of_Sale;
L_Cost_Of_Removal Number := P_Cost_Of_Removal;
V_Request_Id Number;
-- User_Id Must Properly Be Set To Run Calc Gain/Loss
/* Define Local Record Types */
L_Trans_Rec Fa_Api_Types.Trans_Rec_Type;
L_Dist_Trans_Rec Fa_Api_Types.Trans_Rec_Type;
L_Asset_Hdr_Rec Fa_Api_Types.Asset_Hdr_Rec_Type;
L_Asset_Retire_Rec Fa_Api_Types.Asset_Retire_Rec_Type;
L_Asset_Dist_Tbl Fa_Api_Types.Asset_Dist_Tbl_Type;
L_Subcomp_Tbl Fa_Api_Types.Subcomp_Tbl_Type;
L_Inv_Tbl Fa_Api_Types.Inv_Tbl_Type;
/* Misc Info */
L_Api_Version Number := 1;
L_Init_Msg_List Varchar2 (1) := Fnd_Api.G_False;
L_Commit Varchar2 (1) := Fnd_Api.G_True;
L_Validation_Level Number := Fnd_Api.G_Valid_Level_Full;
L_Calling_Fn Varchar2 (80) := 'Retirement Aset wrapper';
L_Return_Status Varchar2 (1) := Fnd_Api.G_False;
L_Msg_Count Number := 0;
L_Msg_Data Varchar2 (512);
L_Count Number;
L_Request_Id Number;
I Number := 0;
Temp_Str Varchar2 (512);
Mesg_Count Number;
Begin
Dbms_Output.Disable;
Dbms_Output.Enable (1000000);
Dbms_Output.Put_Line ('begin');
Fa_Srvr_Msg.Init_Server_Message;
Fa_Debug_Pkg.Set_Debug_Flag (Debug_Flag => 'YES');
-- Get Standard Who Info
L_Request_Id := Fnd_Global.Conc_Request_Id;
Fnd_Profile.Get ('LOGIN_ID', L_Trans_Rec.Who_Info.Last_Update_Login);
Fnd_Profile.Get ('USER_ID', L_Trans_Rec.Who_Info.Last_Updated_By);
If (L_Trans_Rec.Who_Info.Last_Updated_By Is Null)
Then
L_Trans_Rec.Who_Info.Last_Updated_By := -1;
End If;
If (L_Trans_Rec.Who_Info.Last_Update_Login Is Null)
Then
L_Trans_Rec.Who_Info.Last_Update_Login := -1;
End If;
L_Trans_Rec.Who_Info.Last_Update_Date := Sysdate;
L_Trans_Rec.Who_Info.Creation_Date := L_Trans_Rec.Who_Info.Last_Update_Date;
L_Trans_Rec.Who_Info.Created_By := L_Trans_Rec.Who_Info.Last_Updated_By;
L_Trans_Rec.Transaction_Type_Code := Null;
-- This Will Be Determined Inside Api
L_Trans_Rec.Transaction_Date_Entered := Null;
L_Asset_Hdr_Rec.Asset_Id := L_Asset_Id;
L_Asset_Hdr_Rec.Book_Type_Code := L_Book_Type_Code;
L_Asset_Hdr_Rec.Period_Of_Addition := Null;
L_Asset_Retire_Rec.Retirement_Prorate_Convention := Null;
L_Asset_Retire_Rec.Date_Retired := Null;
-- Will Be Current Period By Default
L_Asset_Retire_Rec.Units_Retired := Null;
L_Asset_Retire_Rec.Cost_Retired := L_Cost_Retired;
L_Asset_Retire_Rec.Proceeds_Of_Sale := L_Proceeds_Of_Sale;
L_Asset_Retire_Rec.Cost_Of_Removal := L_Cost_Of_Removal;
L_Asset_Retire_Rec.Retirement_Type_Code := 'SALE';
L_Asset_Retire_Rec.Trade_In_Asset_Id := Null;
L_Asset_Retire_Rec.Calculate_Gain_Loss := Fnd_Api.G_False;
Fnd_Profile.Put ('USER_ID', L_User_Id);
L_Asset_Dist_Tbl.Delete;
Fa_Retirement_Pub.Do_Retirement (P_Api_Version => L_Api_Version,
P_Init_Msg_List => L_Init_Msg_List,
P_Commit => L_Commit,
P_Validation_Level => L_Validation_Level,
P_Calling_Fn => L_Calling_Fn,
X_Return_Status => L_Return_Status,
X_Msg_Count => L_Msg_Count,
X_Msg_Data => L_Msg_Data,
Px_Trans_Rec => L_Trans_Rec,
Px_Dist_Trans_Rec => L_Dist_Trans_Rec,
Px_Asset_Hdr_Rec => L_Asset_Hdr_Rec,
Px_Asset_Retire_Rec => L_Asset_Retire_Rec,
P_Asset_Dist_Tbl => L_Asset_Dist_Tbl,
P_Subcomp_Tbl => L_Subcomp_Tbl,
P_Inv_Tbl => L_Inv_Tbl
);
If L_Return_Status = Fnd_Api.G_False
Then
Raise Api_Error;
End If;
Dbms_Output.Put_Line ( 'Asset Retirement Done: Retirement_id: '
|| L_Asset_Retire_Rec.Retirement_Id
);
--Commit;
-- Dump Debug Messages When Run In Debug Mode To Log File
If (Fa_Debug_Pkg.Print_Debug)
Then
Fa_Debug_Pkg.Write_Debug_Log;
End If;
Fa_Srvr_Msg.Add_Message (Calling_Fn => L_Calling_Fn,
Name => 'FA_SHARED_END_SUCCESS',
Token1 => 'PROGRAM',
Value1 => 'RETIREMENT_API'
);
Mesg_Count := Fnd_Msg_Pub.Count_Msg;
If (Mesg_Count > 0)
Then
Temp_Str := Fnd_Msg_Pub.Get (Fnd_Msg_Pub.G_First, Fnd_Api.G_False);
Dbms_Output.Put_Line ('dump: ' || Temp_Str);
For I In 1 .. (Mesg_Count - 1)
Loop
Temp_Str := Fnd_Msg_Pub.Get (Fnd_Msg_Pub.G_Next, Fnd_Api.G_False);
Dbms_Output.Put_Line ('dump: ' || Temp_Str);
End Loop;
Else
Dbms_Output.Put_Line ('dump: NO MESSAGE !');
End If;
Exception
When Api_Error
Then
Rollback Work;
Fa_Srvr_Msg.Add_Message (Calling_Fn => L_Calling_Fn,
Name => 'FA_SHARED_PROGRAM_FAILED',
Token1 => 'PROGRAM',
Value1 => L_Calling_Fn
);
Mesg_Count := Fnd_Msg_Pub.Count_Msg;
If (Mesg_Count > 0)
Then
Temp_Str := Fnd_Msg_Pub.Get (Fnd_Msg_Pub.G_First, Fnd_Api.G_False);
Dbms_Output.Put_Line ('dump: ' || Temp_Str);
For I In 1 .. (Mesg_Count - 1)
Loop
Temp_Str := Fnd_Msg_Pub.Get (Fnd_Msg_Pub.G_Next, Fnd_Api.G_False);
Dbms_Output.Put_Line ('dump: ' || Temp_Str);
End Loop;
Else
Dbms_Output.Put_Line ('dump: NO MESSAGE !');
End If;
Begin
Fnd_Global.Apps_Initialize (User_Id => 1184,
Resp_Id => 50367,
Resp_Appl_Id => 7000
);
V_Request_Id :=
Fnd_Request.Submit_Request ('OFA',
'FARET',
Null,
Null,
False,
L_Book_Type_Code
);
Commit;
Dbms_Output.Put_Line (V_Request_Id);
End;
End;
/
Exec Apps.XxARK_Asset_Retirment_Api (
461,--P_Asset_Id In Number,
'CU1 ASSET BOOK',--P_Book_Type_Code In Varchar2,
500,--P_Cost_Retired In Number,
300,--P_Proceeds_Of_Sale In Number,
150--P_Cost_Of_Removal In Number
)
P_Cost_Retired, P_Proceeds_Of_Sale, P_Cost_Of_Removal
ReplyDeleteHow to get the values for these Input paramateres
Where Can I get P_Proceeds_Of_Sale, P_Cost_Of_Removal to pass ??
ReplyDelete