Update delivery details using WSH_DELIVERY_DETAILS_PUB.Update__Attributes API
The “WSH_DELIVERY_DETAILS_PUB.Update_Shipping_Attributes” API enables to modify data in wsh_delivery_details. In this specific example we have used this API to update the shipped_quantity field in the wsh_delivery_details table to ship all quantities.
Specific Parameters:
- p_changed_attributes=>Attributes of ChangedAttributesTabType that are to be updated.
- p_source_code => Code for source system which updates wsh_delivery_details table(always set to OE)
In order to specify in your logic about backorder or staged quantities you can use the following logic
Ship all quantities
changed_attributes(1).delivery_detail_id := <<Enter the detail id>>;
changed_attributes(1).shipped_quantity := <<Enter the full quantity to be shipped>>;
Back order all quantities
changed_attributes(2).delivery_detail_id := <<Enter the detail id>>;
changed_attributes(2).shipped_quantity := 0;
changed_attributes(2).cycle_count_quantity := <<Enter the full quantity to be shipped>>;
Stage all the quantities
changed_attributes(3).delivery_detail_id := <<Enter the full quantity to be shipped>>;
changed_attributes(3).shipped_quantity := 0;
changed_attributes(3).cycle_count_quantity := 0;
Sample code to Update the Delivery Details:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
DECLARE
--Standard Parameters.
p_api_version NUMBER;
init_msg_list VARCHAR2(30);
p_commit VARCHAR2(30);
--Parameters for WSH_DELIVERY_DETAILS_PUB.update_shipping_attributes.
source_code VARCHAR2(15);
changed_attributes WSH_DELIVERY_DETAILS_PUB.ChangedAttributeTabType;
--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 updating delivery details to ship all quantities in the
first line, stage everything in the second line, and back order all in
the third. It is assumed that the user knows the quantities in each
line.
*/
source_code := 'OE'; -- The only source code that should be used by the API
changed_attributes(1).delivery_detail_id := 3964468; -- Ship All quantities in this detail.
changed_attributes(1).shipped_quantity := 2; -- update the shipped quantity to 2
--Call to WSH_DELIVERY_DETAILS_PUB.Update_Shipping_Attributes.
WSH_DELIVERY_DETAILS_PUB.Update_Shipping_Attributes(
p_api_version_number => 1.0,
p_init_msg_list => init_msg_list,
p_commit => p_commit,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_changed_attributes => changed_attributes,
p_source_code => source_code);
IF (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS)
THEN
RAISE vApiErrorException;
ELSE
dbms_output.put_line('The shipped quantity is updated with '||changed_attributes(1).shipped_quantity|| ' for the delivery detail '||changed_attributes(1).delivery_detail_id );
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;
/
|
0 comments