EBS:OM Sales Order销售订单【Open Interface、Open API】

21. OM Sales Order销售订单【Open Interface、Open API】
21.1. 快速参考

参考点
内容
功能导航
N: OM/Orders, Returns/Sales Order
并发请求
N: OM/View/Request/Order Import
接口表
oe_headers_iface_all/oe_lines_iface_all/oe_actions_iface_all/….
API
oe_order_pub.process_order
错误信息表
接口Form
N/A
接口Report
N/A
Debug Profile
OM: Debug Level
详细例子
oracle_iface_scripts_pkg.oe_so_iface
官方文档
115mfgapi.pdf:Oracle Manufacturing APIs and Open Interfaces Manual 115omapi.pdf:Oracle Order Management Open Interfaces, API, & Electronic Messaging Guide
数据验证包
21.2.
接口表、错误信息表
开发参考
Table List:
接口表
数据表
说明
oe_headers_iface_all
oe_order_headers_all
订单头
oe_lines_iface_all
oe_order_lines_all
订单行
oe_actions_iface_all
订单操作控制
错误信息表
Table Relation: 头和行关联:OU、订单来源、头参考 头和Action关联:OU、订单来源、头参考 如果Action的行参考为空,说明控制整个订单,否则控制单行
并发程序
N: OM/View/Requst/Order Import
参数
说明
Order Source
订单来源
Order Reference
订单参考
Validate Only
是否仅验证
Instance
并发数
Interface Form
N: 无
21.3.
订单头和订单行,大部分字段都可以根据Default Rule自定给出;不过,为精确控制,确定的字段我们还是尽可能给出为好。
关键字段(参数)+最简单例子
关键字段
oe_headers_iface_all
字段
说明
org_id
OU
order_number
订单号,自动编号的,给空
order_source_id
订单来源,手工输入是0,即Online
orig_sys_document_ref
订单参考,和订单来源构成唯一性,一般用来标志源系统ID
operation_code
INSERT或者UPDATE,当订单来源和参考组合存在时用更新,当订单为Enter状态时,可以DELETE
ready_flag
Y
ordered_date
订单日期
order_type_id
订单类型
price_list_id
价目表
conversion_type_code
货币转换类型,可由订单类型默认
transactional_curr_code
货币单位
字段
说明
tax_exempt_flag
S,税务免除标志
payment_term_id
付款条件,也可以默认
salesrep_id
销售员ID
sold_from_org_id
销售OU
sold_to_org_id
客户ID,来自hz_cust_accounts
ship_from_org_id
发运库存
ship_to_org_id
发运地址,来自hz_cust_site_uses_all
invoice_to_org_id
开票地址,来自hz_cust_site_uses_all
booked_flag
Y或者N
closed_flag
Y或者N
5个who字段
习惯上都给
oe_headers_iface_all
字段
说明
org_id
OU
order_source_id
订单来源,手工输入是0,即Online
orig_sys_document_ref
订单参考,一般用来标志源系统ID
orig_sys_line_ref
行参考,与上面两个构成唯一性,一般用来标志源系统ID
operation_code
INSERT或者UPDATE,当上述3个组合存在时用更新,当订单为Enter状态时,可以DELETE
split_from_line_ref
拆行时,标志来源行参考
line_number
行号,非Close的订单行号不能重复。接口表我们可以给空由系统自动编号;如果有需要待导入后Update Line表即可
shipment_number
发运行号
line_type_id
行类型
item_type_code
物料类别,默认由ITEM类型决定,通常是STANDARD
inventory_item_id
Item ID
source_type_code
EXTERNAL或者INTERNAL,可由默认规则确定
ordered_quantity
订单数量,正负要与Line Type一致,正的对Order,负的对Return,否则接口报Inventory Item错误
order_quantity_uom
单位
pricing_quantity
计价数量
pricing_quantity_uom
单位
unit_list_price
价目表价格
unit_selling_price
实际销售价格
calculate_price_flag
N或者Y,是否自动计算价格
5个who字段
习惯上都给
oe_actions_iface_all
字段
说明
org_id
OU
order_source_id
订单来源,手工输入是0,即Online
orig_sys_document_ref
订单参考,一般用来标志源系统ID
orig_sys_line_ref
行参考,与上面两个构成唯一性,一般用来标志源系统ID
operation_code
CLOSE_ORDER,用于关闭订单或行或行 BOOK_ORDER,用户预定订单
Open Inerface最简单例子(新建Book的订单)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
(11.5.10.2 Prod环境测试通过)
脚本如下:
DECLARE l_iface_rec ont.oe_headers_iface_all%ROWTYPE;
l_iface_lines_rec ont.oe_lines_iface_all%ROWTYPE;
l_iface_action_rec ont.oe_actions_iface_all%ROWTYPE;
l_org_id NUMBER := 102; --OU ID
l_user_id NUMBER := 0; --User ID?Sysadmin
BEGIN --Header
l_iface_rec.last_update_date := SYSDATE;
l_iface_rec.last_updated_by := 0;
l_iface_rec.creation_date := SYSDATE;
l_iface_rec.created_by := 0;
l_iface_rec.last_update_login := -1;
l_iface_rec.org_id := l_org_id;
l_iface_rec.order_number := NULL; --Null
if Autonumber l_iface_rec.order_source_id := 0;
--Online, see ont.oe_order_sources
l_iface_rec.orig_sys_document_ref := 'HEADER0001';
--'UPDATE' when order_source_id/orig_sys_document_ref exists
l_iface_rec.operation_code := 'INSERT';
l_iface_rec.ready_flag := 'Y';
l_iface_rec.ordered_date := SYSDATE;
l_iface_rec.order_type_id := 1006;
l_iface_rec.price_list_id := 6007;
--Derive from order type or customer
l_iface_rec.conversion_type_code := 'Corporate';
--Derive from order type
l_iface_rec.transactional_curr_code := 'CNY';
l_iface_rec.tax_exempt_flag := 'S';
l_iface_rec.payment_term_id := 5; --Derive from order type or customer
l_iface_rec.salesrep_id := 100000040;
l_iface_rec.sold_from_org_id := 102; l_iface_rec.sold_to_org_id := 1040;
l_iface_rec.ship_from_org_id := 104; l_iface_rec.ship_to_org_id := 1042;
l_iface_rec.invoice_to_org_id := 1040;
l_iface_rec.booked_flag := 'Y';
l_iface_rec.closed_flag := 'N'; --'Y' for closed order INSERT INTO
ont.oe_headers_iface_all VALUES l_iface_rec;
--Line
l_iface_lines_rec.last_update_date := SYSDATE;
l_iface_lines_rec.last_updated_by := 0;
l_iface_lines_rec.creation_date := SYSDATE;
l_iface_lines_rec.created_by := 0;
l_iface_lines_rec.last_update_login := -1;
l_iface_lines_rec.org_id := l_iface_rec.org_id;
l_iface_lines_rec.order_source_id := l_iface_rec.order_source_id;
l_iface_lines_rec.orig_sys_document_ref := l_iface_rec.orig_sys_document_ref;
l_iface_lines_rec.orig_sys_line_ref := 'LINE0001';
l_iface_lines_rec.split_from_line_ref := NULL;
--Used for split line
--'UPDATE' when order_source_id/orig_sys_document_ref/orig_sys_line_ref exists
l_iface_lines_rec.operation_code := 'INSERT';
l_iface_lines_rec.line_number := 1; l_iface_lines_rec.shipment_number := 1;
l_iface_lines_rec.line_type_id := 1001;
--can derive from header type
l_iface_lines_rec.item_type_code := NULL;
--default 'STANDARD'
l_iface_lines_rec.inventory_item_id := 5;
l_iface_lines_rec.source_type_code := NULL;
--'EXTERNAl' or 'INTERNAL', derive using default rule
l_iface_lines_rec.ordered_quantity := 100;
l_iface_lines_rec.order_quantity_uom := 'PCS';
l_iface_lines_rec.pricing_quantity := l_iface_lines_rec.ordered_quantity;
l_iface_lines_rec.pricing_quantity_uom := l_iface_lines_rec.order_quantity_uom;
l_iface_lines_rec.unit_list_price := 9;
l_iface_lines_rec.unit_selling_price := 9.9;
l_iface_lines_rec.calculate_price_flag := 'N';
INSERT INTO ont.oe_lines_iface_all VALUES l_iface_lines_rec;
END;
Open API最简单例子(Book订单)(11.5.9..10环境测试通过) 胡俊奇提供
只需要提供订单头ID即可。
 
