Home » Applications » Oracle Fusion Apps & E-Business Suite » is there is API to create sales order (OM R12.1)
|
|
Re: is there is API to create sales order [message #429795 is a reply to message #429721] |
Thu, 05 November 2009 17:17 |
alaa_fouad2004
Messages: 64 Registered: January 2009
|
Member |
|
|
i read the example in the document which you refer to it .
and i wrote the create code for new sales order and run it but it is didn't create any sales order.
can you check the code and tell me the error
CREATE OR REPLACE procedure APPS.cc_sales_order_api as
g_message varchar2(100);
l_file varchar2(100);
l_return_status varchar2(30);
l_msg_data varchar2(256);
l_msg_count number;
l_msg_index NUMBER;
l_data VARCHAR2(2000);
l_header_rec OE_Order_PUB.Header_Rec_Type ;
l_header_val_rec OE_Order_PUB.Header_Val_Rec_Type ;
l_line_tbl OE_Order_PUB.Line_Tbl_Type;
l_line_val_tbl OE_Order_PUB.Line_Val_Tbl_Type;
l_header_adj_tbl OE_ORDER_PUB.Header_Adj_Tbl_Type ;
l_header_adj_val_tbl OE_ORDER_PUB.Header_Adj_Val_Tbl_Type ;
l_header_price_att_tbl OE_ORDER_PUB.Header_Price_Att_Tbl_Type;
l_header_adj_assoc_tbl OE_ORDER_PUB.Header_Adj_Assoc_Tbl_Type;
l_header_scredit_tbl OE_ORDER_PUB.Header_Scredit_Tbl_Type;
l_header_scredit_val_tbl OE_ORDER_PUB.Header_Scredit_Val_Tbl_Type;
l_header_adj_att_tbl OE_ORDER_PUB.Header_Adj_Att_Tbl_Type;
l_Line_Adj_Tbl OE_ORDER_PUB.Line_Adj_Tbl_Type;
l_Line_Adj_Val_Tbl OE_ORDER_PUB.Line_Adj_Val_Tbl_Type;
l_Line_Price_Att_Tbl OE_ORDER_PUB.Line_Price_Att_Tbl_Type;
l_Line_Adj_Att_Tbl OE_ORDER_PUB.Line_Adj_Att_Tbl_Type ;
l_Line_Adj_Assoc_Tbl OE_ORDER_PUB.Line_Adj_Assoc_Tbl_Type;
l_line_scredit_tbl OE_ORDER_PUB.Line_Scredit_Tbl_Type;
l_Line_scredit_val_Tbl OE_ORDER_PUB.Line_Scredit_Val_Tbl_Type;
l_line_price_att_rec OE_Order_PUB.Line_Price_Att_Rec_Type;
l_Lot_Serial_Tbl OE_ORDER_PUB.Lot_Serial_Tbl_Type;
l_Lot_Serial_val_Tbl OE_ORDER_PUB.Lot_Serial_val_Tbl_Type;
l_Request_Tbl OE_ORDER_PUB.Request_Tbl_Type ;
BEGIN
--- source the env
fnd_global.apps_initialize(1013455,21623,660);
-- pass in user_id, responsibility_id, and application_id
oe_debug_pub.initialize;
oe_debug_pub.setdebuglevel(5);
Oe_Msg_Pub.initialize;
--- Populate header record
l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
--l_header_rec.header_id := 104917;
l_header_rec.orig_sys_document_ref :='11500011';
l_header_rec.order_type_id := 1000;
l_header_val_rec.order_type := 'Standard';
l_header_rec.ship_to_org_id := 1031;
l_header_rec.sold_to_org_id := 1007;
l_header_rec.invoice_to_org_id := 1030;
l_header_rec.TRANSACTIONAL_CURR_CODE:='USD';
l_header_rec.ordered_date := sysdate;
l_header_rec.created_by := 1013455;
l_header_rec.creation_date := sysdate;
l_header_rec.last_updated_by := 1013455;
l_header_rec.last_update_date := sysdate;
l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
-- Populate line record
l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;
--l_line_tbl(1).header_id := 104917;
--l_line_tbl(1).line_id := 184808;
l_line_tbl(1).price_list_id := 1000;
l_line_tbl(1).inventory_item_id := 4630;
--l_line_tbl(1).pricing_context := 'PRICING ATTRIBUTE';
--l_line_tbl(1).pricing_Attribute16 := 12;
l_line_tbl(1).ordered_quantity := 1;
l_line_tbl(1).pricing_date := sysdate;
l_line_tbl(1).unit_selling_price := 2.70;
l_line_tbl(1).calculate_price_flag := 'Y';
l_line_tbl(1).orig_sys_document_ref :='11500011';
l_line_tbl(1).orig_sys_line_ref :='11500011';
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
-- Populate line pricing attribute record
--l_Line_price_Att_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_PRICE_ATT_REC;
-- l_Line_price_Att_tbl(1).order_price_attrib_id := 1111;
-- l_Line_price_Att_tbl(1).header_id := 104747;
-- l_Line_price_Att_tbl(1).line_id := 184632;
-- l_Line_price_Att_tbl(1).flex_title := 'QP_ATTR_DEFNS_PRICING';
-- l_Line_price_Att_tbl(1).pricing_context := 'PRICING ATTRIBUTE';
-- l_Line_price_Att_tbl(1).pricing_attribute1 := 9510;
-- l_Line_price_Att_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
--l_Line_Adj_Tbl(1) := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
--l_Line_Adj_Tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
--l_Line_Adj_Tbl(1).header_id := 104917;
--l_Line_Adj_Tbl(1).line_id := 184808;
--l_Line_Adj_Tbl(1).price_adjustment_id := 224744;
-- l_Line_Adj_Tbl(1).line_index := 1;
--l_Line_Adj_Tbl(1).automatic_flag := 'N';
--l_Line_Adj_Tbl(1).applied_flag := 'Y';
--l_Line_Adj_Tbl(1).updated_flag := 'Y';
--l_Line_Adj_Tbl(1).list_header_id := 25501;
--l_Line_Adj_Tbl(1).list_line_id := 78076;
--l_Line_Adj_Tbl(1).list_line_type_code := 'DIS';
-- l_Line_Adj_Tbl(1).adjusted_amount := .30;
-- l_Line_Adj_Tbl(1).adjusted_amount_per_pqty := .30;
--l_Line_Adj_Tbl(1).arithmetic_operator:= '%';
--l_Line_Adj_Tbl(1).operand := 10;
--l_line_scredit_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_SCREDIT_REC;
/*
In addition one may use the following
example code to pass manual adjustment details as a guideline.
.
Example code to pass manual adjustment:
-------------------------------------------------------------------------- */
-- l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;
--l_line_tbl(1).header_id := 49810;
-- l_line_tbl(1).line_id := 59186;
-- l_line_adj_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
-- order header id, if available.
-- l_line_adj_tbl(1).header_id := 49810;
-- order line id, if available.
-- l_line_adj_tbl(1).line_id := 59186;
-- l_line_adj_tbl(1).automatic_flag := 'N' ;
-- l_line_adj_tbl(1).applied_flag := 'Y';
-- l_line_adj_tbl(1).updated_flag := 'Y';
-- l_line_adj_tbl(1).list_header_id := 9320;
--l_line_adj_tbl(1).list_line_id := 18005;
-- l_line_adj_tbl(1).operand := 10;
-- l_line_adj_tbl(1).charge_type_code := 'FREIGHT';
-- l_line_adj_tbl(1).modifier_level_code := 'LINE';
-- l_line_adj_tbl(1).list_line_type_code := 'FREIGHT_CHARGE';
--l_line_adj_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
-- l_line_adj_tbl(1).line_index := 1;
OE_DEBUG_PUB.Add('Just before calling Process_Order API l_index:' );
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,
p_header_rec => l_header_rec,
p_header_val_rec => l_header_val_rec,
p_line_tbl => l_line_tbl,
p_line_adj_tbl => l_line_adj_tbl,
p_line_scredit_tbl => l_line_scredit_tbl,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
x_header_rec => l_header_rec,
x_header_val_rec => l_header_val_rec,
x_header_adj_tbl => l_header_adj_tbl,
x_header_adj_val_tbl => l_header_adj_val_tbl,
x_header_price_att_tbl => l_header_price_att_tbl,
x_header_adj_att_tbl => l_header_adj_att_tbl,
x_header_adj_assoc_tbl => l_header_adj_assoc_tbl,
x_header_scredit_tbl => l_header_scredit_tbl,
x_header_scredit_val_tbl => l_header_scredit_val_tbl,
x_line_tbl => l_line_tbl,
x_line_val_tbl => l_line_val_tbl,
x_line_adj_tbl => l_Line_Adj_Tbl,
x_line_adj_val_tbl => l_Line_Adj_Val_Tbl,
x_line_price_att_tbl => l_Line_Price_Att_Tbl,
x_line_adj_att_tbl => l_Line_Adj_Att_Tbl,
x_line_adj_assoc_tbl => l_Line_Adj_Assoc_Tbl,
x_line_scredit_tbl => l_line_scredit_tbl,
x_line_scredit_val_tbl => l_Line_Scredit_val_Tbl,
x_lot_serial_tbl => l_Lot_Serial_Tbl,
x_lot_serial_val_tbl => l_Lot_Serial_val_Tbl,
x_action_request_tbl => l_Request_Tbl
);
OE_DEBUG_PUB.Add('Just after calling Process_Order API');
commit;
end;
/
Thanks
i will wait your answer
Alaa Fouad
[Updated on: Thu, 05 November 2009 18:20] Report message to a moderator
|
|
|
Re: is there is API to create sales order [message #429919 is a reply to message #429669] |
Fri, 06 November 2009 05:19 |
SSGKK
Messages: 19 Registered: March 2009
|
Junior Member |
|
|
You did not specify what error are you getting. BTW, here is a sample code that creates a SO
set serveroutput on size 1000000
DECLARE
l_api_version_number NUMBER := 1;
l_return_status VARCHAR2(2000);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
/*****************PARAMETERS****************************************************/
l_debug_level number := 1; -- OM DEBUG LEVEL (MAX 5)
l_org number := 105; -- OPERATING UNIT
l_user number := 2905; -- USER
l_resp number := 50308; -- RESPONSIBLILTY
l_appl number := 660; -- ORDER MANAGEMENT
/*****************INPUT VARIABLES FOR PROCESS_ORDER API*************************/
l_header_rec oe_order_pub.header_rec_type;
l_line_tbl oe_order_pub.line_tbl_type;
l_action_request_tbl oe_order_pub.Request_Tbl_Type;
/*****************OUT VARIABLES FOR PROCESS_ORDER API***************************/
l_header_rec_out oe_order_pub.header_rec_type;
l_header_val_rec_out oe_order_pub.header_val_rec_type;
l_header_adj_tbl_out oe_order_pub.header_adj_tbl_type;
l_header_adj_val_tbl_out oe_order_pub.header_adj_val_tbl_type;
l_header_price_att_tbl_out oe_order_pub.header_price_att_tbl_type;
l_header_adj_att_tbl_out oe_order_pub.header_adj_att_tbl_type;
l_header_adj_assoc_tbl_out oe_order_pub.header_adj_assoc_tbl_type;
l_header_scredit_tbl_out oe_order_pub.header_scredit_tbl_type;
l_header_scredit_val_tbl_out oe_order_pub.header_scredit_val_tbl_type;
l_line_tbl_out oe_order_pub.line_tbl_type;
l_line_val_tbl_out oe_order_pub.line_val_tbl_type;
l_line_adj_tbl_out oe_order_pub.line_adj_tbl_type;
l_line_adj_val_tbl_out oe_order_pub.line_adj_val_tbl_type;
l_line_price_att_tbl_out oe_order_pub.line_price_att_tbl_type;
l_line_adj_att_tbl_out oe_order_pub.line_adj_att_tbl_type;
l_line_adj_assoc_tbl_out oe_order_pub.line_adj_assoc_tbl_type;
l_line_scredit_tbl_out oe_order_pub.line_scredit_tbl_type;
l_line_scredit_val_tbl_out oe_order_pub.line_scredit_val_tbl_type;
l_lot_serial_tbl_out oe_order_pub.lot_serial_tbl_type;
l_lot_serial_val_tbl_out oe_order_pub.lot_serial_val_tbl_type;
l_action_request_tbl_out oe_order_pub.request_tbl_type;
l_msg_index NUMBER;
l_data VARCHAR2(2000);
l_loop_count NUMBER;
l_debug_file VARCHAR2(200);
-- book API vars
b_return_status VARCHAR2(200);
b_msg_count NUMBER;
b_msg_data VARCHAR2(2000);
BEGIN
dbms_application_info.set_client_info(l_org);
/*****************INITIALIZE DEBUG INFO*************************************/
if (l_debug_level > 0) then
l_debug_file := OE_DEBUG_PUB.Set_Debug_Mode('FILE');
oe_debug_pub.initialize;
oe_debug_pub.setdebuglevel(l_debug_level);
Oe_Msg_Pub.initialize;
end if;
/*****************INITIALIZE ENVIRONMENT*************************************/
fnd_global.apps_initialize(l_user, l_resp, l_appl); -- pass in user_id, responsibility_id, and application_id
/*****************INITIALIZE HEADER RECORD******************************/
l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
/*****************POPULATE REQUIRED ATTRIBUTES **********************************/
l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
l_header_rec.order_type_id := 1013;
l_header_rec.sold_to_org_id := 1054;
l_header_rec.ship_to_org_id := 3014;
l_header_rec.price_list_id := 184090;
l_header_rec.pricing_date := SYSDATE;
l_header_rec.transactional_curr_code := 'GBP';
l_header_rec.flow_status_code := 'ENTERED';
l_header_rec.cust_po_number := '06112009-08';
l_header_rec.order_source_id := 1001 ;
l_header_rec.attribute1 := 'ABC';
/*****************INITIALIZE ACTION REQUEST RECORD*************************************/
l_action_request_tbl(1) := OE_ORDER_PUB.G_MISS_REQUEST_REC;
l_action_request_tbl(1).request_type := oe_globals.g_book_order;
l_action_request_tbl(1).entity_code := oe_globals.g_entity_header;
/*****************INITIALIZE LINE RECORD********************************/
l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
l_line_tbl(1).inventory_item_id := 6288 ;
l_line_tbl(1).ordered_quantity := 1;
l_line_tbl(1).ship_to_org_id := 2992 ;
l_line_tbl(1).tax_code := 'STANDARD RATE' ;
/*****************CALLTO PROCESS ORDER API*********************************/
dbms_output.put_line('Calling API');
OE_Order_PUB.Process_Order( p_api_version_number => l_api_version_number,
p_header_rec => l_header_rec,
p_line_tbl => l_line_tbl,
p_action_request_tbl => l_action_request_tbl,
--OUT variables
x_header_rec => l_header_rec_out,
x_header_val_rec => l_header_val_rec_out,
x_header_adj_tbl => l_header_adj_tbl_out,
x_header_adj_val_tbl => l_header_adj_val_tbl_out,
x_header_price_att_tbl => l_header_price_att_tbl_out,
x_header_adj_att_tbl => l_header_adj_att_tbl_out,
x_header_adj_assoc_tbl => l_header_adj_assoc_tbl_out,
x_header_scredit_tbl => l_header_scredit_tbl_out,
x_header_scredit_val_tbl => l_header_scredit_val_tbl_out,
x_line_tbl => l_line_tbl_out,
x_line_val_tbl => l_line_val_tbl_out,
x_line_adj_tbl => l_line_adj_tbl_out,
x_line_adj_val_tbl => l_line_adj_val_tbl_out,
x_line_price_att_tbl => l_line_price_att_tbl_out,
x_line_adj_att_tbl => l_line_adj_att_tbl_out,
x_line_adj_assoc_tbl => l_line_adj_assoc_tbl_out,
x_line_scredit_tbl => l_line_scredit_tbl_out,
x_line_scredit_val_tbl => l_line_scredit_val_tbl_out,
x_lot_serial_tbl => l_lot_serial_tbl_out,
x_lot_serial_val_tbl => l_lot_serial_val_tbl_out,
x_action_request_tbl => l_action_request_tbl_out,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data);
/*****************CHECK RETURN STATUS***********************************/
if l_return_status = FND_API.G_RET_STS_SUCCESS then
dbms_output.put_line('Return status is success ');
dbms_output.put_line('debug level '||l_debug_level);
if (l_debug_level > 0) then
dbms_output.put_line('success');
end if;
commit;
else
dbms_output.put_line('Return status failure ');
if (l_debug_level > 0) then
dbms_output.put_line('failure');
end if;
rollback;
end if;
/*****************DISPLAY RETURN STATUS FLAGS******************************/
if (l_debug_level > 0) then
DBMS_OUTPUT.PUT_LINE('process ORDER ret status IS: ' || l_return_status);
DBMS_OUTPUT.PUT_LINE('process ORDER msg data IS: ' || l_msg_data);
DBMS_OUTPUT.PUT_LINE('process ORDER msg COUNT IS: ' || l_msg_count);
DBMS_OUTPUT.PUT_LINE('header.order_number IS: ' || to_char(l_header_rec_out.order_number));
DBMS_OUTPUT.PUT_LINE('header.return_status IS: ' || l_header_rec_out.return_status);
DBMS_OUTPUT.PUT_LINE('header.booked_flag IS: ' || l_header_rec_out.booked_flag);
DBMS_OUTPUT.PUT_LINE('header.header_id IS: ' || l_header_rec_out.header_id);
DBMS_OUTPUT.PUT_LINE('header.order_source_id IS: ' || l_header_rec_out.order_source_id);
DBMS_OUTPUT.PUT_LINE('header.flow_status_code IS: ' || l_header_rec_out.flow_status_code);
end if;
/*****************DISPLAY ERROR MSGS*************************************/
if (l_debug_level > 0) then
FOR i IN 1 .. l_msg_count LOOP
Oe_Msg_Pub.get(
p_msg_index => i
,p_encoded => Fnd_Api.G_FALSE
,p_data => l_data
,p_msg_index_out => l_msg_index);
DBMS_OUTPUT.PUT_LINE('message is: ' || l_data);
DBMS_OUTPUT.PUT_LINE('message index is: ' || l_msg_index);
END LOOP;
end if;
if (l_debug_level > 0) then
DBMS_OUTPUT.PUT_LINE('Debug = ' || OE_DEBUG_PUB.G_DEBUG);
DBMS_OUTPUT.PUT_LINE('Debug Level = ' || to_char(OE_DEBUG_PUB.G_DEBUG_LEVEL));
DBMS_OUTPUT.PUT_LINE('Debug File = ' || OE_DEBUG_PUB.G_DIR||'/'||OE_DEBUG_PUB.G_FILE);
DBMS_OUTPUT.PUT_LINE('****************************************************');
OE_DEBUG_PUB.DEBUG_OFF;
end if;
END;
/
|
|
|
Re: is there is API to create sales order [message #429985 is a reply to message #429919] |
Fri, 06 November 2009 12:39 |
alaa_fouad2004
Messages: 64 Registered: January 2009
|
Member |
|
|
Dear Sir
i adjust your code to my case to be
CREATE OR REPLACE procedure APPS.cc_sales_order_api2 as
l_api_version_number NUMBER := 1;
l_return_status VARCHAR2(2000);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
/*****************PARAMETERS****************************************************/
l_debug_level number := 1; -- OM DEBUG LEVEL (MAX 5)
l_org number := 204; -- OPERATING UNIT
l_user number := 1013455; -- USER
l_resp number := 21623; -- RESPONSIBLILTY
l_appl number := 660; -- ORDER MANAGEMENT
/*****************INPUT VARIABLES FOR PROCESS_ORDER API*************************/
l_header_rec oe_order_pub.header_rec_type;
l_line_tbl oe_order_pub.line_tbl_type;
l_action_request_tbl oe_order_pub.Request_Tbl_Type;
/*****************OUT VARIABLES FOR PROCESS_ORDER API***************************/
l_header_rec_out oe_order_pub.header_rec_type;
l_header_val_rec_out oe_order_pub.header_val_rec_type;
l_header_adj_tbl_out oe_order_pub.header_adj_tbl_type;
l_header_adj_val_tbl_out oe_order_pub.header_adj_val_tbl_type;
l_header_price_att_tbl_out oe_order_pub.header_price_att_tbl_type;
l_header_adj_att_tbl_out oe_order_pub.header_adj_att_tbl_type;
l_header_adj_assoc_tbl_out oe_order_pub.header_adj_assoc_tbl_type;
l_header_scredit_tbl_out oe_order_pub.header_scredit_tbl_type;
l_header_scredit_val_tbl_out oe_order_pub.header_scredit_val_tbl_type;
l_line_tbl_out oe_order_pub.line_tbl_type;
l_line_val_tbl_out oe_order_pub.line_val_tbl_type;
l_line_adj_tbl_out oe_order_pub.line_adj_tbl_type;
l_line_adj_val_tbl_out oe_order_pub.line_adj_val_tbl_type;
l_line_price_att_tbl_out oe_order_pub.line_price_att_tbl_type;
l_line_adj_att_tbl_out oe_order_pub.line_adj_att_tbl_type;
l_line_adj_assoc_tbl_out oe_order_pub.line_adj_assoc_tbl_type;
l_line_scredit_tbl_out oe_order_pub.line_scredit_tbl_type;
l_line_scredit_val_tbl_out oe_order_pub.line_scredit_val_tbl_type;
l_lot_serial_tbl_out oe_order_pub.lot_serial_tbl_type;
l_lot_serial_val_tbl_out oe_order_pub.lot_serial_val_tbl_type;
l_action_request_tbl_out oe_order_pub.request_tbl_type;
l_msg_index NUMBER;
l_data VARCHAR2(2000);
l_loop_count NUMBER;
l_debug_file VARCHAR2(200);
-- book API vars
b_return_status VARCHAR2(200);
b_msg_count NUMBER;
b_msg_data VARCHAR2(2000);
BEGIN
dbms_application_info.set_client_info(l_org);
/*****************INITIALIZE DEBUG INFO*************************************/
mo_global.init('ONT');
if (l_debug_level > 0) then
l_debug_file := OE_DEBUG_PUB.Set_Debug_Mode('FILE');
oe_debug_pub.initialize;
oe_debug_pub.setdebuglevel(l_debug_level);
Oe_Msg_Pub.initialize;
end if;
/*****************INITIALIZE ENVIRONMENT*************************************/
fnd_global.apps_initialize(l_user, l_resp, l_appl); -- pass in user_id, responsibility_id, and application_id
/*****************INITIALIZE HEADER RECORD******************************/
l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
/*****************POPULATE REQUIRED ATTRIBUTES **********************************/
l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
l_header_rec.order_type_id := 1000;
l_header_rec.sold_to_org_id := 1007;
l_header_rec.ship_to_org_id := 1031;
l_header_rec.sold_from_org_id := 204;
l_header_rec.ship_from_org_id := 1884;
l_header_rec.org_id := 204;
l_header_rec.price_list_id := 1000;
l_header_rec.pricing_date := SYSDATE;
l_header_rec.transactional_curr_code := 'USD';
l_header_rec.flow_status_code := 'ENTERED';
--l_header_rec.cust_po_number := '06112009-08';
l_header_rec.order_source_id := 1046 ;
--l_header_rec.attribute1 := 'ABC';
/*****************INITIALIZE ACTION REQUEST RECORD*************************************/
l_action_request_tbl(1) := OE_ORDER_PUB.G_MISS_REQUEST_REC;
l_action_request_tbl(1).request_type := oe_globals.g_book_order;
l_action_request_tbl(1).entity_code := oe_globals.g_entity_header;
/*****************INITIALIZE LINE RECORD********************************/
l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
l_line_tbl(1).inventory_item_id := 4630 ;
l_line_tbl(1).ordered_quantity := 1;
l_line_tbl(1).ship_to_org_id := 1031 ;
l_line_tbl(1).tax_code := 'Location';--'STANDARD RATE' ;
/*****************CALLTO PROCESS ORDER API*********************************/
dbms_output.put_line('Calling API');
OE_Order_PUB.Process_Order( p_api_version_number => l_api_version_number,
p_header_rec => l_header_rec,
p_line_tbl => l_line_tbl,
p_action_request_tbl => l_action_request_tbl,
--OUT variables
x_header_rec => l_header_rec_out,
x_header_val_rec => l_header_val_rec_out,
x_header_adj_tbl => l_header_adj_tbl_out,
x_header_adj_val_tbl => l_header_adj_val_tbl_out,
x_header_price_att_tbl => l_header_price_att_tbl_out,
x_header_adj_att_tbl => l_header_adj_att_tbl_out,
x_header_adj_assoc_tbl => l_header_adj_assoc_tbl_out,
x_header_scredit_tbl => l_header_scredit_tbl_out,
x_header_scredit_val_tbl => l_header_scredit_val_tbl_out,
x_line_tbl => l_line_tbl_out,
x_line_val_tbl => l_line_val_tbl_out,
x_line_adj_tbl => l_line_adj_tbl_out,
x_line_adj_val_tbl => l_line_adj_val_tbl_out,
x_line_price_att_tbl => l_line_price_att_tbl_out,
x_line_adj_att_tbl => l_line_adj_att_tbl_out,
x_line_adj_assoc_tbl => l_line_adj_assoc_tbl_out,
x_line_scredit_tbl => l_line_scredit_tbl_out,
x_line_scredit_val_tbl => l_line_scredit_val_tbl_out,
x_lot_serial_tbl => l_lot_serial_tbl_out,
x_lot_serial_val_tbl => l_lot_serial_val_tbl_out,
x_action_request_tbl => l_action_request_tbl_out,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data);
commit;
/*****************CHECK RETURN STATUS***********************************/
if l_return_status = FND_API.G_RET_STS_SUCCESS then
dbms_output.put_line('Return status is success ');
dbms_output.put_line('debug level '||l_debug_level);
if (l_debug_level > 0) then
dbms_output.put_line('success');
end if;
commit;
else
dbms_output.put_line('Return status failure ');
if (l_debug_level > 0) then
dbms_output.put_line('failure');
end if;
rollback;
end if;
/*****************DISPLAY RETURN STATUS FLAGS******************************/
if (l_debug_level > 0) then
DBMS_OUTPUT.PUT_LINE('process ORDER ret status IS: ' || l_return_status);
DBMS_OUTPUT.PUT_LINE('process ORDER msg data IS: ' || l_msg_data);
DBMS_OUTPUT.PUT_LINE('process ORDER msg COUNT IS: ' || l_msg_count);
DBMS_OUTPUT.PUT_LINE('header.order_number IS: ' || to_char(l_header_rec_out.order_number));
DBMS_OUTPUT.PUT_LINE('header.return_status IS: ' || l_header_rec_out.return_status);
DBMS_OUTPUT.PUT_LINE('header.booked_flag IS: ' || l_header_rec_out.booked_flag);
DBMS_OUTPUT.PUT_LINE('header.header_id IS: ' || l_header_rec_out.header_id);
DBMS_OUTPUT.PUT_LINE('header.order_source_id IS: ' || l_header_rec_out.order_source_id);
DBMS_OUTPUT.PUT_LINE('header.flow_status_code IS: ' || l_header_rec_out.flow_status_code);
end if;
/*****************DISPLAY ERROR MSGS*************************************/
if (l_debug_level > 0) then
FOR i IN 1 .. l_msg_count LOOP
Oe_Msg_Pub.get(
p_msg_index => i
,p_encoded => Fnd_Api.G_FALSE
,p_data => l_data
,p_msg_index_out => l_msg_index);
DBMS_OUTPUT.PUT_LINE('message is: ' || l_data);
DBMS_OUTPUT.PUT_LINE('message index is: ' || l_msg_index);
END LOOP;
end if;
if (l_debug_level > 0) then
DBMS_OUTPUT.PUT_LINE('Debug = ' || OE_DEBUG_PUB.G_DEBUG);
DBMS_OUTPUT.PUT_LINE('Debug Level = ' || to_char(OE_DEBUG_PUB.G_DEBUG_LEVEL));
DBMS_OUTPUT.PUT_LINE('Debug File = ' || OE_DEBUG_PUB.G_DIR||'/'||OE_DEBUG_PUB.G_FILE);
DBMS_OUTPUT.PUT_LINE('****************************************************');
OE_DEBUG_PUB.DEBUG_OFF;
end if;
END;
/
when i run it give me this output
Quote:
Calling API
Return status is success
debug level 1
success
process ORDER ret status IS: S
process ORDER msg data IS:
process ORDER msg COUNT IS: 5
header.order_number IS: 66404
header.return_status IS: S
header.booked_flag IS: N
header.header_id IS: 190542
header.order_source_id IS: 1046
header.flow_status_code IS: ENTERED
message is: Could not find a source to schedule the line. Please specify a warehouse on the line or define Sourcing Rules for the Item.
message index is: 1
message is: One of the group attributes failed your scheduling attempt.
You tried to perform a scheduling action on a schedule group (ATO Configuration, Ship Complete Configuration, ,Ship Set or Arrival Set) and since one of the group members failed it caused the entire group to fail.
message index is: 2
message is: Failed to insert the line into the set. The line could not be scheduled on the set attributes and could not schedule the whole set on some alternative date.
message index is: 3
message is: Could not find a source to schedule the line. Please specify a warehouse on the line or define Sourcing Rules for the Item.
message index is: 4
message is: Order has been booked.
message index is: 5
Debug = F
Debug Level = 1
Debug File = /dbfiles/applcsf/log/l5030617.dbg
****************************************************
note that the sales order created with its line .
please can I ask you another question about the splitting the line of the sales order using API.
if you never mine i will send to you the code which i wrote which there is a problem in it
Thanks to much
Alaa fouad
[Updated on: Fri, 06 November 2009 14:26] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Dec 23 18:38:48 CST 2024
|