Hello all,
I am trying to create an order from the back end using process order api, the code is compiling well.But when I run it,only the header record is getting created,line record is not created.Can any one please help me out on why the line record is not getting created.Here is the code I am using for order creation

/* In Variable declaration section, declare and initialize the various variables used in the pl/sql block can be done here.
These entities are used to define INPUT and OUTPUT parameters to Process Order API*/
DECLARE
--l_header_rec OE_ORDER_PUB.Header_Rec_Type;
l_line_tbl_index NUMBER;
l_line_rec OE_ORDER_PUB.line_rec_type;

--l_Lot_Serial_val_tbl OE_ORDER_PUB.Lot_Serial_Val_Tbl_Type;
l_request_rec OE_ORDER_PUB.Request_Rec_Type ;
l_new_header_rec oe_order_pub.header_rec_type;
l_header_rec oe_order_pub.header_rec_type;
l_header_val_rec oe_order_pub.header_val_rec_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_att_tbl oe_order_pub.header_adj_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_line_tbl oe_order_pub.line_tbl_type;
l_line_val_tbl oe_order_pub.line_val_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_lot_serial_tbl oe_order_pub.lot_serial_tbl_type;
l_lot_serial_val_tbl oe_order_pub.lot_serial_val_tbl_type;
l_action_request_tbl oe_order_pub.request_tbl_type;
l_msg_count NUMBER;
l_msg_data VARCHAR2 (2000);
l_return_status VARCHAR2 (1);
l_msg_index NUMBER;
l_msg_index_out NUMBER;

--p_api_version_number varchar2(10):='1.0';
-- x_return_status VARCHAR2(1);
BEGIN
--This sets the buffer size so that messages are written to debug file.
dbms_output.enable(1000000);
/*****************INITIALIZE ENVIRONMENT*************************
-- fnd_global.apps_initialize(user_id,responsibility_id ,application_id);
/* Pass in user_id, responsibility_id, and application_id here, as the system would need to information while setting the who columns for updating the data in the tables. Also required to set the organization/operating unit context for the system has to see the data in views.*/
fnd_global.apps_initialize(1072,50228,660);-- vision env variables
/*This section sets the debug level to 5 so that all messages would be written to the debug file.*/
oe_msg_pub.initialize;
oe_debug_pub.initialize;
--X_DEBUG_FILE := OE_DEBUG_PUB.Set_Debug_Mode('FILE');
oe_debug_pub.SetDebugLevel(5);
dbms_output.put_line('START OF NEW DEBUG');
/* The header record is initialized to missing as there would be no header_id exists for the record.Once the header_id is generated by the API, the l_header_rec will take the value of the header_id */
l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
-- Header Attributes
l_header_rec.order_type_id := 1011;
l_header_rec.sold_to_org_id := 52824;
--l_header_rec.ship_to_org_id := 42102;
l_header_rec.ship_from_org_id :=100;
--l_header_rec.invoice_to_org_id := 42103;
l_header_rec.orig_sys_document_ref := '1751309';
l_header_rec.price_list_id := 6474;
l_header_rec.attribute11 := '0';
l_header_rec.attribute12 := '1751309';
l_header_rec.attribute15 := 'ORDER';


