Category Archives: Scripts

Creating Move Order using INV_PICK_WAVE_PICK_CONFIRM_PUB.PICK_CONFIRM

Creating Move Order using API’s:

Creating Move Order using INV_PICK_WAVE_PICK_CONFIRM API’s:

Sample Script to Populate data into MTL_MATERIAL_TRANSACTIONS_TEMP and serial numbers temp tables: Continue reading

  

Related posts:

Pick Release the Sales Order using WSH_DELIVERIES_PUB.Delivery_Action

Pick Release a Delivery using wsh_deliveries_pub.delivery_action API:

Once the Delivery Details are assigned to a Delivery the Next Step is to Pick Release the Delivery.

Sample code to Pick Release the Delivery:

 
DECLARE
    -- Standard Parameters.    
    p_api_version             NUMBER;          
    p_init_msg_list           VARCHAR2(30);    
    p_commit                  VARCHAR2(30);

    --Parameters for WSH_DELIVERIES_PUB.Delivery_Action.    
    p_action_code             VARCHAR2(15);  
    p_delivery_id             NUMBER;        
    p_delivery_name           VARCHAR2(30); 
    p_asg_trip_id             NUMBER;
    p_asg_trip_name           VARCHAR2(30);
    p_asg_pickup_stop_id      NUMBER;
    p_asg_pickup_loc_id       NUMBER;
    p_asg_pickup_loc_code     VARCHAR2(30);
    p_asg_pickup_arr_date     DATE;
    p_asg_pickup_dep_date     DATE;
    p_asg_dropoff_stop_id     NUMBER;
    p_asg_dropoff_loc_id      NUMBER;
    p_asg_dropoff_loc_code    VARCHAR2(30);
    p_asg_dropoff_arr_date    DATE;
    p_asg_dropoff_dep_date    DATE;
    p_sc_action_flag          VARCHAR2(10);
    p_sc_close_trip_flag      VARCHAR2(10);
    p_sc_create_bol_flag      VARCHAR2(10);
    p_sc_stage_del_flag       VARCHAR2(10);
    p_sc_trip_ship_method     VARCHAR2(30);
    p_sc_actual_dep_date      VARCHAR2(30);
    p_sc_report_set_id        NUMBER;
    p_sc_report_set_name      VARCHAR2(60);
    p_wv_override_flag        VARCHAR2(10);
    x_trip_id                 VARCHAR2(30);
    x_trip_name               VARCHAR2(30);

    -- outparameters   
    x_return_status           VARCHAR2(10);    
    x_msg_count               NUMBER;          
    x_msg_data                VARCHAR2(2000);  
    x_msg_details             VARCHAR2(3000);
    x_msg_summary             VARCHAR2(3000);

    -- Handle exceptions   
    vApiErrorException        EXCEPTION;

