2 Replies Latest reply: Feb 3, 2013 10:11 AM by Activesometimes-Oracle RSS

    Errors while trying to create a new line using oe_order_pub.Process_order

    981952
      Hi,
      i am trying to create a new line(RMA line) for an existing order and i am facing the following errors from the order management
      message is: ORA-01403: no data found in Package OE_Order_PVT Procedure Process_Requests_And_Notify
      message index is: 1
      message is: ORA-01403: no data found in Package OE_Order_GRP Procedure Id_To_Value
      message index is: 2
      message is: User-Defined Exception in Package OE_Order_PUB Procedure Id_To_Value
      message index is: 3
      Hard Luck! Error(s) while creating Order.
      3;User-Defined Exception in Package OE_Order_PUB Procedure Id_To_Value.

      Could you please help me with this. This is the code i have been using :

      set serveroutput on

      Declare

      /* Initialize the proper Context */
      /*l_org_id NUMBER := 204;
      l_application_id NUMBER := 660;

      /* PQD12MS1 */
      -- l_responsibility_id NUMBER := 21623;
      -- l_user_id NUMBER := 1318;

      /* MZ4Md211 */
      /*l_responsibility_id NUMBER := 21623;
      l_user_id NUMBER := 1318;*/

      /* Initialize the record to G_MISS to enable defaulting */
      l_header_rec OE_ORDER_PUB.Header_Rec_Type := OE_ORDER_PUB.G_MISS_HEADER_REC;
      l_old_header_rec OE_ORDER_PUB.Header_Rec_Type;

      l_line_tbl OE_ORDER_PUB.Line_Tbl_Type;
      l_old_line_tbl OE_ORDER_PUB.Line_Tbl_Type;

      l_action_request_tbl OE_ORDER_PUB.Request_Tbl_Type;

      x_header_rec OE_ORDER_PUB.Header_Rec_Type;
      x_header_val_rec OE_ORDER_PUB.Header_Val_Rec_Type;
      x_Header_Adj_tbl OE_ORDER_PUB.Header_Adj_Tbl_Type;
      x_Header_Adj_val_tbl OE_ORDER_PUB.Header_Adj_Val_Tbl_Type;
      x_Header_price_Att_tbl OE_ORDER_PUB.Header_Price_Att_Tbl_Type;
      x_Header_Adj_Att_tbl OE_ORDER_PUB.Header_Adj_Att_Tbl_Type;
      x_Header_Adj_Assoc_tbl OE_ORDER_PUB.Header_Adj_Assoc_Tbl_Type;
      x_Header_Scredit_tbl OE_ORDER_PUB.Header_Scredit_Tbl_Type;
      x_Header_Scredit_val_tbl OE_ORDER_PUB.Header_Scredit_Val_Tbl_Type;
      x_line_tbl OE_ORDER_PUB.Line_Tbl_Type;
      x_line_val_tbl OE_ORDER_PUB.Line_Val_Tbl_Type;
      x_Line_Adj_tbl OE_ORDER_PUB.Line_Adj_Tbl_Type;
      x_Line_Adj_val_tbl OE_ORDER_PUB.Line_Adj_Val_Tbl_Type;
      x_Line_price_Att_tbl OE_ORDER_PUB.Line_Price_Att_Tbl_Type;
      x_Line_Adj_Att_tbl OE_ORDER_PUB.Line_Adj_Att_Tbl_Type;
      x_Line_Adj_Assoc_tbl OE_ORDER_PUB.Line_Adj_Assoc_Tbl_Type;
      x_Line_Scredit_tbl OE_ORDER_PUB.Line_Scredit_Tbl_Type;
      x_Line_Scredit_val_tbl OE_ORDER_PUB.Line_Scredit_Val_Tbl_Type;
      x_Lot_Serial_tbl OE_ORDER_PUB.Lot_Serial_Tbl_Type;
      x_Lot_Serial_val_tbl OE_ORDER_PUB.Lot_Serial_Val_Tbl_Type;
      x_action_request_tbl OE_ORDER_PUB.Request_Tbl_Type;

      l_return_status VARCHAR2(2000);
      l_msg_count NUMBER;
      l_msg_data VARCHAR2(2000);

      l_line_cnt number := 0;
      l_top_model_line_index number;
      l_link_to_line_index number;

      l_msg_index_out number(10);
      Begin

      /* Turn on DBMS Output */
      dbms_output.enable(1000000);

      /* Set the appropriate context */
      /* For 11i */
      -- fnd_global.apps_initialize(l_user_id, l_responsibility_id, l_application_id);
      -- fnd_client_info.set_org_context(to_char(l_org_id));

      /* For R12 */
      fnd_global.apps_initialize(8059,50027,800);
      mo_global.init('ONT');
      mo_global.set_policy_context('S',140);

      /* Turn on OM Debug */
      oe_debug_pub.G_FILE := NULL;
      oe_debug_pub.debug_on;
      oe_debug_pub.initialize;
      oe_debug_pub.setdebuglevel(5);

      dbms_output.put_line('Debug File : '|| OE_DEBUG_PUB.Set_Debug_Mode('FILE'));


      /* Populate the required Header Fields */
      /*l_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
      l_header_rec.header_id := 144392;*/


      /* Populate the Actions Table for Header */
      -- l_action_request_tbl(1).request_type := OE_GLOBALS.G_BOOK_ORDER;
      --l_action_request_tbl(1).entity_code := OE_GLOBALS.G_ENTITY_HEADER;


      /* Populate the required Line Fields */
      /* Standard Items */
      l_line_cnt := 2;
      l_line_tbl(l_line_cnt) := OE_ORDER_PUB.G_MISS_LINE_REC;
      l_line_tbl(l_line_cnt).operation := OE_GLOBALS.G_OPR_CREATE;
      l_line_tbl(l_line_cnt).header_id := 144392;
      --l_line_tbl(l_line_cnt).item_type_code  := 'STANDARD';
      l_line_tbl(l_line_cnt).inventory_item_id := 48717;
      l_line_tbl(l_line_cnt).ordered_quantity := 1;
      l_line_tbl(l_line_cnt).ship_from_org_id := 170;
      l_line_tbl(l_line_cnt).line_type_id := 1088;
      l_line_tbl(l_line_cnt).return_reason_code := 'DAMAGED PRODUCT';
      l_line_tbl(l_line_cnt).org_id :=140;
      l_line_tbl(l_line_cnt).sold_from_org_id := 140;
      l_line_tbl(l_line_cnt).ordered_item := 'part99';
      /* Call the Process Order API with Header Rec and Line Tbl */
      OE_ORDER_PUB.Process_Order
      (
      p_api_version_number => 1,
      p_org_id => 182, -- For R12
      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_action_request_tbl => l_action_request_tbl,
      p_header_rec => l_header_rec,
      p_old_header_rec => l_old_header_rec,
      p_line_tbl => l_line_tbl,
      p_old_line_tbl => l_old_line_tbl,
      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
      );

      FOR i IN 1 .. l_msg_count LOOP
      Oe_Msg_Pub.get( p_msg_index => i ,p_encoded => Fnd_Api.G_FALSE
      ,p_data => l_msg_data
      ,p_msg_index_out => l_msg_index_out);
      DBMS_OUTPUT.PUT_LINE('message is: ' || l_msg_data);
      DBMS_OUTPUT.PUT_LINE('message index is: ' || l_msg_index_out);
      END LOOP;

      /* Display the status and Order Number if successfully created */
      if l_return_status = 'S' then
      dbms_output.put_line('CONGRATULATIONS! New Order created successfully!');
      dbms_output.put_line('New Order Number : ' || x_header_rec.order_number || '; New Header Id : ' || x_header_rec.header_id);
      dbms_output.put_line('Commit Issued ... !');
      commit;
      else
      dbms_output.put_line('Hard Luck! Error(s) while creating Order.');
      dbms_output.put_line(l_msg_count || ';' || l_msg_data);
      end if;


      /* Turn off OM Debug */
      oe_debug_pub.debug_off;

      End;
      /

      Please do let me know if need to pass any additional details for that line.

      Thanks
        • 1. Re: Errors while trying to create a new line using oe_order_pub.Process_order
          Dipanjan Maitra
          For RMA Line. I am assuming you have already created a 'RETURN' type transaction Type, and tied that to the AR transaction type. if yes, then just follow the COPY UTILITY to copy the original line into a RMA line using the Copy Utility as below. Let me know if that was helpful.

          debug_message('Start Copying order..');
          l_copy_rec.api_version_number := 1;
          l_copy_rec.init_msg_list := 'T';
          l_copy_rec.COMMIT := 'T';
          l_copy_rec.Copy_Order := 'T';
          l_copy_rec.hdr_count := 1;
          l_copy_rec.append_to_header_id:= NULL;
          l_copy_rec.hdr_info := 'T';
          l_copy_rec.hdr_type := l_refund_order_type_id;
          l_copy_rec.hdr_descflex := 'T'; -- changed to 'T'; Dipanjan; 03/06/2012
          l_copy_rec.hdr_credit_card_details := 'F';
          l_copy_rec.hdr_scredits := 'T';
          l_copy_rec.hdr_attchmnts := 'T';
          l_copy_rec.hdr_holds := 'F';
          l_copy_rec.manual_order_number:= NULL;
          l_copy_rec.all_lines := 'F';

          l_copy_rec.line_count := l_line_ids.count;
          l_copy_rec.line_type :=&l_refund_line_type_id; -- replace with the 'Return' type transaction type Id
          l_copy_rec.incl_cancelled := 'T';
          l_copy_rec.line_price_mode := 1;
          --l_copy_rec.line_price_date := NULL;
          -- l_copy_rec.line_discount_id := NULL;
          l_copy_rec.line_descflex := 'T';
          l_copy_rec.line_scredits := 'F';
          l_copy_rec.line_attchmnts := 'T';
          l_copy_rec.line_payments := 'T';
          l_copy_rec.return_reason_code := 'WRONG ITEM';
          l_copy_rec.default_null_values:= 'F';
          l_copy_rec.copy_complete_config := 'T';

          l_header_id(1).id1 := &l_orig_header_id;--- replace with original header Id

          Oe_order_copy_util.copy_order( p_copy_rec => l_copy_rec
          ,p_hdr_id_tbl => l_header_id
          ,p_line_id_tbl => l_line_ids
          ,x_header_id => l_query_header_id
          ,x_return_status => l_return_status
          ,x_msg_count => l_msg_count
          ,x_msg_data => l_msg_data);
          debug_message('End Copying order..');
          • 2. Re: Errors while trying to create a new line using oe_order_pub.Process_order
            Activesometimes-Oracle
            Why are you passing l_line_cnt := 2 ? it could be 1 right ?