Update sales order api in oracle apps
In this post , we will discuss about how we can Update sales order api in oracle apps. Some time we need to mass update sale order due to some internal requirements for that requirements we need to use this below api. Here below is the sample code of the Update sales order api in oracle apps.
Sample code of Update sales order api in oracle apps.
DECLARE
l_error
VARCHAR2 (1000);
PRAGMA
AUTONOMOUS_TRANSACTION;
line_id NUMBER;
l_count
NUMBER := 0;
l_archive_file_name VARCHAR2(1000);
l_shipment_exists NUMBER:=0;
l_header_id NUMBER;
l_line_id NUMBER;
p_header_rec Oe_Order_Pub.Header_Rec_Type;
l_line_tbl oe_order_pub.line_tbl_type := oe_order_pub.g_miss_line_tbl;
l_header_rec OE_ORDER_PUB.Header_Rec_Type;
l_header_val_out_rec OE_ORDER_PUB.Header_Val_Rec_Type;
l_header_adj_out_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
l_header_adj_val_out_tbl OE_Order_PUB.Header_Adj_Val_Tbl_Type;
l_header_price_att_out_tbl OE_ORDER_PUB.Header_Price_Att_Tbl_Type;
l_header_adj_att_out_tbl OE_ORDER_PUB.Header_Adj_Att_Tbl_Type;
l_header_adj_assoc_out_tbl OE_ORDER_PUB.Header_Adj_Assoc_Tbl_Type;
l_header_scredit_out_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
l_header_scredit_val_out_tbl OE_Order_PUB.Header_Scredit_Val_Tbl_Type;
l_line_rec OE_ORDER_PUB.line_rec_type;
l_line_out_tbl OE_ORDER_PUB.Line_Tbl_Type;
l_line_val_out_tbl OE_ORDER_PUB.Line_Val_Tbl_Type;
l_line_adj_out_tbl OE_ORDER_PUB.Line_Adj_Tbl_Type;
l_line_adj_val_out_tbl OE_ORDER_PUB.Line_Adj_Val_Tbl_Type;
l_line_price_att_out_tbl OE_ORDER_PUB.Line_Price_Att_Tbl_Type;
l_line_adj_att_out_tbl OE_ORDER_PUB.Line_Adj_Att_Tbl_Type;
l_line_adj_assoc_out_tbl OE_ORDER_PUB.Line_Adj_Assoc_Tbl_Type;
l_line_scredit_out_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
l_line_scredit_val_out_tbl OE_Order_PUB.Line_Scredit_Val_Tbl_Type;
l_lot_serial_out_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
l_lot_serial_val_out_tbl
OE_Order_PUB.Lot_Serial_Val_Tbl_Type;
l_action_request_out_tbl OE_Order_PUB.Request_Tbl_Type;
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
l_return_status VARCHAR2(1);
l_index NUMBER;
l_rows_processed NUMBER:=0;
l_line_mawb VARCHAR2(240);
l_line_hawb VARCHAR2(240);
l_line_flight_num VARCHAR2(240);
l_org_id NUMBER :=FND_GLOBAL.ORG_ID;
l_resp_id NUMBER:=FND_GLOBAL.RESP_ID;
l_resp_appl_id NUMBER:=FND_GLOBAL.RESP_APPL_ID;
l_user_id number := FND_GLOBAL.USER_ID;
l_promise_date date;
v_line_count number:=0;
x_debug_file
VARCHAR2 (100);
V_Error_Message VARCHAR2(4000):= null;
i number:=0;
BEGIN
p_header_rec :=
OE_ORDER_PUB.G_MISS_HEADER_REC;
p_header_rec.header_id := 3444222; -- Order Header Id---
l_line_tbl :=
oe_order_pub.g_miss_line_tbl;
l_line_tbl(i) := oe_order_pub.g_miss_line_rec;
l_line_tbl(i).header_id := 3444222; -- Order Header Id---
l_line_tbl(i).line_id := 1233002 -- Order Line Id --
l_line_tbl(i).promise_date := sysdate;
--l_promise_date;
l_line_tbl(i).operation := oe_globals.g_opr_update;
BEGIN
x_debug_file := oe_debug_pub.set_debug_mode
('FILE');
oe_debug_pub.setdebuglevel (5);
apps.oe_order_pub.process_order
(p_api_version_number => 1.0
,p_init_msg_list
=> fnd_api.g_true
,p_return_values
=> fnd_api.g_false
,x_return_status
=> l_return_status
,x_msg_count
=> l_msg_count
,x_msg_data =>
l_msg_data
,p_header_rec
=> p_header_rec
,p_line_tbl =>
l_line_tbl
-- out variables
,x_header_rec => l_header_rec
,x_header_val_rec
=> l_header_val_out_rec
,x_header_adj_tbl
=> l_header_adj_out_tbl
,x_header_adj_val_tbl => l_header_adj_val_out_tbl
,x_header_price_att_tbl
=> l_header_price_att_out_tbl
,x_header_adj_att_tbl => l_header_adj_att_out_tbl
,x_header_adj_assoc_tbl => l_header_adj_assoc_out_tbl
,x_header_scredit_tbl => l_header_scredit_out_tbl
,x_header_scredit_val_tbl => l_header_scredit_val_out_tbl
,x_line_tbl =>
l_line_out_tbl
,x_line_val_tbl
=> l_line_val_out_tbl
,x_line_adj_tbl
=> l_line_adj_out_tbl
,x_line_adj_val_tbl => l_line_adj_val_out_tbl
,x_line_price_att_tbl => l_line_price_att_out_tbl
,x_line_adj_att_tbl
=> l_line_adj_att_out_tbl
,x_line_adj_assoc_tbl => l_line_adj_assoc_out_tbl
,x_line_scredit_tbl => l_line_scredit_out_tbl
,x_line_scredit_val_tbl => l_line_scredit_val_out_tbl
,x_lot_serial_tbl =>
l_lot_serial_out_tbl
,x_lot_serial_val_tbl
=> l_lot_serial_val_out_tbl
,x_action_request_tbl
=> l_action_request_out_tbl
);
g_error_message:='Error
in API --->'||SQLERRM;
EXCEPTION
when others then
V_Error_Message:='Exception inside order api-'||SQLERRM;
null;
END;
--
Retrieve messages
IF
l_return_status <> fnd_api.g_ret_sts_success THEN
ROLLBACK;
V_Error_Message:= V_Error_Message||'Error in updating';
END IF;
EXCEPTION
WHEN OTHERS
THEN
V_Error_Message := 'Error in process order api' || SQLERRM;
end;
3 comments:
This helped a lot for me
Thanks Mahesh for your comments!!
how can i update sold_to_org_id in Header
Post a Comment