FA_BOOKS_PKG.UPDATE_ROW is the package used to insert/update/delete the Asset data. This package can almost update all the Asset columns in the table FA_BOOKS.
Below are 2 versions, Before patch and After Patch.
Choose which ever worked for you.
Navigation
-----------
Fixed Assets Manager --> Assets --> Assets Workbench --> View financial Information
In this topic i will mention how to update production_quantity for an existing Asset Number. For the below procedure p_asset_num,book_name are mandatory columns along with these the column that has to be modified new_prd_qty in below case is also mandatory
Before Patch
CREATE OR REPLACE PROCEDURE FA_ASSET_UPDATE (p_asset_num varchar2,
new_prd_qty number) is
book_name varchar2(100) := <book name> -- Can be found from fa_books_v table
l_asset_id number;
l_call_fn varchar2(256);
l_book_type_code varchar2(100);
begin
mo_global.SET_POLICY_CONTEXT('S',<org to be modified>);
begin
select fb.asset_id,fb.book_type_code into l_asset_id,l_book_type_code from fa_book_controls fbc,fa_books_v fb
where BOOK_TYPE_NAME = book_name
and fb.asset_id = (select asset_id from FA_ADDITIONS_V fa
where fa.asset_number = p_asset_num)
and fb.book_type_code = fbc.book_type_code;
exception when others then
l_asset_id := null;
end;
if l_asset_id is not null then
fa_books_pkg.update_row(X_Asset_Id => l_asset_id,
X_Book_Type_Code => l_book_type_code,
X_Production_Capacity => new_prd_qty,
X_Calling_Fn => l_call_fn);
commit;
else
dbms_output.put_line('Asset Number '||p_asset_num||' Update failed');
end if;
exception when others then
dbms_output.put_line('Sqlerrm - Asset Number '||p_asset_num||' Update failed '||sqlerrm);
end;
After Patch
CREATE OR REPLACE PROCEDURE FA_ASSET_UPDATE (p_asset_num varchar2,
new_prd_qty number) is
book_name varchar2(100) := <book name> -- Can be found from fa_books_v table
l_asset_id number;
l_call_fn varchar2(256);
l_book_type_code varchar2(100);
l_set_of_books_id number;
begin
mo_global.SET_POLICY_CONTEXT('S',<org to be modified>);
begin
select fb.asset_id,fb.book_type_code,fbc.set_of_books_id into l_asset_id,l_book_type_code,l_set_of_books_id from fa_book_controls fbc,fa_books_v fb
where BOOK_TYPE_NAME = book_name
and fb.asset_id = (select asset_id from FA_ADDITIONS_V fa
where fa.asset_number = p_asset_num)
and fb.book_type_code = fbc.book_type_code;
exception when others then
l_asset_id := null;
end;
if l_asset_id is not null then
fa_books_pkg.update_row(X_Asset_Id => l_asset_id,
X_Book_Type_Code => l_book_type_code,
X_Production_Capacity => new_prd_qty,
X_set_of_books_id => l_set_of_books_id,
X_Calling_Fn => l_call_fn,
p_log_level_rec => null );
commit;
else
dbms_output.put_line('Asset Number '||p_asset_num||' Update failed');
end if;
exception when others then
dbms_output.put_line('Sqlerrm - Asset Number '||p_asset_num||' Update failed '||sqlerrm);
end;
No comments:
Post a Comment