DECLARE
vApiVersion NUMBER := 1.0;
vInitMsglist VARCHAR2(30);
vCommit VARCHAR2(30);
vActionCode VARCHAR2(15) := 'CREATE';
xDeliveryId wsh_new_deliveries.delivery_id%TYPE;
vDeliveryInfo wsh_deliveries_pub.delivery_pub_rec_type;
xDeliveryName wsh_new_deliveries.name%TYPE;
-- out parameters
xReturnStatus VARCHAR2(1);
xMsgCount NUMBER;
xMsgData VARCHAR2(2000);
xMsgDetails VARCHAR2(2000);
xMsgSummary VARCHAR2(2000);
-- Handle exceptions
eApiFail EXCEPTION;
BEGIN
xReturnStatus := wsh_util_core.g_ret_sts_success;
-- Call this procedure to initialize applications parameters.
fnd_global.apps_initialize(user_id => 00, resp_id => 00,resp_appl_id => 00);
-- Create a new delivery for the following
--vDeliveryInfo.name := 'XX';
vDeliveryInfo.organization_id := 00;
vDeliveryInfo.initial_pickup_location_id := 00;
vDeliveryInfo.ultimate_dropoff_location_id := 00;
vDeliveryInfo.ship_method_code := 'XX';
-- Call to wsh_deliveries_pub.create_update_delivery
wsh_deliveries_pub.create_update_delivery(p_api_version_number => vApiVersion,
p_init_msg_list => vInitMsglist,
x_return_status => xReturnStatus,
x_msg_count => xMsgCount,
x_msg_data => xMsgData,
p_action_code => vActionCode,
p_delivery_info => vDeliveryInfo,
p_delivery_name => xDeliveryName,
x_delivery_id => xDeliveryId,
x_name => xDeliveryName);
-- If the return status is not success(S) then raise exception
IF (xReturnStatus <> wsh_util_core.g_ret_sts_success) THEN
RAISE eApiFail;
ELSE
dbms_output.put_line('Delivery ID : ' || xDeliveryId);
dbms_output.put_line('Delivery Name: ' || xDeliveryName);
END IF;
EXCEPTION
WHEN eApiFail THEN
wsh_util_core.get_messages('Y', xMsgSummary, xMsgDetails,
xMsgCount);
IF xMsgData > 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;
沒有留言:
張貼留言