我通过API创建了一个移动顺序,但是当我运行过程时出现的错误是:数字或值错误:字符串缓冲区太小:ORA-0651 。我在论坛中检查了一些建议但没有解决我的问题。我需要你的帮助。谢谢你。
create or replace PROCEDURE AAA_CREATE_MO(v_organization_id in number,v_mrf_id in number, v_description in varchar2, v_mo_number out varchar2)
as
x_return_status VARCHAR2 (1);
x_msg_data VARCHAR2 (4000);
x_msg_count NUMBER;
l_user_id NUMBER;
l_resp_id NUMBER;
l_appl_id NUMBER;
l_hdr_rec inv_move_order_pub.trohdr_rec_type := inv_move_order_pub.g_miss_trohdr_rec;
x_hdr_rec inv_move_order_pub.trohdr_rec_type := inv_move_order_pub.g_miss_trohdr_rec;
l_line_tbl inv_move_order_pub.trolin_tbl_type:= inv_move_order_pub.g_miss_trolin_tbl;
x_line_tbl inv_move_order_pub.trolin_tbl_type:= inv_move_order_pub.g_miss_trolin_tbl;
x_hdr_val_rec inv_move_order_pub.trohdr_val_rec_type;
x_line_val_tbl inv_move_order_pub.trolin_val_tbl_type;
v_msg_index_out NUMBER;
l_cnt number := 0;
l_rsr_type inv_reservation_global.mtl_reservation_tbl_type;
l_code_combination_id gl_code_combinations.code_combination_id%type;
CURSOR c_itm_onhand
IS
select *
from XXGSC_MRF_MO_INTERFACE
where mrf_id = v_mrf_id;
BEGIN
SELECT user_id INTO l_user_id FROM fnd_user WHERE user_name = 'CONCSYS';
SELECT fr.responsibility_id,
fr.application_id
INTO l_resp_id,
l_appl_id
FROM fnd_responsibility fr,
fnd_responsibility_tl frt
WHERE fr.responsibility_id = frt.responsibility_id
AND frt.responsibility_name = 'ISD-Inventory Super User'; --Responsibility
fnd_global.apps_initialize (l_user_id, l_resp_id, l_appl_id);
DBMS_OUTPUT.put_line ('Creating MO');
--l_line_tbl.DELETE;
FOR i IN c_itm_onhand
LOOP
l_cnt := l_cnt + 1;
mo_global.set_policy_context ('S', i.organization_id);
inv_globals.set_org_id (i.organization_id);
mo_global.init ('INV');
x_line_tbl.DELETE;
l_hdr_rec.date_required := SYSDATE;
l_hdr_rec.header_status := inv_globals.g_to_status_preapproved;
l_hdr_rec.organization_id := v_organization_id;
l_hdr_rec.status_date := SYSDATE;
l_hdr_rec.transaction_type_id := inv_globals.g_type_transfer_order_issue; --Type:Move Order Issue
l_hdr_rec.move_order_type := inv_globals.g_move_order_requisition;
l_hdr_rec.db_flag := fnd_api.g_true;
l_hdr_rec.operation := inv_globals.g_opr_create;
-- l_hdr_rec.description := v_description;
-- l_hdr_rec.to_account_id := i.ccid;
--l_hdr_rec.from_subinventory_code := i.subinventory_code;
l_line_tbl (l_cnt).date_required := SYSDATE;
l_line_tbl (l_cnt).inventory_item_id := i.inventory_item_id;
l_line_tbl (l_cnt).line_id := fnd_api.g_miss_num;
l_line_tbl (l_cnt).line_status := inv_globals.g_to_status_preapproved;
l_line_tbl (l_cnt).transaction_type_id := inv_globals.g_type_transfer_order_issue;
l_line_tbl (l_cnt).organization_id := i.organization_id;
l_line_tbl (l_cnt).quantity := i.qty;
l_line_tbl (l_cnt).status_date := SYSDATE;
l_line_tbl (l_cnt).uom_code := i.transaction_uom;
l_line_tbl (l_cnt).db_flag := fnd_api.g_true;
l_line_tbl (l_cnt).operation := inv_globals.g_opr_create;
l_line_tbl (l_cnt).from_subinventory_code := i.subinventory_code;
l_line_tbl (l_cnt).to_account_id := i.ccid;
--l_line_tbl (l_cnt).lot_number := i.lot_number;
DBMS_OUTPUT.put_line ('===================================');
DBMS_OUTPUT.put_line ('Calling INV_MOVE_ORDER_PUB to Create MO');
--INV_MOVE_ORDER_PUB.PROCESS_MOVE_ORDER (p_api_version_number => 1.0, p_init_msg_list => fnd_api.g_false, p_return_values => fnd_api.g_false, p_commit => fnd_api.g_false, x_return_status => x_return_status, x_msg_count => x_msg_count, x_msg_data => x_msg_data, p_trohdr_rec => l_hdr_rec, p_trolin_tbl => l_line_tbl, x_trohdr_rec => x_hdr_rec, x_trohdr_val_rec => x_hdr_val_rec, x_trolin_tbl => x_line_tbl, x_trolin_val_tbl => x_line_val_tbl);
END LOOP;
INV_MOVE_ORDER_PUB.PROCESS_MOVE_ORDER (p_api_version_number => 1.0, p_init_msg_list => fnd_api.g_false, p_return_values => fnd_api.g_false, p_commit => fnd_api.g_false, x_return_status => x_return_status, x_msg_count => x_msg_count, x_msg_data => x_msg_data, p_trohdr_rec => l_hdr_rec, p_trolin_tbl => l_line_tbl, x_trohdr_rec => x_hdr_rec, x_trohdr_val_rec => x_hdr_val_rec, x_trolin_tbl => x_line_tbl, x_trolin_val_tbl => x_line_val_tbl);
DBMS_OUTPUT.put_line (x_return_status);
DBMS_OUTPUT.put_line (x_msg_count);
IF x_return_status = 'S' THEN
COMMIT;
DBMS_OUTPUT.put_line ('Move Order Successfully Created');
DBMS_OUTPUT.put_line ('Move Order Number is :=>>>>>>>> '||x_hdr_rec.request_number);
DBMS_OUTPUT.put_line ('===================================');
ELSE
ROLLBACK;
DBMS_OUTPUT.put_line ('Move Order Creation Failed Due to Following Reasons');
DBMS_OUTPUT.put_line ('===================================');
END IF;
IF x_msg_count > 0 THEN
FOR v_index IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get (p_msg_index => v_index, p_encoded => 'F', p_data => x_msg_data, p_msg_index_out => v_msg_index_out );
x_msg_data := SUBSTR (x_msg_data, 1, 200);
DBMS_OUTPUT.put_line (x_msg_data);
END LOOP;
END IF;
v_mo_number := x_hdr_rec.request_number;
END AAA_CREATE_MO;