BEGIN

    -- Initialize return status    
    x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;

    -- Call this procedure to initialize applications parameters.     
    FND_GLOBAL.APPS_INITIALIZE  (
									  user_id      => 1318
								   ,  resp_id      => 21623
								   ,  resp_appl_id => 660
								);

    -- Values for WSH_DELIVERIES_PUB.delivery_action   
    p_action_code := 'PICK-RELEASE';  -- Releases Lines related to a delivery
    p_delivery_id := 3773373;         -- delivery ID that action is performed on

    -- Call to WSH_DELIVERIES_PUB.Delivery_Action.   
    WSH_DELIVERIES_PUB.Delivery_Action  (
											p_api_version_number           => 1.0,
											p_init_msg_list                => P_init_msg_list,
											x_return_status                => x_return_status,
											x_msg_count                    => x_msg_count,
											x_msg_data                     => x_msg_data,
											p_action_code                  => p_action_code,
											p_delivery_id                  => p_delivery_id,
											p_delivery_name                => p_delivery_name,
											p_asg_trip_id                  => p_asg_trip_id,
											p_asg_trip_name                => p_asg_trip_name,
											p_asg_pickup_stop_id           => p_asg_pickup_stop_id,
											p_asg_pickup_loc_id            => p_asg_pickup_loc_id,
											p_asg_pickup_loc_code          => p_asg_pickup_loc_code,
											p_asg_pickup_arr_date          => p_asg_pickup_arr_date,
											p_asg_pickup_dep_date          => p_asg_pickup_dep_date,
											p_asg_dropoff_stop_id          => p_asg_dropoff_stop_id,
											p_asg_dropoff_loc_id           => p_asg_dropoff_loc_id,
											p_asg_dropoff_loc_code         => p_asg_dropoff_loc_code,
											p_asg_dropoff_arr_date         => p_asg_dropoff_arr_date,
											p_asg_dropoff_dep_date         => p_asg_dropoff_dep_date,
											p_sc_action_flag               => p_sc_action_flag,
											p_sc_close_trip_flag           => p_sc_close_trip_flag,
											p_sc_create_bol_flag           => p_sc_create_bol_flag,
											p_sc_stage_del_flag            => p_sc_stage_del_flag,
											p_sc_trip_ship_method          => p_sc_trip_ship_method,
											p_sc_actual_dep_date           => p_sc_actual_dep_date,
											p_sc_report_set_id             => p_sc_report_set_id,
											p_sc_report_set_name           => p_sc_report_set_name,
											p_wv_override_flag             => p_wv_override_flag,
											x_trip_id                      => x_trip_id,
											x_trip_name                    => x_trip_name
										);

        IF (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) 
	    THEN
            RAISE vApiErrorException;
        ELSE
            DBMS_OUTPUT.PUT_LINE('The delivery '||p_delivery_id || ' is successfully pick released');
        END IF;
EXCEPTION
    WHEN vApiErrorException 
	THEN
        WSH_UTIL_CORE.get_messages('Y', x_msg_summary, x_msg_details,x_msg_count);
        IF x_msg_count > 1 
		THEN
            x_msg_data := x_msg_summary || x_msg_details;
            DBMS_OUTPUT.PUT_LINE('Message Data : '||x_msg_data);
        ELSE
            x_msg_data := x_msg_summary;
            DBMS_OUTPUT.PUT_LINE('Message Data : '||x_msg_data);
        END IF;
END;
/

Result:
The delivery 3773373 is successfully pick released

Test the API:

 select * from wsh_new_deliveries where delivery_id = 3773373;
 Here the STATUS_CODE will be 'OP'

 select RELEASED_STATUS from WSH_DELIVERY_DETAILS where delivery_detail_id = 3963468;

 

  • MTL_TXN_REQUEST_HEADERS
  • MTL_TXN_REQUEST_LINES (LINE_ID goes as TXN_SOURCE_LINE_ID)
  • (move order tables. Here request is generated to move item from Source (RM or FG) sub-inventory to staging sub-inventory)
  • MTL_MATERIAL_TRANSACTIONS_TEMP (link to above tables through MOVE_ORDER_HEADER_ID/LINE_ID, this table holds the record temporally)
  • MTL_SERIAL_NUMBERS_TEMP (if item is serial controlled at receipt then record goes in this table)
  • MTL_SERIAL_NUMBERS (enter value in GROUP_MARK_ID )

In shipping transaction form order status remains “Released to Warehouse” and all the material still remains in source sub-inventory. We need to do Move Order Transaction for this order. Till this no material transaction has been posted to MTL_MATERIAL_TRANSACTIONS.

Below post will give you the details about the pick release status
Instance: 11i or R12
Table: WSH_DELIVERY_DETAILS
Column: RELEASED_STATUS
Possible Values:
B: Backordered- Line failed to be allocated in Inventory
C: Shipped -Line has been shipped
D: Cancelled -Line is Cancelled
N: Not Ready for Release -Line is not ready to be released
R: Ready to Release: Line is ready to be released
S: Released to Warehouse: Line has been released to Inventory for processing
X: Not Applicable- Line is not applicable for Pick Release
Y: Staged- Line has been picked and staged by Inventory
Delivery line statuses in detail
Not Applicable (Code X)  
The delivery line can be invoiced but non-shippable, for example, a service line or a warranty line.
Not Ready for Release (Code N)
 The delivery line is not eligible for pick release. This happens when the order line is manually imported into Oracle Shipping Execution using the Import Delivery Line concurrent process or the corresponding order line has not reached the Awaiting Shipping workflow activity.
