Page 1 of 1

Process Order API

Posted: Thu Nov 01, 2007 7:42 am
by vishalaksha
I am using oracle apps 11.5.10.2.
I want to create a sales order using process order API. There is no error in compiling the code but I am unable to create order. I cached the error ?Validation failed for the field - Order Type? in x_msg_data parameter. I tried many combinations for input values but in all cases I am getting same type of error (Not in compiling).
Please help me in solving the problem.
Below is my code and output.

<b>Code:</b>

DECLARE
x_return_status VARCHAR2(250);
x_msg_count NUMBER;
x_msg_data VARCHAR2(250);
F varchar2(2000);

--out parameters
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;

--in parameters
l_header_rec OE_Order_PUB.Header_Rec_Type;
t_line_tbl OE_ORDER_PUB.Line_Tbl_Type;

--v_hdr_id NUMBER;
--v_shipto_orgid NUMBER;
--v_soldto_id NUMBER;
--v_salesrep_id NUMBER;
--v_billto_orgid NUMBER;
--v_ord_id NUMBER ;

BEGIN

/*SELECT OE_ORDER_HEADERS_S.NEXTVAL
INTO v_hdr_id
FROM dual;*/

--l_header_rec.header_id := v_hdr_id;
--l_header_rec.order_number := 57130;
--l_header_rec.ship_to_org_id := 6452;
--l_header_rec.payment_term_id := 1020;
--l_header_rec.order_source_id := 0;
l_header_rec.order_type_id := 1430;
--l_header_rec.price_list_id := 1000;
--l_header_rec.invoicing_rule_id := -2;
--l_header_rec.accounting_rule_id := 1;
l_header_rec.org_id := 204;
--l_header_rec.sold_to_org_id := 5331;
--l_header_rec.invoice_to_org_id := 6450;
--l_header_rec.salesrep_id := 1006;
l_header_rec.operation := 'CREATE';--Oe_Globals.g_opr_create;
l_header_rec.transactional_curr_code := 'USD';
--l_header_rec.orig_sys_document_ref := 'OE_ORDER_HEADERS_ALL96841';
--l_header_rec.request_date := SYSDATE;
--l_header_rec.conversion_rate_date := SYSDATE;
--l_header_rec.last_update_date := SYSDATE;
--l_header_rec.ordered_date := SYSDATE;
--l_header_rec.creation_date := SYSDATE;
l_header_rec.pricing_date := SYSDATE;

--t_line_tbl := OE_ORDER_PUB.G_MISS_LINE_REC; ---check

--t_line_tbl(1).inventory_item_id := 5040;
--t_line_tbl(1).ordered_quantity := 1;
--t_line_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;

