How to auto create trip in oracle order management
1. Auto Create Trip In Oracle Order Management
What is a Trip?
A trip is an instance of a specific freight carried departing from particular location containing deliveries.
A trip is carrier specific and contains at least 2 stops such as the pick-up stop and drop-off stop. Trips can
be created automatically or manually…
What is a Stop?
A stop is a point along the route of a trip where goods are either picked up, dropped off or both..
Consider the following Business Scenario:
A sales order is placed for two items: a desktop CPU and a monitor. The order lines are booked and
Scheduled in Order Management. The inventory for the desktop CPU resides in the M1 inventory
Organization and the Monitor resides in V1 inventory organization. The objective is to create a plan that
enables the shipments of the individual items to be made from their respective inventory organizations,
merge or consolidate at an intermediate distribution center location, and deliver to the customer’s
ultimate ship to location as a single shipment….
Once the order is booked, the order lines are imported into Shipping Execution where the
2. Transportation Planner has visibility to the lines. At this point, the planner creates Trip 1
(Consisting of Carrier and vehicle information) for the desktop CPU located in Warehouse 1 in
Seattle, WA. The key element depicting the Trip is the ship method.
The creation of the Trip can be done in a variety of ways depending on your business process.
1) Auto create Trip
When a Trip is created using the Auto create Trip functionality, 2 stops are created.
The first stop consists of the location where the shipment is picked up, (Ship From) and the second stop
is the location where the shipment is dropped off (Ship To). In the business scenario we’re describing, an
Intermediate stop needs to be defined and assigned to the Trip 1.
Lets create an auto trip from the applications:
Log on to Applications and navigate to the responsibility : Order Management Super User, Vision
Operations (USA):
Double Click on Sales Orders:
Enter the Customer Information and the rest of the information should be defaulted automatically,click
on the Line Items Tab:
3. Enter the Line Information and then click on ‘Book Order’:
4. You will see the following note click OK , make a note of the Order Number(in this case -69413) and
close the form:
Navigate to the Shipping Transactions Form:
5. Enter the Order Number ‘69413’ and press Tab and then click on ‘Find’:
You will see the two items you created on the sales order with their respective delivery detail id,now to
auto create the trip you need to select the lines (Edit->Select all) and from the Actions menu select the
‘Auto-create Trip’ option.
6. What happens when you select the action ‘Auto-create Trip’ and click on ‘Go’?
Oracle Shipping Execution creates the trips, creates the pick up and dropoff stops, autocreates the
deliveries, and assigns the deliveries to trips.
Verify the Action has completed by clicking on the Tabs ‘Path by Trip’ and ‘Path by Stop’,note the trip id:
7. You would see minimum two stops – One for Pickup and One for Drop off:
The Next step would be to Pick Release the Trip, inorder to do that query the trip from the Shipping
Transactions form:
8. Before selecting from the Actions ‘Launch Pick Release’,enter the Ship Method and save it…then click on
‘Go’:
The following Note is shown :
10. The next step is to ship confirm the Trip:
Navigate to the Shipping Transactions form and then select the Action ‘Ship Confirm’ and click on ‘Go’:
You should see the following note:
The Interface Trip Stop program runs in the backend and kicks off the other necessary programs like Bill
of Lading,Packing Slip Report,Commercial Invoice etc..You will see the status of the Trip change from
‘Open’ to ‘Closed’…
Technical Side Code:
We can do the same from backend by using the Oracle Public API :
procedure auto_create_trip( p_user_id IN NUMBER,
p_resp_id IN
NUMBER,
p_order_num IN
VARCHAR2,
p_resp_appl_id IN
NUMBER,
11. p_action IN
VARCHAR2,
p_org_id IN
NUMBER,
p_del_detail_id IN
NUMBER,
x_trip_number OUT
NUMBER,
x_del_trip_name OUT
VARCHAR2,
x_delivery_name OUT
NUMBER,
x_mast_status OUT
VARCHAR2,
x_mast_err_msg OUT
VARCHAR2
)
is
lv_return_status VARCHAR2 (1);
ln_msg_count NUMBER;
lv_msg_data VARCHAR2 (4000);
ln_trip_id NUMBER;
lv_trip_name VARCHAR2 (30);
l_line_tbl wsh_util_core.id_tab_type;
l_del_rows_tbl wsh_util_core.id_tab_type;
ln_line_no NUMBER := 0;
l_msg_index_out NUMBER;
p_master_trip VARCHAR2(30);
p_err_msg VARCHAR2(3000);
END_CHK_EXCEP exception;
cursor del_detid(p_order_num VARCHAR2)
is
select delivery_detail_id
from wsh_deliverables_v
where 1=1
and source_header_number=p_order_num;
begin
/* Setting the oracle applications context for the particular session */
fnd_global.apps_initialize (
user_id => p_user_id
, resp_id => p_resp_id
, resp_appl_id => p_resp_appl_id
, security_group_id => 0
);
--Initialize message list
FND_MSG_PUB.INITIALIZE;
/* Setting the org context for the particular session */
mo_global.set_policy_context('S',p_org_id);
mo_global.init ('ONT');
12. if p_del_detail_id is null then
for c_del_detid in del_detid(p_order_num)
loop
dbms_output.put_line('Calling the Oracle API with Delivery Detail Id : '
|| c_del_detid.delivery_detail_id);
ln_line_no := NVL (ln_line_no, 0) + 1;
dbms_output.put_line('Calling the Oracle API with Line Number: ' ||
ln_line_no);
l_line_tbl (ln_line_no) := c_del_detid.delivery_detail_id;
dbms_output.put_line('Calling the Oracle API for delivery detail id : '
|| l_line_tbl (ln_line_no) );
end loop;
else
l_line_tbl(1):=p_del_detail_id;
end if;
begin
wsh_delivery_details_pub.autocreate_del_trip (p_api_version_number
=> 1.0 ,
p_init_msg_list => fnd_api.g_false,
p_commit => fnd_api.g_false,
x_return_status => lv_return_status,
x_msg_count => ln_msg_count,
x_msg_data => lv_msg_data,
p_line_rows => l_line_tbl,
x_del_rows => l_del_rows_tbl,
x_trip_id => ln_trip_id,
x_trip_name => lv_trip_name
);
COMMIT;
exception
WHEN others THEN
dbms_output.put_line('Error From the Oracle API : ' || lv_msg_data);
x_mast_status := 'E';
x_mast_err_msg := SUBSTR(x_mast_err_msg ||' '||'Other Procedure
Errors.'||SQLERRM, 1, 240);
Raise END_CHK_EXCEP;
end;
IF NVL (ln_msg_count, 0) > 0
THEN
FOR j IN 1 .. ln_msg_count
13. LOOP
fnd_msg_pub.get (p_msg_index => j,
p_encoded => 'F',
p_data => lv_msg_data,
p_msg_index_out => l_msg_index_out
);
END LOOP;
END IF;
dbms_output.put_line('Status of API is : ' || lv_return_status || ' - '
|| lv_msg_data);
IF NVL (lv_return_status, 'X') = 'S'
THEN
x_del_trip_name := lv_trip_name;
x_trip_number := ln_trip_id;
x_delivery_name := l_del_rows_tbl(1);
x_mast_status := 'S';
x_mast_err_msg :='API Successfully Completed';
dbms_output.put_line('Trip Name = : ' || x_del_trip_name);
dbms_output.put_line('Trip Number is = : ' || x_trip_number);
dbms_output.put_line('Delivery Number is = : ' ||
x_delivery_name);
ELSIF NVL (lv_return_status, 'X') = 'E'
THEN
p_err_msg := lv_msg_data;
dbms_output.put_line('Error Due to : ' || p_err_msg);
x_mast_status := 'E';
x_mast_err_msg := 'Error Due to ' || ' - ' || p_err_msg || ' -
' || sqlerrm;
END IF;
COMMIT;
EXCEPTION
WHEN END_CHK_EXCEP THEN
x_mast_status := 'E';
x_mast_err_msg := 'Error Due to ' || ' - ' || x_mast_err_msg ||
' - ' || sqlerrm;
WHEN others THEN
x_mast_status := 'E';
x_mast_err_msg := SUBSTR(x_mast_err_msg ||' '||'Other
Procedure Errors.'||SQLERRM, 1, 240);
END auto_create_trip;