Ready for Release (Code R)
  The delivery line is eligible for pick release.  Occurs when the order line has reached the Awaiting Shipping workflow activity (it is booked, scheduled, and in Oracle Shipping Execution).
Submitted to Warehouse (Code S)
Pick release has processed the delivery line and has:
1.       Created move order headers and lines.
2.       Found available quantity and created inventory allocations.
3.       Not pick confirmed. If you are using auto-pick confirm, it changes release status to Staged. If you are not using auto-pick confirm and want to progress the delivery lines, navigate to Oracle Inventory Move Order Transaction window and perform manual pick confirm.
Staged (Code Y)
 The delivery line is pick confirmed; inventory is transferred from storage sub-inventory to staging sub-inventory.  It remains staged until ship confirm.
Backordered (Code B)
Some of the circumstances that can causes this status are listed below
a. Pick release has processed the delivery line and cannot find the entire quantity.  This typically occurs when the Oracle Inventory indicates that there is not enough material (either because there is not enough material or because the inventory balance is incorrect).
b. At ship confirm, you: Enter Shipped Quantity that is less than Original Requested Quantity Backorder the entire delivery quantity transfer a reservation to cycle count.
c. This typically occurs when the material that you want to ship:
1.       Has become unavailable, for example, damaged, between picking and shipping.
2.       Is available and you backorder material for specific business reasons. For example, all available material has been allocated to a specific customer when you find out additional supply for other orders will be delayed.
Shipped (Code C)
  The delivery line’s delivery is ship confirmed and posted as in-transit, OM Interface and Inventory Interface have processed, and the trip is closed.
Cancelled (Code D)

The order line that the delivery line supports is cancelled.

  

Related posts:

Assign Delivery Details to Delivery

Assigning Delivery Details to Delivery

Based on the delivery details assigned to the sales Order find the delivery detail id. Now we are trying to attach the Delivery Details to the New delivery which is created.

The delivery detail can be assigned to the newly created delivery by using the public API “WSH_DELIVERY_DETAILS_PUB. Detail_to_Delivery”. Continue reading

  

Related posts:

Create a New Delivery for an Existing Order

Create a New delivery for an existing Sales Order

We have created a Sales Order from Back End using the Sales Order API in Booked Status. The order Number Is: 66401. When an Order is in Booked status a delivery detail’s are created and which can be viewed from Shipping –> Transactions form from Front End.

Find out the existing Ship To Location Id, ship from location id, Organization id using the following Script:

SELECT  delivery_detail_id,
	source_code,
	source_header_id,
	source_line_id,
	organization_id,
	cust_po_number,
	ship_from_location_id,
	ship_to_location_id ,
        customer_id   ,
        freight_terms_code,
        fob_code,
        weight_uom_code,
        volume_uom_code,
        currency_code
  FROM wsh_delivery_details 
 WHERE source_header_id = 198316;

Result:
DELIVERY_DETAIL_ID,SOURCE_CODE,SOURCE_HEADER_ID,SOURCE_LINE_ID,ORGANIZATION_ID,CUST_PO_NUMBER,SHIP_FROM_LOCATION_ID,SHIP_TO_LOCATION_ID,CUSTOMER_ID,FREIGHT_TERMS_CODE,FOB_CODE,WEIGHT_UOM_CODE,VOLUME_UOM_CODE,CURRENCY_CODE
3963468,OE,198316,394280,204,BookTestAPI-1,20795,16879,5371,Due,Destination,Lbs,FT3,USD

 

Sample script to create Deliveries:

