在 Oracle EBS 的訂單模組( OM : Order Management) 有提供訂單匯入的功能,主要操作的 Table 有兩個 : OE_HEADERS_IFACE_ALL、OE_LINES_IFACE_ALL,詳細請參考 Oracle 官方文件:115omapi.pdf 。以下以範例來作說明:

範例1 : 新訂單

-- Insert a Sales Order Header and make the Order's Status is Booked. (表頭:OE_HEADERS_IFACE_ALL,並作 Booked)

INSERT INTO OE_HEADERS_IFACE_ALL (
order_source_id
,orig_sys_document_ref
,creation_date
,created_by
,last_update_date
,last_updated_by
,operation_code
,sold_to_org_id
,booked_flag
,org_id
,customer_po_number )
VALUES (
1001 --order_source_id
,'12345691' --orig_sys_document_ref
,SYSDATE --creation_date
,-1 --created_by
,SYSDATE --last_update_date
,-1 --last_updated_by
,'INSERT' --operation_code
,1891 --sold_to_org_id
,'Y' --booked_flag
,77 --org_id (for specific ou)
,'12345691' -- customer_po_number 
);

-- Insert a Sales Order Line (表身:OE_LINES_IFACE_ALL)

INSERT INTO OE_LINES_IFACE_ALL (
order_source_id
,orig_sys_document_ref
,orig_sys_line_ref
,inventory_item_id
,ordered_quantity
,operation_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,ship_from_org_id
)
VALUES (
1001 --order_source_id
,'12345691' --orig_sys_document_ref
,'1' --orig_sys_line_ref
,285730 --inventory_item_id
, 1 --ordered_quantity
, 'INSERT' --operation_code
, -1 --created_by
, SYSDATE --creation_date
, -1 --last_updated_by
, SYSDATE --last_update_date
, 77 -- ship_from_org_id
);

範例2 : 訂單變更 (Line 1->qty 0 ; Line 2 new with qty 2)

-- Insert a Sales Order Header and make the Order's Status is Booked.(表頭:OE_HEADERS_IFACE_ALL)

INSERT INTO OE_HEADERS_IFACE_ALL 
(
change_sequence
,order_source_id
,orig_sys_document_ref
,creation_date
,created_by
,last_update_date
,last_updated_by
,operation_code
,sold_to_org_id
,booked_flag
,org_id
,customer_po_number
,force_apply_flag )
VALUES (
1--change_sequence
,1001 --order_source_id
,'12345691' --orig_sys_document_ref
,SYSDATE --creation_date
,-1 --created_by
,SYSDATE --last_update_date
,-1 --last_updated_by
,'UPDATE' --operation_code
,1891 --sold_to_org_id
,'Y' --booked_flag
,77 --org_id (for specific ou)
,'12345691' --customer_po_number
,'Y' -- force_apply_flag  
);

-- Insert a Sales Order Line 1 (表身:OE_LINES_IFACE_ALL)

INSERT INTO OE_LINES_IFACE_ALL 
(
change_sequence
,order_source_id
,orig_sys_document_ref
,orig_sys_line_ref
,inventory_item_id
,ordered_quantity
,operation_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,change_reason
)
VALUES (
1--change_sequence
,1001 --order_source_id
,'12345691' --orig_sys_document_ref
,'1' --orig_sys_line_ref
,285730 --inventory_item_id
, 0 --ordered_quantity
, 'UPDATE' --operation_code
, -1 --created_by
, SYSDATE --creation_date
, -1 --last_updated_by
, SYSDATE --last_update_date
,'Not provided ' -- change_reason
);

-- Insert a Sales Order Line 2 (表身:OE_LINES_IFACE_ALL)

INSERT INTO OE_LINES_IFACE_ALL 
(
change_sequence
,order_source_id
,orig_sys_document_ref
,orig_sys_line_ref
,inventory_item_id
,ordered_quantity
,operation_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,change_reason
)
VALUES (
1--change_sequence
,1001 --order_source_id
,'12345691' --orig_sys_document_ref
,'2' --orig_sys_line_ref
,285730 --inventory_item_id
, 2 --ordered_quantity
, 'INSERT' --operation_code
, -1 --created_by
, SYSDATE --creation_date
, -1 --last_updated_by
, SYSDATE --last_update_date
,'Not provided ' -- change reason
);

範例3 : 訂單單身拆行 (Line 2 由數量qty 200 拆成 Line1 -> qty 2 & Line2 -> qty 198)

