Use Extensions to Cancel Order Lines

Create an extension that uses an extensible flexfield to cancel order lines in a sales order.

Assume your customer places a sales order for items that you can't fulfill because the items are obsolete and your supplier no longer supplies them. You can use an order management extension to cancel lines that contain a value, such as Obsolete, in an extensible flexfield.

This topic uses example values. You might need different values, depending on your business requirements.

  1. Create the extensible flexfield.

    • Add it to the Fulfillment Line Information flexfield. Use these values:

      Attribute

      Value

      Name

      CancelLine

      Category

      Additional Fulfillment Line Information

      Context

      ProductObsoleteContext

    • Set the values on the Create Segment page.

      Attribute

      Value

      Name

      CancelLine

      Code

      CancelLine

      API Name

      cancelline

      Enabled

      Contains a check mark.

      Data type

      Character

      Table Column

      ATTRIBUTE_CHAR2

      Value Set

      10 Characters

      Prompt

      Cancel Line

      Display Type

      Text Box

    • Publish and deploy your flexfield.

    For details, see Set Up Extensible Flexfields in Order Management.

  2. Create your extension.

    • In the Setup and Maintenance work area, go to the task.

      • Offering: Order Management

      • Functional Area: Orders

      • Task: Manage Order Management Extensions

    • On the Create Extension page, on the On Start of Submission Request tab, enter values.

      Attribute

      Value

      Name

      Cancel Order Quantity

      Description

      This extension examines the value of an extensible flexfield on an order line to determine whether to cancel the line.

    • In the Definition area, add code.

      import oracle.apps.scm.doo.common.extensions.ValidationException;
      def poNumber = header.getAttribute("CustomerPONumber");
      if( !"CancelOrderQuantity".equals(poNumber) ) 
      return;
      def lines = header.getAttribute("Lines");
      if(lines == null)
      return;
      while(lines.hasNext()){
         def line = lines.next();   
         //Get the row for the flexfield context named ProductObsoleteContext.
         //Use the code value for the context as the argument to get the context row.   
         def context = line.getContextRow("ProductObsoleteContext");
         if(context == null)
         throw new ValidationException("Context ProductObsoleteContext was null");   
         def cancelLineEffVal = context.getAttribute("cancelline");   
         if("Y".equals(cancelLineEffVal)){
           line.setAttribute("OrderedQuantity",0);
         }
      }
    • Click Validate > Save and Close.

Test Your Setup

Create a test sales order for customer Computer Service and Rentals.

  1. Create the sales order.

    • Go to the Order Management work area and create a new sales order.

      Set attributes on the order header.

      Attribute

      Value

      Customer

      Computer Service and Rentals

      Order Type

      Standard Orders

    • Add an order line that contains an item that isn't configured.

    • Click Submit.

  2. Wait for the order line status to change to Awaiting Shipping. Click Refresh to update the status.

  3. Revise your sales order.

    • On the Manage Orders page, click Actions > Create Revision

    • On the Create Revision page, set the attribute on the order header.

      Attribute

      Value

      Purchase Order

      CancelOrderQuantity

    • Click an order line, then click Update Lines.

    • On the Update Lines page, move the Additional Information attribute to the Selected window, then click Next.

    • In the Specify values area, click Update Additional Information.

    • In the dialog that opens, click CancelLine.

    • In the ProductObsoleteContext area, in the window next to CancelLine, enter "Y".

      You must include the double quotation marks.

    • Click OK, then click Update.

  4. Verify that Order Management changed the quantity on the order line to 0, and canceled the line.