作者:大市低开_127 | 来源:互联网 | 2023-10-11 21:20
篇首语:本文由编程笔记#小编为大家整理,主要介绍了ORACLE EBS ASN入库事务处理开发接口案例相关的知识,希望对你有一定的参考价值。
DECLARE
CURSOR cur_rcvs IS
SELECT rt.shipment_header_id,
rsh.receipt_source_code,
rt.vendor_id,
rt.vendor_site_id,
rt.source_document_code,
rt.po_header_id,
rt.po_line_id,
rt.po_line_location_id,
rt.po_release_id,
rt.shipment_line_id,
rt.transaction_id,
rt.po_distribution_id,
rsl.category_id,
rsl.item_id,
rt.quantity,
rt.unit_of_measure,
rt.routing_header_id,
rt.lpn_id,
rt.location_id
FROM rcv_shipment_headers rsh, rcv_shipment_lines rsl, rcv_transactions rt
WHERE 1 = 1
AND rsh.shipment_header_id = rsl.shipment_header_id
AND rsh.shipment_header_id = rt.shipment_header_id
AND rsh.ship_to_org_id = rt.organization_id
AND rsl.shipment_line_id = rt.shipment_line_id
AND rt.transaction_type = 'RECEIVE'
AND NOT EXISTS (SELECT 'X'
FROM rcv_transactions rt2
WHERE 1 = 1
AND rsh.shipment_header_id = rt2.shipment_header_id
AND rsl.shipment_line_id = rt2.shipment_line_id
AND rt2.transaction_type = 'DELIVER')
AND rt.transaction_id = &transaction_id;
l_group_id NUMBER;
l_iface_rcv_rec po.rcv_transactions_interface%ROWTYPE;
l_request_id NUMBER;
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(4000);
BEGIN
SELECT po.rcv_interface_groups_s.nextval INTO l_group_id FROM dual;
FOR rec_rcvs IN cur_rcvs LOOP
-- insert rcv txn interface
l_iface_rcv_rec.last_update_date := SYSDATE;
l_iface_rcv_rec.last_updated_by := 2414;
l_iface_rcv_rec.creation_date := SYSDATE;
l_iface_rcv_rec.created_by := 2414;
l_iface_rcv_rec.last_update_login := -1;
SELECT rcv_transactions_interface_s.nextval
INTO l_iface_rcv_rec.interface_transaction_id
FROM dual;
l_iface_rcv_rec.group_id := l_group_id;
l_iface_rcv_rec.shipment_header_id := rec_rcvs.shipment_header_id; --Shipment Header
l_iface_rcv_rec.processing_status_code := 'PENDING';
l_iface_rcv_rec.transaction_status_code := 'PENDING';
l_iface_rcv_rec.processing_mode_code := 'BATCH';
l_iface_rcv_rec.validation_flag := 'Y';
l_iface_rcv_rec.receipt_source_code := rec_rcvs.receipt_source_code;
l_iface_rcv_rec.vendor_id := rec_rcvs.vendor_id;
l_iface_rcv_rec.vendor_site_id := rec_rcvs.vendor_site_id; --Optional
l_iface_rcv_rec.source_document_code := rec_rcvs.source_document_code;
l_iface_rcv_rec.po_header_id := rec_rcvs.po_header_id;
l_iface_rcv_rec.po_line_id := rec_rcvs.po_line_id;
l_iface_rcv_rec.po_line_location_id := rec_rcvs.po_line_location_id;
l_iface_rcv_rec.transaction_type := 'DELIVER';
l_iface_rcv_rec.auto_transact_code := NULL;
l_iface_rcv_rec.destination_type_code := 'INVENTORY';
l_iface_rcv_rec.shipment_line_id := rec_rcvs.shipment_line_id;
l_iface_rcv_rec.parent_transaction_id := rec_rcvs.transaction_id;
l_iface_rcv_rec.po_distribution_id := rec_rcvs.po_distribution_id;
l_iface_rcv_rec.category_id := rec_rcvs.category_id;
l_iface_rcv_rec.item_id := rec_rcvs.item_id;
l_iface_rcv_rec.transaction_date := SYSDATE;
l_iface_rcv_rec.quantity := rec_rcvs.quantity;
l_iface_rcv_rec.unit_of_measure := rec_rcvs.unit_of_measure; --Not Code
l_iface_rcv_rec.routing_header_id := rec_rcvs.routing_header_id;
l_iface_rcv_rec.lpn_id := rec_rcvs.lpn_id;
l_iface_rcv_rec.subinventory := 'RPK';
l_iface_rcv_rec.locator := 'RPK-RPK-RPK';
l_iface_rcv_rec.to_organization_id := 709;
l_iface_rcv_rec.location_id := rec_rcvs.location_id;
l_iface_rcv_rec.interface_source_code := 'BATCH RCV';
INSERT INTO po.rcv_transactions_interface VALUES l_iface_rcv_rec;
dbms_output.put_line('l_group_id:' || l_group_id);
END LOOP;
apps.fnd_global.apps_initialize(user_id => 2414, resp_id => 51173, resp_appl_id => 20003);
-- submit RVCTP request, and wait for complete the request.
wtwms_004extb_rvctp_prc(p_api_version => 1.0,
p_init_msg_list => fnd_api.g_true,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
x_request_id => l_request_id,
p_group_id => l_group_id,
p_interval => 10,
p_wait_for_request => 'Y');
dbms_output.put_line('l_request_id:' || l_request_id || ',l_return_status:' || l_return_status ||
',l_msg_data' || l_msg_data);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Exception:' || SQLCODE || SQLERRM);
END;