Process_Order API Error

Hi to all,
I want to create a new Sales Order using PL/SQL, so i used the process_order API to achieve this.
I first set the client info using fnd_client_info.set_org_context(82) and then set the initialization parameters using fnd_global.apps_initilize (1090,21623,660).
To get the initialization parameters i used this query:
select fu.user_Id ,
fur.responsibility_Id,
fur.responsibility_application_Id,
frt.responsibility_name
from fnd_user fu,
fnd_responsibility_tl frt,
fnd_user_resp_groups fur
where user_name = '<USER>'
and fu.user_Id = fur.user_Id
and fur.responsibility_Id = frt.responsibility_Id
order by fur.responsibility_Id
I then called my api but i get errors, such as ORA-01403: no data found and ORA-06512 at APPS.OE_ORDER_CACHE and ORA-01403 no data found in Package OE_ORDER_UTIL Procedure GET_ATTRIBUTE_NAME.
Below is my code:
BEGIN
     fnd_client_info.set_org_context(82);
     fnd_global.apps_initialize(1090,21623,660); -- pass in user_id, responsibility_id, and application_id     
END;
DECLARE
--for get order
x_return_status VARCHAR2(1000);
x_msg_count NUMBER(20);
x_msg_data VARCHAR2(1000);
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;
--for adding a new line to process order
x_header_rec2 Oe_Order_Pub.Header_Rec_Type;
x_line_tbl2 Oe_Order_Pub.Line_Tbl_Type;
x_action_request_tbl Oe_Order_Pub.Request_Tbl_Type;
--for getting messages
v_msg_data VARCHAR2(8000);
v_msg_index_out NUMBER(10);
CCIDGOOD varchar2(1);
X_RETURN_CCID number;
X_CONCAT_SEGS varchar2(250);
X_CONCAT_IDS varchar2(250);
X_CONCAT_DESCRS varchar2(250);
-- X_MSG_COUNT number;
X_ERRMSG varchar2(1000);
X_ORDER_LINE_ID number;
X_FLEX_NUMBER number;
X_DEBUG_FILE varchar2(100);
x_fnd_debug varchar2(32000);
x_status boolean;
p_ship_from number;
BEGIN
fnd_global.apps_initialize(1318,21623,660); pass in user_id, responsibility_id, and application_id
--dbms_application_info.SET_CLIENT_INFO('82');
fnd_global.apps_initialize(1090,21623,660); pass in user_id, responsibility_id, and application_id
oe_debug_pub.initialize;
X_DEBUG_FILE := OE_DEBUG_PUB.Set_Debug_Mode('TABLE');
oe_debug_pub.SetDebugLevel(1); -- Use 5 for the most debuging output, I warn you its a lot of data
Oe_Msg_Pub.initialize;
-- Setting Up the Header Record
-- initialize record to (a record template?)
x_header_rec2 := OE_ORDER_PUB.G_MISS_HEADER_REC;
-- required attributes (e.g. Order Type and Customer)
x_header_rec2.order_type_id := 1001; -- You need a valid Order_Type
x_header_rec2.sold_to_org_id := 1049; -- You need to have a valid Org_id for your Customer AR_CUSTOMERS_V.CUSTOMER_ID
--x_header_rec2.invoice_to_org_id := 1025;
x_header_rec2.ship_to_org_id := 1040; -- You need to have a valid SHIP_TO_ORG_ID
--x_header_rec2.ship_from_org_id := 207;
--x_header_rec2.sold_from_org_id := 204;
--x_header_rec2.payment_term_id := 1020;
x_header_rec2.cust_po_number := 'PONUMBERORDER';
-- Pricing
--x_header_rec2.price_list_id := 6041;
-- Null attribute: no defaulting for freight terms
-- check biz rules on this, copied from sample code
--x_header_rec2.freight_terms_code := NULL;
-- Indicates to process order that a new header is being created
x_header_rec2.operation := OE_GLOBALS.G_OPR_CREATE;
-- FIRST LINE RECORD
--x_line_tbl2(1) := Oe_Order_Pub.G_MISS_LINE_REC;
-- x_line_tbl2(1).inventory_item_id := 3178; -- Your INVENTORY_ITEM_ID VALUE goes here
--x_line_tbl2(1).ordered_quantity := 2;
--x_line_tbl2(1).operation := Oe_Globals.G_OPR_CREATE;
IF TRUE THEN -- enable/disable toggle for Process_Order
Oe_Order_Pub.Process_Order
( 1
, Fnd_Api.G_FALSE
, Fnd_Api.G_FALSE
, Fnd_Api.G_FALSE
, x_return_status
, x_msg_count
, x_msg_data
--IN PARAMETERS
, p_line_tbl => x_line_tbl2
, p_header_rec => x_header_rec2
--OUT PARAMETERS
, x_header_rec => x_header_rec
, x_header_val_rec => x_header_val_rec
, x_Header_Adj_tbl => x_Header_Adj_tbl
, x_Header_Adj_val_tbl => x_Header_Adj_val_tbl
, x_Header_price_Att_tbl => x_Header_price_Att_tbl
, x_Header_Adj_Att_tbl => x_Header_Adj_Att_tbl
, x_Header_Adj_Assoc_tbl => x_Header_Adj_Assoc_tbl
, x_Header_Scredit_tbl => x_Header_Scredit_tbl
, x_Header_Scredit_val_tbl => x_Header_Scredit_val_tbl
, x_line_tbl => x_line_tbl
, x_line_val_tbl => x_line_val_tbl
, x_Line_Adj_tbl => x_Line_Adj_tbl
, x_Line_Adj_val_tbl => x_Line_Adj_val_tbl
, x_Line_price_Att_tbl => x_Line_price_Att_tbl
, x_Line_Adj_Att_tbl => x_Line_Adj_Att_tbl
, x_Line_Adj_Assoc_tbl => x_Line_Adj_Assoc_tbl
, x_Line_Scredit_tbl => x_Line_Scredit_tbl
, x_Line_Scredit_val_tbl => x_Line_Scredit_val_tbl
, x_Lot_Serial_tbl => x_Lot_Serial_tbl
, x_Lot_Serial_val_tbl => x_Lot_Serial_val_tbl
, x_action_request_tbl => x_action_request_tbl
COMMIT;
DBMS_OUTPUT.PUT_LINE('process ORDER ret status IS: ' || x_return_status);
DBMS_OUTPUT.PUT_LINE('process ORDER msg data IS: ' || x_msg_data);
DBMS_OUTPUT.PUT_LINE('process ORDER msg COUNT IS: ' || x_msg_count);
DBMS_OUTPUT.PUT_LINE('header.order_number IS: ' || x_header_rec.order_number);
DBMS_OUTPUT.PUT_LINE('header.return_status IS: ' || x_header_rec.return_status);
DBMS_OUTPUT.PUT_LINE('header.booked_flag IS: ' || x_header_rec.booked_flag);
DBMS_OUTPUT.PUT_LINE('header.header_id IS: ' || x_header_rec.header_id);
DBMS_OUTPUT.PUT_LINE('header.order_source_id IS: ' || x_header_rec.order_source_id);
DBMS_OUTPUT.PUT_LINE('header.flow_status_code IS: ' || x_header_rec.flow_status_code);
END IF;
FOR i IN 1 .. x_msg_count LOOP
Oe_Msg_Pub.get(
p_msg_index => i
,p_encoded => Fnd_Api.G_FALSE
,p_data => v_msg_data
,p_msg_index_out => v_msg_index_out);
DBMS_OUTPUT.PUT_LINE('message is: ' || v_msg_data);
DBMS_OUTPUT.PUT_LINE('message index is: ' || v_msg_index_out);
END LOOP;
DBMS_OUTPUT.PUT_LINE('oe_msg_pub.count_msg = ' || Oe_Msg_Pub.count_msg);
DBMS_OUTPUT.PUT_LINE('****************************************************');
DBMS_OUTPUT.PUT_LINE('* OUTPUT FROM OM: DEBUG LEVEL PROFILE SETTING *');
DBMS_OUTPUT.PUT_LINE('****************************************************');
for i in 1..OE_DEBUG_PUB.g_debug_count loop
dbms_output.put_line(OE_DEBUG_PUB.G_debug_tbl(i));
end loop;
OE_DEBUG_PUB.DEBUG_OFF;
DBMS_OUTPUT.PUT_LINE('****************************************************');
DBMS_OUTPUT.PUT_LINE('* SUMMARY OF RETURNED RESULTS *');
DBMS_OUTPUT.PUT_LINE('****************************************************');
DBMS_OUTPUT.PUT_LINE('Output Parameters: ');
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('X_RETURN_CCID = ' || to_char(X_RETURN_CCID));
DBMS_OUTPUT.PUT_LINE('X_CONCAT_SEGS = ' || X_CONCAT_SEGS);
DBMS_OUTPUT.PUT_LINE('X_CONCAT_IDS = ' || X_CONCAT_IDS);
DBMS_OUTPUT.PUT_LINE('X_CONCAT_DESCRS = ' || X_CONCAT_DESCRS);
DBMS_OUTPUT.PUT_LINE('X_ERRMSG = ' || X_ERRMSG);
DBMS_OUTPUT.PUT_LINE('****************************************************');
END;
Please someone help me as i am stuck for days and i need to complete this as soon as possible.
Thanks
Antonis

Antonis,
I am using following process which is working fine
create or replace procedure tnq_so_import_api ( retcode number,errbuff
varchar2)
is
--gmigapi.item_rec_typ;
l_header_rec OE_Order_PUB.Header_Rec_Type;
l_line_tbl OE_Order_PUB.Line_Rec_Type;
l_line_adj_tbl OE_Order_PUB.Line_Adj_Rec_Type;
l_header_scr_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
l_header_adj_tbl OE_Order_PUB.Header_Adj_Val_Tbl_Type;
l_line_scredit_tbl OE_Order_PUB.Line_Scredit_Rec_Type;
l_return_status VARCHAR2 (1) := fnd_api.g_ret_sts_success;
l_msg_count NUMBER;
l_msg_data VARCHAR2 (10000);
begin --@1
-- SETTING UP THE HEADER RECORD
-- Initialize record to missing
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;
-- Other attributes
l_header_rec.price_list_id := 10;
-- Null attribute: no defaulting for freight terms
l_header_rec.freight_terms_code := NULL;
-- Indicates to process order that a new header is being created
l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
-- FIRST LINE RECORD
-- Initialize record to missing
l_line_tbl := OE_ORDER_PUB.G_MISS_LINE_REC;
-- Line attributes
l_line_tbl.inventory_item_id := 311;
l_line_tbl.ordered_quantity := 1;
l_line_tbl.operation := OE_GLOBALS.G_OPR_CREATE;
-- SECOND LINE RECORD
-- Initialize record to missing
--l_line_tbl(2) := OE_ORDER_PUB.G_MISS_LINE_REC;
-- Line attributes
--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;
-- CALL TO PROCESS ORDER
OE_Order_PUB.Process_Order
( -- Passing just the entity records that are a part of this 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
OE_Order_PUB.Process_Order
( -- Passing just the entity records that are a part of this order
p_api_version_number IN NUMBER
, p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
, p_return_values IN VARCHAR2 := FND_API.G_FALSE
, p_action_commit IN VARCHAR2 := FND_API.G_FALSE
, x_return_status OUT VARCHAR2
, x_msg_count OUT NUMBER
, x_msg_data OUT VARCHAR2
, p_header_rec IN Header_Rec_Type :=
G_MISS_HEADER_REC
, p_old_header_rec IN Header_Rec_Type :=
G_MISS_HEADER_REC
, p_header_val_rec IN Header_Val_Rec_Type :=
G_MISS_HEADER_VAL_REC
, p_old_header_val_rec IN Header_Val_Rec_Type :=
G_MISS_HEADER_VAL_REC
, p_Header_Adj_tbl IN Header_Adj_Tbl_Type :=
G_MISS_HEADER_ADJ_TBL
, p_old_Header_Adj_tbl IN Header_Adj_Tbl_Type :=
G_MISS_HEADER_ADJ_TBL
, p_Header_Adj_val_tbl IN Header_Adj_Val_Tbl_Type :=
G_MISS_HEADER_ADJ_VAL_TBL
, p_old_Header_Adj_val_tbl IN Header_Adj_Val_Tbl_Type :=
G_MISS_HEADER_ADJ_VAL_TBL
, p_Header_price_Att_tbl IN Header_Price_Att_Tbl_Type :=
G_MISS_HEADER_PRICE_ATT_TBL
, p_old_Header_Price_Att_tbl IN Header_Price_Att_Tbl_Type :=
G_MISS_HEADER_PRICE_ATT_TBL
, p_Header_Adj_Att_tbl IN Header_Adj_Att_Tbl_Type :=
G_MISS_HEADER_ADJ_ATT_TBL
, p_old_Header_Adj_Att_tbl IN Header_Adj_Att_Tbl_Type :=
G_MISS_HEADER_ADJ_ATT_TBL
, p_Header_Adj_Assoc_tbl IN Header_Adj_Assoc_Tbl_Type :=
G_MISS_HEADER_ADJ_ASSOC_TBL
, p_old_Header_Adj_Assoc_tbl IN Header_Adj_Assoc_Tbl_Type :=
G_MISS_HEADER_ADJ_ASSOC_TBL
, p_Header_Scredit_tbl IN Header_Scredit_Tbl_Type :=
G_MISS_HEADER_SCREDIT_TBL
, p_old_Header_Scredit_tbl IN Header_Scredit_Tbl_Type :=
G_MISS_HEADER_SCREDIT_TBL
, p_Header_Scredit_val_tbl IN Header_Scredit_Val_Tbl_Type :=
G_MISS_HEADER_SCREDIT_VAL_TBL
, p_old_Header_Scredit_val_tbl IN Header_Scredit_Val_Tbl_Type :=
G_MISS_HEADER_SCREDIT_VAL_TBL
, p_line_tbl IN Line_Tbl_Type :=
G_MISS_LINE_TBL
, p_old_line_tbl IN Line_Tbl_Type :=
G_MISS_LINE_TBL
, p_line_val_tbl IN Line_Val_Tbl_Type :=
G_MISS_LINE_VAL_TBL
, p_old_line_val_tbl IN Line_Val_Tbl_Type :=
G_MISS_LINE_VAL_TBL
, p_Line_Adj_tbl IN Line_Adj_Tbl_Type :=
G_MISS_LINE_ADJ_TBL
, p_old_Line_Adj_tbl IN Line_Adj_Tbl_Type :=
G_MISS_LINE_ADJ_TBL
, p_Line_Adj_val_tbl IN Line_Adj_Val_Tbl_Type :=
G_MISS_LINE_ADJ_VAL_TBL
, p_old_Line_Adj_val_tbl IN Line_Adj_Val_Tbl_Type :=
G_MISS_LINE_ADJ_VAL_TBL
, p_Line_price_Att_tbl IN Line_Price_Att_Tbl_Type :=
G_MISS_LINE_PRICE_ATT_TBL
, p_old_Line_Price_Att_tbl IN Line_Price_Att_Tbl_Type :=
G_MISS_LINE_PRICE_ATT_TBL
, p_Line_Adj_Att_tbl IN Line_Adj_Att_Tbl_Type :=
G_MISS_LINE_ADJ_ATT_TBL
, p_old_Line_Adj_Att_tbl IN Line_Adj_Att_Tbl_Type :=
G_MISS_LINE_ADJ_ATT_TBL
, p_Line_Adj_Assoc_tbl IN Line_Adj_Assoc_Tbl_Type :=
G_MISS_LINE_ADJ_ASSOC_TBL
, p_old_Line_Adj_Assoc_tbl IN Line_Adj_Assoc_Tbl_Type :=
G_MISS_LINE_ADJ_ASSOC_TBL
, p_Line_Scredit_tbl IN Line_Scredit_Tbl_Type :=
G_MISS_LINE_SCREDIT_TBL
, p_old_Line_Scredit_tbl IN Line_Scredit_Tbl_Type :=
G_MISS_LINE_SCREDIT_TBL
, p_Line_Scredit_val_tbl IN Line_Scredit_Val_Tbl_Type :=
G_MISS_LINE_SCREDIT_VAL_TBL
, p_old_Line_Scredit_val_tbl IN Line_Scredit_Val_Tbl_Type :=
G_MISS_LINE_SCREDIT_VAL_TBL
, p_Lot_Serial_tbl IN Lot_Serial_Tbl_Type :=
G_MISS_LOT_SERIAL_TBL
, p_old_Lot_Serial_tbl IN Lot_Serial_Tbl_Type :=
G_MISS_LOT_SERIAL_TBL
, p_Lot_Serial_val_tbl IN Lot_Serial_Val_Tbl_Type :=
G_MISS_LOT_SERIAL_VAL_TBL
, p_old_Lot_Serial_val_tbl IN Lot_Serial_Val_Tbl_Type :=
G_MISS_LOT_SERIAL_VAL_TBL
, p_action_request_tbl     IN Request_Tbl_Type :=
                         G_MISS_REQUEST_TBL
, x_header_rec OUT Header_Rec_Type
, x_header_val_rec OUT Header_Val_Rec_Type
, x_Header_Adj_tbl OUT Header_Adj_Tbl_Type
, x_Header_Adj_val_tbl OUT Header_Adj_Val_Tbl_Type
, x_Header_price_Att_tbl OUT Header_Price_Att_Tbl_Type
, x_Header_Adj_Att_tbl OUT Header_Adj_Att_Tbl_Type
, x_Header_Adj_Assoc_tbl OUT Header_Adj_Assoc_Tbl_Type
, x_Header_Scredit_tbl OUT Header_Scredit_Tbl_Type
, x_Header_Scredit_val_tbl OUT Header_Scredit_Val_Tbl_Type
, x_line_tbl OUT Line_Tbl_Type
, x_line_val_tbl OUT Line_Val_Tbl_Type
, x_Line_Adj_tbl OUT Line_Adj_Tbl_Type
, x_Line_Adj_val_tbl OUT Line_Adj_Val_Tbl_Type
, x_Line_price_Att_tbl OUT Line_Price_Att_Tbl_Type
, x_Line_Adj_Att_tbl OUT Line_Adj_Att_Tbl_Type
, x_Line_Adj_Assoc_tbl OUT Line_Adj_Assoc_Tbl_Type
, x_Line_Scredit_tbl OUT Line_Scredit_Tbl_Type
, x_Line_Scredit_val_tbl OUT Line_Scredit_Val_Tbl_Type
, x_Lot_Serial_tbl OUT Lot_Serial_Tbl_Type
, x_Lot_Serial_val_tbl OUT Lot_Serial_Val_Tbl_Type
, x_action_request_tbl     OUT Request_Tbl_Type
--For bug 3390458
, p_rtrim_data IN Varchar2 :='N'
-- Retrieve messages
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 l_return_status = FND_API.G_RET_STS_SUCCESS then
DBMS_OUTPUT.put_line ('Return Status =' || l_msg_data ||' Success ');
else
DBMS_OUTPUT.put_line ('Return Status =' || l_msg_data ||' Failure ');
end if;
exception --@1
when others then
fnd_file.put_line(fnd_file.log,' Exception others in main procedure @1
:'||sqlerrm);
end tnq_so_import_api;
Check if you can get any help from this
*** Regards
Narender

Similar Messages

  • Process_Order API is not working in OM - r12.1.3

    Hello,
    I am writing a process_order API to create sales orders in Oracle from  Blanket Sales Agreements.  But below mentioned API is neither throwing any errors nor it is importing. Not sure what am I missing.   Complete code is mentioned below.
    Hope to get lucky in getting advise from gurus on this forum.
    code
    /* Formatted on 8/15/2013 2:54:52 PM (QP5 v5.252.13127.32867) */
    CREATE OR REPLACE PACKAGE BODY XXCH_BSA_ORDER
    IS
       PROCEDURE BSA_PROCESS_ORDER (errbuf             OUT VARCHAR2,
                                    retcode            OUT VARCHAR2,
                                    p_blanket_number       NUMBER,
                                    p_blanket_line         NUMBER,
                                    p_select               VARCHAR2,
                                    p_order_type           NUMBER,
                                    p_copies               NUMBER)
       AS
          v_error   VARCHAR2 (2000);
       BEGIN
          INSERT INTO LOGFILE (STEPID, MODULE)
               VALUES (1, 'VERIZON');
          COMMIT;
          FOR i IN 1 .. p_copies
          LOOP
             INSERT INTO LOGFILE (STEPID, MODULE)
                  VALUES (2, 'VERIZON');
             BSA_API (p_blanket_number   => p_blanket_number,
                      p_blanket_line     => p_blanket_line,
                      p_select           => p_select,
                      p_order_type       => p_order_type);
          END LOOP;
       EXCEPTION
          WHEN OTHERS
          THEN
             v_error := SQLERRM;
             RAISE_APPLICATION_ERROR (-20001, v_error);
       END;
       PROCEDURE BSA_API (p_blanket_number    NUMBER,
                          p_blanket_line      NUMBER,
                          p_select            VARCHAR2,
                          p_order_type        NUMBER)
       AS
          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;
          l_header_adj_tbl               oe_order_pub.header_adj_tbl_type;
          l_line_adj_tbl                 oe_order_pub.line_adj_tbl_type;
          l_header_scr_tbl               oe_order_pub.header_scredit_tbl_type;
          l_line_scredit_tbl             oe_order_pub.line_scredit_tbl_type;
          l_request_rec                  oe_order_pub.request_rec_type;
          l_return_status                VARCHAR2 (3000);
          l_msg_count                    NUMBER;
          l_msg_data                     VARCHAR2 (3000);
          p_api_version_number           NUMBER := 1.0;
          p_init_msg_list                VARCHAR2 (1000) := fnd_api.g_true;
          p_return_values                VARCHAR2 (1000) := fnd_api.g_true;
          p_action_commit                VARCHAR2 (1000) := fnd_api.g_true;
          x_return_status                VARCHAR2 (10);
          x_msg_count                    NUMBER;
          x_msg_data                     VARCHAR2 (3000);
          p_header_rec                   oe_order_pub.header_rec_type
                                            := oe_order_pub.g_miss_header_rec;
          p_old_header_rec               oe_order_pub.header_rec_type
                                            := oe_order_pub.g_miss_header_rec;
          p_header_val_rec               oe_order_pub.header_val_rec_type
                                            := oe_order_pub.g_miss_header_val_rec;
          p_old_header_val_rec           oe_order_pub.header_val_rec_type
                                            := oe_order_pub.g_miss_header_val_rec;
          p_header_adj_tbl               oe_order_pub.header_adj_tbl_type
                                            := oe_order_pub.g_miss_header_adj_tbl;
          p_old_header_adj_tbl           oe_order_pub.header_adj_tbl_type
                                            := oe_order_pub.g_miss_header_adj_tbl;
          p_header_adj_val_tbl           oe_order_pub.header_adj_val_tbl_type
                                            := oe_order_pub.g_miss_header_adj_val_tbl;
          p_old_header_adj_val_tbl       oe_order_pub.header_adj_val_tbl_type
                                            := oe_order_pub.g_miss_header_adj_val_tbl;
          p_header_price_att_tbl         oe_order_pub.header_price_att_tbl_type
             := oe_order_pub.g_miss_header_price_att_tbl;
          p_old_header_price_att_tbl     oe_order_pub.header_price_att_tbl_type
             := oe_order_pub.g_miss_header_price_att_tbl;
          p_header_adj_att_tbl           oe_order_pub.header_adj_att_tbl_type
             := oe_order_pub.g_miss_header_adj_att_tbl;
          p_old_header_adj_att_tbl       oe_order_pub.header_adj_att_tbl_type
             := oe_order_pub.g_miss_header_adj_att_tbl;
          p_header_adj_assoc_tbl         oe_order_pub.header_adj_assoc_tbl_type
             := oe_order_pub.g_miss_header_adj_assoc_tbl;
          p_old_header_adj_assoc_tbl     oe_order_pub.header_adj_assoc_tbl_type
             := oe_order_pub.g_miss_header_adj_assoc_tbl;
          p_header_scredit_tbl           oe_order_pub.header_scredit_tbl_type
             := oe_order_pub.g_miss_header_scredit_tbl;
          p_old_header_scredit_tbl       oe_order_pub.header_scredit_tbl_type
             := oe_order_pub.g_miss_header_scredit_tbl;
          p_header_scredit_val_tbl       oe_order_pub.header_scredit_val_tbl_type
             := oe_order_pub.g_miss_header_scredit_val_tbl;
          p_old_header_scredit_val_tbl   oe_order_pub.header_scredit_val_tbl_type
             := oe_order_pub.g_miss_header_scredit_val_tbl;
          p_line_tbl                     oe_order_pub.line_tbl_type
                                            := oe_order_pub.g_miss_line_tbl;
          p_old_line_tbl                 oe_order_pub.line_tbl_type
                                            := oe_order_pub.g_miss_line_tbl;
          p_line_val_tbl                 oe_order_pub.line_val_tbl_type
                                            := oe_order_pub.g_miss_line_val_tbl;
          p_old_line_val_tbl             oe_order_pub.line_val_tbl_type
                                            := oe_order_pub.g_miss_line_val_tbl;
          p_line_adj_tbl                 oe_order_pub.line_adj_tbl_type
                                            := oe_order_pub.g_miss_line_adj_tbl;
          p_old_line_adj_tbl             oe_order_pub.line_adj_tbl_type
                                            := oe_order_pub.g_miss_line_adj_tbl;
          p_line_adj_val_tbl             oe_order_pub.line_adj_val_tbl_type
             := oe_order_pub.g_miss_line_adj_val_tbl;
          p_old_line_adj_val_tbl         oe_order_pub.line_adj_val_tbl_type
             := oe_order_pub.g_miss_line_adj_val_tbl;
          p_line_price_att_tbl           oe_order_pub.line_price_att_tbl_type
             := oe_order_pub.g_miss_line_price_att_tbl;
          p_old_line_price_att_tbl       oe_order_pub.line_price_att_tbl_type
             := oe_order_pub.g_miss_line_price_att_tbl;
          p_line_adj_att_tbl             oe_order_pub.line_adj_att_tbl_type
             := oe_order_pub.g_miss_line_adj_att_tbl;
          p_old_line_adj_att_tbl         oe_order_pub.line_adj_att_tbl_type
             := oe_order_pub.g_miss_line_adj_att_tbl;
          p_line_adj_assoc_tbl           oe_order_pub.line_adj_assoc_tbl_type
             := oe_order_pub.g_miss_line_adj_assoc_tbl;
          p_old_line_adj_assoc_tbl       oe_order_pub.line_adj_assoc_tbl_type
             := oe_order_pub.g_miss_line_adj_assoc_tbl;
          p_line_scredit_tbl             oe_order_pub.line_scredit_tbl_type
             := oe_order_pub.g_miss_line_scredit_tbl;
          p_old_line_scredit_tbl         oe_order_pub.line_scredit_tbl_type
             := oe_order_pub.g_miss_line_scredit_tbl;
          p_line_scredit_val_tbl         oe_order_pub.line_scredit_val_tbl_type
             := oe_order_pub.g_miss_line_scredit_val_tbl;
          p_old_line_scredit_val_tbl     oe_order_pub.line_scredit_val_tbl_type
             := oe_order_pub.g_miss_line_scredit_val_tbl;
          p_lot_serial_tbl               oe_order_pub.lot_serial_tbl_type
                                            := oe_order_pub.g_miss_lot_serial_tbl;
          p_old_lot_serial_tbl           oe_order_pub.lot_serial_tbl_type
                                            := oe_order_pub.g_miss_lot_serial_tbl;
          p_lot_serial_val_tbl           oe_order_pub.lot_serial_val_tbl_type
             := oe_order_pub.g_miss_lot_serial_val_tbl;
          p_old_lot_serial_val_tbl       oe_order_pub.lot_serial_val_tbl_type
             := oe_order_pub.g_miss_lot_serial_val_tbl;
          p_action_request_tbl           oe_order_pub.request_tbl_type
                                            := oe_order_pub.g_miss_request_tbl;
          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_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;
          x_debug_file                   VARCHAR2 (100);
          l_line_tbl_index               NUMBER;
          l_msg_index_out                NUMBER;
          l_user_id                      fnd_user.user_id%TYPE;
          l_appl_id                      fnd_application.application_id%TYPE;
          l_resp_id                      fnd_responsibility.responsibility_id%TYPE;
          l_org_id                       hr_operating_units.organization_id%TYPE;
          l_sold_to_org_id               hz_cust_accounts.cust_account_id%TYPE;
          l_ship_to_org_id               hz_cust_site_uses_all.site_use_id%TYPE;
          l_cust_acct_site_id            hz_cust_acct_sites_all.cust_acct_site_id%TYPE;
          l_party_id                     hz_parties.party_id%TYPE;
          l_price_list_id                qp_list_headers_b.list_header_id%TYPE;
          l_primary_salesrep_id          ra_salesreps.salesrep_id%TYPE;
          l_order_type_id                oe_transaction_types_all.transaction_type_id%TYPE;
          l_order_line_type_id           oe_transaction_types_all.transaction_type_id%TYPE;
          l_order_category_code          oe_transaction_types_all.order_category_code%TYPE;
          l_inventory_item_id            mtl_system_items_b.inventory_item_id%TYPE;
          l_currency_code                qp_list_headers.currency_code%TYPE;
          l_party_site_id                hz_party_sites.party_site_id%TYPE;
          xbreak                         VARCHAR2 (33);
          errorx                         VARCHAR2 (3000);
          k                              INTEGER := 0;
          CURSOR BlanketHeader
          IS
             SELECT *
               FROM oe_blanket_headers_all
              WHERE header_id = p_blanket_number;
          CURSOR BlanketLines (
             v_agreement_id    NUMBER)
          IS
             SELECT *
               FROM oe_blanket_lines_all
              WHERE     header_id = v_agreement_id
                    AND line_number = NVL (p_blanket_line, line_number);
       BEGIN
          -- Create Header
          xbreak := '100';
          fnd_global.apps_initialize (12647, 51839, 660);
          --       pass in user_id, responsibility_id, and application_id
          oe_msg_pub.initialize;
          oe_debug_pub.initialize;
          l_org_id := fnd_profile.VALUE ('ORG_ID');
          xbreak := '101';
          fnd_file.Put_line (
             fnd_file.LOG,
             '*********************************************** BOOK ORDER **************************');
          fnd_file.put_line (fnd_file.LOG,
                             'Begining of the procedure Book Order');
          --    Initialize header record
          xbreak := '102';
          FOR i IN BlanketHeader
          LOOP
          insert into logfile(stepid,module) values (23,'BPO:'||to_char(i.header_id));
           l_header_rec := oe_order_pub.g_miss_header_rec;
             xbreak := '103';
             l_header_rec.cust_po_number := i.cust_po_number;
             l_header_rec.ordered_date := SYSDATE;
             l_header_rec.salesrep_id := i.salesrep_id;
             l_header_rec.order_type_id := p_order_type;
             l_header_rec.operation := oe_globals.g_opr_create; --Specifies that Order is getting created
             --xbreak := '104';
             l_header_rec.order_category_code := 'ORDER';
             --         l_num_tbl_index := 1;
             l_header_rec.booked_flag := 'Y';
             xbreak := '105';
             l_header_rec.sold_to_org_id := i.sold_to_org_id;
             l_header_rec.invoice_to_org_id := i.invoice_to_org_id;
             l_header_rec.ship_to_org_id := i.ship_to_org_id;
             l_header_rec.price_list_id := i.price_list_id;
             --Create Line record
             FOR j IN BlanketLines(i.header_id)
             LOOP
                l_line_tbl_index := 1;
                -- FIRST LINE RECORD
                -- Initialize 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 :=
                   j.inventory_item_id;
                l_line_tbl (l_line_tbl_index).ordered_quantity := 1;
                -- Set to 'N' when you need to pass unit_selling_price
                l_line_tbl (l_line_tbl_index).calculate_price_flag := 'N';
                l_line_tbl (l_line_tbl_index).unit_selling_price := NULL;
                l_line_tbl (l_line_tbl_index).ship_from_org_id := j.org_id;
                l_line_tbl (l_line_tbl_index).operation := oe_globals.g_opr_create;
             END LOOP;
    x_debug_file := oe_debug_pub.set_debug_mode ('FILE');
    oe_debug_pub.setdebuglevel (5);
             oe_order_pub.process_order (
                p_org_id  => l_org_id,
                p_operating_unit => l_org_id,
                p_api_version_number       => 1.0,
                p_init_msg_list            => fnd_api.g_true,
                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_line_tbl                 => l_line_tbl,
                p_action_request_tbl       => l_action_request_tbl -- OUT PARAMETERS
                x_header_rec               => l_header_rec,
                x_header_val_rec           => x_header_val_rec,
                x_header_adj_tbl           => x_header_adj_tbl,
                x_header_adj_val_tbl       => x_header_adj_val_tbl,
                x_header_price_att_tbl     => x_header_price_att_tbl,
                x_header_adj_att_tbl       => x_header_adj_att_tbl,
                x_header_adj_assoc_tbl     => x_header_adj_assoc_tbl,
                x_header_scredit_tbl       => x_header_scredit_tbl,
                x_header_scredit_val_tbl   => x_header_scredit_val_tbl,
                x_line_tbl                 => l_line_tbl,
                x_line_val_tbl             => x_line_val_tbl,
                x_line_adj_tbl             => x_line_adj_tbl,
                x_line_adj_val_tbl         => x_line_adj_val_tbl,
                x_line_price_att_tbl       => x_line_price_att_tbl,
                x_line_adj_att_tbl         => x_line_adj_att_tbl,
                x_line_adj_assoc_tbl       => x_line_adj_assoc_tbl,
                x_line_scredit_tbl         => x_line_scredit_tbl,
                x_line_scredit_val_tbl     => x_line_scredit_val_tbl,
                x_lot_serial_tbl           => x_lot_serial_tbl,
                x_lot_serial_val_tbl       => x_lot_serial_val_tbl,
                x_action_request_tbl       => l_action_request_tbl);
             COMMIT;
             INSERT INTO LOGFILE (STEPID, MODULE)
                     VALUES (
                               22,
                                  TO_CHAR (l_header_rec.header_id)
                               || '-'
                               || l_msg_data);
             COMMIT;
             xbreak := '106';
          END LOOP;
          FOR i IN 1 .. l_msg_count
          LOOP
             k := k + 1;
             xbreak := '108';
             Oe_Msg_Pub.get (p_msg_index       => k,
                             p_encoded         => Fnd_Api.G_FALSE,
                             p_data            => l_msg_data,
                             p_msg_index_out   => l_msg_index_out);
                               INSERT INTO LOGFILE (STEPID, MODULE)
                     VALUES (
                               24,l_msg_data);
          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
             xbreak := '109';
             fnd_file.put_line (
                fnd_file.LOG,
                   'Return from the API:-'
                || 'return status'
                || l_return_status
                || '-'
                || l_header_rec.header_id);
          ELSE
             xbreak := '110';
             fnd_file.put_line (
                fnd_file.LOG,
                   'Return from the API'
                || 'return status'
                || l_return_status
                || '-'
                || TO_CHAR (l_header_rec.header_id));
          END IF;
       EXCEPTION
          WHEN OTHERS
          THEN
             errorx := xbreak || '-' || SQLERRM;
             raise_application_error (-20002, errorx);
       END;
    END;
    Thanks
    Darsh

    Hussein,
    As always - Thank you.   I have passed the above issue but now in the same API, it is not importing lines.  I need to enter multiple lines for a given sales order through this API. As per the note from you on this thread, I am now maintaining separate set of input and output variables.
    When I searched metalink and google, there are countless examples of process_order APIs  giving example of importing one sales order line along with header at the time of creation.  Then, they ask to add subsequent lines through an UPDATE operations for existing order that was just created. Thus, forcing me to write process_order api call two times.
    Can't I just create a loop and add multiple lines right at the time of order creation? Please see the revised code as shown below.  This code is not working - it throws "no data found" for a weird reason.  I know for a fact that data is fetched properly by blanketLines cursor.
    /* Formatted on 8/16/2013 4:23:09 PM (QP5 v5.252.13127.32867) */
    CREATE OR REPLACE PACKAGE BODY XXCH_BSA_ORDER
    IS
       PROCEDURE BSA_PROCESS_ORDER (errbuf             OUT VARCHAR2,
                                    retcode            OUT VARCHAR2,
                                    p_blanket_number       NUMBER,
                                    p_select               VARCHAR2,
                                    p_blanket_line         NUMBER,
                                    p_order_type           NUMBER,
                                    p_copies               NUMBER)
       AS
          v_error          VARCHAR2 (2000);
          o_order_number   NUMBER;
       BEGIN
          INSERT INTO LOGFILE (STEPID, MODULE)
               VALUES (1, 'VERIZON');
          COMMIT;
          FOR i IN 1 .. p_copies
          LOOP
             INSERT INTO LOGFILE (STEPID, MODULE)
                  VALUES (2, 'VERIZON');
             BSA_API (p_blanket_number   => p_blanket_number,
                      p_blanket_line     => p_blanket_line,
                      p_select           => p_select,
                      p_order_type       => p_order_type,
                      p_order_number     => o_order_number);
             fnd_file.put_line (fnd_file.OUTPUT,
                                'Order Number Created:-' || o_order_number);
          END LOOP;
       EXCEPTION
          WHEN OTHERS
          THEN
             v_error := SQLERRM;
             RAISE_APPLICATION_ERROR (-20001, v_error);
       END;
       PROCEDURE BSA_API (p_blanket_number       NUMBER,
                          p_blanket_line         NUMBER,
                          p_select               VARCHAR2,
                          p_order_type           NUMBER,
                          p_order_number     OUT NUMBER)
       AS
          l_header_rec                   oe_order_pub.header_rec_type;
          l_header_rec_out               oe_order_pub.header_rec_type;
          l_line_tbl                     oe_order_pub.line_tbl_type;
          l_line_tbl_out                 oe_order_pub.line_tbl_type;
          l_action_request_tbl           oe_order_pub.request_tbl_type;
          l_header_adj_tbl               oe_order_pub.header_adj_tbl_type;
          l_line_adj_tbl                 oe_order_pub.line_adj_tbl_type;
          l_header_scr_tbl               oe_order_pub.header_scredit_tbl_type;
          l_line_scredit_tbl             oe_order_pub.line_scredit_tbl_type;
          l_request_rec                  oe_order_pub.request_rec_type;
          l_return_status                VARCHAR2 (3000);
          l_msg_count                    NUMBER;
          l_msg_data                     VARCHAR2 (3000);
          p_api_version_number           NUMBER := 1.0;
          p_init_msg_list                VARCHAR2 (1000) := fnd_api.g_true;
          p_return_values                VARCHAR2 (1000) := fnd_api.g_true;
          p_action_commit                VARCHAR2 (1000) := fnd_api.g_true;
          x_return_status                VARCHAR2 (10);
          x_msg_count                    NUMBER;
          x_msg_data                     VARCHAR2 (3000);
          p_header_rec                   oe_order_pub.header_rec_type
                                            := oe_order_pub.g_miss_header_rec;
          p_old_header_rec               oe_order_pub.header_rec_type
                                            := oe_order_pub.g_miss_header_rec;
          p_header_val_rec               oe_order_pub.header_val_rec_type
                                            := oe_order_pub.g_miss_header_val_rec;
          p_old_header_val_rec           oe_order_pub.header_val_rec_type
                                            := oe_order_pub.g_miss_header_val_rec;
          p_header_adj_tbl               oe_order_pub.header_adj_tbl_type
                                            := oe_order_pub.g_miss_header_adj_tbl;
          p_old_header_adj_tbl           oe_order_pub.header_adj_tbl_type
                                            := oe_order_pub.g_miss_header_adj_tbl;
          p_header_adj_val_tbl           oe_order_pub.header_adj_val_tbl_type
                                            := oe_order_pub.g_miss_header_adj_val_tbl;
          p_old_header_adj_val_tbl       oe_order_pub.header_adj_val_tbl_type
                                            := oe_order_pub.g_miss_header_adj_val_tbl;
          p_header_price_att_tbl         oe_order_pub.header_price_att_tbl_type
             := oe_order_pub.g_miss_header_price_att_tbl;
          p_old_header_price_att_tbl     oe_order_pub.header_price_att_tbl_type
             := oe_order_pub.g_miss_header_price_att_tbl;
          p_header_adj_att_tbl           oe_order_pub.header_adj_att_tbl_type
             := oe_order_pub.g_miss_header_adj_att_tbl;
          p_old_header_adj_att_tbl       oe_order_pub.header_adj_att_tbl_type
             := oe_order_pub.g_miss_header_adj_att_tbl;
          p_header_adj_assoc_tbl         oe_order_pub.header_adj_assoc_tbl_type
             := oe_order_pub.g_miss_header_adj_assoc_tbl;
          p_old_header_adj_assoc_tbl     oe_order_pub.header_adj_assoc_tbl_type
             := oe_order_pub.g_miss_header_adj_assoc_tbl;
          p_header_scredit_tbl           oe_order_pub.header_scredit_tbl_type
             := oe_order_pub.g_miss_header_scredit_tbl;
          p_old_header_scredit_tbl       oe_order_pub.header_scredit_tbl_type
             := oe_order_pub.g_miss_header_scredit_tbl;
          p_header_scredit_val_tbl       oe_order_pub.header_scredit_val_tbl_type
             := oe_order_pub.g_miss_header_scredit_val_tbl;
          p_old_header_scredit_val_tbl   oe_order_pub.header_scredit_val_tbl_type
             := oe_order_pub.g_miss_header_scredit_val_tbl;
          p_line_tbl                     oe_order_pub.line_tbl_type
                                            := oe_order_pub.g_miss_line_tbl;
          p_old_line_tbl                 oe_order_pub.line_tbl_type
                                            := oe_order_pub.g_miss_line_tbl;
          p_line_val_tbl                 oe_order_pub.line_val_tbl_type
                                            := oe_order_pub.g_miss_line_val_tbl;
          p_old_line_val_tbl             oe_order_pub.line_val_tbl_type
                                            := oe_order_pub.g_miss_line_val_tbl;
          p_line_adj_tbl                 oe_order_pub.line_adj_tbl_type
                                            := oe_order_pub.g_miss_line_adj_tbl;
          p_old_line_adj_tbl             oe_order_pub.line_adj_tbl_type
                                            := oe_order_pub.g_miss_line_adj_tbl;
          p_line_adj_val_tbl             oe_order_pub.line_adj_val_tbl_type
             := oe_order_pub.g_miss_line_adj_val_tbl;
          p_old_line_adj_val_tbl         oe_order_pub.line_adj_val_tbl_type
             := oe_order_pub.g_miss_line_adj_val_tbl;
          p_line_price_att_tbl           oe_order_pub.line_price_att_tbl_type
             := oe_order_pub.g_miss_line_price_att_tbl;
          p_old_line_price_att_tbl       oe_order_pub.line_price_att_tbl_type
             := oe_order_pub.g_miss_line_price_att_tbl;
          p_line_adj_att_tbl             oe_order_pub.line_adj_att_tbl_type
             := oe_order_pub.g_miss_line_adj_att_tbl;
          p_old_line_adj_att_tbl         oe_order_pub.line_adj_att_tbl_type
             := oe_order_pub.g_miss_line_adj_att_tbl;
          p_line_adj_assoc_tbl           oe_order_pub.line_adj_assoc_tbl_type
             := oe_order_pub.g_miss_line_adj_assoc_tbl;
          p_old_line_adj_assoc_tbl       oe_order_pub.line_adj_assoc_tbl_type
             := oe_order_pub.g_miss_line_adj_assoc_tbl;
          p_line_scredit_tbl             oe_order_pub.line_scredit_tbl_type
             := oe_order_pub.g_miss_line_scredit_tbl;
          p_old_line_scredit_tbl         oe_order_pub.line_scredit_tbl_type
             := oe_order_pub.g_miss_line_scredit_tbl;
          p_line_scredit_val_tbl         oe_order_pub.line_scredit_val_tbl_type
             := oe_order_pub.g_miss_line_scredit_val_tbl;
          p_old_line_scredit_val_tbl     oe_order_pub.line_scredit_val_tbl_type
             := oe_order_pub.g_miss_line_scredit_val_tbl;
          p_lot_serial_tbl               oe_order_pub.lot_serial_tbl_type
                                            := oe_order_pub.g_miss_lot_serial_tbl;
          p_old_lot_serial_tbl           oe_order_pub.lot_serial_tbl_type
                                            := oe_order_pub.g_miss_lot_serial_tbl;
          p_lot_serial_val_tbl           oe_order_pub.lot_serial_val_tbl_type
             := oe_order_pub.g_miss_lot_serial_val_tbl;
          p_old_lot_serial_val_tbl       oe_order_pub.lot_serial_val_tbl_type
             := oe_order_pub.g_miss_lot_serial_val_tbl;
          p_action_request_tbl           oe_order_pub.request_tbl_type
                                            := oe_order_pub.g_miss_request_tbl;
          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_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;
          x_debug_file                   VARCHAR2 (100);
          l_line_tbl_index               INTEGER := 0;
          l_msg_index_out                NUMBER;
          l_user_id                      fnd_user.user_id%TYPE;
          l_appl_id                      fnd_application.application_id%TYPE;
          l_resp_id                      fnd_responsibility.responsibility_id%TYPE;
          l_org_id                       hr_operating_units.organization_id%TYPE;
          l_sold_to_org_id               hz_cust_accounts.cust_account_id%TYPE;
          l_ship_to_org_id               hz_cust_site_uses_all.site_use_id%TYPE;
          l_cust_acct_site_id            hz_cust_acct_sites_all.cust_acct_site_id%TYPE;
          l_party_id                     hz_parties.party_id%TYPE;
          l_price_list_id                qp_list_headers_b.list_header_id%TYPE;
          l_primary_salesrep_id          ra_salesreps.salesrep_id%TYPE;
          l_order_type_id                oe_transaction_types_all.transaction_type_id%TYPE;
          l_order_line_type_id           oe_transaction_types_all.transaction_type_id%TYPE;
          l_order_category_code          oe_transaction_types_all.order_category_code%TYPE;
          l_inventory_item_id            mtl_system_items_b.inventory_item_id%TYPE;
          l_currency_code                qp_list_headers.currency_code%TYPE;
          l_party_site_id                hz_party_sites.party_site_id%TYPE;
          xbreak                         VARCHAR2 (33);
          errorx                         VARCHAR2 (3000);
          k                              INTEGER := 0;
          ln_kount                       INTEGER := 0;
          v_order                        NUMBER;
          CURSOR BlanketHeader
          IS
             SELECT *
               FROM oe_blanket_headers_all
              WHERE header_id = p_blanket_number;
          CURSOR BlanketLines (
             v_agreement_id    NUMBER)
          IS
             SELECT *
               FROM oe_blanket_lines_all
              WHERE     header_id = v_agreement_id
                    AND line_number = NVL (p_blanket_line, line_number);
       BEGIN
          -- Create Header
          xbreak := '100';
          l_org_id := fnd_profile.VALUE ('ORG_ID');
          INSERT INTO logfile (stepid, module)
               VALUES (1, 'orgid:' || TO_CHAR (l_org_id));
          oe_msg_pub.initialize;
          oe_debug_pub.initialize;
          mo_global.set_policy_context ('S', l_org_ID);
          mo_global.init ('ONT');
          fnd_global.apps_initialize (12647, 51839, 660);
          --       pass in user_id, responsibility_id, and application_id
          oe_debug_pub.setdebuglevel (5);
          x_debug_file := oe_debug_pub.set_debug_mode ('FILE');
          INSERT INTO logfile (stepid, module)
               VALUES (25, 'debug:' || x_debug_File);
          COMMIT;
          l_org_id := fnd_profile.VALUE ('ORG_ID');
          xbreak := '101';
          fnd_file.Put_line (
             fnd_file.LOG,
             '*********************************************** BOOK ORDER **************************');
          fnd_file.put_line (fnd_file.LOG,
                             'Begining of the procedure Book Order');
          --    Initialize header record
          xbreak := '102';
          FOR i IN BlanketHeader
          LOOP
             INSERT INTO logfile (stepid, module)
                  VALUES (23, 'BPO:' || TO_CHAR (i.header_id));
             l_header_rec := oe_order_pub.g_miss_header_rec;
             xbreak := '103';
             l_header_rec.cust_po_number := i.cust_po_number;
             l_header_rec.ordered_date := SYSDATE;
             l_header_rec.salesrep_id := i.salesrep_id;
             l_header_rec.order_type_id := p_order_type;
             l_header_rec.operation := oe_globals.g_opr_create; --Specifies that Order is getting created
             --xbreak := '104';
             l_header_rec.order_category_code := 'ORDER';
             --         l_num_tbl_index := 1;
             l_header_rec.booked_flag := 'N';
             l_header_rec.flow_status_code := 'ENTERED';
             xbreak := '105';
             l_header_rec.sold_to_org_id := i.sold_to_org_id;
             l_header_rec.invoice_to_org_id := i.invoice_to_org_id;
             l_header_rec.ship_to_org_id := i.ship_to_org_id;
             l_header_rec.price_list_id := i.price_list_id;
             l_header_rec.shipping_instructions := i.shipping_instructions;
             l_header_rec.freight_terms_code := i.freight_terms_code;
             l_header_rec.attribute10 := i.attribute1;
             l_header_rec.salesrep_id := i.salesrep_id;
             l_action_request_tbl (1) := OE_ORDER_PUB.G_MISS_REQUEST_REC;
             INSERT INTO logfile (stepid, module)
                  VALUES (53, 'BPO:' || TO_CHAR (i.header_id));  -- Create Lines .
             xbreak := '206';
             FOR j IN BlanketLines (i.header_id)
             LOOP
                xbreak := '205';
                ln_kount := ln_kount + 1;
                l_line_tbl_index := 1;
                l_line_tbl (l_line_tbl_index) := oe_order_pub.g_miss_line_rec;
                l_line_tbl (l_line_tbl_index).operation := oe_globals.g_opr_create;
                l_line_tbl (l_line_tbl_index).inventory_item_id :=
                   j.inventory_item_id;
                INSERT INTO logfile (stepid, module)
                     VALUES (57, 'BPO:' || TO_CHAR (j.inventory_item_id));
                l_line_tbl (l_line_tbl_index).order_quantity_uom := 'EA';
                l_line_tbl (l_line_tbl_index).payment_term_id := 1000;
                l_line_tbl (l_line_tbl_index).schedule_arrival_date := SYSDATE + 1;
                l_line_tbl (l_line_tbl_index).schedule_ship_date := SYSDATE + 1;
                l_line_tbl (l_line_tbl_index).request_date := SYSDATE;
                l_line_tbl (l_line_tbl_index).promise_date := SYSDATE;
                l_line_tbl (l_line_tbl_index).shipping_method_code := NULL;
                l_line_tbl (l_line_tbl_index).freight_terms_code := NULL;
                l_line_tbl (l_line_tbl_index).line_number := 1;
                l_line_tbl (l_line_tbl_index).ordered_quantity := 1;
                l_line_tbl (l_line_tbl_index).calculate_price_flag := 'N';
                l_line_tbl (l_line_tbl_index).unit_selling_price := NULL;
                l_line_tbl (l_line_tbl_index).ship_from_org_id := j.org_id;
                l_line_tbl (l_line_tbl_index).ship_to_org_id := j.ship_to_org_id;
             END LOOP;
             oe_order_pub.process_order (
                p_org_id                   => l_org_id,
                p_operating_unit           => NULL,
                p_api_version_number       => 1.0,
                --            p_init_msg_list => fnd_api.g_true,
                --                                p_return_values => fnd_api.g_true,
                --                                p_action_commit => fnd_api.g_true,
                p_header_rec               => l_header_rec,
                p_line_tbl                 => l_line_tbl,
                p_action_request_tbl       => l_action_request_tbl -- OUT PARAMETERS
                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;
             FND_FILE.PUT_LINE (
                FND_FILE.LOG,
                   'OM Debug file: '
                || oe_debug_pub.g_dir
                || '/'
                || oe_debug_pub.g_file);
             INSERT INTO LOGFILE (STEPID, MODULE)
                     VALUES (
                               22,
                                  TO_CHAR (l_header_rec_out.header_id)
                               || '-'
                               || l_msg_data);
             COMMIT;
             xbreak := '106';
             SELECT order_number
               INTO v_order
               FROM oe_order_headerS_all
              WHERE header_id = l_header_rec_out.header_id;
             p_order_number := v_order;
          END LOOP;
          FOR i IN 1 .. l_msg_count
          LOOP
             k := k + 1;
             xbreak := '108';
             Oe_Msg_Pub.get (p_msg_index       => k,
                             p_encoded         => Fnd_Api.G_FALSE,
                             p_data            => l_msg_data,
                             p_msg_index_out   => l_msg_index_out);
             INSERT INTO LOGFILE (STEPID, MODULE)
                  VALUES (24, l_msg_data);
             fnd_file.put_line (
                fnd_file.LOG,
                   'Return from the API:-'
                || 'return status:-'
                || l_return_status
                || '-'
                || l_msg_data);
          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
             xbreak := '109';
             fnd_file.put_line (
                fnd_file.LOG,
                   'Return from the API:-'
                || 'return status:-'
                || l_return_status
                || '-'
                || l_header_rec_out.header_id);
          ELSE
             xbreak := '110';
             fnd_file.put_line (
                fnd_file.LOG,
                   'Return from the API:-'
                || 'return status:-'
                || l_return_status
                || '-'
                || TO_CHAR (l_header_rec_out.header_id));
          END IF;
       EXCEPTION
          WHEN OTHERS
          THEN
             errorx := xbreak || '-' || SQLERRM;
             raise_application_error (-20002, errorx);
       END;
    END;

  • Process_order api - Validation Failed for Field Bill To

    I am relatively new to the EBS world and I'm having some issues with calling the OE_Order_Pub.Process_order API. When I call this API I am getting a return error of "Validation failed for field - Bill To".
    For a background...I have an APEX application where users can choose parts from a small part master list to add to an existing order. The existing order will not have a status of Closed or Cancelled and there will be atleast 1 line in the order before the new parts are added. The parts will be added as new lines to the order with some of the new line data defaulting to the same information as the first line. I am using EBS version 12.1.3 with a multi-org setup. It seems that the orders under one org (id=3) are working fine, but another org(id=569) they never work and keep getting the error. I am setting the context to the org of the order and initializing the apps user information with the responsibility "Order Management Super User".
    Do you have any idea what could be wrong or how I can debug the error to get a little more detail?
    Here is the procedure I have.
    PROCEDURE TEK_ORD_PROCESS_ORDER(p_order_id IN NUMBER, p_return_code OUT NOCOPY VARCHAR2, p_status OUT NOCOPY VARCHAR2) IS
        CURSOR c_order_parts IS
          SELECT *
            FROM TEK_APEX.TEK_ORD_ORDER_PARTS
           WHERE ORDER_ID = p_order_id;
        TYPE t_parts IS TABLE OF TEK_APEX.TEK_ORD_ORDER_PARTS%ROWTYPE;
        v_order_parts t_parts;
        --Setup variables
        H_Op_Code      VARCHAR2(25) DEFAULT OE_GLOBALS.G_OPR_UPDATE;
        L_Op_Code      VARCHAR2(25) DEFAULT OE_GLOBALS.G_OPR_CREATE;
        v_install_type VARCHAR2(25) := 'PTO';
        v_source_id    NUMBER;
        v_user_id      NUMBER;
        v_resp_id      NUMBER;
        v_app_id       NUMBER;
        v_debug        VARCHAR2(32767);
        v_oracle_order OE_ORDER_HEADERS_ALL%ROWTYPE;
        v_apex_order   TEK_APEX.TEK_ORD_SALES_ORDERS%ROWTYPE;
        p_header_rec                    OE_Order_Pub.Header_Rec_Type;
        p_header_val_rec                OE_Order_Pub.Header_Val_Rec_Type;
        p_Header_Adj_tab                OE_Order_Pub.Header_Adj_Tbl_Type;
        p_Header_Adj_val_tab            OE_Order_Pub.Header_Adj_Val_Tbl_Type;
        p_Header_price_Att_tab          OE_Order_Pub.Header_Price_Att_Tbl_Type;
        p_Header_Adj_Att_tab            OE_Order_Pub.Header_Adj_Att_Tbl_Type;
        p_Header_Adj_Assoc_tab          OE_Order_Pub.Header_Adj_Assoc_Tbl_Type;
        p_Header_Scredit_tab            OE_Order_Pub.Header_Scredit_Tbl_Type;
        p_Header_Scredit_val_tab        OE_Order_Pub.Header_Scredit_Val_Tbl_Type;
        p_line_tab                      OE_Order_Pub.Line_Tbl_Type;
        p_line_val_tab                  OE_Order_Pub.Line_Val_Tbl_Type;
        p_Line_Adj_tab                  OE_Order_Pub.Line_Adj_Tbl_Type;
        p_Line_Adj_val_tab              OE_Order_Pub.Line_Adj_Val_Tbl_Type;
        p_Line_price_Att_tab            OE_Order_Pub.Line_Price_Att_Tbl_Type;
        p_Line_Adj_Att_tab              OE_Order_Pub.Line_Adj_Att_Tbl_Type;
        p_Line_Adj_Assoc_tab            OE_Order_Pub.Line_Adj_Assoc_Tbl_Type;
        p_Line_Scredit_tab              OE_Order_Pub.Line_Scredit_Tbl_Type;
        p_Line_Scredit_val_tab          OE_Order_Pub.Line_Scredit_Val_Tbl_Type;
        p_Lot_Serial_tab                OE_Order_Pub.Lot_Serial_Tbl_Type;
        p_Lot_Serial_val_tab            OE_Order_Pub.Lot_Serial_Val_Tbl_Type;
        p_action_request_tab            OE_Order_pub.Request_Tbl_Type;
        l_header_rec                    OE_Order_Pub.Header_Rec_Type;
        l_header_val_rec                OE_Order_Pub.Header_Val_Rec_Type;
        l_Header_Adj_tab                OE_Order_Pub.Header_Adj_Tbl_Type;
        l_Header_Adj_val_tab            OE_Order_Pub.Header_Adj_Val_Tbl_Type;
        l_Header_price_Att_tab          OE_Order_Pub.Header_Price_Att_Tbl_Type;
        l_Header_Adj_Att_tab            OE_Order_Pub.Header_Adj_Att_Tbl_Type;
        l_Header_Adj_Assoc_tab          OE_Order_Pub.Header_Adj_Assoc_Tbl_Type;
        l_Header_Scredit_tab            OE_Order_Pub.Header_Scredit_Tbl_Type;
        l_Header_Scredit_val_tab        OE_Order_Pub.Header_Scredit_Val_Tbl_Type;
        l_line_tab                      OE_Order_Pub.Line_Tbl_Type;
        l_line_val_tab                  OE_Order_Pub.Line_Val_Tbl_Type;
        l_Line_Adj_tab                  OE_Order_Pub.Line_Adj_Tbl_Type;
        l_Line_Adj_val_tab              OE_Order_Pub.Line_Adj_Val_Tbl_Type;
        l_Line_price_Att_tab            OE_Order_Pub.Line_Price_Att_Tbl_Type;
        l_Line_Adj_Att_tab              OE_Order_Pub.Line_Adj_Att_Tbl_Type;
        l_Line_Adj_Assoc_tab            OE_Order_Pub.Line_Adj_Assoc_Tbl_Type;
        l_Line_Scredit_tab              OE_Order_Pub.Line_Scredit_Tbl_Type;
        l_Line_Scredit_val_tab          OE_Order_Pub.Line_Scredit_Val_Tbl_Type;
        l_Lot_Serial_tab                OE_Order_Pub.Lot_Serial_Tbl_Type;
        l_Lot_Serial_val_tab            OE_Order_Pub.Lot_Serial_Val_Tbl_Type;
        l_ret_status                    VARCHAR2(200);
        l_msg_count                     NUMBER;
        l_msg_data                      VARCHAR2(200);
           --Email information
        v_email_address           varchar2(100);
           v_msg_text                varchar(1000);
           v_subject_text            varchar(1000);
           --Default line information
        v_item_id           NUMBER;
        v_contact_id        NUMBER;
        v_invoice_to_org_id oe_order_lines_all.INVOICE_TO_ORG_ID%TYPE;
        v_ship_to_org_id    oe_order_lines_all.SHIP_TO_ORG_ID%TYPE;
        v_sold_to_org_id    oe_order_lines_all.SOLD_TO_ORG_ID%TYPE;
        v_flow_status_code  oe_order_lines_all.FLOW_STATUS_CODE%TYPE;
        FUNCTION GET_ORACLE_ORDER(p_order_number IN OE_ORDER_HEADERS_ALL.ORDER_NUMBER%TYPE)
          RETURN OE_ORDER_HEADERS_ALL%ROWTYPE IS
          v_order OE_ORDER_HEADERS_ALL%ROWTYPE;
        BEGIN
          SELECT *
            INTO v_order
            FROM APPS.OE_ORDER_HEADERS_ALL
           WHERE ORDER_NUMBER = p_order_number;
          RETURN v_order;
        EXCEPTION
          WHEN OTHERS THEN
            RETURN NULL;
        END GET_ORACLE_ORDER;
        FUNCTION GET_APEX_ORDER(p_order_id IN TEK_APEX.TEK_ORD_SALES_ORDERS.ORDER_ID%TYPE)
          RETURN TEK_APEX.TEK_ORD_SALES_ORDERS%ROWTYPE IS
          v_order TEK_APEX.TEK_ORD_SALES_ORDERS%ROWTYPE;
        BEGIN
          SELECT *
            INTO v_order
            FROM TEK_APEX.TEK_ORD_SALES_ORDERS
           WHERE ORDER_ID = p_order_id;
          RETURN v_order;
        EXCEPTION
          WHEN OTHERS THEN
            RETURN NULL;
        END GET_APEX_ORDER;
        FUNCTION GET_SOURCE_ID(p_source_name IN VARCHAR2)
          RETURN OE_ORDER_SOURCES.ORDER_SOURCE_ID%TYPE IS
          v_source_id OE_ORDER_SOURCES.ORDER_SOURCE_ID%TYPE;
        BEGIN
          SELECT ORDER_SOURCE_ID
            INTO v_source_id
            FROM APPS.OE_ORDER_SOURCES
           WHERE NAME = p_source_name;
          RETURN v_source_id;
        EXCEPTION
          WHEN OTHERS THEN
            RETURN NULL;
        END GET_SOURCE_ID;
        FUNCTION GET_ITEM_ID(p_part_number IN VARCHAR2, p_org_id IN NUMBER)
          RETURN MTL_SYSTEM_ITEMS.INVENTORY_ITEM_ID%TYPE IS
          v_item_id MTL_SYSTEM_ITEMS.INVENTORY_ITEM_ID%TYPE;
        BEGIN
          SELECT INVENTORY_ITEM_ID
            INTO v_item_id
            FROM APPS.MTL_SYSTEM_ITEMS
           WHERE SEGMENT1 = p_part_number
             AND ORGANIZATION_ID = p_org_id;
          RETURN v_item_id;
        EXCEPTION
          WHEN OTHERS THEN
            RETURN NULL;
        END GET_ITEM_ID;
      BEGIN
        apps.mo_global.set_policy_context('S',3);
        apps.mo_global.init('XXTEK');
        BEGIN
          SELECT USER_ID
            INTO v_user_id
            FROM APPS.FND_USER
           WHERE USER_NAME = 'SYSADMIN';
        EXCEPTION
          WHEN OTHERS THEN
            RAISE_APPLICATION_ERROR(-20001, 'Error selecting user');
        END;
        BEGIN
          SELECT RESPONSIBILITY_ID, APPLICATION_ID
            INTO v_resp_id, v_app_id
            FROM TEK_APEX.TEK_RR_ACTIVE_RESP_VW
           WHERE UPPER(RESPONSIBILITY_NAME) = 'ORDER MANAGEMENT SUPER USER';
          --Set current user information
          fnd_global.apps_initialize (user_id      => v_user_id
                                     ,resp_id      => v_resp_id
                                     ,resp_appl_id => v_app_id);
        EXCEPTION
          WHEN OTHERS THEN
            RAISE_APPLICATION_ERROR(-20001, 'Error selecting responsibility');
        END;
        --Get the order information from Oracle and APEX
        v_apex_order := GET_APEX_ORDER(p_order_id);
        IF v_apex_order.ORDER_ID IS NULL THEN
          RAISE_APPLICATION_ERROR(-20001, 'APEX Order ID is invalid: ' || p_order_id);
        END IF;
        v_oracle_order := GET_ORACLE_ORDER(TO_NUMBER(v_apex_order.ORDER_NUMBER));
        IF v_oracle_order.ORDER_NUMBER IS NULL THEN
          RAISE_APPLICATION_ERROR(-20001, 'Order Number not found in Oracle: ' || v_apex_order.ORDER_NUMBER);
        END IF;
        apps.mo_global.set_policy_context('S', v_oracle_order.ORG_ID);
        v_source_id := GET_SOURCE_ID('IMPORT');
        IF v_source_id IS NULL THEN
          RAISE_APPLICATION_ERROR(-20001, 'Source ID not found for IMPORT');
        END IF;
        /* ********** Gather Order Header********** */
        /* ********** Info.              ********** */
        OE_Order_Pub.Get_Order(p_api_version_number    =>      1.0,
                               p_init_msg_list         =>      FND_API.G_TRUE,
                               p_return_values         =>      FND_API.G_TRUE,
                               x_return_status         =>      l_ret_status,
                               x_msg_count             =>      l_msg_count,
                               x_msg_data              =>      l_msg_data,
                               p_header_id             =>      v_oracle_order.HEADER_ID,
                               p_header                =>      NULL,
                               x_header_rec            =>      l_header_rec,
                               x_header_val_rec        =>      l_header_val_rec,
                               x_Header_Adj_tbl        =>      l_Header_Adj_tab,
                               x_Header_Adj_val_tbl    =>      l_Header_Adj_val_tab,
                               x_Header_price_Att_tbl  =>      l_Header_price_Att_tab,
                               x_Header_Adj_Att_tbl    =>      l_Header_Adj_Att_tab,
                               x_Header_Adj_Assoc_tbl  =>      l_Header_Adj_Assoc_tab,
                               x_Header_Scredit_tbl    =>      l_Header_Scredit_tab,
                               x_Header_Scredit_val_tbl=>      l_Header_Scredit_val_tab,
                               x_line_tbl              =>      l_line_tab,
                               x_line_val_tbl          =>      l_line_val_tab,
                               x_Line_Adj_tbl          =>      l_Line_Adj_tab,
                               x_Line_Adj_val_tbl      =>      l_Line_Adj_val_tab,
                               x_Line_price_Att_tbl    =>      l_Line_price_Att_tab,
                               x_Line_Adj_Att_tbl      =>      l_Line_Adj_Att_tab,
                               x_Line_Adj_Assoc_tbl    =>      l_Line_Adj_Assoc_tab,
                               x_Line_Scredit_tbl      =>      l_Line_Scredit_tab,
                               x_Line_Scredit_val_tbl  =>      l_Line_Scredit_val_tab,
                               x_Lot_Serial_tbl        =>      l_Lot_Serial_tab,
                               x_Lot_Serial_val_tbl    =>      l_Lot_Serial_val_tab);
        --Save defaults from first line
        IF l_line_tab.EXISTS(1) THEN
          v_contact_id        := l_line_tab(1).SHIP_TO_CONTACT_ID;
          v_invoice_to_org_id := l_line_tab(1).INVOICE_TO_ORG_ID;
          v_ship_to_org_id    := l_line_tab(1).SHIP_TO_ORG_ID;
          v_sold_to_org_id    := l_line_tab(1).SOLD_TO_ORG_ID;
          v_flow_status_code  := l_line_tab(1).FLOW_STATUS_CODE;
        END IF;
        --Clear out the line array before adding any new parts
        FOR i IN l_line_tab.FIRST..l_line_tab.LAST LOOP
          l_line_tab.DELETE(i);
          l_line_val_tab.DELETE(i);
          l_line_adj_tab.DELETE(i);
          l_line_adj_val_tab.DELETE(i);
          l_line_price_att_tab.DELETE(i);
          l_line_adj_att_tab.DELETE(i);
          l_line_adj_assoc_tab.DELETE(i);
          l_line_scredit_tab.DELETE(i);
          l_line_scredit_val_tab.DELETE(i);
          l_lot_serial_tab.DELETE(i);
          l_lot_serial_val_tab.DELETE(i);
        END LOOP;
        /* ********** Gather Order Lines ********** */
        OPEN c_order_parts;
        FETCH c_order_parts BULK COLLECT INTO v_order_parts;
        CLOSE c_order_parts;
        FOR i IN v_order_parts.FIRST..v_order_parts.LAST LOOP
          v_item_id := GET_ITEM_ID(v_order_parts(i).PART_NUMBER, v_oracle_order.SHIP_FROM_ORG_ID);
          IF v_item_id IS NULL THEN
            RAISE_APPLICATION_ERROR(-20001, 'Error selecting part number ' || v_order_parts(i).PART_NUMBER);
          END IF;
          --Clear line first
          l_line_tab(i)             := OE_Order_Pub.G_Miss_Line_Rec;
             l_line_val_tab(i)         := OE_ORDER_PUB.G_MISS_LINE_VAL_REC;
          l_line_adj_tab(i)             := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
          l_line_adj_val_tab(i)     := OE_ORDER_PUB.G_MISS_LINE_ADJ_VAL_REC;
          l_line_price_att_tab(i)      := OE_ORDER_PUB.G_MISS_LINE_PRICE_ATT_REC ;
          l_line_adj_att_tab(i)     := OE_ORDER_PUB.G_MISS_LINE_ADJ_ATT_REC;
          l_line_adj_assoc_tab(i)   := OE_ORDER_PUB.G_MISS_LINE_ADJ_ASSOC_REC;
          l_line_scredit_tab(i)     := OE_ORDER_PUB.G_MISS_LINE_SCREDIT_REC;
          l_line_scredit_val_tab(i) := OE_ORDER_PUB.G_MISS_LINE_SCREDIT_VAL_REC;
          l_lot_serial_tab(i)       := OE_ORDER_PUB.G_MISS_LOT_SERIAL_REC;
          l_lot_serial_val_tab(i)   := OE_ORDER_PUB.G_MISS_LOT_SERIAL_VAL_REC;
          --Set line information
             l_line_tab(i).PRICE_LIST_ID          := v_oracle_order.PRICE_LIST_ID;
          l_line_tab(i).header_id              := v_oracle_order.header_id;
          l_line_tab(i).inventory_item_id      := v_item_id;
          l_line_tab(i).ordered_quantity       := v_order_parts(i).QUANTITY;
          l_line_tab(i).operation              := l_op_code;
          l_line_tab(i).unit_list_price        := 0;
          l_line_tab(i).ship_from_org_id       := v_oracle_order.ship_from_org_id;
          l_line_tab(i).program_id             := fnd_global.conc_program_id ;
          l_line_tab(i).program_application_id := fnd_global.PROG_APPL_ID;
          l_line_tab(i).order_source_id        := v_source_id;
          l_line_tab(i).calculate_price_flag   := 'N' ;
          l_line_tab(i).unit_selling_price     := 0.00 ;
             l_line_tab(i).request_date           := v_apex_order.onsite_date;
             l_line_tab(i).Schedule_ship_date     := v_apex_order.onsite_date;
             l_line_tab(i).promise_date           := null;
          l_line_tab(i).invoice_to_org_id      := v_invoice_to_org_id;
          l_line_tab(i).ship_to_org_id         := v_ship_to_org_id;
          l_line_tab(i).sold_to_org_id         := v_sold_to_org_id;
          l_line_tab(i).ship_to_contact_id     := v_contact_id;
        END LOOP;
    --OE_DEBUG_PUB.DEBUG_ON;
    --OE_DEBUG_PUB.Initialize;
    --OE_DEBUG_PUB.SetDebugLevel(5);
        --Add lines to order
        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_TRUE,
                                   p_action_commit                 =>      FND_API.G_FALSE,
                                   x_return_status                 =>      l_ret_status,
                                   x_msg_count                     =>      l_msg_count,
                                   x_msg_data                      =>      l_msg_data,
                                   p_header_rec                    =>  l_header_rec,
                                   p_old_header_rec                =>  l_header_rec,
                                   p_header_val_rec                =>  l_header_val_rec,
                                   p_old_header_val_rec            =>  l_header_val_rec,
                                   p_Header_Adj_tbl                =>  l_Header_Adj_tab,
                                   p_old_Header_Adj_tbl            =>  l_Header_Adj_tab,
                                   p_Header_Adj_val_tbl            =>  l_Header_Adj_val_tab,
                                   p_old_Header_Adj_val_tbl        =>  l_Header_Adj_val_tab,
                                   p_Header_price_Att_tbl          =>  l_Header_price_Att_tab,
                                   p_old_Header_Price_Att_tbl      =>  l_Header_price_Att_tab,
                                   p_Header_Adj_Att_tbl            =>  l_Header_Adj_Att_tab,
                                   p_old_Header_Adj_Att_tbl        =>  l_Header_Adj_Att_tab,
                                   p_Header_Adj_Assoc_tbl          =>  l_Header_Adj_Assoc_tab,
                                   p_old_Header_Adj_Assoc_tbl      =>  l_Header_Adj_Assoc_tab,
                                   p_Header_Scredit_tbl            =>  l_Header_Scredit_tab,
                                   p_old_Header_Scredit_tbl        =>  l_Header_Scredit_tab,
                                   p_Header_Scredit_val_tbl        =>  l_Header_Scredit_val_tab,
                                   p_old_Header_Scredit_val_tbl    =>  l_Header_Scredit_val_tab,
                                   p_line_tbl                      =>  l_line_tab,
                                   p_line_val_tbl                  =>  l_line_val_tab,
                                   p_Line_Adj_tbl                  =>  l_line_adj_tab,
                                   p_Line_Adj_val_tbl              =>  l_line_adj_val_tab,
                                   p_Line_price_Att_tbl            =>  l_line_price_att_tab,
                                   p_Line_Adj_Att_tbl              =>  l_line_adj_att_tab,
                                   p_Line_Adj_Assoc_tbl            =>  l_line_adj_assoc_tab,
                                   p_Line_Scredit_tbl              =>  l_line_scredit_tab,
                                   p_Line_Scredit_val_tbl          =>  l_line_scredit_val_tab,
                                   p_Lot_Serial_tbl                =>  l_lot_serial_tab,
                                   p_Lot_Serial_val_tbl            =>  l_lot_serial_val_tab,
                                   p_action_request_tbl            =>  OE_ORDER_PUB.G_MISS_REQUEST_TBL,
                                   x_header_rec                    =>      p_header_rec,
                                   x_header_val_rec                =>      p_header_val_rec,
                                   x_Header_Adj_tbl                =>      p_Header_Adj_tab,
                                   x_Header_Adj_val_tbl            =>      p_Header_Adj_val_tab,
                                   x_Header_price_Att_tbl          =>      p_Header_price_Att_tab,
                                   x_Header_Adj_Att_tbl            =>      p_Header_Adj_Att_tab,
                                   x_Header_Adj_Assoc_tbl          =>      p_Header_Adj_Assoc_tab,
                                   x_Header_Scredit_tbl            =>      p_Header_Scredit_tab,
                                   x_Header_Scredit_val_tbl        =>      p_Header_Scredit_val_tab,
                                   x_line_tbl                      =>      p_line_tab,
                                   x_line_val_tbl                  =>      p_line_val_tab,
                                   x_line_adj_tbl                  =>      p_line_adj_tab,
                                   x_line_adj_val_tbl              =>      p_line_adj_val_tab,
                                   x_line_price_att_tbl            =>      p_line_price_att_tab,
                                   x_line_adj_att_tbl              =>      p_line_adj_att_tab,
                                   x_line_adj_assoc_tbl            =>      p_line_adj_assoc_tab,
                                   x_line_scredit_tbl              =>      p_line_scredit_tab,
                                   x_line_scredit_val_tbl          =>      p_line_scredit_val_tab,
                                   x_lot_serial_tbl                =>      p_lot_serial_tab,
                                   x_lot_serial_val_tbl            =>      p_lot_serial_val_tab,
                                   x_action_request_tbl            =>      p_action_request_tab);
    --  OE_DEBUG_PUB.DEBUG_OFF;
        p_return_code := l_ret_status;
        IF l_ret_status != 'S' THEN
          DBMS_OUTPUT.PUT_LINE(l_msg_data);
          IF l_msg_count = 1 THEN
            p_status := OE_Msg_Pub.Get(1,'F');
          ELSE
            FOR i IN 1..l_msg_count LOOP
              p_status := OE_Msg_Pub.Get(i,'F') || '<br />';
            END LOOP;
          END IF;
          p_status := 'Error loading lines<br>' || p_status;
        ELSE
          p_status := 'Order Processed Successfully<br>' || v_order_parts.COUNT || ' Line(s) Loaded';
        END IF;
    --    WHILE OE_DEBUG_PUB.G_DEBUG_INDEX < OE_DEBUG_PUB.CountDebug LOOP
    --      OE_DEBUG_PUB.GetNext(v_debug);
    --      DBMS_OUTPUT.PUT_LINE(v_debug);
    --    END LOOP;
      EXCEPTION
        WHEN OTHERS THEN
          ROLLBACK;
          RAISE;
      END TEK_ORD_PROCESS_ORDER;Thanks!
    Jonathan Hart

    Hello,
    Try the following
    1) Check if any processing constraints are applied to customer/location
    2) Try to create a new customer and associate internal location.
    Create a new order to reproduce the issue
    Thanks
    -Arif

  • Re:Oracle Apps Adapter and invocation of Process_order API

    Hi,
    I am trying to create sales order in Oracle Apps 11.5.10.2 using Oracle Apps Adapter by invoking Process_order API and facing the following problem.
    file:/D:/SOA_SUITE/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_EDI850InboundService_1.0_973a35abc5c4e4b30f414886437b790d.tmp/writeEDIData
    2OracleService.wsdl [
    writeEDIData2OracleService_ptt::writeEDIData2OracleService(InputParameters,Outpu
    tParameters) ] - WSIF JCA Execute of operation 'writeEDIData2OracleService'
    failed due to: Error while converting to a Java struct object.
    Unable to convert the XSD element P_HEADER_REC whose user defined type is
    OE_ORDER_PUB_HEADER_REC_TYPE. Cause: java.sql.SQLException: Closed Connection
    [Caused by: Closed Connection]
    ; nested exception is:
    ORABPEL-11802
    Error while converting to a Java struct object.
    Unable to convert the XSD element P_HEADER_REC whose user defined type is OE_ORDER_PUB_HEADER_REC_TYPE. Cause:
    java.sql.SQLException: Closed Connection [Caused by: Closed Connection]
    Check to ensure that the XML data describing the user defined type matches the
    definition of the struct in the XSD. Contact oracle support if error is not
    fixable.
    I am using SOA-Suite 10.1.3.3.0.
    Can someone help me on this.
    Regards
    Lalit

    Hi lalit,
    Upgrade your database 10.0.2 to 10.1.0.5.
    You can apply the Oracle Database 10g release 10.1.0.5 patch set to the following Oracle Database 10g releases (10.1.0.2, 10.1.0.3, or 10.1.0.4) installations.
    See document 263719.1 on the OracleMetalink Web site:
    To locate document 263719.1:
    -->Log on to OracleMetalink.
    -->Click Advanced at the top of the OracleMetalink page.
    -->Enter 263719.1 in the Document ID field, then click Submit.
    Cheers,
    Abhi...

  • Sales Order API Error

    Hiiii
    When i am running the Sales Order API Script, getting error
    Plz reply me . where is the problem
    Below Mentioned error
    failure
    process ORDER ret status IS: U
    process ORDER msg data IS: FND
    process ORDER msg COUNT IS: 1
    header.order_number IS:
    header.return_status IS:
    header.booked_flag IS:
    header.header_id IS:
    header.order_source_id IS:
    header.flow_status_code IS:
    message is: ORA-20001: SQL_PLSQL_ERROR: N, ROUTINE, MO_GLOBAL.VALIDATE_ORGID_PUB_API, N, ERRNO, -20001, N, REASON, ORA-20001: in Package OE_Order_PUB Procedure Process_Order
    message index is: 1
    Debug = F
    Debug Level = 1
    Debug File = /sqlcom/outbound/l0001064.dbg
    ****************************************************

    Application is Order management
    This is Sales Order API Code .
    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 := 89; -- OPERATING UNIT
    l_no_orders number :=1; --NO OF ORDERS
    l_user number := 1110; -- USER
    l_resp number := 50769; -- RESPONSIBLILTY
    l_appl number := 523; -- 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(89);
    /*****************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(1110, 50769, 523); --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 := 1055;
    l_header_rec.sold_to_org_id := 4253;
    l_header_rec.price_list_id := 9032;
    l_header_rec.pricing_date := SYSDATE;
    l_header_rec.transactional_curr_code := 'SAR';
    l_header_rec.flow_status_code:='ENTERED';
    l_header_rec.cust_po_number := '2001';
    --l_header_rec.attribute1   := 'ABC';
    /*****************INITIALIZE ACTION REQUEST RECORD*************************************/
    l_action_request_tbl(1) := OE_ORDER_PUB.G_MISS_REQUEST_REC;
    /*****************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 := 1522;
    l_line_tbl(1).ordered_quantity := 1;
    for i in 1..l_no_orders
    loop -- BEGIN LOOP
    /*****************CALLTO PROCESS ORDER 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
    if (l_debug_level > 0) then
    dbms_output.put_line('success');
    end if;
    commit;
    OE_ORDER_BOOK_UTIL.COMPLETE_BOOK_ELIGIBLE(1.0,FND_API.G_FALSE,
    l_header_rec_out.header_id,
    b_return_status,
    b_msg_count,
    b_msg_data
    commit;
    else
    if (l_debug_level > 0) then
    dbms_output.put_line('failure');
    end if;
    rollback;
    end if;
    end loop; -- END LOOP
    /*****************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;
    Edited by: 811288 on Dec 7, 2010 1:16 AM

  • DI API error while adding AP Invoice (Using serial Nos.)

    Hi,
    Im getting the following DI API error when adding an AP Invoice which has serial numbers and i cant seem to find any logical fault in the code.
    " [PCH1.WhsCode][line: 4] , 'This entry already exists in the following tables (ODBC -2035) "
    If anybody has encountered this error and found a solution kindly let me know.

    Hi Vivek,
    Are you trying to add same document number, serial number or so on?
    "entry exist " means like "duplicate key problem", I guess.
    Basically, whscode column in PCH1 table allows duplicating.
    So, I think serial number is duplicated among same item code.
    Hope this useful for you.
    Regards,
    Hyunil Choi.

  • Issues in creating the sales order with oe_order_pub.process_order api

    Hi All,
    I am trying to create a sales order with BOOKED status using oe_order_pub.process_order api, and I am getting response as
    <X_RETURN_STATUS>E</X_RETURN_STATUS>
              <X_MSG_COUNT>1</X_MSG_COUNT>
              <X_MSG_DATA>ONTOE_LOCK_ROW_DELETED</X_MSG_DATA>
    Can any one help me in fixing this issue ..!
    Thanks,
    Vamsi…
    Edited by: user11147471 on Jul 9, 2009 2:02 AM

    When using the API, are you trying to create the order as booked using the booked flag or the book action?  I would recommend using the action if you are not. To troubleshoot, I would try the API without booking and then use the following article to determine the issue:
    Unable To Setup A Credit Card Bank Account For The Customer. CC Information On The Order Is Not Valid (Doc ID 1450936.1)

  • I am receiving this error message when trying to export pictures: 'Unable to Export": An internal error has occured: Win32 API error 2 ( "The system cannot find the file specified.") when calling ShellExecuteExW from AgWorkspace.shellExecute.// I have a H

    I am receiving this error message when trying to export pictures: 'Unable to Export": An internal error has occured: Win32 API error 2 ( "The system cannot find the file specified.") when calling ShellExecuteExW from AgWorkspace.shellExecute.// I have a HP ENVY Phoenix, fully loaded, 1 1/2 years old.

    Nevermind I fixed it. Thank you.

  • How to create the service lines in a sales order using Process_order API

    Hi ,
    I have to create the service lines in a Config to order using process Order API. When i am trying to create a sercvice line , it is comming as new line all together. but i need that one to happen in the configuration itself after the option item but not like standalone line.
    what are the manditory fields for service lines to create using Process_order API.
    Apprciate your help on this.
    Thanks
    Rags

    Moderator message - Please do some analysis before posting here - thread locked
    Rob

  • Process_order API() with bank account process flow in 11i

    Hi all,
    I want to know the basic process flow for customer bank account creation and assignment process. I.e I had pass the customer details ,credit card information throw the oe_order_pub.process_order() API .after this processing this api ,how the bank account creation and updation process works? , and it's process flow.
    process_order API manual process:
    BEGIN
    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.header_id := '100192';
    l_header_rec.credit_card_holder_name := 'myname';
    l_header_rec.credit_card_number := 'xxxxxxxxxxxxxxxx1111';
    l_header_rec.credit_card_expiration_date := '1-Jan-28';
    l_header_rec.credit_card_code := 'VISA';
    l_header_rec.payment_type_code := 'CREDIT_CARD';
    l_header_rec.sold_to_org_id := '17118';
    l_header_rec.credit_card_approval_code := '34545656676';
    l_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
    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
    , 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_line_tbl => l_line_tbl
    , p_action_request_tbl => l_action_request_tbl
    x_header_rec => l_header_rec
    , x_header_val_rec => x_header_val_rec
    , x_Header_Adj_tbl => x_Header_Adj_tbl
    , x_Header_Adj_val_tbl => x_Header_Adj_val_tbl
    , x_Header_price_Att_tbl => x_Header_price_Att_tbl
    , x_Header_Adj_Att_tbl => x_Header_Adj_Att_tbl
    , x_Header_Adj_Assoc_tbl => x_Header_Adj_Assoc_tb
    ............etc );
    END;
    After this api process , how the bank account will update regarding this value.
    Thanks
    prabu

    Hi all,
    I want to know the basic process flow for customer bank account creation and assignment process. I.e I had pass the customer details ,credit card information throw the oe_order_pub.process_order() API .after this processing this api ,how the bank account creation and updation process works? , and it's process flow.
    process_order API manual process:
    BEGIN
    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.header_id := '100192';
    l_header_rec.credit_card_holder_name := 'myname';
    l_header_rec.credit_card_number := 'xxxxxxxxxxxxxxxx1111';
    l_header_rec.credit_card_expiration_date := '1-Jan-28';
    l_header_rec.credit_card_code := 'VISA';
    l_header_rec.payment_type_code := 'CREDIT_CARD';
    l_header_rec.sold_to_org_id := '17118';
    l_header_rec.credit_card_approval_code := '34545656676';
    l_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
    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
    , 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_line_tbl => l_line_tbl
    , p_action_request_tbl => l_action_request_tbl
    x_header_rec => l_header_rec
    , x_header_val_rec => x_header_val_rec
    , x_Header_Adj_tbl => x_Header_Adj_tbl
    , x_Header_Adj_val_tbl => x_Header_Adj_val_tbl
    , x_Header_price_Att_tbl => x_Header_price_Att_tbl
    , x_Header_Adj_Att_tbl => x_Header_Adj_Att_tbl
    , x_Header_Adj_Assoc_tbl => x_Header_Adj_Assoc_tb
    ............etc );
    END;
    After this api process , how the bank account will update regarding this value.
    Thanks
    prabu

  • Win32 API error 126

    What to do if message: [Win32 API error 126 ("Dasangegebene Modul wurde nicht gefunden") when calling ::LoadLibrary from getFunction] apears

    What to do if message: [Win32 API error 126 ("Dasangegebene Modul wurde nicht gefunden") when calling ::LoadLibrary from getFunction] apears

  • WEBI working in Rich Client but giving error opendocument' api. (error err_wis_30270) in launch pad

    Hi,
    I transported webi documents + universe from a development server (BI 4.1. SP2) to a test server (same release). I can open the documents with the WEBI rich client, but I am unable to open them with the launch pad (error ...opendocument' api. (error err_wis_30270)).
    Does anyone have a clue where there could be a difference in the settings that cause this behaviour?
    Thanks,
    Sandra.

    Can you check this KB?
    1684675
      - An internal error occurred while calling 'openDocument' API. (Error:
    ERR_WIS_302070) while opening WebIntelligence reports in SAP BO BI 4.0.

  • Unit Selling Price Override through PROCESS_ORDER API

    Hi All,
    I have this below requirement to be achieved through process_order API.
    1. In the Order Oganizer UI, I open the Order Entry form.
    2. Open the Lines tab
    3. For the Unit Selling Price, I change the price manually and tab out.
    4. Its gives me a LOV to select a Surcharge modifier.
    5. I select one of the surcharge and click save.
    6. The price is overridden and a manual price adjustment is created for the above selected surcharge.
    This functionality I want to acieve through the PROCESS_ORDER API. Basically, I want to override the unit selling price and apply a surchage modifier. This should change the selling price and create a adjustement record for the above line.
    Please let me know if anyone knows about this. That would help me.
    Thanks,
    Anand

    Anand
    I tested this in 12.0.4 vision and works. Also if you need to use update option if you are applying the same modifier more than once(not create), just like the way screen changes behave.
    DECLARE
    l_return_status VARCHAR2 (30);
    x_msg_data VARCHAR2 (2000);
    x_msg_count NUMBER;
    l_adj_rec oe_order_pub.line_adj_rec_type;
    l_adj_tbl oe_order_pub.line_adj_tbl_type;
    l_x_header_rec oe_order_pub.header_rec_type;
    l_x_header_adj_tbl oe_order_pub.header_adj_tbl_type;
    l_x_header_scredit_tbl oe_order_pub.header_scredit_tbl_type;
    l_x_line_tbl oe_order_pub.line_tbl_type;
    l_x_line_adj_tbl oe_order_pub.line_adj_tbl_type;
    l_x_line_scredit_tbl oe_order_pub.line_scredit_tbl_type;
    l_x_lot_serial_tbl oe_order_pub.lot_serial_tbl_type;
    l_x_action_request_tbl oe_order_pub.request_tbl_type;
    l_x_header_price_att_tbl oe_order_pub.header_price_att_tbl_type;
    l_x_header_adj_att_tbl oe_order_pub.header_adj_att_tbl_type;
    l_x_header_adj_assoc_tbl oe_order_pub.header_adj_assoc_tbl_type;
    l_x_line_price_att_tbl oe_order_pub.line_price_att_tbl_type;
    l_x_line_adj_att_tbl oe_order_pub.line_adj_att_tbl_type;
    l_x_line_adj_assoc_tbl oe_order_pub.line_adj_assoc_tbl_type;
    l_list_line_type_code VARCHAR2 (30) := NULL;
    l_list_line_id NUMBER;
    l_x_header_payment_tbl oe_order_pub.header_payment_tbl_type;
    l_x_line_payment_tbl oe_order_pub.line_payment_tbl_type;
    l_prc_adj_request oe_order_pub.request_tbl_type;
    l_prc_adj_index NUMBER := 1;
    l_price_adj_id NUMBER;
    v_msg_index_out NUMBER;
    x_header_rec_type oe_order_pub.header_rec_type;
    x_header_val_rec_type oe_order_pub.header_val_rec_type;
    x_header_adj_tbl_type oe_order_pub.header_adj_tbl_type;
    x_header_adj_val_tbl_type oe_order_pub.header_adj_val_tbl_type;
    x_header_price_att_tbl_type oe_order_pub.header_price_att_tbl_type;
    x_header_adj_att_tbl_type oe_order_pub.header_adj_att_tbl_type;
    x_header_adj_assoc_tbl_type oe_order_pub.header_adj_assoc_tbl_type;
    x_header_scredit_tbl_type oe_order_pub.header_scredit_tbl_type;
    x_header_scredit_val_tbl_type oe_order_pub.header_scredit_val_tbl_type;
    x_line_tbl_type oe_order_pub.line_tbl_type;
    x_line_val_tbl_type oe_order_pub.line_val_tbl_type;
    x_line_adj_tbl_type oe_order_pub.line_adj_tbl_type;
    x_line_adj_val_tbl_type oe_order_pub.line_adj_val_tbl_type;
    x_line_price_att_tbl_type oe_order_pub.line_price_att_tbl_type;
    x_line_adj_att_tbl_type oe_order_pub.line_adj_att_tbl_type;
    x_line_adj_assoc_tbl_type oe_order_pub.line_adj_assoc_tbl_type;
    x_line_scredit_tbl_type oe_order_pub.line_scredit_tbl_type;
    x_line_scredit_val_tbl_type oe_order_pub.line_scredit_val_tbl_type;
    x_lot_serial_tbl_type oe_order_pub.lot_serial_tbl_type;
    x_lot_serial_val_tbl_type oe_order_pub.lot_serial_val_tbl_type;
    x_request_tbl_type oe_order_pub.request_tbl_type;
    x_header_payment_tbl_type oe_order_pub.header_payment_tbl_type;
    x_header_payment_val_tbl_type oe_order_pub.header_payment_val_tbl_type;
    x_line_payment_tbl_type oe_order_pub.line_payment_tbl_type;
    x_line_payment_val_tbl_type oe_order_pub.line_payment_val_tbl_type;
    l_control_rec oe_globals.control_rec_type;
    BEGIN
    fnd_global.apps_initialize (1005902, 21623, 660);
    mo_global.set_policy_context ('S', 204);
    l_x_line_tbl (1).line_id := 319799;
    l_x_line_tbl (1).header_id := 155008;
    l_adj_rec := oe_order_pub.g_miss_line_adj_rec;
    l_adj_rec.price_adjustment_id := fnd_api.g_miss_num;
    l_adj_rec.list_header_id := 8988; --Modifier id
    l_adj_rec.list_line_id := 16596; --Modifier line id
    l_adj_rec.automatic_flag := 'N';
    l_adj_rec.list_line_type_code := 'DIS'; --Change this is it is surcharge
    l_adj_rec.arithmetic_operator := 'AMT'; --Percentage or amount
    l_adj_rec.operand := 10; --How much?
    l_adj_rec.operation := oe_globals.g_opr_create;
    l_adj_rec.line_index := 1;
    l_adj_rec.update_allowed := 'Y';
    l_adj_rec.applied_flag := 'Y'; --this is required to change the price of the line
    l_adj_rec.change_reason_code := 'MANUAL';
    l_adj_rec.change_reason_text := 'Manually applied adjustments';
    l_adj_tbl (1) := l_adj_rec;
    l_control_rec.process_entity := oe_globals.g_entity_line_adj;
    l_control_rec.process := TRUE;
    oe_order_pub.process_order (p_api_version_number => 1.0
    , x_return_status => l_return_status
    , x_msg_count => x_msg_count
    , x_msg_data => x_msg_data
    , p_header_rec => l_x_header_rec
    , p_header_adj_tbl => l_x_header_adj_tbl
    , p_header_scredit_tbl => l_x_header_scredit_tbl
    , p_header_payment_tbl => l_x_header_payment_tbl
    , p_line_tbl => l_x_line_tbl
    , p_line_adj_tbl => l_adj_tbl
    , p_line_scredit_tbl => l_x_line_scredit_tbl
    , p_line_payment_tbl => l_x_line_payment_tbl
    , p_lot_serial_tbl => l_x_lot_serial_tbl
    , p_action_request_tbl => l_prc_adj_request
    , p_header_price_att_tbl => l_x_header_price_att_tbl
    , p_header_adj_att_tbl => l_x_header_adj_att_tbl
    , p_header_adj_assoc_tbl => l_x_header_adj_assoc_tbl
    , p_line_price_att_tbl => l_x_line_price_att_tbl
    , p_line_adj_att_tbl => l_x_line_adj_att_tbl
    , p_line_adj_assoc_tbl => l_x_line_adj_assoc_tbl
    , x_header_rec => x_header_rec_type
    , x_header_val_rec => x_header_val_rec_type
    , x_header_adj_tbl => x_header_adj_tbl_type
    , x_header_adj_val_tbl => x_header_adj_val_tbl_type
    , x_header_price_att_tbl => x_header_price_att_tbl_type
    , x_header_adj_att_tbl => x_header_adj_att_tbl_type
    , x_header_adj_assoc_tbl => x_header_adj_assoc_tbl_type
    , x_header_scredit_tbl => x_header_scredit_tbl_type
    , x_header_scredit_val_tbl => x_header_scredit_val_tbl_type
    , x_header_payment_tbl => x_header_payment_tbl_type
    , x_header_payment_val_tbl => x_header_payment_val_tbl_type
    , x_line_tbl => x_line_tbl_type
    , x_line_val_tbl => x_line_val_tbl_type
    , x_line_adj_tbl => x_line_adj_tbl_type
    , x_line_adj_val_tbl => x_line_adj_val_tbl_type
    , x_line_price_att_tbl => x_line_price_att_tbl_type
    , x_line_adj_att_tbl => x_line_adj_att_tbl_type
    , x_line_adj_assoc_tbl => x_line_adj_assoc_tbl_type
    , x_line_scredit_tbl => x_line_scredit_tbl_type
    , x_line_scredit_val_tbl => x_line_scredit_val_tbl_type
    , x_line_payment_tbl => x_line_payment_tbl_type
    , x_line_payment_val_tbl => x_line_payment_val_tbl_type
    , x_lot_serial_tbl => x_lot_serial_tbl_type
    , x_lot_serial_val_tbl => x_lot_serial_val_tbl_type
    , x_action_request_tbl => x_request_tbl_type
    DBMS_OUTPUT.put_line (l_return_status);
    IF x_msg_count > 0
    THEN
    FOR v_index IN 1 .. x_msg_count
    LOOP
    oe_msg_pub.get (p_msg_index => v_index, p_encoded => 'F', p_data => x_msg_data, p_msg_index_out => v_msg_index_out);
    x_msg_data := SUBSTR (x_msg_data, 1, 200);
    DBMS_OUTPUT.put_line (x_msg_data);
    DBMS_OUTPUT.put_line ('============================================================');
    END LOOP;
    END IF;
    END;
    Thanks
    Nagamohan

  • Essbase Hyperion 9 + BO XI 3.1 SP3. Essbase API Error (1030723) (WIS 1

    Hello, Need your help please !!!
    I have installed BO Enterprise XI 3.1 SP3 on window 2003 which IBM DataStage have been installed on it.
    There are no problem when :
    - Creating connection using essbase hypersion 9 and creating universe in Universe Designer (Ok)
    - Checking validity of the universe (Ok)
    - Create and run report in webbi rich clien (Ok)
    The problem is when I tried to create report and run query in Web Intelligence Java Panel Report, I got this Error "A database error occured. The database error text is: Essbase API Error (1030723): . (WIS 10901)".
    Can someone help me to solve this problem, please?
    Regards
    Sofian

    Hi Stratos,
    I have installed Essbase Client Version 11. I have installed the same in my laptop and I didn't got this problem, the different only i haven't installed DataStage in my laptop.
    Regards
    Sofian

  • Essbase Hyperion 9 + BO XI 3.1 SP3. Essbase API Error (1030723) (WIS 10901)

    Hello, Need your help please !!!
    I have installed BO Enterprise XI 3.1 SP3 on window 2003 which IBM DataStage have been installed on it.
    There are no problem when :
    - Creating connection using essbase hypersion 9 and creating universe in Universe Designer (Ok)
    - Checking validity of the universe (Ok)
    - Create and run report in webbi rich clien (Ok)
    The problem is when I tried to create report and run query in Web Intelligence Java Panel Report, I got this Error "A database error occured. The database error text is: Essbase API Error (1030723): . (WIS 10901)".
    Can someone help me to solve this problem, please?
    Regards
    Sofian

    Hi Stratos,
    I have installed Essbase Client Version 11. I have installed the same in my laptop and I didn't got this problem, the different only i haven't installed DataStage in my laptop.
    Regards
    Sofian

Maybe you are looking for

  • CR 2008 Multiple Crashes on single & simple clics !

    Hi all, I'm getting crazy with CR 2008. While creating some reports (from scratch or existing ones), after a few minutes, if I click onto the report itself (on a field, or on the blank area) CR completely crashes and the application get closed. I've

  • MSI GD65 - Win7 64 Prof. Random freezes

    Edit: Setting DRAM Voltage to 1.65V instead of 1.5V seems to help a lot! Edit: BIOS 1.6 is giving hopeful results for automatic OC (Genie) too. In an attempt to aggregate the information on this, topics that seem to be related (to me): https://forum-

  • Help with Multiselect List Item

    Assuming one employee can work for multiple departments, I want to display the departments employee 7844 works for preselected in a multiselect list. I am using the following query statement in a report region. select htmldb_item.select_list_from_que

  • MDB cannot connect to JMS destination using Foreign Server

    Hi everyone, I have configured foreign jms server in weblogic but when MDB tries to connect to specific queue, it gets the following exception: I would really appreciate if anyone could help me. <Sep 28, 2012 5:23:34 PM CEST> <Warning> <EJB> <BEA-010

  • Switcher ?Can you change the size of the screen resolution on the Macbook?

    I'm really interested in buying a Macbook. This will be my first Mac. I love the way they look and feel. I'm concerned with the size of everything on the Macbook. The overall size of the fonts in applications such as word, or safari was too small for