[Home] [Help]
PACKAGE BODY: APPS.WSH_U_GTT
Source
1 PACKAGE BODY WSH_U_GTT AS
2 /* $Header: WSHUGTTB.pls 120.0.12020000.3 2013/02/14 01:24:48 adagur ship $ */
3
4 -- standard global constants
5 G_PKG_NAME CONSTANT VARCHAR2(30) := 'WSH_U_GTT';
6 p_message_type CONSTANT VARCHAR2(1) := 'E';
7 -- -------------------------------------------------------------------
8 -- Start of comments
9 -- API name : Time_In_Transit
10 -- Type : public
11 -- Function : compose the input string, call UPS APIs and parse
12 -- the L_OUTPUT string, place them in the returning
13 --
14 -- Version : Initial version 1.0
15 -- Notes
16 --
17 -- End of comments
18 -- ---------------------------------------------------------------------
19 PROCEDURE Time_In_Transit
20 ( p_api_version IN NUMBER
21 , p_init_msg_list IN VARCHAR2
22 , x_return_status OUT NOCOPY VARCHAR2
23 , x_msg_count OUT NOCOPY NUMBER
24 , x_msg_data OUT NOCOPY VARCHAR2
25 , p_AppVersion IN VARCHAR2
26 , p_AcceptLicenseAgreement IN VARCHAR2
27 , p_ResponseType IN VARCHAR2
28 , p_tnt_request_in IN tnt_request_rec --Added for Carrier Services Integration with Shipping project Bug 16095594
29 , x_TimeInTransit_out OUT NOCOPY TimeInTransitOutRec)
30 IS
31 -- standard version infermation
32 l_api_version CONSTANT NUMBER := 1.0;
33 l_api_name CONSTANT VARCHAR2(30) := 'Time_In_Tansit';
34
35 -- standard variables
36 l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
37 l_msg_count NUMBER := 0;
38 l_msg_data VARCHAR2(2000) := NULL;
39 l_msg_summary VARCHAR2(2000) := NULL;
40 l_msg_details VARCHAR2(4000) := NULL;
41
42 l_tnt_request_in tnt_request_rec; --Added for Carrier Services Integration with Shipping project Bug 16095594
43 WSH_U_SHIPFROMTO EXCEPTION; --Added for Carrier Services Integration with Shipping project Bug 16095594
44 -- L_UPS_URL VARCHAR2(200) := 'http://wwwapps.ups.com/transit/timetran.cgi';
45 /* Commented for Carrier Services Integration with Shipping project Bug 16095594
46 L_UPS_URL VARCHAR2(1000) := NULL;
47 L_INTERNET_PROXY VARCHAR2(1000) := NULL;
48
49 l_boundary_string_start NUMBER := 0;
50 l_boundary_string_end NUMBER := 0;
51 l_boundary_string VARCHAR2(100) := NULL;
52
53 L_Content_Str_Len NUMBER := 0;
54
55 L_INPUT_STR VARCHAR2(2000);
56 L_OUTPUT_STR VARCHAR2(10000);
57 l_output_data utl_http.html_pieces;
58
59 L_GTT_Message VARCHAR2(500);
60
61 L_Content_Type VARCHAR2(200);
62
63 L_Locate_boundary NUMBER := 1;
64 L_Locate_Str_Len NUMBER := 1;
65 L_Locate_Str_Len_End NUMBER := 0;
66 L_Locate_Content NUMBER :=1;
67 L_Locate_boundary_End NUMBER := 1;
68 L_Locate_Begin NUMBER := 1;
69 L_Token_Start NUMBER := 1;
70 L_Token_End NUMBER := 0;
71 l_find_error NUMBER := 0;
72
73 -- this is used to print the debug message only
74
75 WSH_U_INPUT_PARAMETER exception;
76 WSH_U_CAR_URL exception;
77 WSH_U_PROXY exception;
78 WSH_U_APPVER exception;
79 WSH_U_LICAGRE exception;
80 WSH_U_RESTYP exception;
81 WSH_U_ORIGINNUM exception;
82 WSH_U_DESTINATIONNUM exception;
83 WSH_U_NO_HOST exception;
84 REQUEST_FAILED exception;
85 INIT_FAILED exception;
86 End of comment for Carrier Services Integration with Shipping project Bug 16095594 */
87
88 l_TimeInTransit_out TimeInTransitOutRec;
89
90 --
91 l_debug_on BOOLEAN;
92 --
93 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'TIME_IN_TRANSIT';
94 --
95 BEGIN
96 -- Standard call to check for call compatibility.
97 --
98 -- Debug Statements
99 --
100 --
101 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
102 --
103 IF l_debug_on IS NULL
104 THEN
105 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
106 END IF;
107 --
108 IF l_debug_on
109 THEN
110 WSH_DEBUG_SV.push(l_module_name);
111 --
112 WSH_DEBUG_SV.log(l_module_name,'P_API_VERSION',P_API_VERSION);
113 WSH_DEBUG_SV.log(l_module_name,'P_INIT_MSG_LIST',P_INIT_MSG_LIST);
114 WSH_DEBUG_SV.log(l_module_name,'P_APPVERSION',P_APPVERSION);
115 WSH_DEBUG_SV.log(l_module_name,'P_ACCEPTLICENSEAGREEMENT',P_ACCEPTLICENSEAGREEMENT);
116 WSH_DEBUG_SV.log(l_module_name,'SHIP_FROM_LOCATION_ID',p_tnt_request_in.ship_from_location_id);
117 WSH_DEBUG_SV.log(l_module_name,'SHIP_TO_LOCATION_ID',p_tnt_request_in.ship_to_location_id );
118 WSH_DEBUG_SV.log(l_module_name,'P_ORIGINNUMBER',p_tnt_request_in.ORIGINNUMBER);
119 WSH_DEBUG_SV.log(l_module_name,'P_DESTINATIONNUMBER',p_tnt_request_in.DESTINATIONNUMBER);
120 END IF;
121 --
122 IF NOT FND_API.compatible_api_call
123 ( l_api_version
124 , p_api_version
125 , l_api_name
126 , G_PKG_NAME)
127 THEN
128 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
129 END IF;
130
131 -- Check p_init_msg_list
132 IF FND_API.to_boolean(p_init_msg_list)
133 THEN
134 FND_MSG_PUB.initialize;
135 END IF;
136
137 -- initialize API return status to success
138 x_return_status := FND_API.G_RET_STS_SUCCESS;
139 x_msg_count := 0;
140 x_msg_data := NULL;
141 -- program specific logic begins here
142 --
143 -- Debug Statements
144 --
145 IF l_debug_on
146 THEN
147 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_CUSTOM_PUB.Shipment_services',WSH_DEBUG_SV.C_PROC_LEVEL);
148 END IF;
149
150 IF p_tnt_request_in.ship_from_location_id IS NULL OR
151 p_tnt_request_in.ship_to_location_id IS NULL
152 THEN
153 RAISE WSH_U_SHIPFROMTO;
154 END IF;
155
156 l_tnt_request_in := p_tnt_request_in;
157
158 --Added for Carrier Services Integration with Shipping project Bug 16095594
159 IF l_debug_on
160 THEN
161 WSH_DEBUG_SV.log(l_module_name,'Entity Called is '||l_tnt_request_in.Entity);
162 WSH_DEBUG_SV.log(l_module_name,'EntityId is '||l_tnt_request_in.Entity_Id);
163 END IF;
164
165 wsh_custom_pub.tnt_shipment_services
166 ( p_request_in => l_tnt_request_in
167 , x_timeintransit_out => l_timeintransit_out
168 , x_msg_count => l_msg_count
169 , x_msg_data => l_msg_data
170 , x_return_status =>l_return_status);
171
172 -- dbms_output.put_line('l_return_status :'||l_return_status);
173 IF l_return_status = FND_API.G_RET_STS_SUCCESS
174 THEN
175 x_timeintransit_out := l_timeintransit_out;
176 ELSE
177 x_return_status := l_return_status;
178 x_msg_data := l_msg_data;
179 x_msg_count := l_msg_count;
180 x_TimeInTransit_out.TransitTime := NULL;
181 x_TimeInTransit_out.OriginCity := NULL;
182 x_TimeInTransit_out.OriginStateProv := NULL;
183 x_TimeInTransit_out.DestinationCity := NULL;
184 x_TimeInTransit_out.DestinationStateProv := NULL;
185 END IF;
186
187 /* -- Commented for Carrier Services Integration with Shipping project Bug 16095594
188 --
189 -- Debug Statements
190 --
191 IF l_debug_on THEN
192 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.GET_CARRIER_API_URL',WSH_DEBUG_SV.C_PROC_LEVEL);
193 END IF;
194 --
195 L_UPS_URL := WSH_U_UTIL.Get_Carrier_API_URL(
196 p_api_version => 1.0,
197 p_init_msg_list => FND_API.G_TRUE,
198 x_return_status => l_return_status,
199 x_msg_count => l_msg_count,
200 x_msg_data => l_msg_data,
201 p_Carrier_Name => 'UPS',
202 p_API_Name => 'TIME_IN_TRANSIT');
203 if l_return_status <> FND_API.G_RET_STS_SUCCESS then
204 raise WSH_U_CAR_URL;
205 end if;
206
207
208 L_INPUT_STR := L_UPS_URL || '?';
209
210 -- ---------------------------------------------------------------
211 -- UPS standard parameters: AppVersion
212 -- AcceptLicenseAgreement
213 -- ResponseType
214 -- ---------------------------------------------------------------
215
216 -- AppVersion ---------------------------------------------------------
217 if( p_AppVersion IS NULL) then
218 raise WSH_U_APPVER;
219 -- p_AppVersion := '1.0';
220 end if;
221 L_INPUT_STR := L_INPUT_STR || 'AppVersion' ||'='|| p_AppVersion;
222
223 -- AcceptLicenseAgreement ---------------------------------------------
224 if( p_AcceptLicenseAgreement IS NULL) then
225 raise WSH_U_LICAGRE;
226 -- p_AcceptLicenseAgreement := 'YES';
227 end if;
228 L_INPUT_STR := L_INPUT_STR || '&' ||'AcceptUPSLicenseAgreement'||'=' || p_AcceptLicenseAgreement;
229
230 -- ResponseType --------------------------------------------------------
231 if( p_ResponseType IS NULL) then
232 raise WSH_U_RESTYP;
233 -- p_ResponseType := 'application/x-ups-timetran';
234 end if;
235 L_INPUT_STR := L_INPUT_STR || '&' || 'ResponseType' ||'='|| p_ResponseType;
236
237
238 -- --------------------------------------------------------------------
239 -- Origin Postal Code is required
240 -- --------------------------------------------------------------------
241 if (p_OriginNumber IS NULL) then
242 raise WSH_U_ORIGINNUM;
243 else
244 L_INPUT_STR := L_INPUT_STR || '&' || 'OriginNumber' ||'='|| p_OriginNumber;
245 end if;
246
247 -- ----------------------------------------------------------------
248 -- Destination Postal Code is required
249 -- ----------------------------------------------------------------
250 if (p_DestinationNumber IS NULL) then
251 raise WSH_U_DESTINATIONNUM;
252 else
253 L_INPUT_STR := L_INPUT_STR || '&' || 'DestinationNumber' ||'='|| p_DestinationNumber;
254 end if;
255
256 L_INPUT_STR := REPLACE(L_INPUT_STR, ' ', '+');
257
258 -- DBMS_OUTPUT.PUT_LINE('========== request begin =========');
259 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,0,50));
260 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,51,50));
261 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,101,50));
262 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,151,50));
263 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,201,50));
264 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(L_INPUT_STR,251,50));
265 -- DBMS_OUTPUT.PUT_LINE('========== request end =========');
266
267 -- clear variables before calling subroutine
268 l_return_status := FND_API.G_RET_STS_SUCCESS;
269 l_msg_count := 0;
270 l_msg_data := NULL;
271
272
273 -- get proxy server URL
274 --
275 -- Debug Statements
276 --
277 IF l_debug_on THEN
278 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.GET_PROXY',WSH_DEBUG_SV.C_PROC_LEVEL);
279 END IF;
280 --
281 L_INTERNET_PROXY := WSH_U_UTIL.Get_PROXY(
282 p_api_version => 1.0,
283 p_init_msg_list => FND_API.G_TRUE,
284 x_return_status => l_return_status,
285 x_msg_count => l_msg_count,
286 x_msg_data => l_msg_data);
287
288 if l_return_status <> FND_API.G_RET_STS_SUCCESS then
289 raise WSH_U_PROXY;
290 end if;
291 -- send request to UPS site
292 if L_INTERNET_PROXY is not NULL then
293 l_output_data := utl_http.request_pieces(L_INPUT_STR,100,L_INTERNET_PROXY);
294 else
295 l_output_data := utl_http.request_pieces(L_INPUT_STR,100);
296 end if;
297 -- when no response is received from a request to a given URL
298 -- then a formatted HTML error message may be returned, it contains the
299 -- following error message
300 l_find_error := INSTR(l_output_data(1), 'Can''t locate remote host');
301 if l_find_error <> 0 then
302 raise WSH_U_NO_HOST;
303 end if;
304
305 -- It is only good for up to 100 iteration else it will fail.
306 -- DBMS_OUTPUT.PUT_LINE('======= result begin =============');
307
308 FOR i in 1 .. l_output_data.count LOOP
309 L_OUTPUT_STR := L_OUTPUT_STR || l_output_data(i);
310 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1, 250));
311 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 251, 250));
312 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 501, 250));
313 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 751, 250));
314 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1001, 250));
315 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1251, 250));
316 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1501, 250));
317 -- DBMS_OUTPUT.PUT_LINE(SUBSTR(l_output_data(i), 1751, 250));
318 END LOOP;
319
320 -- DBMS_OUTPUT.PUT_LINE('========== result end ===========');
321 l_boundary_string_start := INSTR(L_OUTPUT_STR, 'boundary=', 1 , 1);
322 if l_boundary_string_start <> 0 then
323 l_boundary_string_start := l_boundary_string_start + 9;
324 -- l_boundary_string_end := INSTR(L_OUTPUT_STR, '--', l_boundary_string_start,1);
325 l_boundary_string_end := INSTR(L_OUTPUT_STR, FND_GLOBAL.LOCAL_CHR(13), l_boundary_string_start,1);
326 l_boundary_string := SUBSTR(L_OUTPUT_STR,
327 l_boundary_string_start ,
328 l_boundary_string_end - l_boundary_string_start);
329 else
330
331 l_boundary_string := 'UPSBOUNDARY';
332 end if;
333
334 -- set default boundary string if the return message does not specify
335 l_boundary_string := '--' || l_boundary_string;
336 -- DBMS_OUTPUT.PUT_LINE('Boundary String:'|| l_boundary_string);
337
338
339
340 LOOP
341
342 L_Locate_boundary :=INSTR(L_OUTPUT_STR, l_boundary_string ,L_Locate_boundary,1);
343 L_Locate_Content := INSTR(L_OUTPUT_STR,'Content-type',L_Locate_boundary,1);
344 -- DBMS_OUTPUT.PUT_LINE('LOCATE CONTENT IS************'||to_char(L_Locate_Content));
345 L_Locate_Str_Len := INSTR(L_OUTPUT_STR, 'Content-length',L_Locate_boundary,1);
346 -- DBMS_OUTPUT.PUT_LINE('LOCATE STR IS************'||to_char(L_Locate_Str_Len));
347 L_Locate_Begin := INSTR(L_OUTPUT_STR,'UPSOnLine',L_Locate_boundary,1);
348 -- DBMS_OUTPUT.PUT_LINE('LOCATE BEGIN IS************'||to_char(L_Locate_Begin));
349 L_Locate_boundary_End := INSTR(L_OUTPUT_STR, l_boundary_string ,L_Locate_boundary,2);
350 -- DBMS_OUTPUT.PUT_LINE('LOCATE boundary END************'||to_char(L_Locate_boundary_End));
351
352 IF(L_Locate_boundary_End > L_Locate_Begin) THEN
353
354 -- Get Content-length
355 L_Locate_Str_Len_End := INSTR(L_OUTPUT_STR, FND_GLOBAL.LOCAL_CHR(13), L_Locate_Str_Len, 1);
356 L_Content_Str_Len := TO_NUMBER(SUBSTR(L_OUTPUT_STR,(L_Locate_Str_Len+16),L_Locate_Str_Len_End - L_Locate_Str_Len - 16));
357
358 -- DBMS_OUTPUT.PUT_LINE('CONTENT STR LENGTH IS ***********'||to_char(L_Content_Str_Len));
359 L_Content_Type := SUBSTR(L_OUTPUT_STR,(L_Locate_Content + LENGTH('Content-type: application/')),(L_Locate_Str_Len - (L_Locate_Content + LENGTH('Content-type: application/'))));
360
361 L_GTT_Message := SUBSTR(L_OUTPUT_STR, L_Locate_Begin, L_Content_Str_Len);
362 -- DBMS_OUTPUT.put_line('Message Is:'||L_GTT_Message);
363 -- DBMS_OUTPUT.PUT_LINE('CONTENT_TYPE IS ************'||L_Content_Type||'*********');
364
365 if(SUBSTR(L_Content_Type,1,LENGTH('x-ups-timetran')) = 'x-ups-timetran' or
366 SUBSTR(L_Content_Type,1,LENGTH('x-ups-error')) = 'x-ups-error')
367 then
368 -- DBMS_OUTPUT.PUT_LINE('===<begin> ======');
369 L_Token_Start := 0;
370 L_Token_End := 0;
371
372
373 --
374 -- Debug Statements
375 --
376 IF l_debug_on THEN
377 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
378 END IF;
379 --
380 x_TimeInTransit_out.UPSOnLine :=
381 WSH_U_UTIL.Calculate_Token(L_GTT_Message,L_Token_Start,L_Token_End);
382
383 --
384 -- Debug Statements
385 --
386 IF l_debug_on THEN
387 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
388 END IF;
389 --
390 x_TimeInTransit_out.AppVersion :=
391 WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
392
393 --
394 -- Debug Statements
395 --
396 IF l_debug_on THEN
397 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
398 END IF;
399 --
400 x_TimeInTransit_out.ReturnCode :=
401 TO_NUMBER(WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End));
402 -- DBMS_OUTPUT.PUT_LINE('Return Code: ' || TO_CHAR(x_TimeInTransit_out.ReturnCode));
403
404 --
405 -- Debug Statements
406 --
407 IF l_debug_on THEN
408 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
409 END IF;
410 --
411 x_TimeInTransit_out.MessageText :=
412 WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
413
414 x_TimeInTransit_out.MessageNumber :=
415 TO_NUMBER(SUBSTR(x_TimeInTransit_out.MessageText,1,4));
416 -- DBMS_OUTPUT.PUT_LINE('MessageNumber: ' || TO_CHAR(x_TimeInTransit_out.MessageNumber));
417
418 x_TimeInTransit_out.MessageText :=
419 SUBSTR(x_TimeInTransit_out.MessageText,5,(LENGTH(x_TimeInTransit_out.MessageText)-4));
420 -- DBMS_OUTPUT.PUT_LINE('MessageText: ' || x_TimeInTransit_out.MessageText);
421
422 if (x_TimeInTransit_out.ReturnCode = 0) then
423
424 --
425 -- Debug Statements
426 --
427 IF l_debug_on THEN
428 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
429 END IF;
430 --
431 x_TimeInTransit_out.TransitTime :=
432 WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
433
434 --
435 -- Debug Statements
436 --
437 IF l_debug_on THEN
438 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
439 END IF;
440 --
441 x_TimeInTransit_out.OriginCity :=
442 WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
443
444 --
445 -- Debug Statements
446 --
447 IF l_debug_on THEN
448 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
449 END IF;
450 --
451 x_TimeInTransit_out.OriginStateProv :=
452 WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
453
454 --
455 -- Debug Statements
456 --
457 IF l_debug_on THEN
458 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
459 END IF;
460 --
461 x_TimeInTransit_out.DestinationCity :=
462 WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
463
464 --
465 -- Debug Statements
466 --
467 IF l_debug_on THEN
468 WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_U_UTIL.CALCULATE_TOKEN',WSH_DEBUG_SV.C_PROC_LEVEL);
469 END IF;
470 --
471 x_TimeInTransit_out.DestinationStateProv :=
472 WSH_U_UTIL.Calculate_Token(L_GTT_Message, L_Token_Start,L_Token_End);
473 else
474 x_TimeInTransit_out.TransitTime := NULL;
475 x_TimeInTransit_out.OriginCity := NULL;
476 x_TimeInTransit_out.OriginStateProv := NULL;
477 x_TimeInTransit_out.DestinationCity := NULL;
478 x_TimeInTransit_out.DestinationStateProv := NULL;
479 end if;
480 -- DBMS_OUTPUT.PUT_LINE('===<end> === application/x-ups-timetran ===');
481 end if;
482
483
484 END IF;
485
486 -- advance to next UPSBOUNDARYUPS section
487 L_Locate_boundary := L_Locate_boundary_End;
488
489 EXIT WHEN L_Locate_Begin = 0;
490
491 END LOOP;
492
493
494 */ -- Commented for Carrier Services Integration with Shipping project Bug 16095594
495
496 --
497 -- Debug Statements
498 --
499 IF l_debug_on THEN
500 WSH_DEBUG_SV.pop(l_module_name);
501 END IF;
502 --
503 EXCEPTION
504 WHEN WSH_U_SHIPFROMTO
505 THEN
506 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_SHIPFROMTO');
507 FND_MESSAGE.SET_TOKEN('MSG_TEXT','Ship to/from Location Id IS null');
508 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
509
510 x_return_status := FND_API.G_RET_STS_ERROR;
511 WSH_UTIL_CORE.get_messages
512 ( 'Y'
513 , l_msg_summary
514 , l_msg_details
515 , x_msg_count);
516
517 IF x_msg_count > 1
518 THEN
519 x_msg_data := l_msg_summary || l_msg_details;
520 ELSE
521 x_msg_data := l_msg_summary;
522 END IF;
523 --
524 -- Debug Statements
525 --
526 IF l_debug_on
527 THEN
528 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_SHIPFROMTO exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
529 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_SHIPFROMTO');
530 END IF;
531 /* Commented for Carrier Services Integration with Shipping project Bug 16095594
532 WHEN WSH_U_CAR_URL THEN
533 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_CAR_URL');
534 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
535 x_return_status := FND_API.G_RET_STS_ERROR;
536 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
537 if x_msg_count > 1 then
538 x_msg_data := l_msg_summary || l_msg_details;
539 else
540 x_msg_data := l_msg_summary;
541 end if;
542
543 --
544 -- Debug Statements
545 --
546 IF l_debug_on THEN
547 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_CAR_URL exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
548 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_CAR_URL');
549 END IF;
550 --
551 WHEN WSH_U_PROXY THEN
552 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_PROXY');
553 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
554 x_return_status := FND_API.G_RET_STS_ERROR;
555 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
556 if x_msg_count > 1 then
557 x_msg_data := l_msg_summary || l_msg_details;
558 else
559 x_msg_data := l_msg_summary;
560 end if;
561
562 -- this exception is produced by UTL_HTTP.REQUEST_PIECES
563 -- The http call fails(for example, bacause of failure of the HTTP
564 -- daemon, or bacause the argument to REQUEST_PIECES cannot be interpreted
565 -- as a URL because it is NULL or has non-HTTP syntax)
566 --
567 -- Debug Statements
568 --
569 IF l_debug_on THEN
570 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_PROXY exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
571 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_PROXY');
572 END IF;
573 --
574 WHEN REQUEST_FAILED THEN
575 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_REQ_FAILED');
576 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
577 x_return_status := FND_API.G_RET_STS_ERROR;
578 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
579 if x_msg_count > 1 then
580 x_msg_data := l_msg_summary || l_msg_details;
581 else
582 x_msg_data := l_msg_summary;
583 end if;
584
585 -- this exception is produced by UTL_HTTP.REQUEST_PIECES
586 -- Initialization of the HTTP callout subsystem failed
587 -- for invironmental reasons such as lack of available memory
588 --
589 -- Debug Statements
590 --
591 IF l_debug_on THEN
592 WSH_DEBUG_SV.logmsg(l_module_name,'REQUEST_FAILED exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
593 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:REQUEST_FAILED');
594 END IF;
595 --
596 WHEN INIT_FAILED THEN
597 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_INIT_FAILED');
598 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
599 x_return_status := FND_API.G_RET_STS_ERROR;
600 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
601 if x_msg_count > 1 then
602 x_msg_data := l_msg_summary || l_msg_details;
603 else
604 x_msg_data := l_msg_summary;
605 end if;
606
607 --
608 -- Debug Statements
609 --
610 IF l_debug_on THEN
611 WSH_DEBUG_SV.logmsg(l_module_name,'INIT_FAILED exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
612 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:INIT_FAILED');
613 END IF;
614 --
615 WHEN WSH_U_NO_HOST THEN
616 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_NO_HOST');
617 WSH_UTIL_CORE.ADD_MESSAGE('E');
618 x_return_status := FND_API.G_RET_STS_ERROR;
619 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
620 if x_msg_count > 1 then
621 x_msg_data := l_msg_summary || l_msg_details;
622 else
623 x_msg_data := l_msg_summary;
624 end if;
625
626
627 --
628 -- Debug Statements
629 --
630 IF l_debug_on THEN
631 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_NO_HOST exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
632 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_NO_HOST');
633 END IF;
634 --
635 WHEN WSH_U_APPVER THEN
636 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_APPVER');
637 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
638 x_return_status := FND_API.G_RET_STS_ERROR;
639 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
640 if x_msg_count > 1 then
641 x_msg_data := l_msg_summary || l_msg_details;
642 else
643 x_msg_data := l_msg_summary;
644 end if;
645
646 --
647 -- Debug Statements
648 --
649 IF l_debug_on THEN
650 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_APPVER exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
651 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_APPVER');
652 END IF;
653 --
654 WHEN WSH_U_LICAGRE THEN
655 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_LICAGRE');
656 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
657 x_return_status := FND_API.G_RET_STS_ERROR;
658
659
660 --
661 -- Debug Statements
662 --
663 IF l_debug_on THEN
664 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_LICAGRE exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
665 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_LICAGRE');
666 END IF;
667 --
668 WHEN WSH_U_RESTYP THEN
669 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_RESTYP');
670 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
671 x_return_status := FND_API.G_RET_STS_ERROR;
672 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
673 if x_msg_count > 1 then
674 x_msg_data := l_msg_summary || l_msg_details;
675 else
676 x_msg_data := l_msg_summary;
677 end if;
678
679 --
680 -- Debug Statements
681 --
682 IF l_debug_on THEN
683 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_RESTYP exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
684 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_RESTYP');
685 END IF;
686 --
687 WHEN WSH_U_ORIGINNUM THEN
688 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_ORIGINNUM');
689 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
690 x_return_status := FND_API.G_RET_STS_ERROR;
691 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
692 if x_msg_count > 1 then
693 x_msg_data := l_msg_summary || l_msg_details;
694 else
695 x_msg_data := l_msg_summary;
696 end if;
697
698 --
699 -- Debug Statements
700 --
701 IF l_debug_on THEN
702 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_ORIGINNUM exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
703 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_ORIGINNUM');
704 END IF;
705 --
706 WHEN WSH_U_DESTINATIONNUM THEN
707 FND_MESSAGE.SET_NAME('WSH', 'WSH_U_DESTINATIONNUM');
708 WSH_UTIL_CORE.ADD_MESSAGE(p_message_type);
709 x_return_status := FND_API.G_RET_STS_ERROR;
710 WSH_UTIL_CORE.get_messages( 'Y', l_msg_summary, l_msg_details, x_msg_count);
711 if x_msg_count > 1 then
712 x_msg_data := l_msg_summary || l_msg_details;
713 else
714 x_msg_data := l_msg_summary;
715 end if;
716
717
718 --
719 -- Debug Statements
720 --
721 IF l_debug_on THEN
722 WSH_DEBUG_SV.logmsg(l_module_name,'WSH_U_DESTINATIONNUM exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
723 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_U_DESTINATIONNUM');
724 END IF;
725 --
726 Commented for Carrier Services Integration with Shipping project Bug 16095594 */
727 WHEN FND_API.G_EXC_UNEXPECTED_ERROR
728 THEN
729 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
730 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
731 THEN
732 FND_MSG_PUB.Add_Exc_Msg
733 ( G_PKG_NAME
734 , l_api_name);
735 END IF;
736 FND_MSG_PUB.count_and_get
737 ( p_count => x_msg_count
738 , p_data => x_msg_data);
739 --
740 -- Debug Statements
741 --
742 IF l_debug_on
743 THEN
744 WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_UNEXPECTED_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
745 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
746 END IF;
747 --
748 WHEN OTHERS
749 THEN
750 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
751 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
752 THEN
753 FND_MSG_PUB.Add_Exc_Msg
754 ( G_PKG_NAME
755 , l_api_name);
756 END IF;
757 FND_MSG_PUB.count_and_get
758 ( p_count => x_msg_count
759 , p_data => x_msg_data);
760
761 --
762 -- Debug Statements
763 --
764 IF l_debug_on
765 THEN
766 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
767 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
768 END IF;
769 --
770 END Time_In_Transit;
771
772
773 END WSH_U_GTT;