-- Insert a Sales Order Header and make the Order's Status is Booked.(表頭:OE_HEADERS_IFACE_ALL)

INSERT INTO OE_HEADERS_IFACE_ALL 
(
change_sequence
,order_source_id
,orig_sys_document_ref
,creation_date
,created_by
,last_update_date
,last_updated_by
,operation_code
,sold_to_org_id
,booked_flag
,org_id
,customer_po_number
,force_apply_flag )
VALUES (
1--change_sequence
,1001 --order_source_id
,'12345691' --orig_sys_document_ref
,SYSDATE --creation_date
,-1 --created_by
,SYSDATE --last_update_date
,-1 --last_updated_by
,'UPDATE' --operation_code
,1891 --sold_to_org_id
,'Y' --booked_flag
,77 --org_id (for specific ou)
, '12345691' --customer_po_number
,'Y' -- force_apply_flag 
);

-- Insert a Sales Order Line 1 (表身:OE_LINES_IFACE_ALL)

INSERT INTO OE_LINES_IFACE_ALL (
change_sequence
,order_source_id
,orig_sys_document_ref
,orig_sys_line_ref
,shipment_number
,inventory_item_id
,ordered_quantity
,operation_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,change_reason
)
VALUES (
1--change_sequence
,1001 --order_source_id
,'12345691' --orig_sys_document_ref
,'2' --orig_sys_line_ref
, NULL --shipment_number
,285730 --inventory_item_id
, 2 --ordered_quantity
, 'UPDATE' --operation_code
, -1 --created_by
, SYSDATE --creation_date
, -1 --last_updated_by
, SYSDATE --last_update_date
,'Not provided ' --change reason
);

-- Insert a Sales Order Line 2 (表身:OE_LINES_IFACE_ALL)

INSERT INTO OE_LINES_IFACE_ALL (
change_sequence
,order_source_id
,orig_sys_document_ref
,orig_sys_line_ref
,shipment_number
,inventory_item_id
,ordered_quantity
,operation_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,change_reason
,split_from_line_ref )
VALUES (
1--change_sequence
,1001 --order_source_id
,'12345691' --orig_sys_document_ref
,'21' --orig_sys_line_ref
, '2' --shipment_number
,285730 --inventory_item_id
, 198 --ordered_quantity
, 'INSERT' --operation_code
, -1 --created_by
, SYSDATE --creation_date
, -1 --last_updated_by
, SYSDATE --last_update_date
,'Not provided ' -- Change reason
,'2' --split_from_line_ref
); 

範例4 : 以客戶料號 Import

-- Insert a Sales Order Header and make the Order's Status is Booked.(表頭:OE_HEADERS_IFACE_ALL)

INSERT INTO OE_HEADERS_IFACE_ALL 
(
change_sequence
,order_source_id
,orig_sys_document_ref
,creation_date
,created_by
,last_update_date
,last_updated_by
,operation_code
,sold_to_org_id
,booked_flag
,org_id
,customer_po_number
,force_apply_flag )
VALUES (
1--change_sequence
,1001 --order_source_id
,'12345691' --orig_sys_document_ref
,SYSDATE --creation_date
,-1 --created_by
,SYSDATE --last_update_date
,-1 --last_updated_by
,‘INSERT' --operation_code
,1891 --sold_to_org_id
,'Y' --booked_flag
,77 --org_id (for specific ou)
, '12345691' --customer_po_number
,'Y' -- force_apply_flag 
);

-- Insert a Sales Order Line (表身:OE_LINES_IFACE_ALL)

INSERT INTO OE_LINES_IFACE_ALL (
change_sequence
,order_source_id
,orig_sys_document_ref
,orig_sys_line_ref
,customer_item_name 
,ordered_quantity
,operation_code
,created_by
,creation_date
,last_updated_by
,last_update_date
,ship_from_org_id
)
VALUES (
1--change_sequence
,1001 --order_source_id
,'12345691' --orig_sys_document_ref
,'3' --orig_sys_line_ref
, 'D210100BT' --customer_item_name 
, 3 --ordered_quantity
, 'INSERT' --operation_code
, -1 --created_by
, SYSDATE --creation_date
, -1 --last_updated_by
, SYSDATE --last_update_date
, 77 -- ship_from_org_id
);
arrow
arrow
    文章標籤
    oracle EBS Interface EBS OM
    全站熱搜

    MIS 發表在 痞客邦 留言(0) 人氣()