1 PACKAGE BODY WSH_INBOUND_SHIP_REQUEST_PKG as
2 /* $Header: WSHINSRB.pls 115.6 2002/11/12 01:42:29 nparikh ship $ */
3
4 --
5 G_PKG_NAME CONSTANT VARCHAR2(50) := 'WSH_INBOUND_SHIP_REQUEST_PKG';
6 --
7 PROCEDURE Process_Ship_Request(P_Item_Type IN VARCHAR2,
8 P_Item_Key IN VARCHAR2,
9 P_Action_Type IN VARCHAR2,
10 P_Delivery_Interface_ID IN NUMBER,
11 X_Delivery_ID OUT NOCOPY NUMBER,
12 X_Return_Status OUT NOCOPY VARCHAR2) IS
13
14 INVALID_INTERFACE_ID EXCEPTION;
15 INVALID_ACTION_TYPE EXCEPTION;
16 Delivery_Int_Wrapper_Failed EXCEPTION;
17 Check_Cancel_Allowed_WF_Failed EXCEPTION;
18 Before_Populating_BT_Others EXCEPTION;
19 before_Check_Cancel_WF_others EXCEPTION;
20 T_Return_Status VARCHAR2(1);
21 --
22 l_debug_on BOOLEAN;
23 --
24 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'PROCESS_SHIP_REQUEST';
25 --
26 Begin
27 --
28 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
29 --
30 IF l_debug_on IS NULL
31 THEN
32 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
33 END IF;
34 --
35 IF l_debug_on THEN
36 wsh_debug_sv.push(l_module_name);
37 wsh_debug_sv.log (l_module_name,'ITEM_TYPE', P_Item_Type);
38 wsh_debug_sv.log (l_module_name,'DELIVERY INTERFACE ID', P_Delivery_Interface_ID);
39 wsh_debug_sv.log (l_module_name,'ACTION TYPE', P_Action_Type);
40 END IF;
41
42 IF ((P_Action_Type IS NULL) OR (P_Action_Type NOT IN ('A','D'))) Then
43 Raise INVALID_ACTION_TYPE;
44 End IF;
45
46 IF (P_Delivery_Interface_ID is Not Null) Then
47
48 IF (P_Action_Type = 'A') Then
49 -- Added the following statement to fix Bug # 2342710
50 SAVEPOINT Before_Populating_Base_Tables;
51 -- End of Changes to fix Bug # 2342710
52
53 Begin
54 WSH_INTERFACE_COMMON_ACTIONS.Delivery_Interface_Wrapper(P_Delivery_Interface_ID,
55 'CREATE',
56 X_Delivery_ID,
57 X_Return_Status);
58
59 IF l_debug_on THEN
60 wsh_debug_sv.log (l_module_name,'X_Delivery_ID,X_Return_Status', X_Delivery_ID||','||X_Return_Status);
61 END IF;
62
63 IF(X_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
64 Raise Delivery_Int_Wrapper_Failed;
65 END IF;
66
67 EXCEPTION
68 WHEN OTHERS THEN
69 Raise Before_Populating_BT_Others;
70 End;
71
72 Else -- If P_Action_Type = 'D'
73
74 -- Added the following statement to fix Bug # 2342710
75 SAVEPOINT Before_Check_Cancel_Allowed_WF;
76 -- End of Changes to fix Bug # 2342710
77
78 Begin
79 WSH_TRANSACTIONS_TPW_UTIL.Check_Cancel_Allowed_WF(P_Item_Type => P_Item_Type,
80 P_Item_Key => P_Item_Key,
81 P_actid => NULL,
82 P_funcmode => NULL,
83 X_Resultout => X_Return_Status);
84 IF l_debug_on THEN
85 wsh_debug_sv.log (l_module_name,'X_Return_Status',X_Return_Status);
86 END IF;
87
88 IF(X_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
89 raise Check_Cancel_Allowed_WF_Failed;
90 END IF;
91
92 EXCEPTION
93 WHEN OTHERS THEN
94 Raise before_Check_Cancel_WF_others;
95 END;
96
97 End If; -- End of If p_Action_Type = 'A'
98
99 Else -- If P_Delivery_Interface_ID is null
100 Raise INVALID_INTERFACE_ID;
101 End IF;
102
103 IF l_debug_on THEN
104 wsh_debug_sv.log(l_module_name, 'Return Status for Process Inbound Ship Request. Return Status :'||X_Return_Status);
105 wsh_debug_sv.pop(l_module_name);
106 END IF;
107
108 EXCEPTION
109 WHEN Check_Cancel_Allowed_WF_Failed THEN
110 -- Added the following statement to fix Bug # 2342710.
111 ROLLBACK TO SAVEPOINT Before_Check_Cancel_Allowed_WF;
112 -- End of Changes for Bug # 2342710.
113 X_Return_Status := WSH_UTIL_CORE.G_RET_STS_ERROR;
114
115 IF l_debug_on THEN
116 WSH_DEBUG_SV.logmsg(l_module_name,'Check_Cancel_Allowed_WF_Failed exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
117 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:check_Cancel_Allowed_WF_Failed');
118 END IF;
119
120 WHEN before_Check_Cancel_WF_others THEN
121 -- Added the following statement to fix Bug # 2342710.
122 ROLLBACK TO SAVEPOINT Before_Check_Cancel_Allowed_WF;
123 -- End of Changes for Bug # 2342710.
124 X_Return_Status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
125
126 IF l_debug_on THEN
127 WSH_DEBUG_SV.logmsg(l_module_name,'before_Check_Cancel_WF_others exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
128 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:before_Check_Cancel_WF_others');
129 END IF;
130
131 WHEN Delivery_Int_Wrapper_Failed THEN
132 -- Added the following statement to fix Bug # 2342710.
133 ROLLBACK TO SAVEPOINT Before_Populating_Base_Tables;
134 -- End of Changes for Bug # 2342710.
135 X_Return_Status := WSH_UTIL_CORE.G_RET_STS_ERROR;
136
137 IF l_debug_on THEN
138 WSH_DEBUG_SV.logmsg(l_module_name,'Delivery_Int_Wrapper_Failed exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
139 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:Delivery_Int_Wrapper_Failed');
140 END IF;
141
142 WHEN Before_Populating_BT_Others THEN
143 -- Added the following statement to fix Bug # 2342710.
144 ROLLBACK TO SAVEPOINT Before_Populating_Base_Tables;
145 -- End of Changes for Bug # 2342710.
146 X_Return_Status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
147
148 IF l_debug_on THEN
149 WSH_DEBUG_SV.logmsg(l_module_name,'Before_Populating_BT_Others exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
150 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:Before_Populating_BT_Others');
151 END IF;
152
153 WHEN INVALID_INTERFACE_ID THEN
154 X_Return_Status := WSH_UTIL_CORE.G_RET_STS_ERROR;
155 IF l_debug_on THEN
156 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_INTERFACE_ID exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
157 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_INTERFACE_ID');
158 END IF;
159
160 WHEN INVALID_ACTION_TYPE THEN
161 X_Return_Status := WSH_UTIL_CORE.G_RET_STS_ERROR;
162 IF l_debug_on THEN
163 WSH_DEBUG_SV.logmsg(l_module_name,'INVALID_ACTION_TYPE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
164 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INVALID_ACTION_TYPE');
165 END IF;
166
167 WHEN OTHERS THEN
168 X_Return_Status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
169 IF l_debug_on THEN
170 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,
171 WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
172 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
173 END IF;
174 End Process_Ship_Request;
175
176 End WSH_INBOUND_SHIP_REQUEST_PKG;