DECLARE
    -- Standard Parameters.   
    pApiVersion              NUMBER := 1.0;   
    pInitMsgList             VARCHAR2(30);

    -- Sepcific Parameters for WSH_DELIVERIES_PUB.create_update_delivery
    pActionCode              VARCHAR2(15);                             
    xDeliveryId              NUMBER;
    pDeliveryInfo            WSH_DELIVERIES_PUB.DELIVERY_PUB_REC_TYPE; 
    pDeliveryName            VARCHAR2(30);

    -- out parameters
    xReturnStatus            VARCHAR2(10);
    xMsgCount                NUMBER;
    xMsgData                 VARCHAR2(2000);
    xMsgDetails              VARCHAR2(3000);
    xMsgSummary              VARCHAR2(3000);

   -- Handle exceptions
   vFailApiException         EXCEPTION;
BEGIN
    -- Initialize return status   
    xReturnStatus := WSH_UTIL_CORE.G_RET_STS_SUCCESS;

    -- Call this procedure to initialize applications parameters.
    FND_GLOBAL.APPS_INITIALIZE(
       user_id      => 1318
    ,  resp_id      => 21623
    ,  resp_appl_id => 660);

    -- Create a new delivery for the following

    pDeliveryInfo.name                            := 'AOATestDelvryAPI-1'; -- Pass delivery name 
    pDeliveryInfo.organization_id                 := 204;      -- Pass Organization ID
    pDeliveryInfo.initial_pickup_location_id      := 20795;      -- Pass the Pick up location ID 
    pDeliveryInfo.ultimate_dropoff_location_id    := 16879;     -- pass the Drop off location ID 
    pDeliveryInfo.ship_method_code                := 'DHL';    -- pass Ship Method
    pDeliveryInfo.CUSTOMER_ID                     := 5371;
    pDeliveryInfo.intmed_ship_to_location_id      := 16879;
    pDeliveryInfo.freight_terms_code              := 'Due';
    pDeliveryInfo.fob_code := 'Destination';
    pDeliveryInfo.weight_uom_code := 'Lbs';
    pDeliveryInfo.volume_uom_code := 'FT3';
    pDeliveryInfo.ultimate_dropoff_date := SYSDATE;
    pDeliveryInfo.initial_pickup_date   := SYSDATE;
    pActionCode                                   := 'CREATE'; -- Action Code 

    -- Call to WSH_DELIVERIES_PUB.create_update_delivery
     WSH_DELIVERIES_PUB.create_update_delivery   (
	 											  p_api_version_number  => pApiVersion,
	 											  p_init_msg_list       => pInitMsgList,
	 											  x_return_status       => xReturnStatus,
	 											  x_msg_count           => xMsgCount,
	 											  x_msg_data            => xMsgData,
	 											  p_action_code         => pActionCode,
	 											  p_delivery_info       => pDeliveryInfo,
	 											  p_delivery_name       => pDeliveryName,
	 											  x_delivery_id         => xDeliveryId,
	 											  x_name                => pDeliveryName 
	 										    );

    -- If the return status is not success(S) then raise exception

    IF (xReturnStatus <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) 
    THEN
       RAISE vFailApiException;
    ELSE 
       DBMS_OUTPUT.PUT_LINE('New Delivery ID  : '||xDeliveryId);
       DBMS_OUTPUT.PUT_LINE('New Delivery Name: '||pDeliveryName);
       COMMIT;
    END IF;

EXCEPTION
    WHEN vFailApiException 
    THEN
        WSH_UTIL_CORE.get_messages('Y', xMsgSummary, xMsgDetails,xMsgCount);
        IF xMsgCount > 1 
		THEN
            xMsgData := xMsgSummary || xMsgDetails;
            DBMS_OUTPUT.PUT_LINE('Message Data : '||xMsgData);
        ELSE
            xMsgData := xMsgSummary;
            DBMS_OUTPUT.PUT_LINE('Message Data : '||xMsgData);
        END IF;
END;
/

Result:
New Delivery ID  : 3773373
New Delivery Name: AOATestDelvryAPI-1

