zoukankan      html  css  js  c++  java
  • Process Order API In Order Management(详细)


    Process Order API In Order Management [ID 746787.1]

      修改时间 18-NOV-2010     类型 BULLETIN     状态 PUBLISHED  

    In this Document
      Purpose
      Scope and Application
      Process Order API In Order Management
          IMPORTING SALES ORDERS AND/OR RETURNS :
         Overview of Process Order API
         Structure of PL/SQL block to call process Order API
         Process Order Usage
          CREATE Operation
          UPDATE Operation
          DELETE Operation
          Other Action Requests
         Sample Scripts
      References


    Applies to:

    Oracle Order Management - Version: 11.5.9 to 12.0.5 - Release: 11.5 to 12.0
    Information in this document applies to any platform.

    Purpose

    This note is intended to help Customer and Support Engineers get acquainted with the basics of Process Order application Interface(API) and demostrate how Process Order API can be used to manipulate Sales Order business objects owned by Order Mangement module.

    Scope and Application

    This note is intended for any users who tries to import an order in Order Management using Process Order API. This scope of this note is to understand and perform test case for using Process Order API.

    Examples provided here work in Internal Instance. The screenshots and testing of sample insert scripts in this page were done in an 11.5.10 CU2 instance. Customers may use these examples; do confirm results on your test instance before trying them on production instance.

    The examples discussed here are the most frequently used actions in the Sales Order Transactions. However for the complete list of options, please refer to user guide “Oracle Order Management -- Open Interfaces, API, & Electronic Messaging Guide(Release 11i)”.

    Process Order API In Order Management

    IMPORTING SALES ORDERS AND/OR RETURNS :

    Order Import is an open interface owned by Oracle Order Management. Order Import
    consists of interface tables and a set of APIs. You can import new, change and
    completed sales orders or returns from legacy applications, EDI Transactions
    processed through the Gateway, or internal orders created from Oracle Purchasing's
    internal requisitions, or returns. In addition, Order Import provides forms
    that allow you to query orders from the interface tables, make corrections or
    changes to the date, and re-initiate the import process. Messages are provided
    to give you the details why the order did not import.

    The features of Order Import include validation and defaulting, processing
    constraint checks, applying and releasing of order holds, shipment scheduling,
    then ultimately inserting, updating or deleting the orders in the base Order
    Management tables. All data is checked for validity during the import process.
    Order Import uses the Process Orders API to validate and process order date in
    the interface tables. Valid transactions are converted into orders with lines,
    reservations, price adjustments and sales credits.


    You can use the Error Message window to determine if your data failed the import
    process. If the data failed to import, you can use the Order Import Corrections
    window, a new feature in release 11i, to examine and correct the data.


    The following parameter and profile options must be defined in order to use
    Order Import.


    Order Management System Parameter:
    - OM: Item Validation Organization

    Order Management Profile Options:
    - OM: Reservation Time Fence
    - OM: Apply Automatic Attachments

    You can import orders in an entered, booked or closed status. If an order is
    imported as booked, the order is automatically eligible to progress to the next
    step the the workflow. If any of the fields required for a booked order are not
    supplied then Order Management places the order in an entered states and notifies
    you of the error.

    You can indicate whether you want to manually enter prices for imported orders
    or allow Order Management to automatically price the order.

    If you want to use automatice pricing, set the column OE_LINES_INTERFACE.
    CALCULATE_PRICE_FLAG to Calculate Price. All pricing information must be
    set up in Oracle Pricing and Order Management.

    If you want to use manual pricing, set the column OE_LINES_INTERFACE.
    CALCULATE_PRICE_FLAG to Freeze Price.

    If you want the system to only calculate Freight Charges, set the column
    OE_LINES_INTERFACE.CALCULATE_PRICE_FLAG to Partial Price.

    Order Import can also perform a price comparison on your imported orders. For
    example, you can provide a selling price and also have the system calculate a
    price. Order Import will WARN you of any differences. Please see table 24-1
    in the Oracle Order Management Implementation Manual for examples of differences
    in the customer price and system price and how the Calculate Price Flag affects
    the process.

    You can run the Order Import process in validation-only mode. This mode allows
    the transaction to be validated against all of the Order Management rules but
    does not pass any valid transactions into the Order Management tables.

    The Order Import window consists of the Find and Summary windows. The Find
    window allows you to find orders to be imported based on certain attributes
    such as Request ID, Order Source, Original System, Document Reference and Change
    sequence.

    The summary window displays order headers, lines, sales credits, price
    adjustments, lot serial numbers, reservations and action requests. You can
    use Oracle Application Folder functionality to limit or display fields.
    You can perform the following actions from this form:
    - modify orders.
    - insert, update and delete the orders and lines in the interface tables.
    - update one or multiple orders or lines at the same time using the
    multi-select functionality.
    - mark an order or line to be rejected by setting the rejected flag.
    - submit a request by selecting Order Import Request and select the
    appropriate parameter and choose Submit.

    Order Import has the following paramters
    1. Order Source
    2. Order Reference
    3. Validate Only
    4. Processing Results

    Customer items numbers or UPC numbers can be entered in Order Import the same
    way as a manually entered sales order as long as all cross-reference data is
    defined before the order import process is run. Set the OE_LINES_IFACE_ALL.
    CUSTOMER_ITEM_NAME to the 'item ordered'. If you know what kind of item
    number it is (for example customer or inventory), you can set the
    OE_LINES_IFACE_ALL.CUSTOMER_ITEM_TYPE.

    You can import changes and cancellations to existing imported orders by setting
    the OPERATION_CODE in each of the interface tables. A NULL value is equivalent
    to INSERT. If you want to make changes, use an OPERATION_CODE of UPDATE. To
    cancel a line set the OPERATION_CODE to UPDATE and make ordered quantity = 0.
    To cancel an order in its entirety, set the OPERATION_CODE at the Header to
    UPDATE and set the CANCEL_FLAG to Y.

    Import sales order returns just like you import standard orders choosing an
    order type that supports return line types. You can also import mixed orders,
    orders which have both standard sales order lines and return order lines.

    To import orders you will need to load the Order Import Interface Tables.
    In most situations, you will develop a program or script to convert data from
    the feeder system into the standard format that Order Import is expecting. You
    can import orders with any external source defined in the Define Document
    Sequences window.

    Oracle Purchasing contains a program, Create Internal Sales Orders, that takes
    the data from the Purchasing schema for internal requisitions and loads the
    Order Import tables. The eCommerce Gateway also provides a program, Purchase
    Order Inbound, that loads the import tables for the Inbound Purchase Order EDI
    transactions set.

    It is recommended that you set up Defaulting Rules in Order Management that will
    default as much of the order and line information as possible for you
    environment. This will reduce the amount of data that needs to be populated
    into the Order Management Interface tables. Please review Note 198900.1 for
    comprehensive information detailing the definition of Defaulting Rules.

    Please tables 2-1 through 2-10 for all required columns and settings.

    Overview of Process Order API

           Process Order API is a PL/SQL packaged procedure which can be used to manipulate the sales order data by performing Insert, update or delete operation on the following sales Order business object entities. Analogous to other public API’s(API’s available to the users), Process Order API also validates the data before inserting them into the application tables.
           Though Process Order API has packaged procedures which will insert, update, delete data into the tables, they can not be run on their own. Either they need to be called from another package procedure or can be executed as PL/SQL block via the sql*plus.

    Entity Related                                          Table Name
    -----------------------------                       ------------------------
    Order Header                                    OE_ORDER_HEADERS_ALL
    Order Price Adjustments                  OE_PRICE_ADJUSTMENTS
    Order Sales Credits                          OE_SALES_CREDITS
    Order Line                                         OE_ORDER_LINES_ALL
    Order Pricing Attributes                    OE_ORDER_PRICE_ATTRIBS
    Order Adjustment Attributes             OE_PRICE_ADJ_ATTRIBS
    Order Adjustment Associations        OE_PRICE_ADJ_ASSOCS
    Line Sales Credits                             OE_SALES_CREDITS
    Line Price Adjustments                     OE_PRICE_ADJUSTMENTS
    Line Pricing Attributes                       OE_ORDER_PRICE_ATTRIBS
    Line Adjustment Attributes                OE_PRICE_ADJ_ATTRIBS
    Line Adjustment Associations           OE_PRICE_ADJ_ASSOCS
    Lot Serial Numbers                            OE_LOT_SERIAL_NUMBERS

    Structure of PL/SQL block to call process Order API

    DECLARE
     Variable Declaration
    BEGIN
    Populate the various specific API parameters
    --Call to Process Order API
    OE_ORDER_PUB.Process_order(
    Standard Parameters


    Specific Parameters);
    Exception Handling
    END;

    Detailed explanation to each of these section is discussed as follows
     

    DECLARE
    /* In Variable declaration section, declare and initialize the various variables used in the pl/sql block can be done here. These entities are used to define INPUT and OUTPUT parameters to Process Order API*/
     l_header_rec OE_ORDER_PUB.Header_Rec_Type;
     l_line_rec OE_ORDER_PUB.line_rec_type;
     l_action_request_tbl OE_ORDER_PUB.Request_Tbl_Type;
     l_header_val_rec OE_ORDER_PUB.Header_Val_Rec_Type;
     l_Header_Adj_tbl OE_ORDER_PUB.Header_Adj_Tbl_Type;
     l_Header_Adj_val_tbl OE_ORDER_PUB.Header_Adj_Val_Tbl_Type;
     l_Header_price_Att_tbl OE_ORDER_PUB.Header_Price_Att_Tbl_Type ;
     l_Header_Adj_Att_tbl OE_ORDER_PUB.Header_Adj_Att_Tbl_Type ;
     l_Header_Adj_Assoc_tbl OE_ORDER_PUB.Header_Adj_Assoc_Tbl_Type ;
     l_Header_Scredit_tbl OE_ORDER_PUB.Header_Scredit_Tbl_Type;
     l_Header_Scredit_val_tbl OE_ORDER_PUB.Header_Scredit_Val_Tbl_Type;
     l_line_tbl OE_ORDER_PUB.Line_Tbl_Type;
     l_Request_Tbl OE_ORDER_PUB.Request_Tbl_Type;
     l_line_val_tbl OE_ORDER_PUB.Line_Val_Tbl_Type;
     l_Line_Adj_tbl OE_ORDER_PUB.Line_Adj_Tbl_Type;
     l_Line_Adj_val_tbl OE_ORDER_PUB.Line_Adj_Val_Tbl_Type;
     l_Line_price_Att_tbl OE_ORDER_PUB.Line_Price_Att_Tbl_Type ;
     l_Line_Adj_Att_tbl OE_ORDER_PUB.Line_Adj_Att_Tbl_Type ;
     l_Line_Adj_Assoc_tbl OE_ORDER_PUB.Line_Adj_Assoc_Tbl_Type ;
     l_Line_Scredit_tbl OE_ORDER_PUB.Line_Scredit_Tbl_Type;
     l_Line_Scredit_val_tbl OE_ORDER_PUB.Line_Scredit_Val_Tbl_Type;
     l_Lot_Serial_tbl OE_ORDER_PUB.Lot_Serial_Tbl_Type;
     l_Lot_Serial_val_tbl OE_ORDER_PUB.Lot_Serial_Val_Tbl_Type;
     l_request_rec OE_ORDER_PUB.Request_Rec_Type ;
     -- Initialize the API Version to 1.0
     p_api_version_number NUMBER :=1.0;
     x_return_status VARCHAR2(1);
    BEGIN
    --This sets the buffer size so that messages are written to debug file.
     dbms_output.enable(1000000);
    /*****************INITIALIZE ENVIRONMENT*************************
    -- fnd_global.apps_initialize(user_id,responsibility_id ,application_id);
    /* Pass in user_id, responsibility_id, and application_id here, as the system would need to information while setting the who columns for updating the data in the tables. Also required to set the organization/operating unit context for the system has to see the data in views.*/
     fnd_global.apps_initialize(4096,21623,660);-- vision env variables
    /*This section sets the debug level to 5 so that all messages would be written to the debug file.*/
     oe_msg_pub.initialize;
     oe_debug_pub.initialize; 
     X_DEBUG_FILE := OE_DEBUG_PUB.Set_Debug_Mode('FILE');
     oe_debug_pub.SetDebugLevel(5);
     dbms_output.put_line('START OF NEW DEBUG');
    /* The header record is initialized to missing as there would be no header_id exists for the record.Once the header_id is generated by the API, the l_header_rec will take the value of the header_id */
     l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    -- Header Attributes
     l_header_rec.order_type_id := &Order Type ID;
     l_header_rec.sold_to_org_id := &Sold To Org ID;
     l_header_rec.ship_to_org_id := &Ship To Org ID;
     l_header_rec.ship_from_org_id := &Ship From Org ID;
     l_header_rec.orig_sys_document_ref := &Document Reference;
     l_header_rec.price_list_id := &Price List ID;
     -- The statement indicates to the process order API that a new header has to be created.
     l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
     -- Setting index as 1 to indicate that these belong to 1st line record
     l_line_tbl_index := 1;
     -- Initializing the line 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 := &Inventory Item ID;
     l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered Quantity;
     l_line_tbl(l_line_tbl_index).orig_sys_document_ref := &Doc Ref;
     l_line_tbl(l_line_tbl_index).orig_sys_line_ref := &Line Reference;
     l_line_tbl(l_line_tbl_index).calculate_price_flag := &Calculate Price Flag;
     l_line_tbl(l_line_tbl_index).line_type_id := &Line Type ID;
     -- Indicates that this is a create operation for the line record.
     l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_CREATE;
     -- Indicates that this is an update operation for the line record.
     l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;
     -- Indicates that this is a delete operation for the line record.
     l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_DELETE;
     /*The below action request indicates to the process order that the order has to be booked. */
     l_action_request_tbl(1).request_type := oe_globals.g_book_order;
     l_action_request_tbl(1).entity_code := oe_globals.g_entity_header;
     -- Call To Process Order API with the required IN and OUT parameters. 
     OE_ORDER_PUB.process_order( );
     -- Get the messages generated and print them
     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;
    /* 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
      dbms_output.put_line('Process Order Success ');
     ELSE
      dbms_output.put_line('Failed');
     END IF;
    END;

    Process Order Usage

    This section is intended to help the users of the process order API in identifying the required parameters for some common operations and to give an understanding of the business flow behind each of these operations.


     CREATE Operation

    In order to create new entities in order management using process_order API, it is necessary that the operation OE_GLOBALS.G_OPR_CREATE is passed alone with the necessary entity records and entity tables.

    Create an Order with one line:
    The following code snippet shows the various attributes required to create an order with one header and line

    --Create Header record
    --Initialize header record to missing
    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    -- Header Attributes
    -- Required attributes (e.g. Order Type and Customer)
    l_header_rec.order_type_id := &Order Type ID;
    l_header_rec.sold_to_org_id := &Sold To Org ID;
    -- Other Attributes
    l_header_rec.transactional_curr_code :=&Trans Currency Code;
    l_header_rec.pricing_date := &Pricing Date;
    l_header_rec.cust_po_number := &Customer PO#;
    l_header_rec.price_list_id : = &Price List ID;
    l_header_rec.ordered_date := &Ordered Date;
    l_header_rec.shipping_method_code := &Shipping Method Code;
    l_header_rec.sold_from_org_id := &Sold from Org ID;
    l_header_rec.salesrep_id := &Sales Rep ID;
    l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
    -- Create first line record
    l_line_tbl_index := 1;
    -- Initialize line record to missing
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    -- Line attributes
    -- Required Attributes Inventory Item Id, Quantity and Operation
    l_line_tbl(l_line_tbl_index).inventory_item_id := &Inventory Item ID;
    l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered Quantity;
    l_line_tbl(l_line_tbl_index).ship_from_org_id := &Ship From Org ID;
    l_line_tbl(l_line_tbl_index).subinventory := &Subinventory Code;
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_CREATE;


    Adding a new line to an existing order

    l_line_tbl_index := 1;
    --This is to add a line to an existing order
    -- Initialize record to missing
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    -- Line attributes
    -- Required Line Attributes
    l_line_tbl(l_line_tbl_index).header_id := &Order Header ID;
    l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered Quantity;
    l_line_tbl(l_line_tbl_index).inventory_item_id := &Inventory Item ID;
    -- Other line attributes
    l_line_tbl(l_line_tbl_index).ship_from_org_id := &Ship from org ID;
    l_line_tbl(l_line_tbl_index).subinventory := &Subinventory Code;
    --Operation set to Create
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_CREATE;

    IMP Note: It is not possible to insert new lines (or, process any other entity) belonging to different orders in one process order call


     UPDATE Operation

    In order to update the entities in order management using process_order API, it is necessary that the operation OE_GLOBALS.G_OPR_UPDATE is passed alone with the necessary entity records and entity tables.

    Cancelling an existing Order:
    In order to cancel an order set the cancelled_flag to ‘Y’
    The following sections describe the code required to cancel an order.

    --This section is used to cancel a order
    -- Initialize record to missing
    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.header_id := &Order Header ID;
    l_header_rec.cancelled_flag := 'Y';
    l_header_rec.change_reason := 'Not provided';
    l_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;

    Cancelling an existing Order Line:
    In order to cancel an order line, set the cancelled_flag to ‘Y’
    The following sections describe the code required to cancel an order line.

    --This section is used to cancel an order line
    l_line_tbl_index := 1;
    -- Initialize record to missing
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(l_line_tbl_index).header_id := &Order Header ID;
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered quantity;
    l_line_tbl(l_line_tbl_index).cancelled_flag := 'Y';
    l_line_tbl(l_line_tbl_index).change_reason := 'Not provided';
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;

    Updating the Line Quantity:

    Updates or cancels a quantity on a sales Order Line

    l_line_tbl_index :=1;
    -- Changed attributes
    -- Initialize the line to missing
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered Quantity;
    -- Primary key of the entity i.e. the order line
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).change_reason := &Change Reason;


    Reserve an existing order line :
    Reservation can be done by providing the reserved_quantity to some non zero value.

    l_line_tbl_index := 1;
    -- Initialize line 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).header_id := &Order Header ID;
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).reserved_quantity := &Reserved Quantity;
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;


    Unreserve a reserved order line:
    Unreservation can be done by reducing reserved quantity or make reserved quantity to zero.

    l_line_tbl_index := 1;
    -- 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).header_id := &Order Header ID;
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).reserved_quantity := 0;
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;


    Splitting an Order Line:
    To split an order line using Process_Order API, It is required to pass the following parameters :

    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.header_id := &Order Header ID; -- header_id of the order
    l_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
    l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
    l_line_tbl(1).split_by := &User ID; -- user_id
    l_line_tbl(1).split_action_code := 'SPLIT';
    l_line_tbl(1).header_id := &Header ID of the Order; -- header_id of the order
    l_line_tbl(1).line_id := &Line ID of the Order Line; -- line_id of the order line
    l_line_tbl(1).ordered_quantity := &New Ordered Qty; -- new ordered quantity
    l_line_tbl(1).change_reason := 'MISC'; -- change reason code
    l_line_tbl(2) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(2).operation := OE_GLOBALS.G_OPR_CREATE;
    l_line_tbl(2).split_by := &User ID; -- user_id
    l_line_tbl(2).split_action_code := 'SPLIT';
    l_line_tbl(2).split_from_line_id := &Line ID of the Original Line; -- line_id of original line
    l_line_tbl(2).inventory_item_id := &Inventory Item ID; -- inventory item id
    l_line_tbl(2).ordered_quantity := &Ordered Qty; -- ordered quantity

     DELETE Operation

    In order to delete the entity record, its necessary to pass the operation like OE_GLOBALS.G_OPR_DELETE. The only attribute which needs to be passed is either the header id or the line id depending on the whether deletion is done for the order or the line. Deletes are cascaded down to the child entities. For example to delete a header record all the child entities i.e. lines, header sales credits, header adjustments are deleted.
    Deleting the lines results in the deletion of line adjustments, line sales credits and line lot serial numbers as well.
    Deletes would also result in the deletion of any holds and attachments associated with the deleted entity and its child entities. The workflow status information for this entity is also purged.

    Delete Order:
    --This is to delete an order

    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.header_id := &Order Header ID;
    -- Indicate to process order that the order is to be deleted
    l_header_rec.operation := OE_GLOBALS.G_OPR_DELETE;



    Delete Line:
    -- This is to delete an order line

    l_line_tbl_index := 1;
    --This is to delete an existing order line.
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(l_line_tbl_index).header_id :=&Order Header ID;
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_DELETE;


     

     Other Action Requests

    Book Order:
    Following are the details of the requests used to book the order

    request_type --> OE_GLOBALS.G_BOOK_ORDER
    Entity_code --> This should be always set to OE_GLOBALS.G_ENTITY_HEADER as booking is an order level action.
    Entity_id --> Header ID of the order to be booked.

    If the order is also being created in the same call to process order, then the user does not need to
    provide this value.
    l_line_tbl_index := 1;
    l_action_request_tbl(l_line_tbl_index).request_type := oe_globals.g_book_order;
    l_action_request_tbl(l_line_tbl_index).entity_code := oe_globals.g_entity_header;
    l_action_request_tbl(l_line_tbl_index).entity_id := <>;

    Apply Hold:
    Following are the details of the requests used to apply hold to the sales Order Header or Line depending on the parameters passed to the Process_Order .

    request_type --> OE_GLOBALS.G_APPLY_HOLD
    Entity_code --> OE_GLOBALS.G_ENTITY_ORDER for order or OE_GLOBALS.G_ENTITY_LINE for line.
    Entity_id --> ID of the order or line to be held
    Param1 --> Hold ID to identify the type of hold that should be applied. (HOLD_ID from OE_HOLD_DEFINITIONS)
    Param2 --> Hold entity code for the hold source to be created.
    C: Customer hold source
    S: Bill To or Ship To hold source
    I: Item hold source
    O: Order hold source
    W: Warehouse Hold Source

    Param3 --> Hold entity ID
    C, B, or S: for Org ID
    O: Header ID
    I: Inventory Item ID

    param4 --> Hold comment
    date_param1 --> Hold Until Date
    parm6-param20 --> Attribute1-15 of the descriptive flex field associated with the hold source record.

    --This is to create a hold on an order header
    l_request_rec.entity_id := &Order Header ID;
    l_request_rec.entity_code := OE_GLOBALS.G_ENTITY_HEADER;
    l_request_rec.request_type := OE_GLOBALS.G_APPLY_HOLD;
    -- hold_id must be passed
    l_request_rec.param1 := &Hold ID;
    -- indicator that it is an order hold
    l_request_rec.param2 := 'O' ;
    -- Header ID of the order
    l_request_rec.param3 := &Order Header ID;
    l_action_request_tbl(l_line_tbl_index) := l_request_rec;

     
    Release Hold:
    Following are the details of the requests used to release hold from the sales Order Header or Line depending on the parameters passed to the Process_Order .

    request_type --> OE_GLOBALS.G_RELEASE_HOLD
    Entity_code --> OE_GLOBALS.G_ENTITY_HEADER for order or OE_GLOBALS.G_ENTITY_LINE for line.
    Entity_id --> ID of the order or line to be released from hold
    Param1 --> Hold ID to specify the type of hold that is to be removed.
    Param2 --> Hold entity code on the hold source associated with the hold to be released
    C: Customer hold source
    S: Bill To or Ship To hold source
    I: Item hold source
    O: Order hold source
    W: Warehouse Hold Source

    param3 --> Hold entity ID:
    C or S: for Org ID
    O: Header ID
    I: Inventory Item ID

    param4 --> Release Reason Code
    param5 --> Release Comment
    -- This is to release a hold on the order
    l_request_rec.entity_id := &Order Header ID;
    l_request_rec.entity_code := OE_GLOBALS.G_ENTITY_HEADER;
    l_request_rec.request_type := OE_GLOBALS.G_RELEASE_HOLD;
    -- hold_id must be passed
    l_request_rec.param1 := &Hold ID;
    -- indicator that it is an order hold
    l_request_rec.param2 := 'O' ;
    -- Header ID of the order
    l_request_rec.param3 := &Order Header ID;
    l_request_rec.param4 :='OM_APPROVE';
    l_action_request_tbl(l_line_tbl_index) := l_request_rec;

    Sample Scripts

    Note 746783.1-Script to Create an order with one line
    Note 746796.1-Script to add a new line to an existing order
    Note 746797.1-Script to cancel an existing Order
    Note 746798.1-Script to cancel an existing Order line
    Note 746802.1- Script to update an existing Order line
    Note 746803.1-Script to reserve order line
    Note 746804.1-Script to unreserve order line
    Note 746808.1-Script to splitting An Order Line
    Note 746809.1-Script to delete an Order
    Note 746810.1-Script to delete a Line
    Note 470741.1-Script to book Order
    Note 746811.1-Script to apply Hold in a sales order
    Note 746812.1-Script to release Hold in a sales order
    Note 292743.1-Script to create an RMA
    Note 746172.1- Script to import an Order with skipped Line number
    Note 745369.1- Script to update Header details using OE_ORDER_PUB For R12
    Note 836332.1- Script To Update Order Header Using OE_ORDER_PUB. Update_Header

    Note 959783.1- How Does One Use The OE_ORDER_PUB.PROCESS_ORDER Api For Manual Freight Application at Order Level?

    Note 291055.1- Release HOLD On Item At Line Leaving the HOLD SOURCE Via Public API
    Note 333429.1- How To Import Order With Price Adjustments
    Note 364316.1- Import Credit Card Payments When Using Process_Order API
    Note 367875.1- How Does One Cancel An Order Using Process_Order API ?
    Note 372598.1- How Does One Apply Hold On The Order Using Process Order API ?
    Note 394124.1- How Does One Split An Order Line Using Order Import ?
    Note 405251.1- How Does One Update Serial Number On Existing Order Using Order Import ?
    Note 436215.1- OEOIMP: Script To Populate Order Import Interface Tables From Existing Sales Order
    Note 444040.1- How does one apply a hold via Order Import on an existing order?
    Note 458752.1- How Does One Import Order Lines On Existing Internal Order Using Order Import ?
    Note 746668.1- How To Create An RMA Order That References An Existing Order?
    Note 746677.1- How To Create An Order For A Simple ATO Model?
    Note 755135.1- How to update Unit Price using API?
    Note 1128445.1- Need Script To Apply Hold Via Oe_order_pub.Process_order in R12

    == Additional Information ==

    The processing Constraint setup has a direct influence on the way the process order API works. For e.g. The processing constraint on reducing quantity on a booked order line, will results in an error if the Update operation is attempted via the Process Order API. 

    RELATED DOCUMENTS
    -----------------
    Oracle Order Management Suite Implementation Manual, Volumes 1 & 2 Release 11i
    Oracle Order Management Users Guide Release 11i
    Oracle Order Management Suite API's and Open Interfaces Manual Volume 1, Release 11i
    Note 121052.1

    References

    NOTE:743389.1 - Order Management Testcase Repository Library

    显示相关信息 相关的


    产品
    • Oracle E-Business Suite > Order Management > Order Management > Oracle Order Management
    关键字
    OE_ORDER_HEADERS_ALL; ORDER LINES; PROCESSING CONSTRAINTS; WAREHOUSES; RESERVE ORDERS

    返回页首返回页首


    Process Order API In Order Management [ID 746787.1]

      修改时间 18-NOV-2010     类型 BULLETIN     状态 PUBLISHED  

    In this Document
      Purpose
      Scope and Application
      Process Order API In Order Management
          IMPORTING SALES ORDERS AND/OR RETURNS :
         Overview of Process Order API
         Structure of PL/SQL block to call process Order API
         Process Order Usage
          CREATE Operation
          UPDATE Operation
          DELETE Operation
          Other Action Requests
         Sample Scripts
      References


    Applies to:

    Oracle Order Management - Version: 11.5.9 to 12.0.5 - Release: 11.5 to 12.0
    Information in this document applies to any platform.

    Purpose

    This note is intended to help Customer and Support Engineers get acquainted with the basics of Process Order application Interface(API) and demostrate how Process Order API can be used to manipulate Sales Order business objects owned by Order Mangement module.

    Scope and Application

    This note is intended for any users who tries to import an order in Order Management using Process Order API. This scope of this note is to understand and perform test case for using Process Order API.

    Examples provided here work in Internal Instance. The screenshots and testing of sample insert scripts in this page were done in an 11.5.10 CU2 instance. Customers may use these examples; do confirm results on your test instance before trying them on production instance.

    The examples discussed here are the most frequently used actions in the Sales Order Transactions. However for the complete list of options, please refer to user guide “Oracle Order Management -- Open Interfaces, API, & Electronic Messaging Guide(Release 11i)”.

    Process Order API In Order Management

    IMPORTING SALES ORDERS AND/OR RETURNS :

    Order Import is an open interface owned by Oracle Order Management. Order Import
    consists of interface tables and a set of APIs. You can import new, change and
    completed sales orders or returns from legacy applications, EDI Transactions
    processed through the Gateway, or internal orders created from Oracle Purchasing's
    internal requisitions, or returns. In addition, Order Import provides forms
    that allow you to query orders from the interface tables, make corrections or
    changes to the date, and re-initiate the import process. Messages are provided
    to give you the details why the order did not import.

    The features of Order Import include validation and defaulting, processing
    constraint checks, applying and releasing of order holds, shipment scheduling,
    then ultimately inserting, updating or deleting the orders in the base Order
    Management tables. All data is checked for validity during the import process.
    Order Import uses the Process Orders API to validate and process order date in
    the interface tables. Valid transactions are converted into orders with lines,
    reservations, price adjustments and sales credits.


    You can use the Error Message window to determine if your data failed the import
    process. If the data failed to import, you can use the Order Import Corrections
    window, a new feature in release 11i, to examine and correct the data.


    The following parameter and profile options must be defined in order to use
    Order Import.


    Order Management System Parameter:
    - OM: Item Validation Organization

    Order Management Profile Options:
    - OM: Reservation Time Fence
    - OM: Apply Automatic Attachments

    You can import orders in an entered, booked or closed status. If an order is
    imported as booked, the order is automatically eligible to progress to the next
    step the the workflow. If any of the fields required for a booked order are not
    supplied then Order Management places the order in an entered states and notifies
    you of the error.

    You can indicate whether you want to manually enter prices for imported orders
    or allow Order Management to automatically price the order.

    If you want to use automatice pricing, set the column OE_LINES_INTERFACE.
    CALCULATE_PRICE_FLAG to Calculate Price. All pricing information must be
    set up in Oracle Pricing and Order Management.

    If you want to use manual pricing, set the column OE_LINES_INTERFACE.
    CALCULATE_PRICE_FLAG to Freeze Price.

    If you want the system to only calculate Freight Charges, set the column
    OE_LINES_INTERFACE.CALCULATE_PRICE_FLAG to Partial Price.

    Order Import can also perform a price comparison on your imported orders. For
    example, you can provide a selling price and also have the system calculate a
    price. Order Import will WARN you of any differences. Please see table 24-1
    in the Oracle Order Management Implementation Manual for examples of differences
    in the customer price and system price and how the Calculate Price Flag affects
    the process.

    You can run the Order Import process in validation-only mode. This mode allows
    the transaction to be validated against all of the Order Management rules but
    does not pass any valid transactions into the Order Management tables.

    The Order Import window consists of the Find and Summary windows. The Find
    window allows you to find orders to be imported based on certain attributes
    such as Request ID, Order Source, Original System, Document Reference and Change
    sequence.

    The summary window displays order headers, lines, sales credits, price
    adjustments, lot serial numbers, reservations and action requests. You can
    use Oracle Application Folder functionality to limit or display fields.
    You can perform the following actions from this form:
    - modify orders.
    - insert, update and delete the orders and lines in the interface tables.
    - update one or multiple orders or lines at the same time using the
    multi-select functionality.
    - mark an order or line to be rejected by setting the rejected flag.
    - submit a request by selecting Order Import Request and select the
    appropriate parameter and choose Submit.

    Order Import has the following paramters
    1. Order Source
    2. Order Reference
    3. Validate Only
    4. Processing Results

    Customer items numbers or UPC numbers can be entered in Order Import the same
    way as a manually entered sales order as long as all cross-reference data is
    defined before the order import process is run. Set the OE_LINES_IFACE_ALL.
    CUSTOMER_ITEM_NAME to the 'item ordered'. If you know what kind of item
    number it is (for example customer or inventory), you can set the
    OE_LINES_IFACE_ALL.CUSTOMER_ITEM_TYPE.

    You can import changes and cancellations to existing imported orders by setting
    the OPERATION_CODE in each of the interface tables. A NULL value is equivalent
    to INSERT. If you want to make changes, use an OPERATION_CODE of UPDATE. To
    cancel a line set the OPERATION_CODE to UPDATE and make ordered quantity = 0.
    To cancel an order in its entirety, set the OPERATION_CODE at the Header to
    UPDATE and set the CANCEL_FLAG to Y.

    Import sales order returns just like you import standard orders choosing an
    order type that supports return line types. You can also import mixed orders,
    orders which have both standard sales order lines and return order lines.

    To import orders you will need to load the Order Import Interface Tables.
    In most situations, you will develop a program or script to convert data from
    the feeder system into the standard format that Order Import is expecting. You
    can import orders with any external source defined in the Define Document
    Sequences window.

    Oracle Purchasing contains a program, Create Internal Sales Orders, that takes
    the data from the Purchasing schema for internal requisitions and loads the
    Order Import tables. The eCommerce Gateway also provides a program, Purchase
    Order Inbound, that loads the import tables for the Inbound Purchase Order EDI
    transactions set.

    It is recommended that you set up Defaulting Rules in Order Management that will
    default as much of the order and line information as possible for you
    environment. This will reduce the amount of data that needs to be populated
    into the Order Management Interface tables. Please review Note 198900.1 for
    comprehensive information detailing the definition of Defaulting Rules.

    Please tables 2-1 through 2-10 for all required columns and settings.

    Overview of Process Order API

           Process Order API is a PL/SQL packaged procedure which can be used to manipulate the sales order data by performing Insert, update or delete operation on the following sales Order business object entities. Analogous to other public API’s(API’s available to the users), Process Order API also validates the data before inserting them into the application tables.
           Though Process Order API has packaged procedures which will insert, update, delete data into the tables, they can not be run on their own. Either they need to be called from another package procedure or can be executed as PL/SQL block via the sql*plus.

    Entity Related                                          Table Name
    -----------------------------                       ------------------------
    Order Header                                    OE_ORDER_HEADERS_ALL
    Order Price Adjustments                  OE_PRICE_ADJUSTMENTS
    Order Sales Credits                          OE_SALES_CREDITS
    Order Line                                         OE_ORDER_LINES_ALL
    Order Pricing Attributes                    OE_ORDER_PRICE_ATTRIBS
    Order Adjustment Attributes             OE_PRICE_ADJ_ATTRIBS
    Order Adjustment Associations        OE_PRICE_ADJ_ASSOCS
    Line Sales Credits                             OE_SALES_CREDITS
    Line Price Adjustments                     OE_PRICE_ADJUSTMENTS
    Line Pricing Attributes                       OE_ORDER_PRICE_ATTRIBS
    Line Adjustment Attributes                OE_PRICE_ADJ_ATTRIBS
    Line Adjustment Associations           OE_PRICE_ADJ_ASSOCS
    Lot Serial Numbers                            OE_LOT_SERIAL_NUMBERS

    Structure of PL/SQL block to call process Order API

    DECLARE
     Variable Declaration
    BEGIN
    Populate the various specific API parameters
    --Call to Process Order API
    OE_ORDER_PUB.Process_order(
    Standard Parameters


    Specific Parameters);
    Exception Handling
    END;

    Detailed explanation to each of these section is discussed as follows
     

    DECLARE
    /* In Variable declaration section, declare and initialize the various variables used in the pl/sql block can be done here. These entities are used to define INPUT and OUTPUT parameters to Process Order API*/
     l_header_rec OE_ORDER_PUB.Header_Rec_Type;
     l_line_rec OE_ORDER_PUB.line_rec_type;
     l_action_request_tbl OE_ORDER_PUB.Request_Tbl_Type;
     l_header_val_rec OE_ORDER_PUB.Header_Val_Rec_Type;
     l_Header_Adj_tbl OE_ORDER_PUB.Header_Adj_Tbl_Type;
     l_Header_Adj_val_tbl OE_ORDER_PUB.Header_Adj_Val_Tbl_Type;
     l_Header_price_Att_tbl OE_ORDER_PUB.Header_Price_Att_Tbl_Type ;
     l_Header_Adj_Att_tbl OE_ORDER_PUB.Header_Adj_Att_Tbl_Type ;
     l_Header_Adj_Assoc_tbl OE_ORDER_PUB.Header_Adj_Assoc_Tbl_Type ;
     l_Header_Scredit_tbl OE_ORDER_PUB.Header_Scredit_Tbl_Type;
     l_Header_Scredit_val_tbl OE_ORDER_PUB.Header_Scredit_Val_Tbl_Type;
     l_line_tbl OE_ORDER_PUB.Line_Tbl_Type;
     l_Request_Tbl OE_ORDER_PUB.Request_Tbl_Type;
     l_line_val_tbl OE_ORDER_PUB.Line_Val_Tbl_Type;
     l_Line_Adj_tbl OE_ORDER_PUB.Line_Adj_Tbl_Type;
     l_Line_Adj_val_tbl OE_ORDER_PUB.Line_Adj_Val_Tbl_Type;
     l_Line_price_Att_tbl OE_ORDER_PUB.Line_Price_Att_Tbl_Type ;
     l_Line_Adj_Att_tbl OE_ORDER_PUB.Line_Adj_Att_Tbl_Type ;
     l_Line_Adj_Assoc_tbl OE_ORDER_PUB.Line_Adj_Assoc_Tbl_Type ;
     l_Line_Scredit_tbl OE_ORDER_PUB.Line_Scredit_Tbl_Type;
     l_Line_Scredit_val_tbl OE_ORDER_PUB.Line_Scredit_Val_Tbl_Type;
     l_Lot_Serial_tbl OE_ORDER_PUB.Lot_Serial_Tbl_Type;
     l_Lot_Serial_val_tbl OE_ORDER_PUB.Lot_Serial_Val_Tbl_Type;
     l_request_rec OE_ORDER_PUB.Request_Rec_Type ;
     -- Initialize the API Version to 1.0
     p_api_version_number NUMBER :=1.0;
     x_return_status VARCHAR2(1);
    BEGIN
    --This sets the buffer size so that messages are written to debug file.
     dbms_output.enable(1000000);
    /*****************INITIALIZE ENVIRONMENT*************************
    -- fnd_global.apps_initialize(user_id,responsibility_id ,application_id);
    /* Pass in user_id, responsibility_id, and application_id here, as the system would need to information while setting the who columns for updating the data in the tables. Also required to set the organization/operating unit context for the system has to see the data in views.*/
     fnd_global.apps_initialize(4096,21623,660);-- vision env variables
    /*This section sets the debug level to 5 so that all messages would be written to the debug file.*/
     oe_msg_pub.initialize;
     oe_debug_pub.initialize; 
     X_DEBUG_FILE := OE_DEBUG_PUB.Set_Debug_Mode('FILE');
     oe_debug_pub.SetDebugLevel(5);
     dbms_output.put_line('START OF NEW DEBUG');
    /* The header record is initialized to missing as there would be no header_id exists for the record.Once the header_id is generated by the API, the l_header_rec will take the value of the header_id */
     l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    -- Header Attributes
     l_header_rec.order_type_id := &Order Type ID;
     l_header_rec.sold_to_org_id := &Sold To Org ID;
     l_header_rec.ship_to_org_id := &Ship To Org ID;
     l_header_rec.ship_from_org_id := &Ship From Org ID;
     l_header_rec.orig_sys_document_ref := &Document Reference;
     l_header_rec.price_list_id := &Price List ID;
     -- The statement indicates to the process order API that a new header has to be created.
     l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
     -- Setting index as 1 to indicate that these belong to 1st line record
     l_line_tbl_index := 1;
     -- Initializing the line 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 := &Inventory Item ID;
     l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered Quantity;
     l_line_tbl(l_line_tbl_index).orig_sys_document_ref := &Doc Ref;
     l_line_tbl(l_line_tbl_index).orig_sys_line_ref := &Line Reference;
     l_line_tbl(l_line_tbl_index).calculate_price_flag := &Calculate Price Flag;
     l_line_tbl(l_line_tbl_index).line_type_id := &Line Type ID;
     -- Indicates that this is a create operation for the line record.
     l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_CREATE;
     -- Indicates that this is an update operation for the line record.
     l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;
     -- Indicates that this is a delete operation for the line record.
     l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_DELETE;
     /*The below action request indicates to the process order that the order has to be booked. */
     l_action_request_tbl(1).request_type := oe_globals.g_book_order;
     l_action_request_tbl(1).entity_code := oe_globals.g_entity_header;
     -- Call To Process Order API with the required IN and OUT parameters. 
     OE_ORDER_PUB.process_order( );
     -- Get the messages generated and print them
     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;
    /* 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
      dbms_output.put_line('Process Order Success ');
     ELSE
      dbms_output.put_line('Failed');
     END IF;
    END;

    Process Order Usage

    This section is intended to help the users of the process order API in identifying the required parameters for some common operations and to give an understanding of the business flow behind each of these operations.


     CREATE Operation

    In order to create new entities in order management using process_order API, it is necessary that the operation OE_GLOBALS.G_OPR_CREATE is passed alone with the necessary entity records and entity tables.

    Create an Order with one line:
    The following code snippet shows the various attributes required to create an order with one header and line

    --Create Header record
    --Initialize header record to missing
    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    -- Header Attributes
    -- Required attributes (e.g. Order Type and Customer)
    l_header_rec.order_type_id := &Order Type ID;
    l_header_rec.sold_to_org_id := &Sold To Org ID;
    -- Other Attributes
    l_header_rec.transactional_curr_code :=&Trans Currency Code;
    l_header_rec.pricing_date := &Pricing Date;
    l_header_rec.cust_po_number := &Customer PO#;
    l_header_rec.price_list_id : = &Price List ID;
    l_header_rec.ordered_date := &Ordered Date;
    l_header_rec.shipping_method_code := &Shipping Method Code;
    l_header_rec.sold_from_org_id := &Sold from Org ID;
    l_header_rec.salesrep_id := &Sales Rep ID;
    l_header_rec.operation := OE_GLOBALS.G_OPR_CREATE;
    -- Create first line record
    l_line_tbl_index := 1;
    -- Initialize line record to missing
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    -- Line attributes
    -- Required Attributes Inventory Item Id, Quantity and Operation
    l_line_tbl(l_line_tbl_index).inventory_item_id := &Inventory Item ID;
    l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered Quantity;
    l_line_tbl(l_line_tbl_index).ship_from_org_id := &Ship From Org ID;
    l_line_tbl(l_line_tbl_index).subinventory := &Subinventory Code;
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_CREATE;


    Adding a new line to an existing order

    l_line_tbl_index := 1;
    --This is to add a line to an existing order
    -- Initialize record to missing
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    -- Line attributes
    -- Required Line Attributes
    l_line_tbl(l_line_tbl_index).header_id := &Order Header ID;
    l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered Quantity;
    l_line_tbl(l_line_tbl_index).inventory_item_id := &Inventory Item ID;
    -- Other line attributes
    l_line_tbl(l_line_tbl_index).ship_from_org_id := &Ship from org ID;
    l_line_tbl(l_line_tbl_index).subinventory := &Subinventory Code;
    --Operation set to Create
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_CREATE;

    IMP Note: It is not possible to insert new lines (or, process any other entity) belonging to different orders in one process order call


     UPDATE Operation

    In order to update the entities in order management using process_order API, it is necessary that the operation OE_GLOBALS.G_OPR_UPDATE is passed alone with the necessary entity records and entity tables.

    Cancelling an existing Order:
    In order to cancel an order set the cancelled_flag to ‘Y’
    The following sections describe the code required to cancel an order.

    --This section is used to cancel a order
    -- Initialize record to missing
    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.header_id := &Order Header ID;
    l_header_rec.cancelled_flag := 'Y';
    l_header_rec.change_reason := 'Not provided';
    l_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;

    Cancelling an existing Order Line:
    In order to cancel an order line, set the cancelled_flag to ‘Y’
    The following sections describe the code required to cancel an order line.

    --This section is used to cancel an order line
    l_line_tbl_index := 1;
    -- Initialize record to missing
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(l_line_tbl_index).header_id := &Order Header ID;
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered quantity;
    l_line_tbl(l_line_tbl_index).cancelled_flag := 'Y';
    l_line_tbl(l_line_tbl_index).change_reason := 'Not provided';
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;

    Updating the Line Quantity:

    Updates or cancels a quantity on a sales Order Line

    l_line_tbl_index :=1;
    -- Changed attributes
    -- Initialize the line to missing
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(l_line_tbl_index).ordered_quantity := &Ordered Quantity;
    -- Primary key of the entity i.e. the order line
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).change_reason := &Change Reason;


    Reserve an existing order line :
    Reservation can be done by providing the reserved_quantity to some non zero value.

    l_line_tbl_index := 1;
    -- Initialize line 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).header_id := &Order Header ID;
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).reserved_quantity := &Reserved Quantity;
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;


    Unreserve a reserved order line:
    Unreservation can be done by reducing reserved quantity or make reserved quantity to zero.

    l_line_tbl_index := 1;
    -- 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).header_id := &Order Header ID;
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).reserved_quantity := 0;
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_UPDATE;


    Splitting an Order Line:
    To split an order line using Process_Order API, It is required to pass the following parameters :

    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.header_id := &Order Header ID; -- header_id of the order
    l_header_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
    l_line_tbl(1) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
    l_line_tbl(1).split_by := &User ID; -- user_id
    l_line_tbl(1).split_action_code := 'SPLIT';
    l_line_tbl(1).header_id := &Header ID of the Order; -- header_id of the order
    l_line_tbl(1).line_id := &Line ID of the Order Line; -- line_id of the order line
    l_line_tbl(1).ordered_quantity := &New Ordered Qty; -- new ordered quantity
    l_line_tbl(1).change_reason := 'MISC'; -- change reason code
    l_line_tbl(2) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(2).operation := OE_GLOBALS.G_OPR_CREATE;
    l_line_tbl(2).split_by := &User ID; -- user_id
    l_line_tbl(2).split_action_code := 'SPLIT';
    l_line_tbl(2).split_from_line_id := &Line ID of the Original Line; -- line_id of original line
    l_line_tbl(2).inventory_item_id := &Inventory Item ID; -- inventory item id
    l_line_tbl(2).ordered_quantity := &Ordered Qty; -- ordered quantity

     DELETE Operation

    In order to delete the entity record, its necessary to pass the operation like OE_GLOBALS.G_OPR_DELETE. The only attribute which needs to be passed is either the header id or the line id depending on the whether deletion is done for the order or the line. Deletes are cascaded down to the child entities. For example to delete a header record all the child entities i.e. lines, header sales credits, header adjustments are deleted.
    Deleting the lines results in the deletion of line adjustments, line sales credits and line lot serial numbers as well.
    Deletes would also result in the deletion of any holds and attachments associated with the deleted entity and its child entities. The workflow status information for this entity is also purged.

    Delete Order:
    --This is to delete an order

    l_header_rec := OE_ORDER_PUB.G_MISS_HEADER_REC;
    l_header_rec.header_id := &Order Header ID;
    -- Indicate to process order that the order is to be deleted
    l_header_rec.operation := OE_GLOBALS.G_OPR_DELETE;



    Delete Line:
    -- This is to delete an order line

    l_line_tbl_index := 1;
    --This is to delete an existing order line.
    l_line_tbl(l_line_tbl_index) := OE_ORDER_PUB.G_MISS_LINE_REC;
    l_line_tbl(l_line_tbl_index).header_id :=&Order Header ID;
    l_line_tbl(l_line_tbl_index).line_id := &Order Line ID;
    l_line_tbl(l_line_tbl_index).operation := OE_GLOBALS.G_OPR_DELETE;


     

     Other Action Requests

    Book Order:
    Following are the details of the requests used to book the order

    request_type --> OE_GLOBALS.G_BOOK_ORDER
    Entity_code --> This should be always set to OE_GLOBALS.G_ENTITY_HEADER as booking is an order level action.
    Entity_id --> Header ID of the order to be booked.

    If the order is also being created in the same call to process order, then the user does not need to
    provide this value.
    l_line_tbl_index := 1;
    l_action_request_tbl(l_line_tbl_index).request_type := oe_globals.g_book_order;
    l_action_request_tbl(l_line_tbl_index).entity_code := oe_globals.g_entity_header;
    l_action_request_tbl(l_line_tbl_index).entity_id := <>;

    Apply Hold:
    Following are the details of the requests used to apply hold to the sales Order Header or Line depending on the parameters passed to the Process_Order .

    request_type --> OE_GLOBALS.G_APPLY_HOLD
    Entity_code --> OE_GLOBALS.G_ENTITY_ORDER for order or OE_GLOBALS.G_ENTITY_LINE for line.
    Entity_id --> ID of the order or line to be held
    Param1 --> Hold ID to identify the type of hold that should be applied. (HOLD_ID from OE_HOLD_DEFINITIONS)
    Param2 --> Hold entity code for the hold source to be created.
    C: Customer hold source
    S: Bill To or Ship To hold source
    I: Item hold source
    O: Order hold source
    W: Warehouse Hold Source

    Param3 --> Hold entity ID
    C, B, or S: for Org ID
    O: Header ID
    I: Inventory Item ID

    param4 --> Hold comment
    date_param1 --> Hold Until Date
    parm6-param20 --> Attribute1-15 of the descriptive flex field associated with the hold source record.

    --This is to create a hold on an order header
    l_request_rec.entity_id := &Order Header ID;
    l_request_rec.entity_code := OE_GLOBALS.G_ENTITY_HEADER;
    l_request_rec.request_type := OE_GLOBALS.G_APPLY_HOLD;
    -- hold_id must be passed
    l_request_rec.param1 := &Hold ID;
    -- indicator that it is an order hold
    l_request_rec.param2 := 'O' ;
    -- Header ID of the order
    l_request_rec.param3 := &Order Header ID;
    l_action_request_tbl(l_line_tbl_index) := l_request_rec;

     
    Release Hold:
    Following are the details of the requests used to release hold from the sales Order Header or Line depending on the parameters passed to the Process_Order .

    request_type --> OE_GLOBALS.G_RELEASE_HOLD
    Entity_code --> OE_GLOBALS.G_ENTITY_HEADER for order or OE_GLOBALS.G_ENTITY_LINE for line.
    Entity_id --> ID of the order or line to be released from hold
    Param1 --> Hold ID to specify the type of hold that is to be removed.
    Param2 --> Hold entity code on the hold source associated with the hold to be released
    C: Customer hold source
    S: Bill To or Ship To hold source
    I: Item hold source
    O: Order hold source
    W: Warehouse Hold Source

    param3 --> Hold entity ID:
    C or S: for Org ID
    O: Header ID
    I: Inventory Item ID

    param4 --> Release Reason Code
    param5 --> Release Comment
    -- This is to release a hold on the order
    l_request_rec.entity_id := &Order Header ID;
    l_request_rec.entity_code := OE_GLOBALS.G_ENTITY_HEADER;
    l_request_rec.request_type := OE_GLOBALS.G_RELEASE_HOLD;
    -- hold_id must be passed
    l_request_rec.param1 := &Hold ID;
    -- indicator that it is an order hold
    l_request_rec.param2 := 'O' ;
    -- Header ID of the order
    l_request_rec.param3 := &Order Header ID;
    l_request_rec.param4 :='OM_APPROVE';
    l_action_request_tbl(l_line_tbl_index) := l_request_rec;

    Sample Scripts

    Note 746783.1-Script to Create an order with one line
    Note 746796.1-Script to add a new line to an existing order
    Note 746797.1-Script to cancel an existing Order
    Note 746798.1-Script to cancel an existing Order line
    Note 746802.1- Script to update an existing Order line
    Note 746803.1-Script to reserve order line
    Note 746804.1-Script to unreserve order line
    Note 746808.1-Script to splitting An Order Line
    Note 746809.1-Script to delete an Order
    Note 746810.1-Script to delete a Line
    Note 470741.1-Script to book Order
    Note 746811.1-Script to apply Hold in a sales order
    Note 746812.1-Script to release Hold in a sales order
    Note 292743.1-Script to create an RMA
    Note 746172.1- Script to import an Order with skipped Line number
    Note 745369.1- Script to update Header details using OE_ORDER_PUB For R12
    Note 836332.1- Script To Update Order Header Using OE_ORDER_PUB. Update_Header

    Note 959783.1- How Does One Use The OE_ORDER_PUB.PROCESS_ORDER Api For Manual Freight Application at Order Level?

    Note 291055.1- Release HOLD On Item At Line Leaving the HOLD SOURCE Via Public API
    Note 333429.1- How To Import Order With Price Adjustments
    Note 364316.1- Import Credit Card Payments When Using Process_Order API
    Note 367875.1- How Does One Cancel An Order Using Process_Order API ?
    Note 372598.1- How Does One Apply Hold On The Order Using Process Order API ?
    Note 394124.1- How Does One Split An Order Line Using Order Import ?
    Note 405251.1- How Does One Update Serial Number On Existing Order Using Order Import ?
    Note 436215.1- OEOIMP: Script To Populate Order Import Interface Tables From Existing Sales Order
    Note 444040.1- How does one apply a hold via Order Import on an existing order?
    Note 458752.1- How Does One Import Order Lines On Existing Internal Order Using Order Import ?
    Note 746668.1- How To Create An RMA Order That References An Existing Order?
    Note 746677.1- How To Create An Order For A Simple ATO Model?
    Note 755135.1- How to update Unit Price using API?
    Note 1128445.1- Need Script To Apply Hold Via Oe_order_pub.Process_order in R12

    == Additional Information ==

    The processing Constraint setup has a direct influence on the way the process order API works. For e.g. The processing constraint on reducing quantity on a booked order line, will results in an error if the Update operation is attempted via the Process Order API. 

    RELATED DOCUMENTS
    -----------------
    Oracle Order Management Suite Implementation Manual, Volumes 1 & 2 Release 11i
    Oracle Order Management Users Guide Release 11i
    Oracle Order Management Suite API's and Open Interfaces Manual Volume 1, Release 11i
    Note 121052.1

    References

    NOTE:743389.1 - Order Management Testcase Repository Library

    显示相关信息 相关的


    产品
    • Oracle E-Business Suite > Order Management > Order Management > Oracle Order Management
    关键字
    OE_ORDER_HEADERS_ALL; ORDER LINES; PROCESSING CONSTRAINTS; WAREHOUSES; RESERVE ORDERS

    返回页首返回页首

             

                成长

           /      |     \

        学习   总结   分享

    QQ交流群:122230156

  • 相关阅读:
    Can't connect to local MySQL server through socket '/tmp/mysql.sock'
    reversePairs
    sort
    分割数组的最小值
    decode string
    276. 栅栏涂色
    133. Clone Graph
    Palindromic string
    爬楼梯
    正则匹配
  • 原文地址:https://www.cnblogs.com/benio/p/1929892.html
Copyright © 2011-2022 走看看