153368796 2024/9/15 9:23:15
21.4.
导入Close的SO
已知问题
整张Close的订单可以通过接口表;Close的订单,Oracle几乎是直接插表;其他的要做很多验证。 部分行Close的订单,可以给行Assign一个仅负责Close(Enter/Fulfill/Close/End)的工作流,这样Workflow Back Ground Process起来之后就会Close
订单行号
Close的订单行号不能重复,所以接口表我们给空;如果有需要待导入后Update Line表即可。
数量正负
数量正负要与Line Type的类型一致,正的对Order,负的对Return,否则接口报Inventory Item错误。
直接更新订单号
需要更新几个表:oe_order_headers_all/wsh_delivery_details/mtl_sales_orders
UPDATE apps.mtl_sales_orders SET segment1 = l_copy_to_order_number
WHERE segment1 = l_order_number AND segment2 = l_order_type
AND segment3 = 'ORDER ENTRY';
直接Close
更新行Close信息代码如下: UPDATE oe_order_lines_all oel
SET oel.invoice_interface_status_code = 'YES', oel.shippable_flag = 'Y',
oel.fulfilled_flag = 'Y',
oel.shipping_quantity_uom = oel.order_quantity_uom,
oel.shipping_interfaced_flag = decode(oel.source_type_code, 'EXTERNAL', 'N', 'Y'),
oel.open_flag = 'N', oel.calculate_price_flag = 'N',
oel.flow_status_code = 'CLOSED',
oel.fulfillment_date = a_rec.fulfillment_date,
oel.actual_shipment_date = a_rec.actual_shipment_date,
oel.shipped_quantity = oel.ordered_quantity,
oel.shipping_quantity = oel.ordered_quantity,
oel.invoiced_quantity = oel.ordered_quantity,
oel.fulfilled_quantity = oel.ordered_quantity,
oel.visible_demand_flag = decode(oel.flow_status_code, 'AWAITING_SHIPPING', 'N', NULL)
WHERE oel.line_id = l_copy_to_order_line_id
自动拆行
订单行在收货或者发货不足的情况下会拆行,拆行的时候系统几乎是拷贝所有的字段,
如果碰到Unique的字段会失败。我碰到的问题是把源系统的line_id记录在弹性域上,
并给这个弹性域建了Unique索引,导致Dropship的订单不分收货老是报错。
 
153368796 2024/9/15 9:24:07
来源: https://www.itpub.net/thread-1812919-1-1.html
 
153368796 2024/9/15 9:23:03
脚本如下:
DECLARE x_debug_file VARCHAR2(100);
x_return_status VARCHAR2(1000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(1000);
l_msg_data VARCHAR2(1000);
l_msg_index_out NUMBER;
l_action_request_tbl oe_order_pub.request_tbl_type;
x_header_rec oe_order_pub.header_rec_type;
x_header_val_rec oe_order_pub.header_val_rec_type;
x_header_adj_tbl oe_order_pub.header_adj_tbl_type;
x_header_adj_val_tbl oe_order_pub.header_adj_val_tbl_type;
x_header_price_att_tbl oe_order_pub.header_price_att_tbl_type;
x_header_adj_att_tbl oe_order_pub.header_adj_att_tbl_type;
x_header_adj_assoc_tbl oe_order_pub.header_adj_assoc_tbl_type;
x_header_scredit_tbl oe_order_pub.header_scredit_tbl_type;
x_header_scredit_val_tbl oe_order_pub.header_scredit_val_tbl_type;
x_line_tbl oe_order_pub.line_tbl_type;
x_line_val_tbl oe_order_pub.line_val_tbl_type;
x_line_adj_tbl oe_order_pub.line_adj_tbl_type;
x_line_adj_val_tbl oe_order_pub.line_adj_val_tbl_type;
x_line_price_att_tbl oe_order_pub.line_price_att_tbl_type;
x_line_adj_att_tbl oe_order_pub.line_adj_att_tbl_type;
x_line_adj_assoc_tbl oe_order_pub.line_adj_assoc_tbl_type;
x_line_scredit_tbl oe_order_pub.line_scredit_tbl_type;
x_line_scredit_val_tbl oe_order_pub.line_scredit_val_tbl_type;
x_lot_serial_tbl oe_order_pub.lot_serial_tbl_type;
x_lot_serial_val_tbl oe_order_pub.lot_serial_val_tbl_type;
x_action_request_tbl oe_order_pub.request_tbl_type;
BEGIN dbms_output.enable(1000000);
fnd_global.apps_initialize(user_id => 0, resp_id => 52459, resp_appl_id => 660);
oe_msg_pub.initialize; oe_debug_pub.initialize;
x_debug_file := oe_debug_pub.set_debug_mode('FILE');
oe_debug_pub.setdebuglevel(5); -- 5 For Most Debuging Output!!
--Action Request l_action_request_tbl(1).request_type := oe_globals.g_book_order;
l_action_request_tbl(1).entity_code := oe_globals.g_entity_header;
l_action_request_tbl(1).entity_id := 1615855;
-- SO's Header_Id
oe_order_pub.process_order(p_api_version_number => 1.0,
p_init_msg_list => fnd_api.g_false,
p_return_values => fnd_api.g_false,
p_action_commit => fnd_api.g_false,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_action_request_tbl => l_action_request_tbl,
x_header_rec => x_header_rec,
x_header_val_rec => x_header_val_rec,
x_header_adj_tbl => x_header_adj_tbl,
x_header_adj_val_tbl => x_header_adj_val_tbl,
x_header_price_att_tbl => x_header_price_att_tbl,
x_header_adj_att_tbl => x_header_adj_att_tbl,
x_header_adj_assoc_tbl => x_header_adj_assoc_tbl,
x_header_scredit_tbl => x_header_scredit_tbl,
x_header_scredit_val_tbl => x_header_scredit_val_tbl,
x_line_tbl => x_line_tbl, x_line_val_tbl => x_line_val_tbl,
x_line_adj_tbl => x_line_adj_tbl, x_line_adj_val_tbl => x_line_adj_val_tbl,
x_line_price_att_tbl => x_line_price_att_tbl,
x_line_adj_att_tbl => x_line_adj_att_tbl,
x_line_adj_assoc_tbl => x_line_adj_assoc_tbl,
x_line_scredit_tbl => x_line_scredit_tbl,
x_line_scredit_val_tbl => x_line_scredit_val_tbl,
x_lot_serial_tbl => x_lot_serial_tbl,
x_lot_serial_val_tbl => x_lot_serial_val_tbl,
x_action_request_tbl => l_action_request_tbl);
--Check Return Status
IF x_return_status = fnd_api.g_ret_sts_success THEN
dbms_output.put_line('Successfull.');
ELSE dbms_output.put_line('Failure.');
END IF;
--Process Message
dbms_output.put_line('Process Message');
FOR i IN 1 .. x_msg_count LOOP
oe_msg_pub.get(p_msg_index => i,
p_encoded => fnd_api.g_false,
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out);
dbms_output.put_line('Messge: ' || l_msg_data);
--dbms_output.put_line('Message Index: ' || l_msg_index_out);
END LOOP;
--Debug Message
dbms_output.put_line('Debug Message');
dbms_output.put_line('Debug File: ' || oe_debug_pub.g_dir || '/' || oe_debug_pub.g_file);
FOR i IN 1 .. oe_debug_pub.g_debug_count LOOP
dbms_output.put_line(oe_debug_pub.g_debug_tbl(i));
END LOOP;
END;

  

posted @   samrv  阅读(131)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示