0 Replies Latest reply: Nov 24, 2012 1:20 AM by A.MohammedRafi RSS

    Unable to cancel sales order line using API

    A.MohammedRafi
      Hi,

      After running the below API script I am getting the error message as

      Error Message: FND FND_AS_UNEXPECTED_ERROR N PKG_NAME OE_Order_PVT N
      PROCEDURE_NAME Process_Order N ERROR_TEXT ORA-01403: no data found

      Help me out to fix the issue.

      Please find the code below :

      create or replace procedure xxso_line_cancel
      is
      l_user_id NUMBER;
      l_resp_id NUMBER;
      l_appl_id NUMBER;
      l_header_rec_in oe_order_pub.header_rec_type;
      l_line_tbl_in oe_order_pub.line_tbl_type;
      l_action_request_tbl_in oe_order_pub.request_tbl_type;
      l_header_rec_out oe_order_pub.header_rec_type;
      l_line_tbl_out oe_order_pub.line_tbl_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_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_chr_program_unit_name VARCHAR2 (100);
      l_ret_status VARCHAR2 (1000) := NULL;
      l_msg_count NUMBER := 0;
      l_msg_data VARCHAR2 (2000);
      l_api_version NUMBER := 1.0;



      CURSOR c_so_details
      IS
      SELECT ol.line_number, ol.shipment_number, ol.header_id, ol.line_id, ol.flow_status_code
      FROM
      oe_order_headers_all oh,
      oe_order_lines_all ol
      WHERE
      ol.header_id = oh.header_id
      AND ol.flow_status_code IN ('AWAITING_SHIPPING','ENTERED')
      AND oh.flow_status_code IN ('BOOKED', 'ENTERED')
      and oh.header_id = 34756
      and line_number=1;
      begin

      fnd_global.apps_initialize ( user_id => 1257 ,resp_id => 21623 , resp_appl_id => 660);
      mo_global.set_policy_context('S',122);
      mo_global.init('ONT');

      FOR i IN c_so_details
      LOOP
      l_line_tbl_in (1) := oe_order_pub.g_miss_line_rec;
      l_line_tbl_in (1).line_id := i.line_id;
      l_line_tbl_in (1).ordered_quantity := 0;
      l_line_tbl_in (1).cancelled_quantity := 4;
      l_line_tbl_in (1).cancelled_flag := 'Y';
      l_line_tbl_in (1).change_reason := '1'; --Administrative Reason
      l_line_tbl_in (1).change_comments := 'Cancel Order Line with reference to ticket#000000';
      l_line_tbl_in (1).operation := oe_globals.g_opr_update;
      oe_msg_pub.delete_msg;

      oe_order_pub.process_order
      (p_api_version_number => l_api_version,
      p_init_msg_list => fnd_api.g_true,
      p_return_values => fnd_api.g_true,
      p_action_commit => fnd_api.g_true,
      p_line_tbl => l_line_tbl_in,
      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_ret_status,
      x_msg_count => l_msg_count,
      x_msg_data => l_msg_data
      );

      commit;

      l_msg_data := NULL;


      IF l_ret_status <> 'S'
      THEN
      FOR iindx IN 1 .. l_msg_count
      LOOP
      l_msg_data := l_msg_data || ' ' || oe_msg_pub.get (iindx);
      END LOOP;
      DBMS_OUTPUT.put_line ('Return Status: ' || l_ret_status);
      DBMS_OUTPUT.put_line ('Error Message: ' || l_msg_data);
      ELSE
      DBMS_OUTPUT.put_line ('Return Status: ' || l_ret_status);
      DBMS_OUTPUT.put_line ('Error Message: ' || l_msg_data);

      END IF;

      END LOOP;
      END;