现在的位置: 首页 > 综合 > 正文

Order Management APIs

2012年12月08日 ⁄ 综合 ⁄ 共 3847字 ⁄ 字号 评论关闭

1.1.1. Create Order API

Creating a new order with 2 lines and 1 line adjustment and the adjustment belongs to the second line.
Declare
l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC; -- Required attributes (e.g. Order Type and Customer)
l_header_rec.order_type_id := 1000;
l_header_rec.sold_to_org_id := 100;
l_header_rec.price_list_id := 10;
l_header_rec.freight_term_code = NULL;
l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
-- FIRST LINE RECORD. Initialize record to missing
l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;
l_line_tbl(1).inventory_item_id := 311;
l_line_tbl(1).ordered_quantity := 1;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
-- SECOND LINE RECORD
l_line_tbl(2) := OE_ORDER_PUB.G_MISS_LINE_REC;
l_line_tbl(2)inventory_item_id := 312;
l_line_tbl(2).ordered_quantity := 2;
l_line_tbl(2).operation := OE_GLOBALS.G_OPR_CREATE;
-- LINE ADJUSTMENT RECORD
l_line_adj_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
l_line_adj_tbl(1).discount_id := 1;
l_line_adj_tbl(1).percent := 5;
l_line_adj_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
-- Indicator that this adjustment belongs to the second line
l_line_adj_tbl(1).line_index := 2;

-- CALL TO PROCESS ORDER
OE_Order_PUB.Process_Order(
p_header_rec => l_header_rec
p_line_tbl=> l_line_tbl
p_line_adj_tbl=> l_line_adj_tbl
-- OUT variables
x_header_rec=> l_header_rec
x_header_scredit_tbl=> l_header_scr_tbl
x_header_adj_tbl=> l_header_adj_tbl
x_line_tbl=> l_line_tbl
x_line_scredit_tbl=> l_line_scredit_tbl
x_line_adj_tbl=> l_line_adj_tbl
................
x_return_status=> l_return_status
x_msg_count=> l_msg_count
x_msg_data=> l_msg_data);
if l_msg_count > 0 then
for l_index in 1..l_msg_count loop
l_msg_data := oe_msg_pub.get(p_msg_index => l_index, p_encoded => ‘F’);
end loop;
end if;
-- Check the return status
if x_return_status = FND_API.G_RET_STS_SUCCESS then success;
Else failure;
end if;
End;

1.1.2. Create New Line

Inserting a new line into an existing order.
-- NEW LINE RECORD
l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;
l_line_tbl(1).header_id := 1000;
l_line_tbl(1).inventory_item_id := 311;
l_line_tbl(1).ordered_quantity := 1;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;

OE_ORDER_PUB.Process_Order(........
p_line_tbl=> l_line_tbl
......);

1.1.3. Update an existing Line 

Updating the bill to organization and order quantity on an order line.
-- LINE RECORD WITH THE CHANGES
l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC.
l_line_tbl(1).invoice_to_org_id := 322;
l_line_tbl(1).ordered_quantity := 2;
l_line_tbl(1).line_id := 1000;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;

OE_ORDER_PUB.Process_Order(........
p_line_tbl=> l_line_tbl
........);

1.1.4. Delete an Order

Deleting an order.
l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
l_header_rec.header_id:=1000;
l_header_rec.operation := OE_GLOBALS.G_OPR_DELETE;

OE_ORDER_PUB.Process_Order(
p_header_rec=> l_header_rec
........);

1.1.5. Apply Line Hold API

Apply a hold to an order line due to a defective item.
-- ACTION REQUEST RECORD
l_request_rec.entity := OE_GLOBALS.G_ENTITY_LINE;  
-- Indicates that it is a line level action
l_request_rec.entity_id := 100; -- Line Id
l_request_rec.request_name := OE_GLOBALS.G_APPLY_HOLD;
l_request_rec.param1 := 4; --Hold ID to identify the type of hold applied. (HOLD_ID from OE_HOLD_DEFINITIONS)
l_request_rec.param2 = ‘I’;  
-- indicator that it is an item hold 
l_request_rec.param3 := 3214;  -- Inv_item_Id of the item since it is an Item hold
l_action_request_tbl := l_request_rec;

Apply Hold action record fields and their valid values.
request_type
entity_code
entity_id
param1
param2

param3

param4 
date_param1 
parm6-param20

OE_GLOBALS.G_APPLY_HOLD
OE_GLOBALS.G_ENTITY_ORDER for order or OE_
ID of the order or line to be held
Hold ID to identify the type of hold that should be applied. (HOLD_ID from OE_HOLD_DEFINITIONS)
Hold entity code for the hold source to be createdviz:
C: Customer hold source
S: Bill To or Ship To hold source
I: Item hold source
O: Order hold source
W: Warehouse Hold Source
Hold entity ID viz:
C, B, or S: for Org ID
O: Header ID
I: Inventory Item ID
Hold comment
Hold Until Date
Attribute1-15 of the descriptive flexfield associated
with the hold source record.

1.1.6. Other APIs

Other OM APIs available are Release Hold, Book Order and for ATO models Delink Config and Match & Reserve APIs are available.

抱歉!评论已关闭.