0% found this document useful (0 votes)
84 views3 pages

Pick Release

This procedure performs several steps: 1. It initializes some global variables and contexts. 2. It calls the Autocreate_Deliveries API to automatically create deliveries for a sales order, checking the status and output. 3. It selects a delivery ID and name from the created delivery and then calls the delivery_action API to perform a pick release action on that delivery. 4. It commits the changes and outputs the status and any exceptions.

Uploaded by

Kum A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views3 pages

Pick Release

This procedure performs several steps: 1. It initializes some global variables and contexts. 2. It calls the Autocreate_Deliveries API to automatically create deliveries for a sales order, checking the status and output. 3. It selects a delivery ID and name from the created delivery and then calls the delivery_action API to perform a pick release action on that delivery. 4. It commits the changes and outputs the status and any exceptions.

Uploaded by

Kum A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

create or replace procedure pickrelease as

x_Api_Status VARCHAR2(30);
l_Msg_Count NUMBER;
l_Msg_Data VARCHAR2(4000);
l_Delivery_Details_Tbl Wsh_Util_Core.Id_Tab_Type;
l_Deliveries_Tbl Wsh_Util_Core.Id_Tab_Type;
i number :=0;
k NUMBER;
l_Rule_Id number;
x_return_status VARCHAR2(2);
l_return_status VARCHAR2 (2);
l_Api_Version NUMBER := 1.0;
--x_Api_Status VARCHAR2(30);
--l_msg_count NUMBER;
--l_msg_data VARCHAR2(1000);
l_Batch_Id Wsh_Delivery_Details.Batch_Id%TYPE;
l_Pick_Release_Request_Id NUMBER;
l_Batch_Rec Wsh_Picking_Batches_Pub.Batch_Info_Rec;
l_trip_id VARCHAR2 (30);
l_trip_name VARCHAR2 (30);

l_Wait_Value BOOLEAN;
l_Phase VARCHAR2(50);
l_Status VARCHAR2(50);
l_Dev_Status VARCHAR2(50);
l_Dev_Phase VARCHAR2(50);
l_Message VARCHAR2(100);

l_delivery_id number;
l_delivery_name VARCHAR2(100);

begin
Dbms_Output.Enable(1000000);
Mo_Global.Init('ONT');
Fnd_Global.Apps_Initialize(82837,59825,660);

/*Oe_Msg_Pub.Initialize;
Oe_Debug_Pub.Initialize;
Mo_Global.Set_Org_Context(7025,
NULL,
'ONT');
Fnd_Global.Set_Nls_Context('AMERICAN');
Mo_Global.Set_Policy_Context('S',7025);*/

-- Mandatory initialization for R12

mo_global.set_policy_context ('S', 7205);


mo_global.init ('ONT');

begin
SELECT Wpr.Picking_Rule_Id
INTO l_Rule_Id
FROM Wsh_Picking_Rules Wpr
WHERE Wpr.Name = 'SPWR Default';
end;

i := i + 1;
l_Delivery_Details_Tbl(i) :=12963403; -- 12963393;
--l_Deliveries_Tbl(i) :=12963394;

dbms_output.put_line('Calling Autocreate_Deliveries API');

Wsh_Delivery_Details_Pub.Autocreate_Deliveries(p_Api_Version_Number =>
1.0,
p_Init_Msg_List =>
Fnd_Api.g_True,
p_Commit =>
Fnd_Api.g_True,
x_Return_Status =>
x_Api_Status,
x_Msg_Count =>
l_Msg_Count,
x_Msg_Data =>
l_Msg_Data,
p_Line_Rows =>
l_Delivery_Details_Tbl,
x_Del_Rows =>
l_Deliveries_Tbl);

dbms_output.put_line('Auto Create Status for SO:- 73200143 is ' ||


x_Api_Status ||
' # of deliveries created ' || l_Deliveries_Tbl.Count);

dbms_output.put_line('wsh_delivery_details_pub.autocreate_deliveries
x_return_status '||x_Api_Status);
IF ( x_return_status <> wsh_util_core.g_ret_sts_success )
THEN
dbms_output.put_line('Auto create delivery Action is failed');
FOR i IN 1..l_Msg_Count LOOP
fnd_msg_pub.get( p_msg_index => i,
p_encoded => 'F',
p_data => l_Msg_Data,
p_msg_index_out => k );
l_msg_data := l_msg_data || ':' || l_Msg_Data;
END LOOP;
dbms_output.put_line('Auto create delivery Action is failed - '||
substr(l_msg_data,1,2000));

ELSE
dbms_output.put_line('Auto Create Delivery Action has successfully
completed');
END IF;

select delivery_id into l_delivery_id


from wsh_delivery_assignments where DELIVERY_DETAIL_ID = 12963403;

select name into l_delivery_name from wsh_new_deliveries where delivery_id


= l_delivery_id;

begin

dbms_output.put_line('Calling wsh_deliveries_pub.delivery_action');

wsh_deliveries_pub.delivery_action (p_api_version_number => 1.0,


p_init_msg_list => NULL,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_action_code => 'PICK-RELEASE',
p_delivery_id => l_delivery_id, --p_delivery_id,
p_delivery_name => l_delivery_name, --p_delivery_name,
p_asg_trip_id => NULL,
p_asg_trip_name => NULL,
p_asg_pickup_stop_id => NULL,
p_asg_pickup_loc_id => NULL,
p_asg_pickup_stop_seq => NULL,
p_asg_pickup_loc_code => NULL,
p_asg_pickup_arr_date => NULL,
p_asg_pickup_dep_date => NULL,
p_asg_dropoff_stop_id => NULL,
p_asg_dropoff_loc_id => NULL,
p_asg_dropoff_stop_seq => NULL,
p_asg_dropoff_loc_code => NULL,
p_asg_dropoff_arr_date => NULL,
p_asg_dropoff_dep_date => NULL,
p_sc_action_flag => 'S',
p_sc_intransit_flag => 'N',
p_sc_close_trip_flag => 'N',
p_sc_create_bol_flag => 'N',
p_sc_stage_del_flag => 'Y',
p_sc_trip_ship_method => NULL,
p_sc_actual_dep_date => NULL,
p_sc_report_set_id => NULL,
p_sc_report_set_name => NULL,
p_sc_defer_interface_flag => 'Y',
p_sc_send_945_flag => NULL,
p_sc_rule_id => NULL,
p_sc_rule_name => NULL,
p_wv_override_flag => 'N',
x_trip_id => l_trip_id,
x_trip_name => l_trip_name
);

commit;

dbms_output.put_line('Pick Release return_status: '||l_return_status);


EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('Pick Release User-Defined Exception '||'-'||
dbms_utility.format_error_backtrace);

WHEN OTHERS THEN


dbms_output.put_line('Pick Release Main Exception '||
substr(SQLERRM,1,50)||'-'||dbms_utility.format_error_backtrace);

END;

end;
/

You might also like