|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
DECLARE
l_hdr_rec OE_Blanket_PUB.header_Rec_type;
l_hdr_val_rec OE_Blanket_PUB.header_val_Rec_type;
l_line_tbl OE_Blanket_PUB.line_tbl_Type;
l_line_val_tbl OE_Blanket_PUB.line_Val_tbl_Type;
l_line_rec OE_Blanket_PUB.line_rec_Type;
l_line_val_rec OE_Blanket_PUB.line_val_rec_Type;
l_control_rec OE_Blanket_PUB.Control_rec_type;
x_line_tbl OE_Blanket_PUB.line_tbl_Type;
x_header_rec OE_Blanket_PUB.header_Rec_type;
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
x_return_status VARCHAR2(30);
i NUMBER;
j NUMBER;
BEGIN
oe_debug_pub.setdebuglevel(5);
oe_debug_pub.add('Enter create BSA ', 1);
dbms_output.put_line('The debug file is :' || OE_DEBUG_PUB.G_DIR || '/' ||
OE_DEBUG_PUB.G_FILE);
--Fnd_Global.apps_initialize(&user_Id,&responsibility_Id,&resp_appl_id);
Fnd_Global.apps_initialize(1318, 21623, 660);
MO_GLOBAL.INIT('ONT');
For j IN 1 .. 1 LOOP
l_hdr_rec := OE_Blanket_PUB.G_MISS_HEADER_REC;
l_hdr_val_rec := OE_Blanket_PUB.G_MISS_HEADER_VAL_REC;
l_hdr_rec.operation := OE_Globals.G_OPR_CREATE;
l_hdr_rec.accounting_rule_id :=1000;
l_hdr_rec.agreement_id :=1001;
l_hdr_rec.sold_to_org_id := 5087;
l_hdr_rec.order_type_id := 1076;
--- l_hdr_rec.ship_to_org_id := 1323;
l_hdr_rec.attribute1 := 'dr test';
l_hdr_rec.start_date_active := sysdate;
l_hdr_rec.end_date_active := sysdate + 5 ;
l_hdr_rec.PRICE_LIST_NAME := 'PRICE_LIST_NAME';
l_hdr_rec.PRICE_LIST_Id :=9007;
--- l_hdr_rec.new_modifier_list_name := 'dr modifier list22';
l_hdr_rec.default_discount_percent := 15;
l_hdr_rec.DEFAULT_DISCOUNT_AMOUNT :=100;
l_hdr_rec.order_number :='2110120001';
l_hdr_rec.transactional_curr_code :='CNY';
l_hdr_rec.CREATION_DATE :=sysdate;
l_hdr_rec.CREATED_BY :=-1;
l_hdr_rec.LAST_UPDATED_BY :=-1;
l_hdr_rec.LAST_UPDATE_DATE :=sysdate;
l_hdr_rec.LAST_UPDATE_LOGIN :=-1;
l_hdr_rec.operation :='INSERT';
l_hdr_rec.cust_po_number :='TEST';
l_hdr_rec.FREIGHT_TERMS_CODE :='CIP';
l_hdr_rec.org_id :=81;
l_hdr_rec.VERSION_NUMBER :=0;
l_hdr_rec.OPEN_FLAG :='N';
l_hdr_rec.accounting_rule_id :=1;
l_hdr_rec.header_id :=1006;
l_hdr_rec.lock_control :=1;
--- l_hdr_rec.payment_term_id :=1032;
l_line_rec := OE_Blanket_PUB.G_MISS_BLANKET_LINE_REC;
l_line_val_rec := OE_Blanket_PUB.G_MISS_BLANKET_LINE_VAL_REC;
l_line_rec.operation := OE_Globals.G_OPR_CREATE;
l_line_rec.accounting_rule_id :=l_hdr_rec.accounting_rule_id ;
l_line_rec.agreement_id := l_hdr_rec.agreement_id ;
l_line_rec.sold_to_org_id := 5087;
l_line_rec.inventory_item_id := 4;
l_line_rec.ordered_item :='1711800016';
--- l_line_rec.inventory_item :='吹风机,600W';
l_line_rec.blanket_min_quantity := 499;
l_line_rec.blanket_max_quantity := 999;
l_line_rec.min_release_quantity := 499;
l_line_rec.max_release_quantity := 999;
l_line_rec.unit_list_price := 888;
l_line_rec.ITEM_IDENTIFIER_TYPE := 'INT';
l_line_rec.pricing_uom := '片';
l_line_rec.ORDER_QUANTITY_UOM := '片';
l_line_rec.ACCOUNTING_RULE_ID :=1;
l_line_rec.header_id :=l_hdr_rec.header_id;
l_line_rec.lock_control :=l_hdr_rec.lock_control;
l_line_rec.override_blanket_controls_flag :='N' ;
l_line_rec.override_release_controls_flag :='N' ;
l_line_rec.operation :='INSERT';
l_line_rec.CREATION_DATE :=sysdate;
l_line_rec.CREATED_BY :=-1;
l_line_rec.LAST_UPDATED_BY :=-1;
l_line_rec.LAST_UPDATE_DATE :=sysdate;
l_line_rec.LAST_UPDATE_LOGIN :=-1;
l_line_rec.org_id :=l_hdr_rec.org_id;
for i in 1 .. 1 loop
l_line_tbl(i) := l_line_rec;
l_line_val_tbl(i) := l_line_val_rec;
end loop;
oe_debug_pub.add('Before calling Process Blanket API', 1);
oe_msg_pub.initialize;
OE_Blanket_PUB.Process_Blanket(p_org_id => 246,
p_operating_unit => NULL,
p_api_version_number => 1.0,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_header_rec => l_hdr_rec,
p_header_val_rec => l_hdr_val_rec,
p_line_tbl => l_line_tbl,
p_line_val_tbl => l_line_val_tbl,
p_control_rec => l_control_rec,
x_header_rec => x_header_rec,
x_line_tbl => x_line_tbl);
oe_debug_pub.add('Number of OE messages :' || x_msg_count, 1);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get(p_msg_index => k, p_encoded => 'F');
dbms_Output.put_line('Message :' || x_msg_data);
oe_debug_pub.add(substr(x_msg_data, 1, 255));
oe_debug_pub.add(substr(x_msg_data, 255, length(x_msg_data)));
end loop;
dbms_output.put_line('x_return_status: ' ||x_return_status);
dbms_output.put_line('x_msg_data: ' ||x_msg_data);
dbms_output.put_line('x_msg_count: ' ||x_msg_count);
dbms_output.put_line('FND_API.G_RET_STS_SUCCESS: ' ||FND_API.G_RET_STS_SUCCESS);
if x_return_status <> FND_API.G_RET_STS_SUCCESS then
oe_debug_pub.add('Error in process blanket ', 1);
dbms_output.put_line('Error in Process blanket, Check the debug log file ');
rollback;
else
dbms_output.put_line('New Sales Agreement Number is :' ||
x_header_rec.order_number || '(Header ID : ' ||
x_header_rec.header_id || ')');
oe_debug_pub.add('Line ID :' || x_line_tbl(1).line_id, 1);
oe_debug_pub.add('Header ID :' || x_header_rec.header_id, 1);
oe_debug_pub.add('Order number :' || x_header_rec.order_number, 1);
oe_debug_pub.add('Sold To :' || x_header_rec.sold_to_org_id, 1);
oe_debug_pub.add('Invoice To :' || x_header_rec.invoice_to_org_id, 1);
oe_debug_pub.add('Ship To :' || x_header_rec.ship_to_org_id, 1);
end if;
end loop;
commit;
End;
/
x_return_status: E
x_msg_data:
x_msg_count: 0
FND_API.G_RET_STS_SUCCESS: S
Error in Process blanket, Check the debug log file
请高手指点。
|
|