Once the delivery is Created look at wsh_new_deliveries for this delivery_id:

 
SELECT *
  FROM wsh_new_deliveries 
 WHERE delivery_id = 3772376;

 

  

Related posts:

Create Delivery API

Creating a New Delivery:

Sample Script to Create a New Delivery with respect to its Location:

DECLARE
    -- Standard Parameters.   
    pApiVersion              NUMBER := 1.0;   
    pInitMsgList             VARCHAR2(30);

    -- Sepcific Parameters for WSH_DELIVERIES_PUB.create_update_delivery
    pActionCode              VARCHAR2(15);                             
    xDeliveryId              NUMBER;
    pDeliveryInfo            WSH_DELIVERIES_PUB.DELIVERY_PUB_REC_TYPE; 
    pDeliveryName            VARCHAR2(30);

    -- out parameters
    xReturnStatus            VARCHAR2(10);
    xMsgCount                NUMBER;
    xMsgData                 VARCHAR2(2000);
    xMsgDetails              VARCHAR2(3000);
    xMsgSummary              VARCHAR2(3000);

   -- Handle exceptions
   vFailApiException         EXCEPTION;
BEGIN
    -- Initialize return status   
    xReturnStatus := WSH_UTIL_CORE.G_RET_STS_SUCCESS;

    -- Call this procedure to initialize applications parameters.
    FND_GLOBAL.APPS_INITIALIZE(
       user_id      => 1318
    ,  resp_id      => 21623
    ,  resp_appl_id => 660);

    -- Create a new delivery for the following

    pDeliveryInfo.name                            := 'AOATest-001'; -- Pass delivery name 
    pDeliveryInfo.organization_id                 := 207;      -- Pass Organization ID
    pDeliveryInfo.initial_pickup_location_id      := 207;      -- Pass the Pick up location ID 
    pDeliveryInfo.ultimate_dropoff_location_id    := 1091;     -- pass the Drop off location ID 
    pDeliveryInfo.ship_method_code                := 'DHL';    -- pass Ship Method
    pActionCode                                   := 'CREATE'; -- Action Code 

    -- Call to WSH_DELIVERIES_PUB.create_update_delivery
     WSH_DELIVERIES_PUB.create_update_delivery   (
	 											  p_api_version_number  => pApiVersion,
	 											  p_init_msg_list       => pInitMsgList,
	 											  x_return_status       => xReturnStatus,
	 											  x_msg_count           => xMsgCount,
	 											  x_msg_data            => xMsgData,
	 											  p_action_code         => pActionCode,
	 											  p_delivery_info       => pDeliveryInfo,
	 											  p_delivery_name       => pDeliveryName,
	 											  x_delivery_id         => xDeliveryId,
	 											  x_name                => pDeliveryName 
	 										    );

    -- If the return status is not success(S) then raise exception

    IF (xReturnStatus <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) 
    THEN
       RAISE vFailApiException;
    ELSE 
       DBMS_OUTPUT.PUT_LINE('New Delivery ID  : '||xDeliveryId);
       DBMS_OUTPUT.PUT_LINE('New Delivery Name: '||pDeliveryName);
       COMMIT;
    END IF;

EXCEPTION
    WHEN vFailApiException 
    THEN
        WSH_UTIL_CORE.get_messages('Y', xMsgSummary, xMsgDetails,xMsgCount);
        IF xMsgCount > 1 
		THEN
            xMsgData := xMsgSummary || xMsgDetails;
            DBMS_OUTPUT.PUT_LINE('Message Data : '||xMsgData);
        ELSE
            xMsgData := xMsgSummary;
            DBMS_OUTPUT.PUT_LINE('Message Data : '||xMsgData);
        END IF;
END;
/

Result:
New Delivery ID : 3772374
New Delivery Name: AOATest-001

Script to verify the API:

SELECT * 
  FROM wsh_new_deliveries 
 WHERE delivery_id = 3772374;

 

 

  

Related posts: