Total Pageviews

August 19, 2015

8/19/2015 12:17:00 PM
Oracle Order Managment

Oracle Order Cancellation:

Restrictions
Your security rules for orders and returns determine whether you can cancel orders, returns, and lines based on their current cycle status. In addition to your security rules are system defined rules. Under these rules you cannot cancel an order if:

  • it has been closed
  • it has already been cancelled at the order level
  • an ATO line has been processed to manufacturing release (work order open or beyond)
  • any line has been pick released (including orders that were entirely back ordered at release)
  • any line has been back ordered or back order released
  • any part of a line has been shipped or invoiced
  • any return line has been received or credited
  • the RMA Interface or Receivables Interface has run on any return line
Order Entry/Shipping honors security rules that you define for the Cancel operation that are stricter than these rules, but if you define any that conflict with these rules, they are ignored.
As long as an order is not subject to other restrictions that keep it from being cancelled, you can cancel an order:

  • with a line that has been cancelled
  • with a line that has demand or reservations (demand and reservations are automatically adjusted)

Results

Cancelling an order:

  • cancels the lines and line details
  • sets the order cycle action to Cancel Order and the result to Complete
  • toggles the Cancelled check box on in the Cancel Orders window
  • stops other changes from being made to the order and lines until the cancel is done

Individual Lines or Line Details

Restrictions

To cancel individual order or return lines, you can query an order or return and then select the lines or line items that you want to cancel. As with whole orders, there are system defined rules governing the cancellation of lines. You cannot cancel:

  • quantities that have already been cancelled
  • quantities that have been pick released but not yet back ordered or shipped
  • quantities that have been back ordered or backorder released
  • quantities that have shipped or been invoiced
  • any part of a line detail that has shipped or been back ordered even if the Update Shipping program has not yet updated the line detail

Results

Cancelling a line:

  • sets the order cycle action to Cancel Line and the result to Complete or Partial appropriately
  • toggles the Cancelled check box on in the Cancel Orders window

Oracle Order Cancellation

Order Cancellation API


DECLARE
   v_api_version_number           NUMBER := 1;
   v_return_status                VARCHAR2 (2000);
   v_msg_count                    NUMBER;
   v_msg_data                     VARCHAR2 (2000);
   p_order_number                 VARCHAR2 (10);
   l_header_id                    NUMBER;
   l_line_id                      NUMBER;


   -- IN Variables --
   v_header_rec                   oe_order_pub.header_rec_type;
   v_line_tbl                     oe_order_pub.line_tbl_type;
   v_action_request_tbl           oe_order_pub.request_tbl_type;
   v_line_adj_tbl                 oe_order_pub.line_adj_tbl_type;

   -- OUT Variables --
   v_header_rec_out               oe_order_pub.header_rec_type;
   v_header_val_rec_out           oe_order_pub.header_val_rec_type;
   v_header_adj_tbl_out           oe_order_pub.header_adj_tbl_type;
   v_header_adj_val_tbl_out       oe_order_pub.header_adj_val_tbl_type;
   v_header_price_att_tbl_out     oe_order_pub.header_price_att_tbl_type;
   v_header_adj_att_tbl_out       oe_order_pub.header_adj_att_tbl_type;
   v_header_adj_assoc_tbl_out     oe_order_pub.header_adj_assoc_tbl_type;
   v_header_scredit_tbl_out       oe_order_pub.header_scredit_tbl_type;
   v_header_scredit_val_tbl_out   oe_order_pub.header_scredit_val_tbl_type;
   v_line_tbl_out                 oe_order_pub.line_tbl_type;
   v_line_val_tbl_out             oe_order_pub.line_val_tbl_type;
   v_line_adj_tbl_out             oe_order_pub.line_adj_tbl_type;
   v_line_adj_val_tbl_out         oe_order_pub.line_adj_val_tbl_type;
   v_line_price_att_tbl_out       oe_order_pub.line_price_att_tbl_type;
   v_line_adj_att_tbl_out         oe_order_pub.line_adj_att_tbl_type;
   v_line_adj_assoc_tbl_out       oe_order_pub.line_adj_assoc_tbl_type;
   v_line_scredit_tbl_out         oe_order_pub.line_scredit_tbl_type;
   v_line_scredit_val_tbl_out     oe_order_pub.line_scredit_val_tbl_type;
   v_lot_serial_tbl_out           oe_order_pub.lot_serial_tbl_type;
   v_lot_serial_val_tbl_out       oe_order_pub.lot_serial_val_tbl_type;
   v_action_request_tbl_out       oe_order_pub.request_tbl_type;

   v_msg_index                    NUMBER;
   v_data                         VARCHAR2 (2000);
   v_loop_count                   NUMBER;
   v_debug_file                   VARCHAR2 (200);
   b_return_status                VARCHAR2 (200);
   b_msg_count                    NUMBER;
   b_msg_data                     VARCHAR2 (2000);