-- The statement indicates to the process order API that a new header has to be created.
l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
-- Setting index as 1 to indicate that these belong to 1st line record
l_line_tbl_index := 1;
-- Initializing the line record to missing
l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
-- Line Attributes
l_line_tbl(l_line_tbl_index).inventory_item_id := 50711;
l_line_tbl(l_line_tbl_index).ordered_quantity := 2;
l_line_tbl(l_line_tbl_index).orig_sys_document_ref := 1751309;
l_line_tbl(l_line_tbl_index).orig_sys_line_ref := 8998800001;
l_line_tbl(l_line_tbl_index).calculate_price_flag := 'N';
l_line_tbl(l_line_tbl_index).line_type_id := 1001;
l_line_tbl(l_line_tbl_index).attribute1 := 35320280;
l_line_tbl(l_line_tbl_index).attribute15 := 'CREDIT HOLD';
-- Indicates that this is a create operation for the line record.
l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_CREATE;
-- Indicates that this is an update operation for the line record.
--l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;
-- Indicates that this is a delete operation for the line record.
--l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_DELETE;
/*The below action request indicates to the process order that the order has to be booked. */
l_action_request_tbl(1).request_type := oe_globals.g_book_order;
l_action_request_tbl(1).entity_code := oe_globals.g_entity_header;
-- Call To Process Order API with the required IN and OUT parameters.
OE_ORDER_PUB.process_order(p_api_version_number => 1.0,
p_return_values => fnd_api.g_true,
p_action_commit => fnd_api.g_true,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_header_rec => l_header_rec,
p_old_header_rec => oe_order_pub.g_miss_header_rec,
p_header_val_rec => oe_order_pub.g_miss_header_val_rec,
p_old_header_val_rec => oe_order_pub.g_miss_header_val_rec,
p_header_adj_tbl => oe_order_pub.g_miss_header_adj_tbl,
p_old_header_adj_tbl => oe_order_pub.g_miss_header_adj_tbl,
p_header_adj_val_tbl => oe_order_pub.g_miss_header_adj_val_tbl,
p_old_header_adj_val_tbl => oe_order_pub.g_miss_header_adj_val_tbl,
p_header_price_att_tbl => oe_order_pub.g_miss_header_price_att_tbl,
p_old_header_price_att_tbl => oe_order_pub.g_miss_header_price_att_tbl,
p_header_adj_att_tbl => oe_order_pub.g_miss_header_adj_att_tbl,
p_old_header_adj_att_tbl => oe_order_pub.g_miss_header_adj_att_tbl,
p_header_adj_assoc_tbl => oe_order_pub.g_miss_header_adj_assoc_tbl,
p_old_header_adj_assoc_tbl => oe_order_pub.g_miss_header_adj_assoc_tbl,
p_header_scredit_tbl => oe_order_pub.g_miss_header_scredit_tbl,
p_old_header_scredit_tbl => oe_order_pub.g_miss_header_scredit_tbl,
p_header_scredit_val_tbl => oe_order_pub.g_miss_header_scredit_val_tbl,
p_old_header_scredit_val_tbl => oe_order_pub.g_miss_header_scredit_val_tbl,
p_line_tbl => oe_order_pub.g_miss_line_tbl,
p_old_line_tbl => oe_order_pub.g_miss_line_tbl,
p_line_val_tbl => oe_order_pub.g_miss_line_val_tbl,
p_old_line_val_tbl => oe_order_pub.g_miss_line_val_tbl,
p_line_adj_tbl => oe_order_pub.g_miss_line_adj_tbl,
p_old_line_adj_tbl => oe_order_pub.g_miss_line_adj_tbl,
p_line_adj_val_tbl => oe_order_pub.g_miss_line_adj_val_tbl,
p_old_line_adj_val_tbl => oe_order_pub.g_miss_line_adj_val_tbl,
p_line_price_att_tbl => oe_order_pub.g_miss_line_price_att_tbl,
p_old_line_price_att_tbl => oe_order_pub.g_miss_line_price_att_tbl,
p_line_adj_att_tbl => oe_order_pub.g_miss_line_adj_att_tbl,
p_old_line_adj_att_tbl => oe_order_pub.g_miss_line_adj_att_tbl,
p_line_adj_assoc_tbl => oe_order_pub.g_miss_line_adj_assoc_tbl,
p_old_line_adj_assoc_tbl => oe_order_pub.g_miss_line_adj_assoc_tbl,
p_line_scredit_tbl => oe_order_pub.g_miss_line_scredit_tbl,
p_old_line_scredit_tbl => oe_order_pub.g_miss_line_scredit_tbl,
p_line_scredit_val_tbl => oe_order_pub.g_miss_line_scredit_val_tbl,
p_old_line_scredit_val_tbl => oe_order_pub.g_miss_line_scredit_val_tbl,
p_lot_serial_tbl => oe_order_pub.g_miss_lot_serial_tbl,
p_old_lot_serial_tbl => oe_order_pub.g_miss_lot_serial_tbl,
p_lot_serial_val_tbl => oe_order_pub.g_miss_lot_serial_val_tbl,
p_old_lot_serial_val_tbl => oe_order_pub.g_miss_lot_serial_val_tbl,
p_action_request_tbl => oe_order_pub.g_miss_request_tbl,
x_header_rec => l_new_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_action_request_tbl );
-- Get the messages generated and print them
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_msg_data
, p_msg_index_out => l_msg_index_out);
DBMS_OUTPUT.PUT_LINE('message is: ' || l_msg_data);
DBMS_OUTPUT.PUT_LINE('message index is: ' || l_msg_index_out);
END LOOP;
/* Check if the process order goes through then it prints the success message, otherwise it prints failed message.*/
IF l_return_status = FND_API.G_RET_STS_SUCCESS
THEN
dbms_output.put_line('Process Order Success '|| l_new_header_rec.header_id );
ELSE
dbms_output.put_line('Failed');
END IF;
END;