asset transfer api测试范例
2012-06-05 15:28
106 查看
经过测试ok的sample
--测试代码开始
declare
l_trans_rec fa_api_types.trans_rec_type;
l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
l_asset_dist_tbl fa_api_types.asset_dist_tbl_type;
l_return_status VARCHAR2(1);
l_mesg_count number;
l_mesg varchar2(512);
begin
dbms_output.enable(1000000);
fa_srvr_msg.init_server_message;
-- fill in asset information
l_asset_hdr_rec.asset_id :=
12138;--要移转的资产id
-- fill in distribution data for existing distribution lines
-- affected by this transfer txn. Note: You need to fill in
-- only affected distribution lines.
--
-- For source distribution, you must fill in either existing
-- distribution id or 2 columns(expense_ccid,location_ccid) or
-- 3-tuple columns(assigned_to,expense_ccid, and location_ccid)
-- depending on the makeup of the particular distribution
-- of the asset.
l_asset_dist_tbl(1).transaction_units
:= -0.1;-- assignment当前行unit要变化的数量
-- Source
-- Option A - known dist id
l_asset_dist_tbl(1).distribution_id
:= 2165368;-- assignment当前行id
-- or
-- Option B - known dist attributes
l_asset_dist_tbl(1).assigned_to
:= 1527; -- assignment当前行assigned_to
人员id
l_asset_dist_tbl(1).expense_ccid
:= 1009142; -- assignment当前行expense
account
l_asset_dist_tbl(1).location_ccid
:= 1037635 ; -- assignment当前行location
-- Destination
l_asset_dist_tbl(2).distribution_id
:= 2165369;
-- fill in dist info for one or more destination distribution (start with 2..(3,4,..))
l_asset_dist_tbl(2).transaction_units
:= 0.1;
l_asset_dist_tbl(2).assigned_to
:= 1527;
l_asset_dist_tbl(2).expense_ccid
:= 1005158;
l_asset_dist_tbl(2).location_ccid
:= 1037635;
FA_TRANSFER_PUB.do_transfer(
-- std parameters
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
p_validation_level => FND_API.G_VALID_LEVEL_FULL,
p_calling_fn => NULL,
x_return_status => l_return_status,
x_msg_count => l_mesg_count,
x_msg_data => l_mesg,
-- api parameters
px_trans_rec => l_trans_rec,
px_asset_hdr_rec => l_asset_hdr_rec,
px_asset_dist_tbl => l_asset_dist_tbl);
--dump messages
l_mesg_count := fnd_msg_pub.count_msg;
if l_mesg_count > 0
then
l_mesg := chr(10) || substr(fnd_msg_pub.get
(fnd_msg_pub.G_FIRST, fnd_api.G_FALSE),
1,
250);
dbms_output.put_line(l_mesg);
for i in 1..(l_mesg_count
- 1)
loop
l_mesg :=
substr(fnd_msg_pub.get
(fnd_msg_pub.G_NEXT,
fnd_api.G_FALSE), 1,
250);
dbms_output.put_line(l_mesg);
end loop;
fnd_msg_pub.delete_msg();
end if;
if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
dbms_output.put_line('FAILURE');
else
dbms_output.put_line('SUCCESS');
dbms_output.put_line('THID' || to_char(l_trans_rec.transaction_header_id));
end if;
end;
--测试代码结束
辅助sql:
根据asset_id查询asset assignment信息
Select Units_Assigned, Rowid, Asset_Id, Book_Type_Code, Distribution_Id, Assigned_To, Transaction_Units,
Code_Combination_Id, Location_Id, Date_Effective, Date_Ineffective, Transaction_Header_Id_In,
Transaction_Header_Id_Out, Retirement_Id, Last_Update_Login, Last_Update_Date, Last_Updated_By
From Fa_Distribution_History
Where ('' Is Null And Date_Ineffective Is Null And Book_Type_Code = 'AP ASSET BOOK' And Asset_Id = 12138 And
'TRANSFER' != 'TRANSFER IN') Or
('' Is Not Null And
(Transaction_Header_Id_Out = '' And 'TRANSFER' In ('TRANSFER', 'TRANSFER OUT', 'UNIT ADJUSTMENT')) Or
(Transaction_Header_Id_In = '' And 'TRANSFER' In ('TRANSFER IN', 'TRANSFER', 'UNIT ADJUSTMENT') And
(Code_Combination_Id, Location_Id, Nvl(Assigned_To, -99)) Not In
(Select Dh.Code_Combination_Id, Dh.Location_Id, Nvl(Dh.Assigned_To, -99)
From Fa_Distribution_History Dh
Where Dh.Asset_Id = 12138 And Dh.Book_Type_Code = 'AP ASSET BOOK' And Dh.Transaction_Header_Id_Out = '' And
'TRANSFER' In ('TRANSFER', 'TRANSFER OUT', 'UNIT ADJUSTMENT'))))
Order By Distribution_Id;
--测试代码开始
declare
l_trans_rec fa_api_types.trans_rec_type;
l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
l_asset_dist_tbl fa_api_types.asset_dist_tbl_type;
l_return_status VARCHAR2(1);
l_mesg_count number;
l_mesg varchar2(512);
begin
dbms_output.enable(1000000);
fa_srvr_msg.init_server_message;
-- fill in asset information
l_asset_hdr_rec.asset_id :=
12138;--要移转的资产id
-- fill in distribution data for existing distribution lines
-- affected by this transfer txn. Note: You need to fill in
-- only affected distribution lines.
--
-- For source distribution, you must fill in either existing
-- distribution id or 2 columns(expense_ccid,location_ccid) or
-- 3-tuple columns(assigned_to,expense_ccid, and location_ccid)
-- depending on the makeup of the particular distribution
-- of the asset.
l_asset_dist_tbl(1).transaction_units
:= -0.1;-- assignment当前行unit要变化的数量
-- Source
-- Option A - known dist id
l_asset_dist_tbl(1).distribution_id
:= 2165368;-- assignment当前行id
-- or
-- Option B - known dist attributes
l_asset_dist_tbl(1).assigned_to
:= 1527; -- assignment当前行assigned_to
人员id
l_asset_dist_tbl(1).expense_ccid
:= 1009142; -- assignment当前行expense
account
l_asset_dist_tbl(1).location_ccid
:= 1037635 ; -- assignment当前行location
-- Destination
l_asset_dist_tbl(2).distribution_id
:= 2165369;
-- fill in dist info for one or more destination distribution (start with 2..(3,4,..))
l_asset_dist_tbl(2).transaction_units
:= 0.1;
l_asset_dist_tbl(2).assigned_to
:= 1527;
l_asset_dist_tbl(2).expense_ccid
:= 1005158;
l_asset_dist_tbl(2).location_ccid
:= 1037635;
FA_TRANSFER_PUB.do_transfer(
-- std parameters
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
p_validation_level => FND_API.G_VALID_LEVEL_FULL,
p_calling_fn => NULL,
x_return_status => l_return_status,
x_msg_count => l_mesg_count,
x_msg_data => l_mesg,
-- api parameters
px_trans_rec => l_trans_rec,
px_asset_hdr_rec => l_asset_hdr_rec,
px_asset_dist_tbl => l_asset_dist_tbl);
--dump messages
l_mesg_count := fnd_msg_pub.count_msg;
if l_mesg_count > 0
then
l_mesg := chr(10) || substr(fnd_msg_pub.get
(fnd_msg_pub.G_FIRST, fnd_api.G_FALSE),
1,
250);
dbms_output.put_line(l_mesg);
for i in 1..(l_mesg_count
- 1)
loop
l_mesg :=
substr(fnd_msg_pub.get
(fnd_msg_pub.G_NEXT,
fnd_api.G_FALSE), 1,
250);
dbms_output.put_line(l_mesg);
end loop;
fnd_msg_pub.delete_msg();
end if;
if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
dbms_output.put_line('FAILURE');
else
dbms_output.put_line('SUCCESS');
dbms_output.put_line('THID' || to_char(l_trans_rec.transaction_header_id));
end if;
end;
--测试代码结束
辅助sql:
根据asset_id查询asset assignment信息
Select Units_Assigned, Rowid, Asset_Id, Book_Type_Code, Distribution_Id, Assigned_To, Transaction_Units,
Code_Combination_Id, Location_Id, Date_Effective, Date_Ineffective, Transaction_Header_Id_In,
Transaction_Header_Id_Out, Retirement_Id, Last_Update_Login, Last_Update_Date, Last_Updated_By
From Fa_Distribution_History
Where ('' Is Null And Date_Ineffective Is Null And Book_Type_Code = 'AP ASSET BOOK' And Asset_Id = 12138 And
'TRANSFER' != 'TRANSFER IN') Or
('' Is Not Null And
(Transaction_Header_Id_Out = '' And 'TRANSFER' In ('TRANSFER', 'TRANSFER OUT', 'UNIT ADJUSTMENT')) Or
(Transaction_Header_Id_In = '' And 'TRANSFER' In ('TRANSFER IN', 'TRANSFER', 'UNIT ADJUSTMENT') And
(Code_Combination_Id, Location_Id, Nvl(Assigned_To, -99)) Not In
(Select Dh.Code_Combination_Id, Dh.Location_Id, Nvl(Dh.Assigned_To, -99)
From Fa_Distribution_History Dh
Where Dh.Asset_Id = 12138 And Dh.Book_Type_Code = 'AP ASSET BOOK' And Dh.Transaction_Header_Id_Out = '' And
'TRANSFER' In ('TRANSFER', 'TRANSFER OUT', 'UNIT ADJUSTMENT'))))
Order By Distribution_Id;
相关文章推荐
- AndroidNFC与sim卡测试demo报Asset path '/system/framework/org.simalliance.openmobileapi.jar' does not exis
- Swagger-UI 基于REST的API测试/文档类插件
- Xcode7 中文产品名不能进行真机测试(There was an internal api error) -- @shinePug
- 06-编写Hibernate API编写访问数据库的代码,使用Junit进行测试
- API 测试(11)
- 八:Zookeeper开源客户端Curator的api测试
- MySQL多线程同步-Transfer使用测试
- CyUSB.sys的说明文档CyUSB.chm-IOCTL接口范例-IOCTL_ADAPT_SEND_EP0_CONTROL_TRANSFER
- LR接口压力测试脚本范例
- Windows下测试TensorFlow Object Detection API
- 模拟键盘鼠标的API,写压力测试程序常用于模拟点击
- net自动化测试之道API测试-存储测试用例执行结果
- net自动化测试之道API测试-例子程序:ApiTest
- Android性能专项测试之耗电量统计API
- Tensorflow object detection API 搭建属于自己的物体识别模型(1)——环境搭建与测试
- 测试用例检查表范例
- 淘宝TOP之API测试
- Android游戏编程之测试单点触摸及多点触摸API
- Spring Boot REST API 自动化测试
- spring boot 学习(三)API注解记录及测试