OE_Order_PUB.Process_Order
( 1.0
, FND_API.G_TRUE
, FND_API.G_TRUE
, FND_API.G_TRUE
, x_return_status
, x_msg_count
, x_msg_data
, l_header_rec --value in header
, OE_Order_PUB.G_MISS_HEADER_REC
, OE_Order_PUB.G_MISS_HEADER_VAL_REC
, OE_Order_PUB.G_MISS_HEADER_VAL_REC
, OE_Order_PUB.G_MISS_HEADER_ADJ_TBL
, OE_Order_PUB.G_MISS_HEADER_ADJ_TBL
, OE_Order_PUB.G_MISS_HEADER_ADJ_VAL_TBL
, OE_Order_PUB.G_MISS_HEADER_ADJ_VAL_TBL
, OE_Order_PUB.G_MISS_HEADER_PRICE_ATT_TBL
, OE_Order_PUB.G_MISS_HEADER_PRICE_ATT_TBL
, OE_Order_PUB.G_MISS_HEADER_ADJ_ATT_TBL
, OE_Order_PUB.G_MISS_HEADER_ADJ_ATT_TBL
, OE_Order_PUB.G_MISS_HEADER_ADJ_ASSOC_TBL
, OE_Order_PUB.G_MISS_HEADER_ADJ_ASSOC_TBL
, OE_Order_PUB.G_MISS_HEADER_SCREDIT_TBL
, OE_Order_PUB.G_MISS_HEADER_SCREDIT_TBL
, OE_Order_PUB.G_MISS_HEADER_SCREDIT_VAL_TBL
, OE_Order_PUB.G_MISS_HEADER_SCREDIT_VAL_TBL
--, t_line_tbl --value in line
, OE_Order_PUB.G_MISS_LINE_TBL
, OE_Order_PUB.G_MISS_LINE_TBL
, OE_Order_PUB.G_MISS_LINE_VAL_TBL
, OE_Order_PUB.G_MISS_LINE_VAL_TBL
, OE_Order_PUB.G_MISS_LINE_ADJ_TBL
, OE_Order_PUB.G_MISS_LINE_ADJ_TBL
, OE_Order_PUB.G_MISS_LINE_ADJ_VAL_TBL
, OE_Order_PUB.G_MISS_LINE_ADJ_VAL_TBL
, OE_Order_PUB.G_MISS_LINE_PRICE_ATT_TBL
, OE_Order_PUB.G_MISS_LINE_PRICE_ATT_TBL
, OE_Order_PUB.G_MISS_LINE_ADJ_ATT_TBL
, OE_Order_PUB.G_MISS_LINE_ADJ_ATT_TBL
, OE_Order_PUB.G_MISS_LINE_ADJ_ASSOC_TBL
, OE_Order_PUB.G_MISS_LINE_ADJ_ASSOC_TBL
, OE_Order_PUB.G_MISS_LINE_SCREDIT_TBL
, OE_Order_PUB.G_MISS_LINE_SCREDIT_TBL
, OE_Order_PUB.G_MISS_LINE_SCREDIT_VAL_TBL
, OE_Order_PUB.G_MISS_LINE_SCREDIT_VAL_TBL
, OE_Order_PUB.G_MISS_LOT_SERIAL_TBL
, OE_Order_PUB.G_MISS_LOT_SERIAL_TBL
, OE_Order_PUB.G_MISS_LOT_SERIAL_VAL_TBL
, OE_Order_PUB.G_MISS_LOT_SERIAL_VAL_TBL
, OE_Order_PUB.G_MISS_REQUEST_TBL
, x_header_rec
, x_header_val_rec
, x_Header_Adj_tbl
, x_Header_Adj_val_tbl
, x_Header_price_Att_tbl
, x_Header_Adj_Att_tbl
, x_Header_Adj_Assoc_tbl
, x_Header_Scredit_tbl
, x_Header_Scredit_val_tbl
, x_line_tbl
, x_line_val_tbl
, x_Line_Adj_tbl
, x_Line_Adj_val_tbl
, x_Line_price_Att_tbl
, x_Line_Adj_Att_tbl
, x_Line_Adj_Assoc_tbl
, x_Line_Scredit_tbl
, x_Line_Scredit_val_tbl
, x_Lot_Serial_tbl
, x_Lot_Serial_val_tbl
, x_action_request_tbl
--For bug 3390458
, 'N'
);

if x_msg_count > 0 then
for l_index in 1..x_msg_count loop
x_msg_data := oe_msg_pub.get(p_msg_index => l_index, p_encoded => F);
dbms_output.put_line('x_msg_data: '||x_msg_data);
end loop;
end if;
/*-- Check the return status
if x_return_status = FND_API.G_RET_STS_SUCCESS then
success;
else
failure;
end if;*/

