Maybe you can have a requirement to backorder an order line which is already pick confirmed but not yet ship confirmed.
In such case you can use the below code to achieve it
Cheers
A
In such case you can use the below code to achieve it
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);
p_sc_defer_interface_flag VARCHAR2(1);
x_trip_id
VARCHAR2(30);
x_trip_name
VARCHAR2(30);
--out parameters
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 Ship Confirming the delivery
p_action_code
:= 'CONFIRM'; -- The action code for ship
confirm
p_delivery_id
:= 3840837; -- The delivery that needs to be confirmed
p_sc_action_flag
:= 'B'; -- Backorder quantity.
p_sc_close_trip_flag := 'Y'; -- Close the trip after ship confirm
p_sc_trip_ship_method := 'DHL'; --
The ship method code
p_sc_defer_interface_flag := 'N';
-- 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,
p_sc_defer_interface_flag => p_sc_defer_interface_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 confirm action on the delivery '||p_delivery_id||' is
successful');
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;
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE('Unexpected Error: '||SQLERRM);
END;
Cheers
A
Thanks Anand for sharing API for backorder line after pick confirm. I checked this and is working fine.
ReplyDeleteBut i have used action_flag := 'C'.
Thanks,
Shashikant
Thank you Anand ji, it is of gr8 help
ReplyDeleteyou can create a procedure to run from concurrent prog by using below
ReplyDeleteFND_GLOBAL.APPS_INITIALIZE(
user_id =>FND_GLOBAL.USER_ID
, resp_id =>FND_GLOBAL.RESP_ID
, resp_appl_id =>FND_GLOBAL.RESP_APPL_ID);
FND_FILE.PUT_LINE(FND_FILE.LOG,'USER_NAME'||'-'||FND_GLOBAL.USER_ID ||'AND RESPONSIBILITY ID'||FND_GLOBAL.RESP_ID ||'AND APPLICATION ID IS '||FND_GLOBAL.RESP_APPL_ID ||'p_sc_trip_ship_method'||p_sc_trip_ship_method);
-- Values for Ship Confirming the delivery
p_action_code := 'CONFIRM'; -- The action code for ship confirm
p_delivery_name :=l_delivery_id; -- The delivery that needs to be confirmed
p_sc_action_flag := 'B'; -- Backorder quantity.
p_sc_close_trip_flag := 'Y'; -- Close the trip after ship confirm
-- p_sc_trip_ship_method := 'DHL'; -- The ship method code
p_sc_defer_interface_flag := 'N';
-- 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 => l_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,
p_sc_defer_interface_flag => p_sc_defer_interface_flag ,
x_trip_id => x_trip_id,
x_trip_name => x_trip_name);
COMMIT;