BEGIN
   DBMS_OUTPUT.PUT_LINE ('Starting of script');

   -- Setting the Enviroment --

   mo_global.init ('ONT');
   --tables used for user_id ->fund_user,
   --USE BELOW CODE

   /*SELECT   user_id, responsibility_application_id, responsibility_id
  FROM   fnd_user_resp_groups_all
 WHERE   responsibility_application_id =
            (SELECT   application_id
               FROM   fnd_allications
              WHERE   application_short_name = 'ONT')*/

   fnd_global.apps_initialize (user_id        => 2585,
                               resp_id        => 50864,
                               resp_appl_id   => 660);
   mo_global.set_policy_context ('S', 83);

   -- CANCEL HEADER --
   --TO GET HEADER_ID,LINE_ID
   SELECT   ooha.header_id, oola.line_id
     INTO   l_header_id, l_line_id
     FROM   oe_order_headers_all ooha, oe_order_lines_all oola
    WHERE   ooha.header_id = oola.header_id
            AND ooha.order_number = p_order_number;


   v_header_rec := oe_order_pub.g_miss_header_rec;
   v_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
   v_header_rec.header_id := l_header_id;
   v_header_rec.cancelled_flag := 'Y';
   v_header_rec.change_reason := 'Not provided';

   DBMS_OUTPUT.PUT_LINE ('Starting of API');

   -- CALLING THE API TO CANCEL AN ORDER --

   OE_ORDER_PUB.PROCESS_ORDER (
      p_api_version_number       => v_api_version_number,
      p_header_rec               => v_header_rec,
      p_line_tbl                 => v_line_tbl,
      p_action_request_tbl       => v_action_request_tbl,
      p_line_adj_tbl             => v_line_adj_tbl            -- OUT variables
                                                  ,
      x_header_rec               => v_header_rec_out,
      x_header_val_rec           => v_header_val_rec_out,
      x_header_adj_tbl           => v_header_adj_tbl_out,
      x_header_adj_val_tbl       => v_header_adj_val_tbl_out,
      x_header_price_att_tbl     => v_header_price_att_tbl_out,
      x_header_adj_att_tbl       => v_header_adj_att_tbl_out,
      x_header_adj_assoc_tbl     => v_header_adj_assoc_tbl_out,
      x_header_scredit_tbl       => v_header_scredit_tbl_out,
      x_header_scredit_val_tbl   => v_header_scredit_val_tbl_out,
      x_line_tbl                 => v_line_tbl_out,
      x_line_val_tbl             => v_line_val_tbl_out,
      x_line_adj_tbl             => v_line_adj_tbl_out,
      x_line_adj_val_tbl         => v_line_adj_val_tbl_out,
      x_line_price_att_tbl       => v_line_price_att_tbl_out,
      x_line_adj_att_tbl         => v_line_adj_att_tbl_out,
      x_line_adj_assoc_tbl       => v_line_adj_assoc_tbl_out,
      x_line_scredit_tbl         => v_line_scredit_tbl_out,
      x_line_scredit_val_tbl     => v_line_scredit_val_tbl_out,
      x_lot_serial_tbl           => v_lot_serial_tbl_out,
      x_lot_serial_val_tbl       => v_lot_serial_val_tbl_out,
      x_action_request_tbl       => v_action_request_tbl_out,
      x_return_status            => v_return_status,
      x_msg_count                => v_msg_count,
      x_msg_data                 => v_msg_data
   );

   DBMS_OUTPUT.PUT_LINE ('Completion of API');

   IF v_return_status = fnd_api.g_ret_sts_success
   THEN
      COMMIT;
      DBMS_OUTPUT.put_line (
         'Order Cancellation Success : ' || v_header_rec_out.header_id
      );
   ELSE
      DBMS_OUTPUT.put_line ('Order Cancellation failed:' || v_msg_data);
      ROLLBACK;

      FOR i IN 1 .. v_msg_count
      LOOP
         v_msg_data := oe_msg_pub.get (p_msg_index => i, p_encoded => 'F');
         DBMS_OUTPUT.put_line (i || ') ' || v_msg_data);
      END LOOP;
   END IF;
END;


Order Management:Order line Splitting-->Read more
 
Related Posts Plugin for WordPress, Blogger...