dbms_output.put_line('x_return_status: '||x_return_status);
dbms_output.put_line('x_msg_count: '||x_msg_count);
dbms_output.put_line('x_msg_data: '||x_msg_data);
dbms_output.put_line('x_header_val_rec: '||x_header_val_rec.accounting_rule);
dbms_output.put_line('x_header_rec header_id: ' ||x_header_rec.header_id);
dbms_output.put_line('x_header_rec order_number: ' ||x_header_rec.order_number);
dbms_output.put_line('x_header_rec ship_to_org_id: ' ||x_header_rec.ship_to_org_id);
dbms_output.put_line('x_header_rec payment_term_id: ' ||x_header_rec.payment_term_id);
dbms_output.put_line('x_header_rec order_source_id: ' ||x_header_rec.order_source_id);
dbms_output.put_line('x_header_rec order_type_id: ' ||x_header_rec.order_type_id);
dbms_output.put_line('x_header_rec price_list_id: ' ||x_header_rec.price_list_id);
dbms_output.put_line('x_header_rec invoicing_rule_id: ' ||x_header_rec.invoicing_rule_id);
dbms_output.put_line('x_header_rec accounting_rule_id: ' ||x_header_rec.accounting_rule_id);
dbms_output.put_line('x_header_rec org_id: ' ||x_header_rec.org_id);
dbms_output.put_line('x_header_rec sold_to_org_id: ' ||x_header_rec.sold_to_org_id);
dbms_output.put_line('x_header_rec invoice_to_org_id: ' ||x_header_rec.invoice_to_org_id);
dbms_output.put_line('x_header_rec salesrep_id: ' ||x_header_rec.salesrep_id);
dbms_output.put_line('x_header_rec invoice_to_org_id: ' ||x_header_rec.invoice_to_org_id);
dbms_output.put_line('x_header_rec operation: ' ||x_header_rec.operation);
dbms_output.put_line('x_header_rec transactional_curr_code: ' ||x_header_rec.transactional_curr_code);
dbms_output.put_line('x_header_rec orig_sys_document_ref: ' ||x_header_rec.orig_sys_document_ref);
dbms_output.put_line('x_header_rec request_date: ' ||x_header_rec.request_date);
dbms_output.put_line('x_header_rec conversion_rate_date: ' ||x_header_rec.conversion_rate_date);
dbms_output.put_line('x_header_rec last_update_date: ' ||x_header_rec.last_update_date);
dbms_output.put_line('x_header_rec ordered_date: ' ||x_header_rec.ordered_date);
dbms_output.put_line('x_header_rec creation_date: ' ||x_header_rec.creation_date);
--dbms_output.put_line('x_line_tbl inventory_item_id: ' ||x_line_tbl(1).inventory_item_id);
--dbms_output.put_line('x_line_tbl ordered_quantity: ' ||x_line_tbl(1).ordered_quantity);
--dbms_output.put_line('x_line_tbl operation: ' ||x_line_tbl(1).operation);
END;

<b>Output:</b>
x_msg_data: Validation failed for the field - Order Type
x_return_status: E
x_msg_count: 1
x_msg_data: Validation failed for the field - Order Type
x_header_val_rec:
x_header_rec header_id:
x_header_rec order_number:
x_header_rec ship_to_org_id:
x_header_rec payment_term_id:
x_header_rec order_source_id:
x_header_rec order_type_id: 1430
x_header_rec price_list_id:
x_header_rec invoicing_rule_id:
x_header_rec accounting_rule_id:
x_header_rec org_id: 204
x_header_rec sold_to_org_id:
x_header_rec invoice_to_org_id:
x_header_rec salesrep_id:
x_header_rec invoice_to_org_id:
x_header_rec operation: CREATE
x_header_rec transactional_curr_code: USD
x_header_rec orig_sys_document_ref:
x_header_rec request_date:
x_header_rec conversion_rate_date:
x_header_rec last_update_date:
x_header_rec ordered_date:
x_header_rec creation_date:

Posted: Fri Nov 02, 2007 6:57 am
by rajaryanreddy
Hi,
There are many validations needed when we try to import order.
Refer to standard pkg for Order Import.
It will be helpful.

rgds,
Raj