DBA Data[Home] [Help]

PACKAGE BODY: APPS.WSH_PICKING_BATCHES_GRP

Source


1 PACKAGE BODY WSH_PICKING_BATCHES_GRP AS
2 /* $Header: WSHPRGPB.pls 120.6.12010000.2 2008/08/04 12:32:27 suppal ship $ */
3 
4 -- Package Variables
5 --
6 --===================
7 -- CONSTANTS
8 --===================
9 --
10   G_PKG_NAME CONSTANT VARCHAR2(50) := 'WSH_PICKING_BATCHES_GRP';
11 -- add your constants here if any
12 
13 --===================
14 -- PROCEDURES
15 --===================
16 --
17 --=============================================================================================
18 -- Start of comments
19 --
20 -- API Name          : Create_Batch
21 -- Type              : Group
22 -- Pre-reqs          : None.
23 -- Function          : This API is called  from WSH_PICKING_BATCHES_PUB
24 --                     to validate all the parameters and create the Picking Batch
25 --
26 -- PARAMETERS        : p_api_version_number    known api versionerror buffer
27 --                     p_init_msg_list         FND_API.G_TRUE to reset list
28 --                     x_return_status         return status
29 --                     x_msg_count             number of messages in the list
30 --                     x_msg_data              text of messages
31 --                     p_commit                FND_API.G_TRUE to perform a commit
32 --                     p_rule_id               Picking Rule Id used for defaulting purpose
33 --	               p_rule_name             Picking Rule name used for defaulting purpose, Ignore it when p_rule_id
34 --                                             contains value
35 --                     p_batch_rec             Contains the all the parameters for the batch
36 --                     p_batch_prefix          Batch prefix to be prefixed to the batch name
37 --                     x_batch_id              Out parameter contains the batch id created
38 -- VERSION           : current version         1.0
39 --                     initial version         1.0
40 --============================================================================================
41 
42 PROCEDURE Create_Batch(
43 	    p_api_version_number     IN	  NUMBER,
44 	    p_init_msg_list	     IN	  VARCHAR2  DEFAULT NULL,
45 	    p_commit		     IN	  VARCHAR2  DEFAULT NULL,
46 	    x_return_status	     OUT  NOCOPY    VARCHAR2,
47 	    x_msg_count		     OUT  NOCOPY    NUMBER,
48 	    x_msg_data		     OUT  NOCOPY    VARCHAR2,
49 	    p_rule_id		     IN	  NUMBER    DEFAULT NULL,
50 	    p_rule_name		     IN	  VARCHAR2  DEFAULT NULL,
51 	    p_batch_rec		     IN	  WSH_PICKING_BATCHES_PUB.Batch_Info_Rec,
52 	    p_batch_prefix	     IN	  VARCHAR2  DEFAULT NULL,
53 	    x_batch_id		     OUT  NOCOPY    NUMBER) IS
54 
55 
56 
57 ---- cursor to get Picking Rule information for the Given Picking Rule Id
58 CURSOR	Get_Picking_Rule_Info(v_rule_id IN NUMBER,v_rule_name IN VARCHAR2) IS
59 SELECT	-- name,
60 	backorders_only_flag,
61 	autodetail_pr_flag,
62 	auto_pick_confirm_flag,
63 	pick_sequence_rule_id,
64 	pick_grouping_rule_id,
65 	include_planned_lines,
66 	organization_id,
67 	customer_id,
68 	from_requested_date,
69 	to_requested_date,
70 	existing_rsvs_only_flag,
71 	order_header_id,
72 	inventory_item_id,
73 	order_type_id,
74 	from_scheduled_ship_date,
75 	to_scheduled_ship_date,
76 	shipment_priority_code,
77 	ship_method_code,
78 	ship_set_number,
79 	ship_to_location_id,
80 	default_stage_subinventory,
81 	default_stage_locator_id,
82 	pick_from_subinventory,
83 	pick_from_locator_id,
84 	task_id,
85 	project_id,
86 	ship_from_location_id,
87 	autocreate_delivery_flag,
88 	ship_confirm_rule_id,
89 	autopack_flag,
90 	autopack_level,
91 	document_set_id,
92 	task_planning_flag,
93         ac_delivery_criteria,
94         append_flag,
95         task_priority,
96         nvl(allocation_method,'I'), -- X-dock
97         crossdock_criteria_id, -- X-dock
98         dynamic_replenishment_flag --bug# 6689448 (replenishment project)
99 FROM	wsh_picking_rules
100 WHERE	picking_rule_id	= nvl(v_rule_id,picking_rule_id)
101 AND     name = nvl(v_rule_name,name)
102 AND trunc(sysdate) BETWEEN nvl(start_date_active,trunc(sysdate)) AND nvl(end_date_active,trunc(sysdate) + 1);
103 
104 
105 CURSOR Get_Order_Type_id(p_type_id IN NUMBER ,p_type_name IN VARCHAR2) IS
106 SELECT transaction_type_id
107 FROM   oe_transaction_types_tl
108 WHERE  p_type_id IS NOT NULL
109 AND    transaction_type_id = p_type_id
110 UNION All
111 SELECT transaction_type_id
112 FROM   oe_transaction_types_tl
113 WHERE  p_type_id IS NULL
114 AND    name = p_type_name;
115 
116 
117 CURSOR Get_order_header_id(p_order_number IN NUMBER ,p_order_type_id IN	NUMBER,p_header_id IN NUMBER) IS
118 SELECT	 header_id
119 FROM	oe_order_headers_all
120 WHERE  p_header_id IS NOT NULL
121 AND    header_id = p_header_id
122 UNION ALL
123 SELECT	 header_id
124 FROM	oe_order_headers_all
125 WHERE  p_header_id IS NULL
126 AND     order_number = p_order_number
127 AND     order_type_id = p_order_type_id;
128 
129 CURSOR  Get_Ship_Set_Id(p_ship_set_id IN NUMBER, p_ship_set_number IN VARCHAR2, p_header_id IN NUMBER) IS
130 SELECT  set_id
131 FROM    OE_SETS
132 WHERE   p_ship_set_id IS NOT NULL
133 AND     set_id =  p_ship_set_id
134 UNION ALL
135 SELECT  set_id
136 FROM    OE_SETS
137 WHERE   p_ship_set_id IS NULL
138 AND     header_id = p_header_id
139 AND     set_name =  p_ship_set_number
140 AND     set_type =  'SHIP_SET';
141 
142 CURSOR Check_Delivery_Detail_Id(p_delivery_detail_id IN NUMBER) IS
143 SELECT delivery_detail_id
144 FROM   wsh_delivery_details
145 WHERE  delivery_detail_id = p_delivery_detail_id
146 AND container_flag IN ('N','Y'); -- R12 MDC
147 
148 CURSOR  Check_Item_Id( p_item_id IN NUMBER,p_organization_id IN NUMBER) IS
149 SELECT  inventory_item_id
150 FROM    mtl_system_items
151 WHERE   inventory_item_id = p_item_id
152 AND     organization_id = nvl(p_organization_id,organization_id)
153 AND     rownum = 1;
154 
155 CURSOR  Check_Subinventory( p_subinventory_name IN VARCHAR2,p_organization_id IN NUMBER) IS
156 SELECT  secondary_inventory_name
157 FROM    mtl_subinventories_trk_val_v
158 WHERE   secondary_inventory_name = p_subinventory_name
159 AND     organization_id = p_organization_id;
160 
161 CURSOR  Check_Locator_Id ( p_Locator_Id IN VARCHAR2, p_subinventory IN VARCHAR2, p_organization_id IN NUMBER) IS
162 SELECT  Inventory_location_id
163 FROM    mtl_item_locations
164 WHERE   Inventory_location_id = p_Locator_Id
165 AND     subinventory_code = p_subinventory
166 AND     organization_id   = p_organization_id;
167 
168 CURSOR  Check_Category_Set_Id( p_category_set_id  IN NUMBER) IS
169 SELECT  category_set_id
170 FROM    mtl_category_sets
171 WHERE   category_set_id = p_category_set_id
172 AND     rownum = 1;
173 
174 CURSOR  Check_Category_Id( p_category_id IN NUMBER ) IS
175 SELECT  category_id
176 FROM    mtl_item_categories
177 WHERE   category_id = p_category_id
178 AND     rownum = 1;
179 
180 -- Bug 3438300 - Start
181 cursor c_location_id (p_org_id VARCHAR2) IS
182 select location_id from wsh_ship_from_orgs_v
183 where organization_id = p_org_id;
184 
185 cursor c_org_id (p_location_id NUMBER) IS
186 select organization_id from wsh_ship_from_orgs_v
187 where location_id = p_location_id;
188 
189 -- Bug# 3438300 - End
190 
191    --R12 MDC
192   CURSOR c_check_consol_dlvy(p_delivery_id IN NUMBER) IS
193   SELECT delivery_id
194   FROM   wsh_new_deliveries
195   WHERE  delivery_id = p_delivery_id
196   AND    delivery_type = 'STANDARD';
197 
198 
199 -- Standard call to check for call compatibility
200 l_api_version	     CONSTANT NUMBER :=	1.0;
201 l_api_name	     CONSTANT VARCHAR2(30) := 'WSH_PICKING_BATCHES_GRP';
202 l_return_status		      VARCHAR2(30) := NULL;
203 l_msg_count		      NUMBER;
204 l_msg_data		      VARCHAR2(32767);
205 l_number_of_errors	      NUMBER :=	0;
206 l_number_of_warnings	      NUMBER :=	0;
207 l_debug_on BOOLEAN;
208 
209 -- Record Variable which holds the input Batch Record
210 l_batch_in_rec         WSH_PICKING_BATCHES_PUB.Batch_Info_rec;
211 -- Record Variable which holds final data to be sent to the private API
212 l_batch_grp_rec        WSH_PICKING_BATCHES_GRP.Batch_Info_rec;
213 
214 l_rule_id         NUMBER;
215 l_rule_name       VARCHAR2(60);
216 l_batch_name_prefix  VARCHAR2(60);
217 -- bug 3463315 add validation when append_flag = 'Y'
218 l_param_info              WSH_SHIPPING_PARAMS_PVT.Parameter_Rec_Typ;
219 
220 -- Bug 3438300 - Start
221 l_ship_from_loc_id NUMBER;
222 l_org_id NUMBER;
223 -- Bug# 3438300 - End
224 
225 l_is_WMS_org  VARCHAR2(1); -- Bug# 3480908
226 --
227 l_module_name CONSTANT VARCHAR2(100) :=	'wsh.plsql.' ||	G_PKG_NAME || '.' || 'CREATE_BATCH';
228 --
229 
230 WSH_INVALID_CONSOL_DEL	EXCEPTION;
231 
232 BEGIN
233 
234   --
235   -- Debug Statements
236   --
237   --
238   l_debug_on :=	WSH_DEBUG_INTERFACE.g_debug;
239   --
240   IF l_debug_on	IS NULL	 THEN
241   --{
242      l_debug_on	:= WSH_DEBUG_SV.is_debug_enabled;
243   --}
244   END IF;
245   --
246   SAVEPOINT PICKING_BATCH_GRP;
247 
248   -- Standard begin of API savepoint
249   --
250   -- Debug Statements
251   --
252   IF l_debug_on	THEN
253   --{
254      wsh_debug_sv.push(l_module_name);
255      --
256      wsh_debug_sv.LOG(l_module_name, 'P_API_VERSION_NUMBER', p_api_version_number);
257      wsh_debug_sv.LOG(l_module_name, 'P_INIT_MSG_LIST',	p_init_msg_list);
258      wsh_debug_sv.LOG(l_module_name, 'P_COMMIT', p_commit);
259   --}
260   END IF;
261 
262   IF NOT fnd_api.compatible_api_call(
263 		 l_api_version,
264 		 p_api_version_number,
265 		 l_api_name,
266 		 g_pkg_name)   THEN
267      RAISE fnd_api.g_exc_unexpected_error;
268   END IF;
269   -- Check p_init_msg_list
270   IF fnd_api.to_boolean(p_init_msg_list) THEN
271   --{
272       fnd_msg_pub.initialize;
273   --}
274   END IF;
275   x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
276   l_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
277 
278   l_batch_in_rec  := p_batch_rec;
279   l_rule_id       := p_rule_id;
280   l_rule_name     := p_rule_name;
281   l_batch_name_prefix := p_batch_prefix;
282 
283 
284   --
285   -- Debug Statements
286   --
287   IF l_debug_on	THEN
288   --{
289      wsh_debug_sv.log(l_module_name,'PROCESSING THE RULE INFORMATION'|| '    P_RULE_ID : ' || TO_CHAR( l_rule_id ) || '  P_RULE_NAME:  '|| l_rule_name);
290   --}
291   END IF;
292   --
293   IF ( l_rule_id is NOT NULL AND l_rule_id <> FND_API.G_MISS_NUM ) OR ( l_rule_name is NOT NULL AND l_rule_name <> FND_API.G_MISS_CHAR ) THEN
294   --{ Passed the Values or Not
295      IF ( l_rule_id  = FND_API.G_MISS_NUM ) THEN
296      --{
297           l_rule_id := NULL;
298      --}
299      END IF;
300      IF ( l_rule_name  = FND_API.G_MISS_CHAR ) OR  ( l_rule_id  IS NOT NULL) THEN
301      --{
302          l_rule_name := NULL;
303      --}
304      END IF;
305      --
306      --
307      -- Debug	Statements
308      --
309      IF l_debug_on THEN
310      --{
311 	WSH_DEBUG_SV.logmsg(l_module_name,  'FETCHING PICKING RULE INFO FOR THE GIVEN RULE ID AND RULE NAME'  );
312      --}
313      END IF;
314      --
315      -- fetch Picking Rule Information for the given picking Rule Id
316      OPEN	Get_Picking_Rule_Info(l_rule_id,l_rule_name);
317      FETCH      Get_Picking_Rule_Info
318      INTO	l_batch_grp_rec.backorders_only_flag,
319 	        l_batch_grp_rec.autodetail_pr_flag,
320 		l_batch_grp_rec.auto_pick_confirm_flag,
321 		l_batch_grp_rec.pick_sequence_rule_id,
322 		l_batch_grp_rec.pick_grouping_rule_id,
323 		l_batch_grp_rec.include_planned_lines,
324 		l_batch_grp_rec.organization_id,
325 		l_batch_grp_rec.customer_id,
326 		l_batch_grp_rec.from_requested_date,
327 		l_batch_grp_rec.to_requested_date,
328 		l_batch_grp_rec.existing_rsvs_only_flag,
329 		l_batch_grp_rec.order_header_id,
330 		l_batch_grp_rec.inventory_item_id,
331 		l_batch_grp_rec.order_type_id,
332 		l_batch_grp_rec.from_scheduled_ship_date,
333 		l_batch_grp_rec.to_scheduled_ship_date,
334 		l_batch_grp_rec.shipment_priority_code,
335 		l_batch_grp_rec.ship_method_code,
336 		l_batch_grp_rec.ship_set_id,
337 		l_batch_grp_rec.ship_to_location_id,
338 		l_batch_grp_rec.Default_Stage_subinventory,
339 		l_batch_grp_rec.Default_Stage_locator_id,
340 		l_batch_grp_rec.pick_from_subinventory,
341 		l_batch_grp_rec.pick_from_locator_id,
342 		l_batch_grp_rec.task_id,
343 		l_batch_grp_rec.project_id,
344 		l_batch_grp_rec.ship_from_location_id,
345 		l_batch_grp_rec.autocreate_delivery_flag,
346 		l_batch_grp_rec.ship_confirm_rule_id,
347 		l_batch_grp_rec.autopack_flag,
348 		l_batch_grp_rec.autopack_level,
349 		l_batch_grp_rec.document_set_id,
350 		l_batch_grp_rec.task_planning_flag,
351 		l_batch_grp_rec.ac_delivery_criteria,
352 		l_batch_grp_rec.append_flag,
353                 l_batch_grp_rec.task_priority,
354                 l_batch_grp_rec.allocation_method,  --X-dock
355                 l_batch_grp_rec.crossdock_criteria_id,  --X-dock
356                 l_batch_grp_rec.dynamic_replenishment_flag; --bug# 6689448 (replenishment project)
357 
358      -- If rule info provided is not exist raise error
359      IF Get_Picking_Rule_Info%NOTFOUND THEN
360      --{
361         --
362         -- Debug Statements
363         --
364         IF l_debug_on THEN
365 	--{
366 	   WSH_DEBUG_SV.logmsg(l_module_name,  'P_RULE_ID : ' || TO_CHAR( p_rule_id ) || 'P_RULE_NAME:  '|| p_rule_name || '	DOES NOT EXIST.');
367         --}
368 	END IF;
369         --
370         FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
371         FND_MESSAGE.SET_TOKEN('ATTRIBUTE','PICKING_RULE');
372 	x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
373 	wsh_util_core.add_message(x_return_status);
374 	CLOSE Get_Picking_Rule_Info;
375 	IF l_debug_on THEN
376 	--{
377   	   WSH_DEBUG_SV.pop(l_module_name);
378 	--}
379 	END IF;
380 	--
381 	return;
382      --}
383      END IF;
384      CLOSE Get_Picking_Rule_Info;
385    --} End of Pick Rule Checking
386   END IF;
387 
388 
389 ------------------------------------------------------------------------------------------------------------
390 -- VALIDATE ALL	THE INPUT PARAMETER VALUES
391 -- LOGIC followed
392 --   If Parameter value is NULL then treat it as NOT PASSED to the API
393 --    (*** In this case consider the value from the picking rule info if picking rule info provided)
394 --   If the parameter value is FND_API.G_MISS.xxx then treat it as NULL
395 --   Otherwise Validate the parameter value.
396 ------------------------------------------------------------------------------------------------------------
397 
398 -- Validating the Back Order Only Flag
399   IF ( l_batch_in_rec.Backorders_Only_Flag IS NOT NULL ) THEN
400   --{ Passed the Values or Not
401      IF (l_batch_in_rec.Backorders_Only_Flag <> FND_API.G_MISS_CHAR ) THEN
402      --{ Checking value is null or not
403          -- BUG # 6719369 (Rplenishment project); Need to consider the
404          --          'replenishment completed' status.
405          IF ( l_batch_in_rec.Backorders_Only_Flag  NOT IN ('I','E','O','M') ) THEN
406 	 --{
407 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
408             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','BACKORDERS_ONLY_FLAG ');
409 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
410 	    wsh_util_core.add_message(x_return_status);
411 	    return;
412          --}
413 	 END IF;
414 	 l_batch_grp_rec.Backorders_Only_Flag := l_batch_in_rec.Backorders_Only_Flag ;
415      ELSE
416         l_batch_grp_rec.Backorders_Only_Flag := NULL;
417      --}
418      END IF;
419   --}
420   END IF;
421 
422 -- End of Validating the Back Order Only Flag
423 
424 --- Organization Validations
425   IF ( ( l_batch_in_rec.Organization_Id IS NOT NULL ) OR ( l_batch_in_rec.Organization_Code IS NOT NULL ) ) THEN
426   --{ Passed the Values or Not
427      IF ( l_batch_in_rec.Organization_Id = FND_API.G_MISS_NUM ) THEN
428      --{
429         l_batch_in_rec.Organization_Id := NULL;
430      --}
431      END IF;
432 
433      IF ( l_batch_in_rec.Organization_Code =  FND_API.G_MISS_CHAR ) THEN
434      --{
435          l_batch_in_rec.Organization_Code := NULL;
436      --}
437      END IF;
438 
439      IF ( ( l_batch_in_rec.Organization_Id IS NOT NULL ) OR ( l_batch_in_rec.Organization_Code IS NOT NULL ) ) THEN
440      --{
441 
442 	IF l_debug_on THEN
443 	--{
444            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_ORG',WSH_DEBUG_SV.C_PROC_LEVEL);
445         --}
446 	END IF;
447         WSH_UTIL_VALIDATE.Validate_Org(
448 	      p_Org_id	       => l_batch_in_rec.Organization_Id,
449 	      p_Org_Code       => l_batch_in_rec.Organization_Code,
450 	      x_return_status  => l_return_status);
451 
452         IF l_debug_on THEN
453 	--{
454            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
455         --}
456 	END IF;
457         --
458         wsh_util_core.api_post_call(
459                p_return_status => l_return_status,
460                x_num_warnings  => l_number_of_warnings,
461                x_num_errors    => l_number_of_errors,
462                p_msg_data      => l_msg_data
463                );
464 
465 	l_batch_grp_rec.Organization_Id :=l_batch_in_rec.Organization_Id;
466 
467 	-- Bug# 3480908 - start - Checking whether the org is a WMS org
468 	IF l_debug_on THEN
469 	--{
470            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.Check_Wms_Org',WSH_DEBUG_SV.C_PROC_LEVEL);
471         --}
472 	END IF;
473         l_is_WMS_org := WSH_UTIL_VALIDATE.Check_Wms_Org(
474 	      p_organization_id	       => l_batch_grp_rec.Organization_Id);
475 
476         IF l_debug_on THEN
477 	--{
478            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
479         --}
480 	END IF;
481         --
482         wsh_util_core.api_post_call(
483                p_return_status => l_return_status,
484                x_num_warnings  => l_number_of_warnings,
485                x_num_errors    => l_number_of_errors,
486                p_msg_data      => l_msg_data
487                );
488 
489 	-- Bug# 3480908 - End
490 
491      ELSE
492         l_batch_grp_rec.Organization_Id := NULL;
493      --}
494      END IF;
495   --} Passed the Values or Not
496   END IF;
497 
498 --  End of Organization Validations
499 
500 --- Document Set Validations
501 
502   IF ( ( l_batch_in_rec.Document_Set_Id IS NOT NULL ) OR ( l_batch_in_rec.Document_Set_Name IS NOT NULL )) THEN
503   --{ Passed the Values or Not
504      IF ( l_batch_in_rec.Document_Set_Id = FND_API.G_MISS_NUM ) THEN
505      --{
506         l_batch_in_rec.Document_Set_id := NULL;
507      --}
508      END IF;
509      IF ( l_batch_in_rec.Document_Set_Name  =  FND_API.G_MISS_CHAR) THEN
510      --{
511         l_batch_in_rec.Document_Set_name := NULL;
512      --}
513      END IF;
514      IF ( l_batch_in_rec.Document_Set_Id IS NOT NULL) OR ( l_batch_in_rec.Document_Set_name IS NOT NULL) THEN
515      --{
516 	IF l_debug_on THEN
517 	--{
518            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_REPORT_SET',WSH_DEBUG_SV.C_PROC_LEVEL);
519         --}
520 	END IF;
521         WSH_UTIL_VALIDATE.Validate_Report_Set(
522 	     p_report_set_id	=> l_batch_in_rec.Document_Set_Id,
523 	     p_report_set_name	=> l_batch_in_rec.Document_Set_name,
524 	     x_return_status	=> l_return_status);
525 
526 	IF l_debug_on THEN
527 	--{
528            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
529         --}
530 	END IF;
531         --
532         wsh_util_core.api_post_call(
533                p_return_status => l_return_status,
534                x_num_warnings  => l_number_of_warnings,
535                x_num_errors    => l_number_of_errors,
536                p_msg_data      => l_msg_data
537                );
538             l_batch_grp_rec.Document_Set_Id := l_batch_in_rec.Document_Set_Id;
539      ELSE
540         l_batch_grp_rec.Document_Set_Id := NULL;
541      --}
542      END IF;
543    --} Passed the Values or Not
544   END IF;
545 
546 -- End of Document Set Validations
547 
548 -- Ship Method  Validations
549 
550   IF ( ( l_batch_in_rec.Ship_Method_Code IS NOT NULL ) OR ( l_batch_in_rec.Ship_Method_Name IS NOT NULL )) THEN
551   --{ Passed the Values or Not
552      IF ( l_batch_in_rec.Ship_Method_Code = FND_API.G_MISS_CHAR ) THEN
553      --{
554         l_batch_in_rec.Ship_Method_Code := NULL;
555      --}
556      END IF;
557      IF ( l_batch_in_rec.Ship_Method_Name =  FND_API.G_MISS_CHAR ) THEN
558      --{
559         l_batch_in_rec.Ship_Method_Name := NULL;
560      --}
561      END IF;
562      IF ( l_batch_in_rec.Ship_Method_Code IS NOT NULL) OR ( l_batch_in_rec.Ship_Method_Name IS NOT NULL) THEN
563      --{
564 	IF l_debug_on THEN
565 	--{
566            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_SHIP_METHOD',WSH_DEBUG_SV.C_PROC_LEVEL);
567         --}
568 	END IF;
569          WSH_UTIL_VALIDATE.Validate_Ship_Method(
570 	      p_ship_method_code   => l_batch_in_rec.Ship_Method_Code,
571 	      p_ship_method_name   => l_batch_in_rec.Ship_Method_Name,
572 	      x_return_status	   => l_return_status);
573 
574         IF l_debug_on THEN
575 	--{
576            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
577         --}
578 	END IF;
579         --
580         wsh_util_core.api_post_call(
581                p_return_status => l_return_status,
582                x_num_warnings  => l_number_of_warnings,
583                x_num_errors    => l_number_of_errors,
584                p_msg_data      => l_msg_data
585                );
586         l_batch_grp_rec.ship_Method_Code := l_batch_in_rec.Ship_Method_Code;
587      ELSE
588         l_batch_grp_rec.ship_Method_Code := NULL;
589      --}
590      END IF;
591   --} Passed the Values or Not
592   END IF;
593 
594 ---  End of Ship Method Validations
595 
596 ---  Customer Validations
597 
598   IF ( ( l_batch_in_rec.Customer_Id IS NOT NULL ) OR ( l_batch_in_rec.Customer_Number IS NOT NULL )) THEN
599   --{ Passed the Values or Not
600      IF  l_batch_in_rec.Customer_Id = FND_API.G_MISS_NUM  THEN
601      --{
602         l_batch_in_rec.Customer_Id := NULL;
603      --}
604      END IF;
605      IF  l_batch_in_rec.Customer_Number =  FND_API.G_MISS_CHAR  THEN
606      --{
607         l_batch_in_rec.Customer_Number := NULL;
608      --}
609      END IF;
610      IF ( ( l_batch_in_rec.Customer_Id IS NOT NULL) OR ( l_batch_in_rec.Customer_Number IS NOT NULL) ) THEN
611      --{
612 	IF l_debug_on THEN
613 	--{
614            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_CUSTOMER',WSH_DEBUG_SV.C_PROC_LEVEL);
615         --}
616 	END IF;
617         WSH_UTIL_VALIDATE.Validate_Customer(
618 	    p_Customer_id	   => l_batch_in_rec.Customer_Id,
619 	    p_Customer_Number	   => l_batch_in_rec.Customer_Number,
620 	    x_return_status	   => l_return_status);
621 
622         IF l_debug_on THEN
623 	--{
624            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
625         --}
626 	END IF;
627         --
628         wsh_util_core.api_post_call(
629                p_return_status => l_return_status,
630                x_num_warnings  => l_number_of_warnings,
631                x_num_errors    => l_number_of_errors,
632                p_msg_data      => l_msg_data
633                );
634         l_batch_grp_rec.Customer_Id :=  l_batch_in_rec.Customer_Id;
635      ELSE
636         l_batch_grp_rec.Customer_Id := NULL;
637      --}
638      END IF;
639   --} Passed the Values or Not
640   END IF;
641 
642 -- End of Customer Validations
643 
644 -- Order Type Validations
645 
646   IF ( ( l_batch_in_rec.Order_Type_Id IS NOT NULL ) OR ( l_batch_in_rec.Order_Type_Name IS NOT NULL )) THEN
647   --{ Passed the Values or Not
648      IF ( l_batch_in_rec.Order_Type_Id = FND_API.G_MISS_NUM ) THEN
649      --{
650         l_batch_in_rec.Order_Type_Id := NULL;
651      --}
652      END IF;
653      IF ( l_batch_in_rec.Order_Type_Name =  FND_API.G_MISS_CHAR ) THEN
654      --{
655         l_batch_in_rec.Order_Type_Name := NULL;
656      --}
657      END IF;
658      IF ( ( l_batch_in_rec.Order_Type_Id IS NOT NULL ) OR ( l_batch_in_rec.Order_Type_Name IS NOT NULL) )THEN
659      --{
660         OPEN Get_Order_Type_id(l_batch_in_rec.Order_Type_Id,l_batch_in_rec.Order_Type_Name);
661         FETCH Get_Order_Type_id INTO l_batch_in_rec.Order_Type_Id;
662         IF ( Get_Order_Type_id%NOTFOUND ) THEN
663 	--{
664 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
665             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','ORDER_TYPE');
666 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
667 	    wsh_util_core.add_message(x_return_status);
668 	    CLOSE Get_Order_Type_id;
669 	    return;
670         --}
671 	END IF;
672 	CLOSE Get_Order_Type_id;
673 	l_batch_grp_rec.Order_Type_Id := l_batch_in_rec.Order_Type_Id;
674      ELSE
675         l_batch_grp_rec.Order_Type_Id := NULL;
676      --}
677      END IF;
678   --} Passed the Values or Not
679   END IF;
680 
681 -- End of Order	Type Validations
682 
683 
684 -- Order Number	Validations
685 
686   IF ( ( l_batch_in_rec.order_header_id IS NOT NULL ) OR ( l_batch_in_rec.order_number IS NOT NULL )) THEN
687   --{ Passed the Values or Not
688      IF ( l_batch_in_rec.order_header_id = FND_API.G_MISS_NUM ) THEN
689      --{
690      	l_batch_in_rec.order_header_id := NULL;
691      --}
692      END IF;
693      IF ( l_batch_in_rec.order_number =  FND_API.G_MISS_NUM ) OR ( l_batch_in_rec.order_header_id IS NOT NULL ) THEN
694      --{
695         l_batch_in_rec.order_number := NULL;
696      --}
697      END IF;
698      IF ( l_batch_in_rec.order_number IS NOT NULL AND l_batch_grp_rec.order_type_id IS NULL ) THEN
699      --{
700 	 FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
701          FND_MESSAGE.SET_TOKEN('ATTRIBUTE','ORDER_NUMBER AND ORDER_TYPE_ID combination');
702 	 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
703 	 wsh_util_core.add_message(x_return_status);
704 	 return;
705      --}
706      END IF;
707      IF ( ( l_batch_in_rec.order_header_id  IS NOT NULL ) OR  ( l_batch_in_rec.order_number IS NOT NULL AND l_batch_grp_rec.order_type_id IS NOT NULL ) ) THEN
708      --{
709          OPEN Get_Order_Header_id(l_batch_in_rec.Order_Number,l_batch_grp_rec.Order_Type_id,l_batch_in_rec.order_header_id);
710          FETCH Get_Order_Header_id INTO l_batch_in_rec.order_header_id;
711          IF ( Get_Order_Header_id%NOTFOUND ) THEN
712 	 --{
713 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
714             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','ORDER_NUMBER OR ORDER_HEADER_ID');
715 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
716 	    wsh_util_core.add_message(x_return_status);
717 	    CLOSE Get_Order_Header_id;
718 	    return;
719          --}
720 	 END IF;
721 	 CLOSE Get_Order_Header_id;
722 	 l_batch_grp_rec.order_header_id := l_batch_in_rec.order_header_id;
723      ELSE
724         l_batch_grp_rec.order_header_id := NULL;
725      --}
726      END IF;
727   --}Passed the Values or Not
728   END IF;
729 
730 -- End of Order	Number Validations
731 
732 -- Ship	Set Number Validations
733 
734   IF ( ( l_batch_in_rec.ship_set_id IS NOT NULL ) OR ( l_batch_in_rec.ship_set_number IS NOT NULL )) THEN
735   --{ Passed the Values or Not
736      IF ( l_batch_in_rec.ship_set_id = FND_API.G_MISS_NUM ) THEN
737      --{
738         l_batch_in_rec.ship_set_id := NULL;
739      --}
740      END IF;
741      IF ( ( l_batch_in_rec.ship_set_number =  FND_API.G_MISS_CHAR ) OR ( l_batch_in_rec.ship_set_id IS NOT NULL ) ) THEN
742      --{
743         l_batch_in_rec.ship_set_number := NULL;
744      --}
745      END IF;
746      IF ( l_batch_in_rec.ship_set_number IS NOT NULL AND l_batch_grp_rec.order_header_id IS NULL ) THEN
747      --{
748 	 FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
749          FND_MESSAGE.SET_TOKEN('ATTRIBUTE','SHIP_SET_NUMBER AND ORDER_HEADER_ID combination');
750 	 x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
751 	 wsh_util_core.add_message(x_return_status);
752 	 return;
753      --}
754      END IF;
755      IF ( ( l_batch_in_rec.ship_set_id  IS NOT NULL ) OR  ( l_batch_in_rec.ship_set_number IS NOT NULL AND l_batch_grp_rec.order_header_id IS NOT NULL ) ) THEN
756      --{
757          OPEN Get_Ship_Set_Id(l_batch_in_rec.ship_set_id,l_batch_in_rec.ship_set_number,l_batch_grp_rec.order_header_id);
758          FETCH Get_Ship_Set_Id INTO l_batch_in_rec.ship_set_id;
759          IF ( Get_Ship_Set_Id%NOTFOUND ) THEN
760 	 --{
761 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
762             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','SHIP_SET_NUMBER OR SHIP_SET_ID');
763 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
764 	    wsh_util_core.add_message(x_return_status);
765 	    CLOSE  Get_Ship_Set_Id;
766 	    return;
767          --}
768 	 END IF;
769 	 CLOSE Get_Ship_Set_Id;
770 	 l_batch_grp_rec.ship_set_id := l_batch_in_rec.ship_set_id;
771      ELSE
772         l_batch_grp_rec.ship_set_id := NULL;
773      --}
774      END IF;
775   --} Passed the Values or Not
776   END IF;
777 
778 -- End of Ship Set Number  Validations
779 
780 --- Ship To Location  Validations
781 IF l_batch_grp_rec.Customer_Id IS NOT NULL THEN --Bug# 3480908 - Ignore Ship_To if customer not provided
782   IF ( ( l_batch_in_rec.Ship_To_Location_Id IS NOT NULL ) OR ( l_batch_in_rec.Ship_To_Location_code IS NOT NULL ) ) THEN
783   --{ Passed the Values or Not
784      IF ( l_batch_in_rec.Ship_To_Location_Id = FND_API.G_MISS_NUM ) THEN
785      --{
786         l_batch_in_rec.Ship_To_Location_Id := NULL;
787      --}
788      END IF;
789      IF ( l_batch_in_rec.Ship_To_Location_code =  FND_API.G_MISS_CHAR) THEN
790      --{
791 	l_batch_in_rec.Ship_To_Location_code := NULL;
792      --}
793      END IF;
794      IF ( ( l_batch_in_rec.Ship_To_Location_Id IS NOT NULL) OR ( l_batch_in_rec.Ship_To_Location_code IS NOT NULL ) ) THEN
795      --{
796 	IF l_debug_on THEN
797 	--{
798            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_LOCATION',WSH_DEBUG_SV.C_PROC_LEVEL);
799         --}
800 	END IF;
801         WSH_UTIL_VALIDATE.Validate_Location(
802 	      p_location_id	   => l_batch_in_rec.Ship_To_Location_Id,
803 	      p_location_code	   => l_batch_in_rec.Ship_To_Location_Code,
804 	      x_return_status	   => l_return_status,
805 	      p_isWshLocation	   => TRUE);
806 
807         IF l_debug_on THEN
808 	--{
809            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
810         --}
811 	END IF;
812         --
813         wsh_util_core.api_post_call(
814                p_return_status => l_return_status,
815                x_num_warnings  => l_number_of_warnings,
816                x_num_errors    => l_number_of_errors,
817                p_msg_data      => l_msg_data
818                );
819 
820 	l_batch_grp_rec.Ship_To_Location_Id := l_batch_in_rec.Ship_To_Location_Id;
821      ELSE
822         l_batch_grp_rec.Ship_To_Location_Id:= NULL;
823      --}
824      END IF;
825   --} Passed the Values or Not
826   END IF;
827 ELSE  -- Bug# 3480908
828   l_batch_grp_rec.Ship_To_Location_Id:= NULL;
829 END IF;
830 -- End of Ship to Location Validations
831 
832 --- Ship From Location Validations
833 
834   IF ( ( l_batch_in_rec.Ship_From_Location_Id IS NOT NULL ) OR ( l_batch_in_rec.Ship_From_Location_code IS NOT NULL ) ) THEN
835   --{ Passed the Values or Not
836      IF ( l_batch_in_rec.Ship_From_Location_Id = FND_API.G_MISS_NUM ) THEN
837      --{
838         l_batch_in_rec.Ship_From_Location_Id := NULL;
839      --}
840      END IF;
841      IF ( l_batch_in_rec.Ship_From_Location_code =  FND_API.G_MISS_CHAR) THEN
842      --{
843         l_batch_in_rec.Ship_From_Location_code := NULL;
844      --}
845      END IF;
846      IF ( ( l_batch_in_rec.Ship_From_Location_Id IS NOT NULL) OR ( l_batch_in_rec.Ship_From_Location_code IS NOT NULL ) ) THEN
847      --{
848 	IF l_debug_on THEN
849 	--{
850            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_LOCATION',WSH_DEBUG_SV.C_PROC_LEVEL);
851         --}
852 	END IF;
853  	WSH_UTIL_VALIDATE.Validate_Location(
854 	     p_location_id	   => l_batch_in_rec.Ship_From_Location_Id,
855 	     p_location_code	   => l_batch_in_rec.Ship_From_Location_Code,
856 	     x_return_status	   => l_return_status,
857 	     p_isWshLocation	   => TRUE);
858 
859         IF l_debug_on THEN
860 	--{
861            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
862         --}
863 	END IF;
864         --
865         wsh_util_core.api_post_call(
866                p_return_status => l_return_status,
867                x_num_warnings  => l_number_of_warnings,
868                x_num_errors    => l_number_of_errors,
869                p_msg_data      => l_msg_data
870                );
871         l_batch_grp_rec.Ship_From_Location_Id := l_batch_in_rec.Ship_From_Location_Id;
872      ELSE
873         l_batch_grp_rec.Ship_From_Location_Id := NULL;
874      --}
875      END IF;
876   --} Passed the Values or Not
877   -- Bug 5373798
878   ELSE -- (l_batch_in_rec.Ship_From_Location_Id IS  NULL) AND ( l_batch_in_rec.Ship_From_Location_code IS NULL)
879       l_batch_grp_rec.Ship_From_Location_Id := NULL;
880   END IF;
881 
882 
883 -- End of Ship From Location Validations
884 
885 
886 --- Trip Validations
887 
888   IF ( ( l_batch_in_rec.Trip_Id IS NOT NULL ) OR ( l_batch_in_rec.Trip_Name IS NOT NULL ) ) THEN
889   --{ Passed the Values or Not
890      IF ( l_batch_in_rec.Trip_Id = FND_API.G_MISS_NUM ) THEN
891      --{
892         l_batch_in_rec.Trip_Id := NULL;
893      --}
894      END IF;
895      IF ( l_batch_in_rec.Trip_name =  FND_API.G_MISS_CHAR) THEN
896      --{
897         l_batch_in_rec.Trip_name := NULL;
898      --}
899      END IF;
900      IF ( ( l_batch_in_rec.Trip_Id IS NOT NULL ) OR ( l_batch_in_rec.Trip_Name IS NOT NULL ) ) THEN
901      --{
902 	IF l_debug_on THEN
903 	--{
904            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_TRIP_NAME',WSH_DEBUG_SV.C_PROC_LEVEL);
905         --}
906 	END IF;
907  	WSH_UTIL_VALIDATE.Validate_Trip_Name(
908 	      p_trip_id	       => l_batch_in_rec.Trip_Id,
909 	      p_trip_name      => l_batch_in_rec.Trip_Name,
910 	      x_return_status  => l_return_status);
911 
912         IF l_debug_on THEN
913 	--{
914            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
915         --}
916 	END IF;
917         --
918         wsh_util_core.api_post_call(
919                p_return_status => l_return_status,
920                x_num_warnings  => l_number_of_warnings,
921                x_num_errors    => l_number_of_errors,
922                p_msg_data      => l_msg_data
923                );
924 
925         l_batch_grp_rec.Trip_Id :=l_batch_in_rec.Trip_Id;
926      ELSE
927         l_batch_grp_rec.Trip_Id := NULL;
928      --}
929      END IF;
930   --} Passed the Values or Not
931   END IF;
932 
933 -- End of Trip Validations
934 
935 -- Delivery   Validations
936 
937   IF ( ( l_batch_in_rec.Delivery_Id IS NOT NULL ) OR ( l_batch_in_rec.Delivery_Name IS NOT NULL ) ) THEN
938   --{ Passed the Values or Not
939      IF ( l_batch_in_rec.Delivery_Id = FND_API.G_MISS_NUM ) THEN
940      --{
941         l_batch_in_rec.Delivery_Id := NULL;
942      --}
943      END IF;
944      IF ( l_batch_in_rec.Delivery_Name =  FND_API.G_MISS_CHAR) THEN
945      --{
946         l_batch_in_rec.Delivery_name := NULL;
947      --}
948      END IF;
949      IF ( ( l_batch_in_rec.Delivery_Id IS NOT NULL) OR ( l_batch_in_rec.Delivery_Name IS NOT NULL ) ) THEN
950      --{
951 	IF l_debug_on THEN
952 	--{
953            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_DELIVERY_NAME',WSH_DEBUG_SV.C_PROC_LEVEL);
954         --}
955 	END IF;
956  	WSH_UTIL_VALIDATE.Validate_Delivery_Name(
957 	      p_delivery_id	   => l_batch_in_rec.Delivery_Id,
958 	      p_delivery_name	   => l_batch_in_rec.Delivery_Name,
959 	      x_return_status  => l_return_status);
960 
961         IF l_debug_on THEN
962 	--{
963            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
964         --}
965 	END IF;
966         --
967         wsh_util_core.api_post_call(
968                p_return_status => l_return_status,
969                x_num_warnings  => l_number_of_warnings,
970                x_num_errors    => l_number_of_errors,
971                p_msg_data      => l_msg_data
972                );
973 
974         --R12 MDC
975         --Delivery must be a standard delivery
976         OPEN c_check_consol_dlvy(l_batch_in_rec.Delivery_Id);
977         FETCH c_check_consol_dlvy INTO l_batch_in_rec.Delivery_Id;
978         IF c_check_consol_dlvy%NOTFOUND THEN
979            CLOSE c_check_consol_dlvy;
980            RAISE WSH_INVALID_CONSOL_DEL;
981         END IF;
982         CLOSE c_check_consol_dlvy;
983 
984 	l_batch_grp_rec.Delivery_Id := l_batch_in_rec.Delivery_Id;
985      ELSE
986         l_batch_grp_rec.Delivery_Id := NULL;
987      --}
988      END IF;
989   --} Passed the Values or Not
990   END IF;
991 
992 -- End of Delivery Validations
993 
994 --- Trip Stop Validations
995 --- Consider the trip stops only when the trip information is provided
996 --- same thing is being followed in pick release form also
997   IF ( l_batch_grp_rec.trip_id IS NOT NULL ) THEN
998   --{
999      IF ( ( l_batch_in_rec.Trip_Stop_Id IS NOT NULL ) OR ( l_batch_in_rec.trip_stop_location_id IS NOT NULL ) ) THEN
1000      --{ Passed the Values or Not
1001         IF ( l_batch_in_rec.Trip_Stop_Id = FND_API.G_MISS_NUM ) THEN
1002 	--{
1003             l_batch_in_rec.Trip_Stop_Id := NULL;
1004         --}
1005 	END IF;
1006         IF ( l_batch_in_rec.trip_stop_location_id =  FND_API.G_MISS_NUM ) THEN
1007 	--{
1008              l_batch_in_rec.trip_stop_location_id := NULL;
1009         --}
1010 	END IF;
1011         IF ( ( l_batch_in_rec.Trip_Stop_Id IS NOT NULL )  OR ( l_batch_in_rec.trip_stop_location_id IS NOT NULL ) ) THEN
1012 	--{
1013   	   IF l_debug_on THEN
1014 	   --{
1015               WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_STOP_NAME',WSH_DEBUG_SV.C_PROC_LEVEL);
1016            --}
1017 	   END IF;
1018            WSH_UTIL_VALIDATE.Validate_Stop_Name(
1019 	      p_stop_id		  => l_batch_in_rec.Trip_Stop_Id,
1020 	      p_trip_id		  => l_batch_grp_rec.Trip_id,
1021 	      p_stop_location_id  => l_batch_in_rec.trip_stop_location_id,
1022 	      p_planned_dep_date  => NULL,
1023 	      x_return_status	  => l_return_status);
1024 
1025            IF l_debug_on THEN
1026 	   --{
1027               WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
1028            --}
1029 	   END IF;
1030            --
1031            wsh_util_core.api_post_call(
1032                p_return_status => l_return_status,
1033                x_num_warnings  => l_number_of_warnings,
1034                x_num_errors    => l_number_of_errors,
1035                p_msg_data      => l_msg_data
1036                );
1037 
1038            l_batch_grp_rec.Trip_Stop_Id := l_batch_in_rec.Trip_Stop_Id ;
1039         ELSE
1040            l_batch_grp_rec.Trip_Stop_Id := NULL;
1041         --}
1042 	END IF;
1043      --} Passed the Values or Not
1044      END IF;
1045   --}
1046   END IF;
1047 
1048 -- End of Trip Stop  Validations
1049 
1050 
1051 -- Pick_Grouping_Rule_Id  Validations
1052 
1053   IF ( ( l_batch_in_rec.pick_grouping_rule_Id IS NOT NULL ) OR ( l_batch_in_rec.pick_grouping_rule_Name IS NOT NULL ) ) THEN
1054   --{ Passed the Values or Not
1055      IF ( l_batch_in_rec.pick_grouping_rule_Id = FND_API.G_MISS_NUM ) THEN
1056      --{
1057         l_batch_in_rec.pick_grouping_rule_Id := NULL;
1058      --}
1059      END IF;
1060      IF ( l_batch_in_rec.pick_grouping_rule_Name =  FND_API.G_MISS_CHAR) THEN
1061      --{
1062         l_batch_in_rec.pick_grouping_rule_name := NULL;
1063      --}
1064      END IF;
1065      IF ( ( l_batch_in_rec.pick_grouping_rule_Id IS NOT	NULL) OR ( l_batch_in_rec.pick_grouping_rule_Name IS NOT NULL ) ) THEN
1066      --{
1067  	 IF l_debug_on THEN
1068 	 --{
1069             WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_PICK_GROUP_RULE_NAMe',WSH_DEBUG_SV.C_PROC_LEVEL);
1070          --}
1071 	 END IF;
1072          WSH_UTIL_VALIDATE.Validate_Pick_Group_Rule_Name(
1073 	      p_pick_grouping_rule_id	       => l_batch_in_rec.pick_grouping_rule_Id,
1074 	      p_pick_grouping_rule_name        => l_batch_in_rec.pick_grouping_rule_Name,
1075 	      x_return_status  => l_return_status);
1076 
1077         IF l_debug_on THEN
1078 	--{
1079            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
1080         --}
1081 	END IF;
1082         --
1083         wsh_util_core.api_post_call(
1084                p_return_status => l_return_status,
1085                x_num_warnings  => l_number_of_warnings,
1086                x_num_errors    => l_number_of_errors,
1087                p_msg_data      => l_msg_data
1088                );
1089 
1090 	l_batch_grp_rec.pick_grouping_rule_Id :=l_batch_in_rec.pick_grouping_rule_Id;
1091      ELSE
1092         l_batch_grp_rec.pick_grouping_rule_Id := NULL;
1093      --}
1094      END IF;
1095   --} Passed the Values or Not
1096   END IF;
1097 
1098 -- End of Pick_Grouping_Rule_Id	 Validations
1099 
1100 -- Pick_Sequence_Rule_Id  Validations
1101 
1102   IF ( ( l_batch_in_rec.pick_sequence_rule_Id IS NOT NULL ) OR ( l_batch_in_rec.pick_sequence_rule_Name IS NOT NULL ) ) THEN
1103   --{ Passed the Values or Not
1104      IF ( l_batch_in_rec.pick_sequence_rule_Id = FND_API.G_MISS_NUM ) THEN
1105      --{
1106         l_batch_in_rec.pick_sequence_rule_Id := NULL;
1107      --}
1108      END IF;
1109      IF ( l_batch_in_rec.pick_sequence_rule_name =  FND_API.G_MISS_CHAR) THEN
1110      --{
1111         l_batch_in_rec.pick_sequence_rule_name := NULL;
1112      --}
1113      END IF;
1114      IF ( ( l_batch_in_rec.pick_sequence_rule_Id IS NOT	NULL) OR ( l_batch_in_rec.pick_sequence_rule_Name IS NOT NULL ) ) THEN
1115      --{
1116  	IF l_debug_on THEN
1117 	--{
1118             WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_PICK_SEQ_RULE_NAME',WSH_DEBUG_SV.C_PROC_LEVEL);
1119         --}
1120  	END IF;
1121         WSH_UTIL_VALIDATE.Validate_Pick_Seq_Rule_Name(
1122 	      p_pick_sequence_rule_id	       => l_batch_in_rec.pick_sequence_rule_Id,
1123 	      p_pick_sequence_rule_name        => l_batch_in_rec.pick_sequence_rule_Name,
1124 	      x_return_status                  => l_return_status);
1125 
1126         IF l_debug_on THEN
1127 	--{
1128            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
1129         --}
1130 	END IF;
1131         --
1132         wsh_util_core.api_post_call(
1133                p_return_status => l_return_status,
1134                x_num_warnings  => l_number_of_warnings,
1135                x_num_errors    => l_number_of_errors,
1136                p_msg_data      => l_msg_data
1137                );
1138 
1139         l_batch_grp_rec.pick_sequence_rule_Id :=l_batch_in_rec.pick_sequence_rule_Id;
1140      ELSE
1141         l_batch_grp_rec.pick_sequence_rule_Id := NULL;
1142      --}
1143      END IF;
1144   --} Passed the Values or Not
1145   END IF;
1146 
1147 -- End of Pick_Sequence_Rule_Id Validations
1148 
1149 -- Bug 3463315 Append_Flag validation
1150 
1151   IF ( l_batch_in_rec.autocreate_delivery_flag IS NOT NULL ) THEN
1152      IF ( l_batch_in_rec.autocreate_delivery_flag = FND_API.G_MISS_CHAR ) THEN
1153         l_batch_in_rec.autocreate_delivery_flag := NULL;
1154      END IF;
1155 
1156      IF (l_batch_in_rec.autocreate_delivery_flag IS NOT NULL) THEN
1157 	l_batch_grp_rec.autocreate_delivery_flag := l_batch_in_rec.autocreate_delivery_flag;
1158      ELSE
1159         l_batch_grp_rec.autocreate_delivery_flag := NULL;
1160      END IF;
1161 
1162   END IF;
1163 
1164   -- Bug# 3480908 - Start
1165   IF l_batch_grp_rec.autocreate_delivery_flag <> 'Y' THEN
1166       l_batch_grp_rec.Autopack_Flag := 'N';
1167       l_batch_grp_rec.Ship_Confirm_Rule_Id := NULL;
1168       l_batch_grp_rec.ac_Delivery_Criteria := NULL;
1169   END IF;
1170   -- Bug# 3480908 - End
1171 
1172   IF ( l_batch_in_rec.ac_delivery_criteria IS NOT NULL ) THEN
1173      IF ( l_batch_in_rec.ac_delivery_criteria = FND_API.G_MISS_CHAR ) THEN
1174         l_batch_in_rec.ac_delivery_criteria := NULL;
1175      END IF;
1176 
1177      IF (l_batch_in_rec.ac_delivery_criteria IS NOT NULL) THEN
1178 	l_batch_grp_rec.ac_delivery_criteria := l_batch_in_rec.ac_delivery_criteria;
1179      ELSE
1180         l_batch_grp_rec.ac_delivery_criteria := NULL;
1181      END IF;
1182   END IF;
1183 
1184 -- End of Bug 3463315 Append_Flag validation
1185 
1186 -- Ship_Confirm_Rule_Id	 Validations
1187 
1188   IF ( ( l_batch_in_rec.ship_confirm_rule_Id IS NOT NULL ) OR ( l_batch_in_rec.ship_confirm_rule_Name IS NOT NULL ) ) THEN
1189   --{ Passed the Values or Not
1190      IF ( l_batch_in_rec.ship_confirm_rule_Id = FND_API.G_MISS_NUM ) THEN
1191      --{
1192         l_batch_in_rec.ship_confirm_rule_Id := NULL;
1193      --}
1194      END IF;
1195      IF ( l_batch_in_rec.ship_confirm_rule_name =  FND_API.G_MISS_CHAR) THEN
1196      --{
1197         l_batch_in_rec.ship_confirm_rule_name := NULL;
1198      --}
1199      END IF;
1200      IF ( ( l_batch_in_rec.ship_confirm_rule_Id IS NOT	NULL) OR ( l_batch_in_rec.ship_confirm_rule_Name IS NOT NULL ) ) THEN
1201      --{
1202 	IF l_debug_on THEN
1203 	--{
1204            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_SHIP_CON_RULE_NAME',WSH_DEBUG_SV.C_PROC_LEVEL);
1205         --}
1206 	END IF;
1207         WSH_UTIL_VALIDATE.Validate_Ship_Con_Rule_Name(
1208 	      p_ship_confirm_rule_id	       => l_batch_in_rec.ship_confirm_rule_Id,
1209 	      p_ship_confirm_rule_name        => l_batch_in_rec.ship_confirm_rule_Name,
1210 	      x_return_status                  => l_return_status);
1211 
1212         IF l_debug_on THEN
1213 	--{
1214            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
1215         --}
1216 	END IF;
1217         --
1218         wsh_util_core.api_post_call(
1219                p_return_status => l_return_status,
1220                x_num_warnings  => l_number_of_warnings,
1221                x_num_errors    => l_number_of_errors,
1222                p_msg_data      => l_msg_data
1223                );
1224 
1225 	l_batch_grp_rec.ship_confirm_rule_Id :=l_batch_in_rec.ship_confirm_rule_Id;
1226      ELSE
1227         l_batch_grp_rec.ship_confirm_rule_Id := NULL;
1228      --}
1229      END IF;
1230   --} Passed the Values or Not
1231   END IF;
1232 
1233 -- End of ship_confirm_Rule_Id Validations
1234   --{
1235   --
1236   -- Posco ER : By now, we know for sure whether a Ship Confirm Rule
1237   -- has to be used with this batch or NOT
1238   --
1239   -- So, proceed to validate the Actual Departure date
1240   --
1241   IF l_batch_grp_rec.ship_confirm_rule_id IS NULL THEN
1242    --{
1243    IF l_batch_in_rec.actual_departure_date IS NOT NULL THEN
1244     --
1245     FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_ACTUAL_DEP_DATE');
1246     x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1247     wsh_util_core.add_message(x_return_status);
1248     --
1249     IF l_debug_on THEN
1250      wsh_debug_sv.logmsg(l_module_name, 'Error - WSH_NO_ACTUAL_DEP_DATE');
1251      wsh_debug_sv.pop(l_module_name);
1252     END IF;
1253     --
1254     RETURN;
1255     --
1256    END IF;
1257    --}
1258   ELSE
1259    --{
1260    IF l_batch_in_rec.actual_departure_date IS NOT NULL THEN
1261     --{
1262     WSH_UTIL_VALIDATE.ValidateActualDepartureDate(
1263             p_ship_confirm_rule_id  => l_batch_grp_rec.ship_confirm_rule_id,
1264             p_actual_departure_date => l_batch_in_rec.actual_departure_date,
1265             x_return_status         => l_return_status);
1266     --
1267     wsh_util_core.api_post_call(
1268                p_return_status => l_return_status,
1269                x_num_warnings  => l_number_of_warnings,
1270                x_num_errors    => l_number_of_errors,
1271                p_msg_data      => l_msg_data
1272                );
1273     --
1274     l_batch_grp_rec.actual_departure_date := l_batch_in_rec.actual_departure_date;
1275     --}
1276    ELSE
1277     l_batch_grp_rec.actual_departure_date := NULL;
1278    END IF;
1279    --}
1280   END IF;
1281   --
1282   --}
1283   --
1284 --- Carrier  Validations
1285 -- Bug#: 3266659 - Removing carrier validations
1286 /*
1287   IF ( ( l_batch_in_rec.Carrier_Id IS NOT NULL ) OR ( l_batch_in_rec.Carrier_Name IS NOT NULL ) ) THEN
1288   --{ Passed the Values or Not
1289      IF ( l_batch_in_rec.Carrier_Id = FND_API.G_MISS_NUM ) THEN
1290      --{
1291         l_batch_in_rec.Carrier_Id := NULL;
1292      --}
1293      END IF;
1294      IF ( l_batch_in_rec.Carrier_name =  FND_API.G_MISS_CHAR ) THEN
1295      --{
1296         l_batch_in_rec.Carrier_Name := NULL;
1297      --}
1298      END IF;
1299      IF ( ( l_batch_in_rec.Carrier_Id IS NOT NULL ) OR ( l_batch_in_rec.Carrier_Name IS NOT NULL ) ) THEN
1300      --{
1301 	IF l_debug_on THEN
1302 	--{
1303            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_VALIDATE.VALIDATE_CARRIER',WSH_DEBUG_SV.C_PROC_LEVEL);
1304         --}
1305 	END IF;
1306         WSH_UTIL_VALIDATE.Validate_Carrier(
1307 	      x_Carrier_id	  => l_batch_in_rec.Carrier_Id,
1308 	      p_Carrier_name	  => l_batch_in_rec.Carrier_Name,
1309 	      x_return_status     => l_return_status);
1310 
1311         IF l_debug_on THEN
1312 	--{
1313            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
1314         --}
1315 	END IF;
1316         --
1317         wsh_util_core.api_post_call(
1318                p_return_status => l_return_status,
1319                x_num_warnings  => l_number_of_warnings,
1320                x_num_errors    => l_number_of_errors,
1321                p_msg_data      => l_msg_data
1322                );
1323 
1324 	l_batch_grp_rec.Carrier_Id := l_batch_in_rec.Carrier_Id;
1325      ELSE
1326         l_batch_grp_rec.Carrier_Id  := NULL;
1327      --}
1328      END IF;
1329   --} Passed the Values or Not
1330   END IF;
1331 */
1332 -- End of Carrier Validations
1333 
1334 -- Inventory Item Id Validations
1335 
1336   IF ( l_batch_in_rec.Inventory_Item_Id IS NOT NULL ) THEN
1337   --{ Passed the Values or Not
1338      IF ( l_batch_in_rec.Inventory_Item_Id <> FND_API.G_MISS_NUM ) THEN
1339      --{
1340         OPEN Check_Item_id(l_batch_in_rec.Inventory_Item_Id,l_batch_grp_rec.organization_id);
1341         FETCH Check_Item_id INTO l_batch_in_rec.Inventory_Item_Id;
1342         IF ( Check_Item_id%NOTFOUND ) THEN
1343 	--{
1344 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1345             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','INVENTORY_ITEM_ID');
1346 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1347 	    wsh_util_core.add_message(x_return_status);
1348 	    CLOSE Check_Item_id;
1349 	    return;
1350         --}
1351 	END IF;
1352 	CLOSE Check_Item_id;
1353         l_batch_grp_rec.Inventory_Item_Id := l_batch_in_rec.Inventory_Item_Id;
1354      ELSE
1355         l_batch_grp_rec.Inventory_Item_Id := NULL;
1356      --}
1357      END IF;
1358   --} Passed the Values or Not
1359   END IF;
1360 
1361 -- End of Inventory Item Id  Validations
1362 
1363 
1364 --  Subinventory and locators are considered only when the organization is mentioned
1365 
1366   IF ( l_batch_grp_rec.organization_id IS NOT NULL ) THEN
1367   --{ Check subinventories and locators only when Org is specified
1368      -- Default_Stage_Subinventory  Validations
1369      IF ( l_batch_in_rec.Default_Stage_Subinventory  IS NOT NULL ) THEN
1370      --{ Passed the Values or Not
1371         IF ( l_batch_in_rec.Default_Stage_Subinventory <> FND_API.G_MISS_CHAR) THEN
1372 	--{
1373            OPEN Check_Subinventory( l_batch_in_rec.Default_Stage_Subinventory,l_batch_grp_rec.organization_id);
1374            FETCH Check_Subinventory INTO l_batch_in_rec.Default_Stage_Subinventory;
1375            IF ( Check_Subinventory%NOTFOUND ) THEN
1376 	   --{
1377 	      FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1378               FND_MESSAGE.SET_TOKEN('ATTRIBUTE','DEFAULT_STAGE_SUBINVENTORY');
1379 	      x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1380 	      wsh_util_core.add_message(x_return_status);
1381 	      CLOSE Check_Subinventory;
1382 	      return;
1383            --}
1384 	   END IF;
1385 	   CLOSE Check_Subinventory;
1386 	   l_batch_grp_rec.Default_Stage_Subinventory := l_batch_in_rec.Default_Stage_Subinventory;
1387         ELSE
1388            l_batch_grp_rec.Default_Stage_Subinventory := NULL;
1389         --}
1390 	END IF;
1391      --} Passed the Values or Not
1392      END IF;
1393      -- End of Default_Stage_Subinventory  Validations
1394 
1395      -- Default_Stage_Locator_Id  Validations
1396      IF ( l_batch_in_rec.Default_Stage_Locator_Id IS NOT NULL ) THEN
1397      --{ Passed the Values or Not
1398         IF (l_batch_in_rec.Default_Stage_Locator_Id <> FND_API.G_MISS_NUM ) THEN
1399 	--{
1400            OPEN Check_Locator_Id( l_batch_in_rec.Default_Stage_Locator_Id,l_batch_grp_rec.Default_Stage_Subinventory,l_batch_grp_rec.organization_id);
1401            FETCH Check_Locator_Id INTO l_batch_in_rec.Default_Stage_Locator_Id;
1402            IF ( Check_Locator_Id%NOTFOUND ) THEN
1403 	   --{
1404 	      FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1405               FND_MESSAGE.SET_TOKEN('ATTRIBUTE','DEFAULT_STAGE_LOCATOR_ID');
1406 	      x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1407 	      wsh_util_core.add_message(x_return_status);
1408 	      CLOSE Check_Locator_Id;
1409 	      return;
1410            --}
1411 	   END IF;
1412 	   CLOSE Check_Locator_Id;
1413            l_batch_grp_rec.Default_Stage_Locator_Id := l_batch_in_rec.Default_Stage_Locator_Id;
1414         ELSE
1415            l_batch_grp_rec.Default_Stage_Locator_Id := NULL;
1416         --}
1417 	END IF;
1418      --} Passed the Values or Not
1419      END IF;
1420      -- End of Default_Stage_Locator_Id  Validations
1421 
1422 
1423      -- Pick_From_Subinventory  Validations
1424      IF ( l_batch_in_rec.Pick_From_Subinventory  IS NOT NULL ) THEN
1425      --{ Passed the Values or Not
1426         IF ( l_batch_in_rec.Pick_From_Subinventory <> FND_API.G_MISS_CHAR) THEN
1427 	--{
1428            OPEN Check_Subinventory( l_batch_in_rec.Pick_From_Subinventory,l_batch_grp_rec.organization_id);
1429            FETCH Check_Subinventory INTO l_batch_in_rec.Pick_From_Subinventory;
1430            IF ( Check_Subinventory%NOTFOUND ) THEN
1431 	   --{
1432 	      FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1433               FND_MESSAGE.SET_TOKEN('ATTRIBUTE','PICK_FROM_SUBINVENTORY');
1434 	      x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1435 	      wsh_util_core.add_message(x_return_status);
1436 	      CLOSE Check_Subinventory;
1437 	      return;
1438            --}
1439 	   END IF;
1440 	   CLOSE Check_Subinventory;
1441 	   l_batch_grp_rec.Pick_From_Subinventory := l_batch_in_rec.Pick_From_Subinventory;
1442         ELSE
1443            l_batch_grp_rec.Pick_From_Subinventory := NULL;
1444         --}
1445 	END IF;
1446      --} Passed the Values or Not
1447      END IF;
1448      -- End of Pick_From_Subinventory  Validations
1449 
1450      -- Pick_From_locator_Id Validations
1451      IF ( l_batch_in_rec.Pick_From_locator_Id IS NOT NULL ) THEN
1452      --{ Passed the Values or Not
1453         IF (l_batch_in_rec.Pick_From_locator_Id <> FND_API.G_MISS_NUM ) THEN
1454 	--{
1455            OPEN Check_Locator_Id( l_batch_in_rec.Pick_From_locator_Id,l_batch_grp_rec.Pick_From_Subinventory,l_batch_grp_rec.organization_id );
1456            FETCH Check_Locator_Id INTO l_batch_in_rec.Pick_From_locator_Id;
1457            IF ( Check_Locator_Id%NOTFOUND ) THEN
1458 	   --{
1459 	      FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1460               FND_MESSAGE.SET_TOKEN('ATTRIBUTE','PICK_FROM_LOCATOR_ID');
1461 	      x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1462 	      wsh_util_core.add_message(x_return_status);
1463 	      CLOSE  Check_Locator_Id;
1464 	      return;
1465 	   --}
1466 	   END IF;
1467 	   CLOSE Check_Locator_Id;
1468            l_batch_grp_rec.Pick_From_locator_Id := l_batch_in_rec.Pick_From_locator_Id;
1469         ELSE
1470            l_batch_grp_rec.Pick_From_locator_Id := NULL;
1471         --}
1472 	END IF;
1473      --} Passed the Values or Not
1474      END IF;
1475      -- End of Pick_From_locator_Id Validations
1476   -- } Check subinventories and locators only when Org is specified
1477   END IF;
1478 
1479 -- End of subinventory and locator validations
1480 
1481 -- Delivery_Detail_Id  Validations
1482 
1483   IF ( l_batch_in_rec.Delivery_Detail_Id IS NOT NULL ) THEN
1484   --{ Passed the Values or Not
1485      IF ( l_batch_in_rec.Delivery_Detail_Id <> FND_API.G_MISS_NUM ) THEN
1486      --{
1487         OPEN Check_Delivery_Detail_Id(l_batch_in_rec.Delivery_Detail_Id);
1488         FETCH Check_Delivery_Detail_Id INTO l_batch_in_rec.Delivery_Detail_Id;
1489         IF ( Check_Delivery_Detail_Id%NOTFOUND ) THEN
1490 	--{
1491 	   FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1492            FND_MESSAGE.SET_TOKEN('ATTRIBUTE','DELIVERY_DETAIL_ID');
1493 	   x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1494 	   wsh_util_core.add_message(x_return_status);
1495 	   CLOSE Check_Delivery_Detail_Id;
1496 	   return;
1497         --}
1498 	END IF;
1499 	CLOSE Check_Delivery_Detail_Id;
1500         l_batch_grp_rec.Delivery_Detail_Id := l_batch_in_rec.Delivery_Detail_Id;
1501      ELSE
1502         l_batch_grp_rec.Delivery_Detail_Id := NULL;
1503      --}
1504      END IF;
1505   --} Passed the Values or Not
1506   END IF;
1507 
1508 -- End of Delivery_Detail_Id  Validations
1509 
1510 -- Category_Set_ID  Validations
1511   IF ( l_batch_in_rec.Category_Set_Id IS NOT NULL ) THEN
1512   --{ Passed the Values or Not
1513      IF ( l_batch_in_rec.Category_Set_Id <> FND_API.G_MISS_NUM ) THEN
1514      --{
1515         OPEN Check_Category_Set_Id(l_batch_in_rec.Category_Set_Id);
1516         FETCH Check_Category_Set_Id INTO l_batch_in_rec.Category_Set_Id;
1517         IF ( Check_Category_Set_Id%NOTFOUND ) THEN
1518 	--{
1519 	   FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1520            FND_MESSAGE.SET_TOKEN('ATTRIBUTE','CATEGORY_SET_ID');
1521 	   x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1522 	   wsh_util_core.add_message(x_return_status);
1523 	   CLOSE Check_Category_Set_Id;
1524 	   return;
1525         --}
1526 	END IF;
1527 	CLOSE Check_Category_Set_Id;
1528         l_batch_grp_rec.Category_Set_Id := l_batch_in_rec.Category_Set_Id;
1529      ELSE
1530         l_batch_grp_rec.Category_Set_Id := NULL;
1531      --}
1532      END IF;
1533   --} Passed the Values or Not
1534   END IF;
1535 -- End of Category_Set_ID  Validations
1536 
1537 
1538 -- Category_ID Validations
1539   IF ( l_batch_grp_rec.Category_Set_Id IS NOT NULL ) THEN
1540   --{ Set_Id
1541      IF ( l_batch_in_rec.Category_Id IS NOT NULL ) THEN
1542      --{ Passed the Values or Not
1543         IF ( l_batch_in_rec.Category_Id <> FND_API.G_MISS_NUM ) THEN
1544 	--{
1545            OPEN Check_Category_Id(l_batch_in_rec.Category_Id);
1546            FETCH Check_Category_Id INTO l_batch_in_rec.Category_Id;
1547            IF ( Check_Category_Id%NOTFOUND ) THEN
1548 	   --{
1549 	      FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1550               FND_MESSAGE.SET_TOKEN('ATTRIBUTE','CATEGORY_ID');
1551 	      x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1552 	      wsh_util_core.add_message(x_return_status);
1553 	      CLOSE Check_Category_Id;
1554 	      return;
1555            --}
1556 	   END IF;
1557            CLOSE Check_Category_Id;
1558 	   l_batch_grp_rec.Category_Id := l_batch_in_rec.Category_Id;
1559         ELSE
1560            l_batch_grp_rec.Category_Id := NULL;
1561         --}
1562 	END IF;
1563      --} Passed the Values or Not
1564      END IF;
1565   --} Set_Id
1566   END IF;
1567 
1568 -- End of Category_ID  Validations
1569 
1570 -- Ignore_Shipset_Smc Validations
1571 
1572   IF ( l_batch_in_rec.Ship_Set_Smc_Flag  IS NOT NULL ) THEN
1573   --{ Passed the Values or Not
1574      IF ( l_batch_in_rec.Ship_Set_Smc_Flag  <> FND_API.G_MISS_CHAR ) THEN
1575      --{
1576         IF ( l_batch_in_rec.Ship_Set_Smc_Flag  NOT IN ('I','E','A') ) THEN
1577 	--{
1578 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1579             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','SHIP_SET_SMC_FLAG');
1580 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1581 	    wsh_util_core.add_message(x_return_status);
1582 	    return;
1583         --}
1584 	END IF;
1585 	l_batch_grp_rec.Ship_Set_Smc_Flag :=l_batch_in_rec.Ship_Set_Smc_Flag;
1586      ELSE
1587         l_batch_grp_rec.Ship_Set_Smc_Flag := NULL;
1588      --}
1589      END IF;
1590   --} Passed the Values or Not
1591   END IF;
1592 
1593 --  End of Ignore_Shipset_Smc Validations
1594 
1595 
1596 -- Auto_Pick_Confirm_Flag Validations
1597   IF ( l_batch_in_rec.Auto_Pick_Confirm_Flag  IS NOT NULL ) THEN
1598   --{ Passed the Values or Not
1599      IF (l_batch_in_rec.Auto_Pick_Confirm_Flag <> FND_API.G_MISS_CHAR) THEN
1600      --{
1601         IF ( l_batch_in_rec.Auto_Pick_Confirm_Flag  NOT IN ('Y','N') )	THEN
1602 	--{
1603 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1604             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','AUTO_PICK_CONFIRM_FLAG');
1605 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1606 	    wsh_util_core.add_message(x_return_status);
1607 	    return;
1608         --}
1609 	END IF;
1610 	l_batch_grp_rec.Auto_Pick_Confirm_Flag := l_batch_in_rec.Auto_Pick_Confirm_Flag;
1611      ELSE
1612         l_batch_grp_rec.Auto_Pick_Confirm_Flag := NULL;
1613      --}
1614      END IF;
1615   --} Passed the Values or Not
1616   END IF;
1617 -- End of Auto_Pick_Confirm_Flag Validations
1618 
1619 -- Validating the Existing Reservations	Only Flag
1620 
1621   IF ( l_batch_in_rec.Existing_Rsvs_Only_Flag IS NOT NULL ) THEN
1622   --{ Passed the Values or Not
1623      IF (l_batch_in_rec.Existing_Rsvs_Only_Flag	<> FND_API.G_MISS_CHAR) THEN
1624      --{
1625         IF ( l_batch_in_rec.Existing_Rsvs_Only_Flag  NOT IN ('N','Y'))	THEN
1626 	--{
1627 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1628             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','EXISTING_RSVS_ONLY_FLAG');
1629 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1630 	    wsh_util_core.add_message(x_return_status);
1631 	    return;
1632         --}
1633 	END IF;
1634 	l_batch_grp_rec.Existing_Rsvs_Only_Flag := l_batch_in_rec.Existing_Rsvs_Only_Flag;
1635      ELSE
1636         l_batch_grp_rec.Existing_Rsvs_Only_Flag := NULL;
1637      --}
1638      END IF;
1639   --} Passed the Values or Not
1640   END IF;
1641 
1642 -- End of Validating the Existing Reservations Only Flag
1643 
1644 -- Include Planned Lines Validations
1645 
1646   IF ( l_batch_in_rec.Include_Planned_Lines IS NOT NULL ) THEN
1647   --{ Passed the Values or Not
1648      IF (l_batch_in_rec.Include_Planned_Lines <> FND_API.G_MISS_CHAR) THEN
1649      --{
1650         IF ( l_batch_in_rec.Include_Planned_Lines  NOT	IN ('Y','N') ) THEN
1651 	--{
1652 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1653             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','INCLUDE_PLANNED_LINES');
1654 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1655 	    wsh_util_core.add_message(x_return_status);
1656 	    return;
1657         --}
1658 	END IF;
1659 	l_batch_grp_rec.Include_Planned_Lines := l_batch_in_rec.Include_Planned_Lines;
1660      ELSE
1661         l_batch_grp_rec.Include_Planned_Lines := NULL;
1662      --}
1663      END IF;
1664   --} Passed the Values or Not
1665   END IF;
1666 
1667 -- End of Include Planned Lines	Validations
1668 
1669 -- Autodetail_Pr_Flag Validations
1670 
1671   IF ( l_batch_in_rec.Autodetail_Pr_Flag IS NOT NULL ) THEN
1672   --{ Passed the Values or Not
1673      IF (l_batch_in_rec.Autodetail_Pr_Flag <> FND_API.G_MISS_CHAR) THEN
1674      --{
1675         IF ( l_batch_in_rec.Autodetail_Pr_Flag  NOT IN ('Y','N') ) THEN
1676 	--{
1677 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1678             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','AUTODETAIL_PR_FLAG');
1679 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1680 	    wsh_util_core.add_message(x_return_status);
1681 	    return;
1682         --}
1683 	END IF;
1684 	l_batch_grp_rec.Autodetail_Pr_Flag :=l_batch_in_rec.Autodetail_Pr_Flag;
1685      ELSE
1686         l_batch_grp_rec.Autodetail_Pr_Flag := NULL;
1687      --}
1688      END IF;
1689   --} Passed the Values or Not
1690   END IF;
1691 
1692 -- End of Autodetail_Pr_Flag Validations
1693 
1694 
1695 -- Autopack_Flag Validations
1696 
1697   IF ( l_batch_in_rec.Autopack_Flag IS NOT NULL ) THEN
1698   --{ Passed the Values or Not
1699      IF (l_batch_in_rec.Autopack_Flag <> FND_API.G_MISS_CHAR) THEN
1700      --{
1701         IF ( l_batch_in_rec.Autopack_Flag  NOT IN ('Y','N') ) THEN
1702 	--{
1703 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1704             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','AUTOPACK_FLAG');
1705 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1706 	    wsh_util_core.add_message(x_return_status);
1707 	    return;
1708         --}
1709 	END IF;
1710 	l_batch_grp_rec.Autopack_Flag :=l_batch_in_rec.Autopack_Flag;
1711      ELSE
1712         l_batch_grp_rec.Autopack_Flag := NULL;
1713      --}
1714      END IF;
1715   --} Passed the Values or Not
1716   END IF;
1717 
1718 -- End of Autopack_Flag	Validations
1719 
1720 -- Autopack_Level Validations
1721 -- Consider the Autopack_level only when the Autopack_Flag set to "Y"
1722   IF ( l_batch_grp_rec.Autopack_Flag = 'Y' ) THEN
1723   --{
1724     IF ( l_batch_in_rec.Autopack_Level IS NOT NULL ) THEN
1725     --{ Passed the Values or Not
1726        IF (l_batch_in_rec.Autopack_Level <> FND_API.G_MISS_NUM) THEN
1727        --{
1728           IF ( l_batch_in_rec.Autopack_Level NOT IN (0,1,2) ) THEN
1729 	  --{
1730 	      FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1731               FND_MESSAGE.SET_TOKEN('ATTRIBUTE','AUTOPACK_LEVEL');
1732 	      x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1733 	      wsh_util_core.add_message(x_return_status);
1734 	      return;
1735           --}
1736 	  END IF;
1737 	  l_batch_grp_rec.Autopack_Level := l_batch_in_rec.Autopack_Level;
1738        ELSE
1739           l_batch_grp_rec.Autopack_Level := NULL;
1740        --}
1741        END IF;
1742     --} Passed the Values or Not
1743     END IF;
1744   --}
1745   END IF;
1746 
1747 -- End of Autopack_Level  Validations
1748 
1749 -- Task_Planning_Flag Validations
1750 
1751   IF ( l_batch_in_rec.Task_Planning_Flag IS NOT NULL ) THEN
1752   --{ Passed the Values or Not
1753      IF (l_batch_in_rec.Task_Planning_Flag <> FND_API.G_MISS_CHAR) THEN
1754      --{
1755         IF ( l_batch_in_rec.Task_Planning_Flag  NOT IN ('Y','N') ) THEN
1756 	--{
1757 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1758             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','TASK_PLANNING_FLAG');
1759 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1760 	    wsh_util_core.add_message(x_return_status);
1761 	    return;
1762         --}
1763 	END IF;
1764 	l_batch_grp_rec.Task_Planning_Flag :=l_batch_in_rec.Task_Planning_Flag;
1765      ELSE
1766         l_batch_grp_rec.Task_Planning_Flag := NULL;
1767      --}
1768      END IF;
1769   --} Passed the Values or Not
1770   END IF;
1771 -- End of Task_Planning_Flag Validations
1772 
1773 -- Bug# 3480908 - Start - If the org is WMS enabled, and Plan task is yes then auto alocate is yes.
1774   IF l_batch_grp_rec.Task_Planning_Flag = 'Y' AND l_is_WMS_org = 'Y' THEN
1775 	l_batch_grp_rec.Autodetail_Pr_Flag := 'Y';
1776   END IF;
1777 -- Bug# 3480908 - End
1778 
1779 
1780 --bug# 6689448 (replenishment project): begin
1781 -- dynamic_replenishment_flag Validations
1782 
1783   IF ( l_batch_in_rec.dynamic_replenishment_flag IS NOT NULL ) THEN
1784   --{ Passed the Values or Not
1785      IF (l_batch_in_rec.dynamic_replenishment_flag <> FND_API.G_MISS_CHAR) THEN
1786      --{
1787         IF ( l_batch_in_rec.dynamic_replenishment_flag  NOT IN ('Y','N') ) THEN
1788 	--{
1789 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1790             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','dynamic_replenishment_flag');
1791 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1792 	    wsh_util_core.add_message(x_return_status);
1793 	    return;
1794         --}
1795 	END IF;
1796 	l_batch_grp_rec.dynamic_replenishment_flag :=l_batch_in_rec.dynamic_replenishment_flag;
1797      ELSE
1798         l_batch_grp_rec.dynamic_replenishment_flag := NULL;
1799      --}
1800      END IF;
1801   --} Passed the Values or Not
1802   END IF;
1803 -- End of dynamic_replenishment_flag Validations
1804 
1805   -- If the org is WMS enabled, and Plan task is yes then auto alocate is yes.
1806   IF l_batch_grp_rec.dynamic_replenishment_flag = 'Y' AND l_is_WMS_org = 'Y' THEN
1807 	l_batch_grp_rec.Autodetail_Pr_Flag := 'Y';
1808   END IF;
1809 
1810 --bug# 6689448 (replenishment project): end
1811 
1812 -- Non_Picking_flag  Validations
1813 -- Bug#: 3266659 - Removing Non_Picking_flag validations
1814 /*
1815   IF ( l_batch_in_rec.Non_Picking_flag IS NOT NULL ) THEN
1816   --{ Passed the Values or Not
1817      IF (l_batch_in_rec.Non_Picking_flag <> FND_API.G_MISS_CHAR) THEN
1818      --{
1819         IF ( l_batch_in_rec.Non_Picking_flag  NOT IN ('Y','N') ) THEN
1820 	--{
1821 	    FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
1822             FND_MESSAGE.SET_TOKEN('ATTRIBUTE','NON_PICKING_FLAG');
1823 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
1824 	    wsh_util_core.add_message(x_return_status);
1825 	    return;
1826         --}
1827 	END IF;
1828 	l_batch_grp_rec.Non_Picking_flag :=l_batch_in_rec.Non_Picking_flag;
1829      ELSE
1830         l_batch_grp_rec.Non_Picking_flag := NULL;
1831      --}
1832      END IF;
1833   --} Passed the Values or Not
1834   END IF;
1835 */
1836 -- End of Non_Picking_flag Validations
1837 
1838 -- Shipment_Priority_Code Validations
1839 
1840   IF ( l_batch_in_rec.Shipment_Priority_Code  IS NOT NULL ) THEN
1841   --{
1842      IF (l_batch_in_rec.Shipment_Priority_Code <> FND_API.G_MISS_CHAR) THEN
1843      --{
1844         l_batch_in_rec.Shipment_Priority_Code  := l_batch_in_rec.Shipment_Priority_Code;
1845      ELSE
1846         l_batch_in_rec.Shipment_Priority_Code := NULL;
1847      --}
1848      END IF;
1849   --}
1850   END IF;
1851 
1852 -- End of Validating the Shipment_Priority_Code
1853 
1854 
1855 -- Project_Id  Validations
1856   IF ( l_batch_in_rec.Project_Id IS NOT NULL ) THEN
1857   --{
1858      IF ( l_batch_in_rec.Project_Id <> FND_API.G_MISS_NUM ) THEN
1859      --{
1860         l_batch_grp_rec.Project_Id := l_batch_in_rec.Project_Id;
1861      ELSE
1862         l_batch_grp_rec.Project_Id := NULL;
1863      --}
1864      END IF;
1865   --}
1866   END IF;
1867 -- End of Project_Id  Validations
1868 
1869 
1870 -- Task_Id Validations
1871   IF ( l_batch_in_rec.Task_Id IS NOT NULL ) THEN
1872   --{
1873      IF ( l_batch_in_rec.Task_Id <> FND_API.G_MISS_NUM ) THEN
1874      --{
1875         l_batch_grp_rec.Task_Id := l_batch_in_rec.Task_Id;
1876      ELSE
1877         l_batch_grp_rec.Task_Id := NULL;
1878      --}
1879      END IF;
1880   --}
1881   END IF;
1882 -- End of Task_Id  Validations
1883 
1884 -- From	Requested Date Validations
1885 
1886   IF ( l_batch_in_rec.From_Requested_Date IS NOT NULL ) THEN
1887   --{
1888      IF ( l_batch_in_rec.From_Requested_Date <> FND_API.G_MISS_DATE ) THEN
1889      --{
1890         l_batch_grp_rec.From_Requested_Date	:= l_batch_in_rec.From_Requested_Date;
1891      ELSE
1892         l_batch_grp_rec.From_Requested_Date := NULL;
1893      --}
1894      END IF;
1895   --}
1896   END IF;
1897 
1898 -- End of From Requested Date  Validations
1899 
1900 -- To Requested	Date Validations
1901 
1902   IF ( l_batch_in_rec.To_Requested_Date IS NOT NULL ) THEN
1903   --{
1904      IF ( l_batch_in_rec.To_Requested_Date <> FND_API.G_MISS_DATE ) THEN
1905      --{
1906         l_batch_grp_rec.To_Requested_Date := l_batch_in_rec.To_Requested_Date;
1907      ELSE
1908         l_batch_grp_rec.To_Requested_Date := NULL;
1909      --}
1910      END IF;
1911   --}
1912   END IF;
1913 
1914 -- End of To_Requested_Date  Validations
1915 
1916 -- From	Scheduled Ship Date  Validations
1917 
1918   IF ( l_batch_in_rec.From_Scheduled_Ship_Date IS NOT NULL ) THEN
1919   --{
1920      IF ( l_batch_in_rec.From_Scheduled_Ship_Date <> FND_API.G_MISS_DATE ) THEN
1921      --{
1922         l_batch_grp_rec.From_Scheduled_Ship_Date :=	l_batch_in_rec.From_Scheduled_Ship_Date;
1923      ELSE
1924         l_batch_grp_rec.From_Scheduled_Ship_Date := NULL;
1925      --}
1926      END IF;
1927   --}
1928   END IF;
1929 
1930 -- End of From_Scheduled_Ship_Date   Validations
1931 
1932 -- To Scheduled	Ship Date Validations
1933 
1934   IF ( l_batch_in_rec.To_Scheduled_Ship_Date IS NOT NULL ) THEN
1935   --{
1936      IF ( l_batch_in_rec.To_Scheduled_Ship_Date	<> FND_API.G_MISS_DATE ) THEN
1937      --{
1938         l_batch_grp_rec.To_Scheduled_Ship_Date := l_batch_in_rec.To_Scheduled_Ship_Date;
1939      ELSE
1940         l_batch_grp_rec.To_Scheduled_Ship_Date := NULL;
1941      --}
1942      END IF;
1943   --}
1944   END IF;
1945 
1946 -- End of To Scheduled Ship Date  Validations
1947 
1948 -- Validate all Attribute Fields
1949   IF ( l_batch_in_rec.Attribute_Category IS NOT NULL ) THEN
1950   --{
1951      IF ( l_batch_in_rec.Attribute_Category <> FND_API.G_MISS_CHAR ) THEN
1952      --{
1953         l_batch_grp_rec.Attribute_Category := l_batch_in_rec.Attribute_Category;
1954      ELSE
1955         l_batch_grp_rec.Attribute_Category := NULL;
1956      --}
1957      END IF;
1958   --}
1959   END IF;
1960 
1961   IF ( l_batch_in_rec.Attribute1 IS NOT NULL ) THEN
1962   --{
1963      IF ( l_batch_in_rec.Attribute1 <> FND_API.G_MISS_CHAR ) THEN
1964      --{
1965         l_batch_grp_rec.Attribute1 := l_batch_in_rec.Attribute1;
1966      ELSE
1967         l_batch_grp_rec.Attribute1 := NULL;
1968      --}
1969      END IF;
1970   --}
1971   END IF;
1972 
1973   IF ( l_batch_in_rec.Attribute2 IS NOT NULL ) THEN
1974   --{
1975      IF ( l_batch_in_rec.Attribute2 <> FND_API.G_MISS_CHAR ) THEN
1976      --{
1977         l_batch_grp_rec.Attribute2 := l_batch_in_rec.Attribute2;
1978      ELSE
1979         l_batch_grp_rec.Attribute2 := NULL;
1980      --}
1981      END IF;
1982   --}
1983   END IF;
1984 
1985   IF ( l_batch_in_rec.Attribute3 IS NOT NULL ) THEN
1986   --{
1987      IF ( l_batch_in_rec.Attribute3 <> FND_API.G_MISS_CHAR ) THEN
1988      --{
1989         l_batch_grp_rec.Attribute3 := l_batch_in_rec.Attribute3;
1990      ELSE
1991         l_batch_grp_rec.Attribute3 := NULL;
1992      --}
1993      END IF;
1994   --}
1995   END IF;
1996 
1997   IF ( l_batch_in_rec.Attribute4 IS NOT NULL ) THEN
1998   --{
1999      IF ( l_batch_in_rec.Attribute4 <> FND_API.G_MISS_CHAR ) THEN
2000      --{
2001         l_batch_grp_rec.Attribute4 := l_batch_in_rec.Attribute4;
2002      ELSE
2003         l_batch_grp_rec.Attribute4 := NULL;
2004      --}
2005      END IF;
2006   --}
2007   END IF;
2008 
2009   IF ( l_batch_in_rec.Attribute5 IS NOT NULL ) THEN
2010   --{
2011      IF ( l_batch_in_rec.Attribute5 <> FND_API.G_MISS_CHAR ) THEN
2012      --{
2013         l_batch_grp_rec.Attribute5 := l_batch_in_rec.Attribute5;
2014      ELSE
2015         l_batch_grp_rec.Attribute5 := NULL;
2016      --}
2017      END IF;
2018   --}
2019   END IF;
2020 
2021   IF ( l_batch_in_rec.Attribute6 IS NOT NULL ) THEN
2022   --{
2023      IF ( l_batch_in_rec.Attribute6 <> FND_API.G_MISS_CHAR ) THEN
2024      --{
2025         l_batch_grp_rec.Attribute6 := l_batch_in_rec.Attribute6;
2026      ELSE
2027         l_batch_grp_rec.Attribute6 := NULL;
2028      --}
2029      END IF;
2030   --}
2031   END IF;
2032 
2033   IF ( l_batch_in_rec.Attribute7 IS NOT NULL ) THEN
2034   --{
2035      IF ( l_batch_in_rec.Attribute7 <> FND_API.G_MISS_CHAR ) THEN
2036      --{
2037         l_batch_grp_rec.Attribute7 := l_batch_in_rec.Attribute7;
2038      ELSE
2039         l_batch_grp_rec.Attribute7 := NULL;
2040      --}
2041      END IF;
2042   --}
2043   END IF;
2044 
2045   IF ( l_batch_in_rec.Attribute8 IS NOT NULL ) THEN
2046   --{
2047      IF ( l_batch_in_rec.Attribute8 <> FND_API.G_MISS_CHAR ) THEN
2048      --{
2049         l_batch_grp_rec.Attribute8 := l_batch_in_rec.Attribute8;
2050      ELSE
2051         l_batch_grp_rec.Attribute8 := NULL;
2052      --}
2053      END IF;
2054   --}
2055   END IF;
2056 
2057   IF ( l_batch_in_rec.Attribute9 IS NOT NULL ) THEN
2058   --{
2059      IF ( l_batch_in_rec.Attribute9 <> FND_API.G_MISS_CHAR ) THEN
2060      --{
2061         l_batch_grp_rec.Attribute9 := l_batch_in_rec.Attribute9;
2062      ELSE
2063         l_batch_grp_rec.Attribute9 := NULL;
2064      --}
2065      END IF;
2066   --}
2067   END IF;
2068 
2069   IF ( l_batch_in_rec.Attribute10 IS NOT NULL ) THEN
2070   --{
2071      IF ( l_batch_in_rec.Attribute10 <> FND_API.G_MISS_CHAR ) THEN
2072      --{
2073         l_batch_grp_rec.Attribute10 := l_batch_in_rec.Attribute10;
2074      ELSE
2075         l_batch_grp_rec.Attribute10 := NULL;
2076      --}
2077      END IF;
2078   --}
2079   END IF;
2080 
2081   IF ( l_batch_in_rec.Attribute11 IS NOT NULL ) THEN
2082   --{
2083      IF ( l_batch_in_rec.Attribute11 <> FND_API.G_MISS_CHAR ) THEN
2084      --{
2085         l_batch_grp_rec.Attribute11 := l_batch_in_rec.Attribute11;
2086      ELSE
2087         l_batch_grp_rec.Attribute11 := NULL;
2088      --}
2089      END IF;
2090   --}
2091   END IF;
2092 
2093   IF ( l_batch_in_rec.Attribute12 IS NOT NULL ) THEN
2094   --{
2095      IF ( l_batch_in_rec.Attribute12 <> FND_API.G_MISS_CHAR ) THEN
2096      --{
2097         l_batch_grp_rec.Attribute12 := l_batch_in_rec.Attribute12;
2098      ELSE
2099         l_batch_grp_rec.Attribute12 := NULL;
2100      --}
2101      END IF;
2102   --}
2103   END IF;
2104 
2105   IF ( l_batch_in_rec.Attribute13 IS NOT NULL ) THEN
2106   --{
2107      IF ( l_batch_in_rec.Attribute13 <> FND_API.G_MISS_CHAR ) THEN
2108      --{
2109         l_batch_grp_rec.Attribute13 := l_batch_in_rec.Attribute13;
2110      ELSE
2111         l_batch_grp_rec.Attribute13 := NULL;
2112      --}
2113      END IF;
2114   --}
2115   END IF;
2116 
2117   IF ( l_batch_in_rec.Attribute14 IS NOT NULL ) THEN
2118   --{
2119      IF ( l_batch_in_rec.Attribute14 <> FND_API.G_MISS_CHAR ) THEN
2120      --{
2121         l_batch_grp_rec.Attribute14 := l_batch_in_rec.Attribute14;
2122      ELSE
2123         l_batch_grp_rec.Attribute14 := NULL;
2124      --}
2125      END IF;
2126   --}
2127   END IF;
2128 
2129   IF ( l_batch_in_rec.Attribute15 IS NOT NULL ) THEN
2130   --{
2131      IF ( l_batch_in_rec.Attribute15 <> FND_API.G_MISS_CHAR ) THEN
2132      --{
2133         l_batch_grp_rec.Attribute15 := l_batch_in_rec.Attribute15;
2134      ELSE
2135         l_batch_grp_rec.Attribute15 := NULL;
2136      --}
2137      END IF;
2138   --}
2139   END IF;
2140 
2141  -- End of Validating  all Attribute Fields
2142 
2143 -- Validatiing the Batch Name Prefix
2144   IF ( l_batch_name_prefix = FND_API.G_MISS_CHAR ) THEN
2145   --{
2146      l_batch_name_prefix := NULL;
2147   --}
2148   END IF;
2149 -- End of Validating the Batch Name Prefix
2150 
2151   -- Bug 3463315 Append_Flag validation
2152   IF l_batch_in_rec.Append_Flag is NOT NULL THEN
2153      IF l_batch_in_rec.Append_Flag <> FND_API.G_MISS_CHAR THEN
2154         l_batch_grp_rec.Append_Flag := l_batch_in_rec.Append_Flag;
2155      ELSE
2156         l_batch_grp_rec.Append_Flag := NULL;
2157      END IF;
2158   END IF;
2159 
2160   -- Validating the Task Priority
2161   IF l_batch_in_rec.task_priority is NOT NULL THEN
2162     IF l_batch_in_rec.task_priority <> FND_API.G_MISS_NUM THEN
2163        l_batch_grp_rec.task_priority := l_batch_in_rec.task_priority;
2164     ELSE
2165        l_batch_grp_rec.task_priority := NULL;
2166     END IF;
2167   END IF;
2168   -- End of Validating the Task Priority
2169 
2170   --
2171   -- Autocreate Delivery Flag can only be Y or N
2172   --
2173   IF (l_batch_grp_rec.autocreate_delivery_flag IS NOT NULL AND
2174       l_batch_grp_rec.autocreate_Delivery_flag NOT IN ('Y', 'N')) THEN
2175    --{
2176    FND_MESSAGE.SET_NAME('WSH', 'WSH_OI_INVALID_ATTRIBUTE');
2177    FND_MESSAGE.SET_TOKEN('ATTRIBUTE', 'AUTOCREATE_DELIVERY_FLAG');
2178    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2179    wsh_util_core.add_message(x_return_status);
2180    --
2181    IF l_debug_on THEN
2182      WSH_DEBUG_SV.pop(l_module_name);
2183    END IF;
2184    --
2185    return;
2186    --}
2187   END IF;
2188   --
2189   --
2190   -- ac_delivery_criteria can be used
2191   -- only if autocreate_delivery_flag is Y
2192   --
2193   IF (l_batch_grp_rec.ac_delivery_criteria IS NOT NULL AND
2194       l_batch_grp_rec.autocreate_delivery_flag <> 'Y') THEN
2195    --{
2196    FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_ACDEL_CRITERIA');
2197    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2198    wsh_util_core.add_message(x_return_status, l_module_name);
2199    --
2200    IF l_debug_on THEN
2201      wsh_debug_sv.pop(l_module_name);
2202    END IF;
2203    --
2204    RETURN;
2205    --}
2206   END IF;
2207   --
2208   IF l_batch_grp_rec.Append_Flag = 'Y' or l_batch_grp_rec.Append_Flag is NULL THEN
2209 
2210      IF l_batch_grp_rec.organization_id is NULL THEN
2211         FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_APPEND_ORGANIZATION');
2212         x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2213 	wsh_util_core.add_message(x_return_status);
2214 	IF l_debug_on THEN
2215 	     WSH_DEBUG_SV.pop(l_module_name);
2216         END IF;
2217 	return;
2218      END IF;
2219 
2220      WSH_SHIPPING_PARAMS_PVT.Get(
2221         p_organization_id  => l_batch_grp_rec.organization_id,
2222         x_param_info       => l_param_info,
2223         x_return_status    => l_return_status);
2224 
2225      IF l_debug_on THEN
2226         wsh_debug_sv.logmsg(l_module_name, 'Return status from WSH_SHIPPING_PARAMS_PVT.Get is :'||l_return_status );
2227      END IF;
2228 
2229      wsh_util_core.api_post_call(
2230 	       p_return_status => l_return_status,
2231 	       x_num_warnings  => l_number_of_warnings,
2232 	       x_num_errors    => l_number_of_errors,
2233 	       p_msg_data      => l_msg_data
2234 	       );
2235 
2236      IF NVL(l_param_info.appending_limit, 'N') = 'N' THEN
2237         FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_APPEND_APPENDING_LIMIT');
2238         FND_MESSAGE.SET_NAME('ORGANIZATION_NAME', WSH_UTIL_CORE.Get_Org_Name(l_batch_grp_rec.organization_id));
2239         x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2240 	wsh_util_core.add_message(x_return_status);
2241 	IF l_debug_on THEN
2242 	     WSH_DEBUG_SV.pop(l_module_name);
2243         END IF;
2244 	return;
2245      END IF;
2246 
2247      IF NVL(l_batch_grp_rec.autocreate_delivery_flag, 'N') <> 'Y' THEN
2248         FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_APPEND_AUTOCREATE_DEL');
2249         x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2250 	wsh_util_core.add_message(x_return_status);
2251 	IF l_debug_on THEN
2252 	     WSH_DEBUG_SV.pop(l_module_name);
2253         END IF;
2254 	return;
2255      END IF;
2256 
2257      IF NVL(l_batch_grp_rec.ac_delivery_criteria, 'Y') <> 'N' THEN
2258         FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_APPEND_AC_DEL_CRITERIA');
2259         x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2260 	wsh_util_core.add_message(x_return_status);
2261 	IF l_debug_on THEN
2262 	     WSH_DEBUG_SV.pop(l_module_name);
2263         END IF;
2264 	return;
2265      END IF;
2266 
2267      IF NVL(l_batch_grp_rec.auto_pick_confirm_flag, 'Y') <> 'N'  THEN
2268         FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_APPEND_AUTO_PICK');
2269         x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2270 	wsh_util_core.add_message(x_return_status);
2271 	IF l_debug_on THEN
2272 	     WSH_DEBUG_SV.pop(l_module_name);
2273         END IF;
2274 	return;
2275      END IF;
2276 
2277      IF l_batch_grp_rec.ship_confirm_rule_id is not NULL THEN
2278         FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_APPEND_AUTO_SHIP');
2279         x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2280 	wsh_util_core.add_message(x_return_status);
2281 	IF l_debug_on THEN
2282 	     WSH_DEBUG_SV.pop(l_module_name);
2283         END IF;
2284 	return;
2285      END IF;
2286 
2287      IF NVL(l_batch_grp_rec.autopack_flag, 'Y') <> 'N' THEN
2288         FND_MESSAGE.SET_NAME('WSH', 'WSH_NO_APPEND_AUTO_PACK');
2289         x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2290 	wsh_util_core.add_message(x_return_status);
2291 	IF l_debug_on THEN
2292 	     WSH_DEBUG_SV.pop(l_module_name);
2293         END IF;
2294 	return;
2295      END IF;
2296 
2297   ELSIF l_batch_grp_rec.Append_Flag <> 'N' THEN
2298      FND_MESSAGE.SET_NAME('WSH', 'WSH_OI_INVALID_ATTRIBUTE');
2299      FND_MESSAGE.SET_TOKEN('ATTRIBUTE', 'APPEND_FLAG');
2300      x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2301      wsh_util_core.add_message(x_return_status);
2302      IF l_debug_on THEN
2303          WSH_DEBUG_SV.pop(l_module_name);
2304      END IF;
2305      return;
2306   END IF;
2307 -- Bug 3463315 End of Append_Flag validation
2308 
2309 -- Bug# 3438300 - Start - Validating mutually exclusive Ship from and Organization
2310   IF l_batch_grp_rec.Organization_Id IS NOT NULL AND l_batch_grp_rec.Ship_From_Location_Id IS NOT NULL THEN
2311         --check whether both are valid combination
2312   	open c_location_id(l_batch_grp_rec.Organization_Id);
2313 	FETCH c_location_id into l_ship_from_loc_id;
2314 	close c_location_id;
2315 
2316 	IF l_ship_from_loc_id <> l_batch_grp_rec.Ship_From_Location_Id THEN
2317 		FND_MESSAGE.SET_NAME('WSH','WSH_ORG_SHIPFROM_NOT_COMP');
2318 		x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2319 		wsh_util_core.add_message(x_return_status);
2320                 IF l_debug_on THEN
2321                    WSH_DEBUG_SV.pop(l_module_name);
2322                 END IF;
2323                 return;
2324 	END IF;
2325   ELSIF l_batch_grp_rec.Organization_Id IS NOT NULL THEN
2326   -- Org is provided, populate the Ship from
2327 	open c_location_id(l_batch_grp_rec.Organization_Id);
2328 	FETCH c_location_id into l_ship_from_loc_id;
2329 	close c_location_id;
2330 	l_batch_grp_rec.Ship_From_Location_Id := l_ship_from_loc_id;
2331   ELSIF l_batch_grp_rec.Ship_From_Location_Id IS NOT NULL THEN
2332   -- Ship from is provided, populate the Org
2333 	open c_org_id(l_batch_grp_rec.Ship_From_Location_Id);
2334 	FETCH c_org_id into l_org_id;
2335 	close c_org_id;
2336 	l_batch_grp_rec.Organization_Id := l_org_id;
2337   END IF;
2338 -- Bug# 3438300 - End
2339 
2340   IF (l_batch_grp_rec.order_header_id IS NULL AND l_batch_grp_rec.ship_set_id IS NULL AND
2341       l_batch_grp_rec.Trip_id IS NULL AND l_batch_grp_rec.Delivery_Id IS NULL AND
2342       l_batch_grp_rec.Delivery_Detail_Id IS NULL AND l_batch_grp_rec.Trip_Stop_Id IS NULL AND
2343       l_batch_grp_rec.Project_Id IS NULL AND l_batch_grp_rec.Task_Id IS NULL ) THEN --{
2344          --
2345          IF l_batch_grp_rec.Organization_Id IS NULL THEN --{
2346            -- Fatal error if no warehouse specified
2347            FND_MESSAGE.SET_NAME('WSH','WSH_PR_NO_WAREHOUSE');
2348            x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2349            wsh_util_core.add_message(x_return_status);
2350            IF l_debug_on THEN
2351               WSH_DEBUG_SV.pop(l_module_name);
2352            END IF;
2353            RETURN;
2354          ELSE --}{
2355            -- Warning if warehouse specified and others null
2356            FND_MESSAGE.SET_NAME('WSH', 'WSH_PR_CRITICAL_NULL');
2357            x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
2358 	   wsh_util_core.add_message(x_return_status);
2359          END IF; --}
2360          --
2361   END IF; --}
2362 
2363   -- X-dock
2364   -- Validating the Allocation method
2365   IF l_batch_in_rec.allocation_method is NOT NULL THEN
2366     IF l_batch_in_rec.allocation_method <> FND_API.G_MISS_CHAR THEN
2367        l_batch_grp_rec.allocation_method := l_batch_in_rec.allocation_method;
2368     ELSE
2369        l_batch_grp_rec.allocation_method := 'I';
2370     END IF;
2371   END IF;
2372   -- End of Validating the Allocation Method
2373 
2374   -- Validating the Crossdock Criteria id
2375   --
2376   -- Public API would have already converted crossdock criteria name to id,
2377   --  so validation is only done for id.
2378   IF l_batch_in_rec.crossdock_criteria_id is NOT NULL THEN
2379     IF l_batch_in_rec.crossdock_criteria_id <> FND_API.G_MISS_NUM THEN
2380        l_batch_grp_rec.crossdock_criteria_id := l_batch_in_rec.crossdock_criteria_id;
2381     ELSE
2382        l_batch_grp_rec.crossdock_criteria_id := NULL;
2383     END IF;
2384   END IF;
2385   -- End of Validating the Crossdock Criteria id
2386 
2387   --
2388   -- Validate Values using l_batch_grp_rec as the values from l_batch_in_rec
2389   -- have been validated and transferred to l_batch_grp_rec
2390   IF WSH_UTIL_VALIDATE.check_wms_org(l_batch_grp_rec.organization_id) = 'Y' THEN
2391   --{
2392     IF (l_batch_grp_rec.allocation_method NOT IN
2393           (WSH_PICK_LIST.C_INVENTORY_ONLY,WSH_PICK_LIST.C_CROSSDOCK_ONLY,
2394            WSH_PICK_LIST.C_PRIORITIZE_CROSSDOCK,WSH_PICK_LIST.C_PRIORITIZE_INVENTORY
2395           )
2396        ) THEN
2397       FND_MESSAGE.SET_NAME('WSH','WSH_INVALID_ALLOCATION_METHOD');
2398       x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2399       wsh_util_core.add_message(x_return_status);
2400       IF l_debug_on THEN
2401         WSH_DEBUG_SV.pop(l_module_name);
2402       END IF;
2403       RETURN;
2404     ELSIF l_batch_grp_rec.crossdock_criteria_id IS NOT NULL AND
2405           l_batch_grp_rec.allocation_method IN (WSH_PICK_LIST.C_CROSSDOCK_ONLY,
2406            WSH_PICK_LIST.C_PRIORITIZE_CROSSDOCK,WSH_PICK_LIST.C_PRIORITIZE_INVENTORY) THEN
2407       -- call WMS API to validate cross dock criteria
2408       WMS_CROSSDOCK_GRP.validate_planxdock_crt_id
2409         (p_criterion_id => l_batch_grp_rec.crossdock_criteria_id,
2410          x_return_status => l_return_status);
2411       IF l_return_status IN (WSH_UTIL_CORE.G_RET_STS_ERROR, WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR) THEN
2412         FND_MESSAGE.SET_NAME('WSH','WSH_INVALID_XDOCK_CRITERION');
2413         x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2414         wsh_util_core.add_message(x_return_status);
2415         IF l_debug_on THEN
2416           WSH_DEBUG_SV.pop(l_module_name);
2417         END IF;
2418         RETURN;
2419       END IF;
2420     ELSIF (l_batch_grp_rec.crossdock_criteria_id IS NOT NULL AND
2421            l_batch_grp_rec.allocation_method = (WSH_PICK_LIST.C_INVENTORY_ONLY)) THEN
2422       FND_MESSAGE.SET_NAME('WSH','WSH_XDOCK_INVALID_ALLOCMETHOD');
2423       x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2424       wsh_util_core.add_message(x_return_status);
2425       IF l_debug_on THEN
2426         WSH_DEBUG_SV.pop(l_module_name);
2427       END IF;
2428       RETURN;
2429     -- Bug#7168917: Dynamic_replenish_flag value should not be 'Yes' when
2430     -- allocation method is 'Cross Dock Only' OR 'Prioritize Inventory'.
2431     ELSIF (l_batch_grp_rec.dynamic_replenishment_flag = 'Y' AND
2432            l_batch_grp_rec.allocation_method IN (WSH_PICK_LIST.C_CROSSDOCK_ONLY,WSH_PICK_LIST.C_PRIORITIZE_INVENTORY)) THEN
2433       FND_MESSAGE.SET_NAME('WSH', 'WSH_OI_INVALID_ATTRIBUTE');
2434       FND_MESSAGE.SET_TOKEN('ATTRIBUTE', 'DYNAMIC_REPLENISHMENT_FLAG');
2435       x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2436       wsh_util_core.add_message(x_return_status);
2437       IF l_debug_on THEN
2438         WSH_DEBUG_SV.pop(l_module_name);
2439       END IF;
2440       RETURN;
2441     END IF;
2442   ELSE -- non WMS org
2443     IF l_batch_grp_rec.allocation_method IN (WSH_PICK_LIST.C_CROSSDOCK_ONLY,
2444            WSH_PICK_LIST.C_PRIORITIZE_CROSSDOCK,WSH_PICK_LIST.C_PRIORITIZE_INVENTORY) THEN
2445       FND_MESSAGE.SET_NAME('WSH','WSH_INVALID_ALLOCATION_METHOD');
2446       x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2447       wsh_util_core.add_message(x_return_status);
2448       IF l_debug_on THEN
2449         WSH_DEBUG_SV.pop(l_module_name);
2450       END IF;
2451       RETURN;
2452     END IF;
2453   --}
2454   END IF;
2455   -- end of X-dock
2456   --
2457 --=======================================================================================================
2458 -- End Of the VALIDATION
2459 --=======================================================================================================
2460 
2461 -- Calling the Private API to Create the Batch
2462 
2463   IF l_debug_on THEN
2464   --{
2465      WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_PICKING_BATCHES_PKG.INSERT_ROW',WSH_DEBUG_SV.C_PROC_LEVEL);
2466   --}
2467   END IF;
2468   --
2469   WSH_PICKING_BATCHES_PKG.Insert_Row(
2470                         X_Rowid                      => l_batch_grp_rec.Row_Id,
2471  			X_Batch_Id		      => l_batch_grp_rec.Batch_Id,
2472 			P_Creation_Date		      => l_batch_grp_rec.Creation_Date,
2473 			P_Created_By		      => l_batch_grp_rec.Created_By,
2474 			P_Last_Update_Date            => l_batch_grp_rec.Last_Update_Date,
2475 			P_Last_Updated_By             => l_batch_grp_rec.Last_Updated_By,
2476 			P_Last_Update_Login           => l_batch_grp_rec.Last_Update_Login,
2477 			p_batch_name_prefix           => l_batch_name_prefix,
2478 			X_Name                        => l_batch_grp_rec.Name,
2479 			P_Backorders_Only_Flag        => l_batch_grp_rec.Backorders_Only_Flag,
2480 			P_Document_Set_Id             => l_batch_grp_rec.Document_Set_Id,
2481 			P_Existing_Rsvs_Only_Flag     => l_batch_grp_rec.Existing_Rsvs_Only_Flag,
2482 			P_Shipment_Priority_Code      => l_batch_grp_rec.Shipment_Priority_Code,
2483 			P_Ship_Method_Code            => l_batch_grp_rec.Ship_Method_Code,
2484 			P_Customer_Id                 => l_batch_grp_rec.Customer_Id,
2485 			P_Order_Header_Id             => l_batch_grp_rec.Order_Header_Id,
2486 			P_Ship_Set_Number             => l_batch_grp_rec.Ship_Set_Id,
2487 			P_Inventory_Item_Id           => l_batch_grp_rec.Inventory_Item_Id,
2488 			P_Order_Type_Id               => l_batch_grp_rec.Order_Type_Id,
2489 			P_From_Requested_Date         => l_batch_grp_rec.From_Requested_Date,
2490 			P_To_Requested_Date           => l_batch_grp_rec.To_Requested_Date,
2491 			P_From_Scheduled_Ship_Date    => l_batch_grp_rec.From_Scheduled_Ship_Date,
2492 			P_To_Scheduled_Ship_Date      => l_batch_grp_rec.To_Scheduled_Ship_Date,
2493 			P_Ship_To_Location_Id         => l_batch_grp_rec.Ship_To_Location_Id,
2494 			P_Ship_From_Location_Id       => l_batch_grp_rec.Ship_From_Location_Id,
2495 			P_Trip_Id                     => l_batch_grp_rec.Trip_Id,
2496 			p_Delivery_Id                 => l_batch_grp_rec.Delivery_Id,
2497 			P_Include_Planned_Lines       => l_batch_grp_rec.Include_Planned_Lines,
2498 			P_Pick_Grouping_Rule_Id       => l_batch_grp_rec.Pick_Grouping_Rule_Id,
2499 			P_Pick_Sequence_Rule_Id       => l_batch_grp_rec.Pick_Sequence_Rule_Id,
2500 			P_Autocreate_Delivery_Flag    => l_batch_grp_rec.Autocreate_Delivery_Flag,
2501 			P_Attribute_Category          => l_batch_grp_rec.Attribute_Category,
2502 			P_Attribute1                  => l_batch_grp_rec.Attribute1,
2503 			P_Attribute2                  => l_batch_grp_rec.Attribute2,
2504 			P_Attribute3                  => l_batch_grp_rec.Attribute3,
2505 			P_Attribute4                  => l_batch_grp_rec.Attribute4,
2506 			P_Attribute5                  => l_batch_grp_rec.Attribute5,
2507 			P_Attribute6                  => l_batch_grp_rec.Attribute6,
2508 			P_Attribute7                  => l_batch_grp_rec.Attribute7,
2509 			P_Attribute8                  => l_batch_grp_rec.Attribute8,
2510 			P_Attribute9                  => l_batch_grp_rec.Attribute9,
2511 			P_Attribute10                 => l_batch_grp_rec.Attribute10,
2512 			P_Attribute11                 => l_batch_grp_rec.Attribute11,
2513 			P_Attribute12                 => l_batch_grp_rec.Attribute12,
2514 			P_Attribute13                 => l_batch_grp_rec.Attribute13,
2515 			P_Attribute14                 => l_batch_grp_rec.Attribute14,
2516 			P_Attribute15                 => l_batch_grp_rec.Attribute15,
2517 			P_Autodetail_Pr_Flag          => l_batch_grp_rec.Autodetail_Pr_Flag,
2518 			-- Bug#: 3266659 - Setting carrier id to NULL
2519 			P_Carrier_Id                  => NULL,
2520 			P_Trip_Stop_Id                => l_batch_grp_rec.Trip_Stop_Id,
2521 			P_Default_Stage_Subinventory  => l_batch_grp_rec.Default_Stage_Subinventory,
2522 			P_Default_Stage_Locator_Id    => l_batch_grp_rec.Default_Stage_Locator_Id,
2523 			P_Pick_From_Subinventory      => l_batch_grp_rec.Pick_From_Subinventory,
2524 			P_Pick_From_locator_Id        => l_batch_grp_rec.Pick_From_locator_Id,
2525 			P_Auto_Pick_Confirm_Flag      => l_batch_grp_rec.Auto_Pick_Confirm_Flag,
2526 			P_Delivery_Detail_Id          => l_batch_grp_rec.Delivery_Detail_Id,
2527 			P_Project_Id                  => l_batch_grp_rec.Project_Id,
2528 			P_Task_Id                     => l_batch_grp_rec.Task_Id,
2529 			P_Organization_Id             => l_batch_grp_rec.Organization_Id,
2530 			P_Ship_Confirm_Rule_Id        => l_batch_grp_rec.Ship_Confirm_Rule_Id,
2531 			P_Autopack_Flag               => l_batch_grp_rec.Autopack_Flag,
2532 			P_Autopack_Level              => l_batch_grp_rec.Autopack_Level,
2533 			P_Task_Planning_Flag          => l_batch_grp_rec.Task_Planning_Flag,
2534 			-- Bug#: 3266659 - Removing non_picking_flag
2535 			-- P_Non_Picking_Flag            => l_batch_grp_rec.Non_Picking_Flag,
2536 			p_categorySetID             => l_batch_grp_rec.category_set_id,
2537 			p_categoryID                 => l_batch_grp_rec.category_id,
2538 			p_ship_set_smc_flag           => l_batch_grp_rec.ship_set_smc_flag,
2539 		       -- Bug#: 3266659 - Adding the  columns like zone, region, delivery criteria, release
2540 		       --		  subinventory and append flag
2541 			p_regionID		      => l_batch_grp_rec.region_id,
2542 			p_zoneId		      => l_batch_grp_rec.zone_id,
2543 			p_acDelivCriteria	      => l_batch_grp_rec.ac_delivery_criteria,
2544 			p_RelSubinventory             => l_batch_grp_rec.rel_subinventory,
2545 			p_append_flag		      => l_batch_grp_rec.append_flag,
2546                         p_task_priority               => l_batch_grp_rec.task_priority,
2547                         p_actual_departure_date => l_batch_grp_rec.actual_departure_date,
2548                         p_allocation_method           => l_batch_grp_rec.allocation_method,  -- X-dock
2549                         p_crossdock_criteria_id       => l_batch_grp_rec.crossdock_criteria_id,  -- X-dock
2550                         p_dynamic_replenishment_flag       => l_batch_grp_rec.dynamic_replenishment_flag --bug# 6689448 (replenishment project)
2551 			);
2552 
2553   IF l_debug_on	THEN
2554   --{
2555       WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
2556   --}
2557   END IF;
2558   --
2559   wsh_util_core.api_post_call(
2560         p_return_status => l_return_status,
2561 	x_num_warnings  => l_number_of_warnings,
2562 	x_num_errors    => l_number_of_errors,
2563 	p_msg_data      => l_msg_data
2564 	 );
2565 
2566   x_batch_id := l_batch_grp_rec.batch_id ;
2567 
2568   IF FND_API.TO_BOOLEAN(p_commit) THEN
2569   --{
2570      COMMIT WORK;
2571   --}
2572   END IF;
2573 
2574   FND_MSG_PUB.Count_And_Get
2575       (
2576  	p_count	=>  x_msg_count,
2577  	p_data	=>  x_msg_data,
2578  	p_encoded => FND_API.G_FALSE
2579       );
2580 
2581   IF l_debug_on THEN
2582   --{
2583      WSH_DEBUG_SV.pop(l_module_name);
2584   --}
2585   END IF;
2586   --
2587   EXCEPTION
2588 	WHEN FND_API.G_EXC_ERROR THEN
2589 	     ROLLBACK TO PICKING_BATCH_GRP;
2590 	     x_return_status :=	FND_API.G_RET_STS_ERROR	;
2591 	     wsh_util_core.add_message(x_return_status);
2592 	     FND_MSG_PUB.Count_And_Get
2593 		 (
2594 		   p_count  => x_msg_count,
2595 		   p_data  =>  x_msg_data,
2596 		   p_encoded =>	FND_API.G_FALSE
2597 		  );
2598 
2599 	    IF l_debug_on THEN
2600 	    --{
2601 		WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2602 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
2603 	    --}
2604 	    END	IF;
2605             --
2606 
2607 	WHEN WSH_INVALID_CONSOL_DEL THEN
2608 	     ROLLBACK TO PICKING_BATCH_GRP;
2609              FND_MESSAGE.SET_NAME('WSH', 'WSH_PUB_CONSOL_DEL_PR');
2610              FND_MESSAGE.SET_TOKEN('PARAMETER',l_batch_in_rec.Delivery_id);
2611 	     x_return_status :=	FND_API.G_RET_STS_ERROR	;
2612 	     wsh_util_core.add_message(x_return_status);
2613 	     FND_MSG_PUB.Count_And_Get
2614 		 (
2615 		   p_count  => x_msg_count,
2616 		   p_data  =>  x_msg_data,
2617 		   p_encoded =>	FND_API.G_FALSE
2618 		  );
2619 
2620 	    IF l_debug_on THEN
2621 	    --{
2622 		WSH_DEBUG_SV.logmsg(l_module_name,'WSH_PUB_CONSOL_DEL_PR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2623 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WSH_PUB_CONSOL_DEL_PR');
2624 	    --}
2625 	    END	IF;
2626             --
2627 
2628 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2629 	     ROLLBACK TO PICKING_BATCH_GRP;
2630 	     x_return_status :=	FND_API.G_RET_STS_UNEXP_ERROR ;
2631 	     wsh_util_core.add_message(x_return_status,	l_module_name);
2632 	     FND_MSG_PUB.Count_And_Get
2633 		 (
2634 		    p_count  =>	x_msg_count,
2635 		    p_data  =>	x_msg_data,
2636 		    p_encoded => FND_API.G_FALSE
2637 		 );
2638 		  --
2639 
2640 	    IF l_debug_on THEN
2641 	    --{
2642 		WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_UNEXPECTED_ERROR exception has	occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
2643 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
2644 	    --}
2645 	    END	IF;
2646        WHEN OTHERS THEN
2647 	    ROLLBACK TO	PICKING_BATCH_GRP;
2648 	    wsh_util_core.default_handler('WSH_PICKING_BATCHES_PUB.CREATE_BATCH');
2649 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
2650 	    FND_MSG_PUB.Count_And_Get
2651 		(
2652 		    p_count  =>	x_msg_count,
2653 		    p_data  =>	x_msg_data,
2654 		    p_encoded => FND_API.G_FALSE
2655 		 );
2656 
2657 	    IF l_debug_on THEN
2658 	    --{
2659 	       WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured.	Oracle error message is	'|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
2660 	       WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
2661 	    --}
2662 	    END	IF;
2663             --
2664 END Create_Batch;
2665 
2666 
2667 --============================================================================================
2668 -- Start of comments
2669 --
2670 -- API Name          : Release_Batch
2671 -- Type              : Group
2672 -- Pre-reqs          : None.
2673 -- Function          : The procedure takes in a Batch_id/ Batch_name and depending on the p_release_mode
2674 --                     value it process the batch.   p_log_level value should be greator than 0 when
2675 --                     customer want to get the pick release log fine incace of concurrent pick release
2676 --                     release.
2677 --                     It will do some basic validations on the  the input parameters
2678 --                     like log_level should be positive  , and on the not null values of p_batch_rec.
2679 --
2680 -- PARAMETERS        : p_api_version_number    known api version  number
2681 --                     p_init_msg_list         FND_API.G_TRUE to reset list
2682 --                     p_commit                FND_API.G_TRUE to perform a commit
2683 --                     x_return_status         return status
2684 --                     x_msg_count             number of messages in the list
2685 --                     x_msg_data              text of messages
2686 --                     p_batch_id              Picking Batch Id which is used to get Batch
2687 --					       information from the wsh_picking_batches table.
2688 --                     p_batch_name            Picking Batch Name which is used to get Batch
2689 --					       information from the wsh_picking_batches table.
2690 --                     p_log_level             Controlls the log message generated by cuncurrent
2691 --					       pick release process.
2692 --                     p_release_mode          Used to do ONLINE or CONCURRENT pick release,
2693 --                                             Default is "CONCURREN"
2694 --                     p_num_workers           Number of Workers for Parallel Pick Release
2695 --                                             Default is 1.
2696 --                                             For Online Mode it is always 1
2697 --                                             For Concurrent Mode the value is determined by profile
2698 --                     x_request_id            Out parameter contains the request Id for the concurrent request submitted
2699 -- VERSION           : current version         1.0
2700 --                     initial version         1.0
2701 -- End of comments
2702 --============================================================================================
2703 
2704 PROCEDURE Release_Batch (
2705          -- Standard parameters
2706          p_api_version_number IN   NUMBER,
2707          p_init_msg_list      IN   VARCHAR2   DEFAULT  NULL,
2708          p_commit             IN   VARCHAR2   DEFAULT  NULL,
2709          x_return_status      OUT  NOCOPY     VARCHAR2,
2710          x_msg_count          OUT  NOCOPY     NUMBER,
2711          x_msg_data           OUT  NOCOPY     VARCHAR2,
2712 
2713          -- program specific paramters.
2714          p_batch_id           IN   NUMBER    DEFAULT  NULL,
2715 	 p_batch_name         IN   VARCHAR2    DEFAULT  NULL,
2716          p_log_level          IN   NUMBER    DEFAULT  NULL,
2717 	 p_release_mode       IN   VARCHAR2  DEFAULT  'CONCURRENT',
2718 	 p_num_workers        IN   NUMBER    ,
2719 	 x_request_id         OUT  NOCOPY    NUMBER
2720         ) IS
2721 
2722 -- Standard call to check for call compatibility
2723 l_api_version	     CONSTANT NUMBER :=	1.0;
2724 l_api_name	     CONSTANT VARCHAR2(30) := 'WSH_PICKING_BATCHES_GRP';
2725 l_return_status		      VARCHAR2(30);
2726 l_msg_count		      NUMBER;
2727 l_msg_data		      VARCHAR2(32767);
2728 l_number_of_errors	      NUMBER :=	0;
2729 l_number_of_warnings	      NUMBER :=	0;
2730 l_debug_on BOOLEAN;
2731 --
2732 l_batch_id            NUMBER;
2733 l_batch_name          VARCHAR2(30);
2734 l_pick_result         VARCHAR2(30);
2735 l_pick_phase          VARCHAR2(30);
2736 l_pick_skip           VARCHAR2(30);
2737 l_log_level           NUMBER;
2738 
2739 l_module_name CONSTANT VARCHAR2(100) :=	'wsh.plsql.' ||	G_PKG_NAME || '.' || 'RELEASE_BATCH';
2740 --
2741 
2742 BEGIN
2743 
2744   --
2745   -- Debug Statements
2746   --
2747   --
2748   l_debug_on :=	WSH_DEBUG_INTERFACE.g_debug;
2749   --
2750   IF l_debug_on	IS NULL	 THEN
2751   --{
2752      l_debug_on	:= WSH_DEBUG_SV.is_debug_enabled;
2753   --}
2754   END IF;
2755   --
2756   SAVEPOINT PICKING_BATCH_GRP;
2757 
2758   -- Standard begin of API savepoint
2759   --
2760   -- Debug Statements
2761   --
2762   IF l_debug_on	THEN
2763   --{
2764      wsh_debug_sv.push(l_module_name);
2765      --
2766      wsh_debug_sv.LOG(l_module_name, 'P_API_VERSION_NUMER', p_api_version_number);
2767      wsh_debug_sv.LOG(l_module_name, 'P_INIT_MSG_LIST',	p_init_msg_list);
2768      wsh_debug_sv.LOG(l_module_name, 'P_COMMIT', p_commit);
2769      wsh_debug_sv.LOG(l_module_name, 'P_NUM_WORKERS', p_num_workers);
2770   --}
2771   END IF;
2772 
2773   IF NOT fnd_api.compatible_api_call(
2774 		 l_api_version,
2775 		 p_api_version_number,
2776 		 l_api_name,
2777 		 g_pkg_name)   THEN
2778      RAISE fnd_api.g_exc_unexpected_error;
2779   END IF;
2780   -- Check p_init_msg_list
2781   IF fnd_api.to_boolean(p_init_msg_list) THEN
2782   --{
2783       fnd_msg_pub.initialize;
2784   --}
2785   END IF;
2786   x_return_status :=  WSH_UTIL_CORE.G_RET_STS_SUCCESS;
2787   l_return_status :=  WSH_UTIL_CORE.G_RET_STS_SUCCESS;
2788   l_batch_id      :=  p_batch_id;
2789   l_batch_name    :=  p_batch_name;
2790   l_log_level     :=  p_log_level;
2791 
2792 
2793 ------------------------------------------------------------------------------------------------------------
2794 -- VALIDATE ALL	THE INPUT VALUES
2795 ------------------------------------------------------------------------------------------------------------
2796 
2797 -- Validating Batch Name and Batch Id
2798   IF ( ( l_batch_Id IS NOT NULL AND l_batch_Id <> FND_API.G_MISS_NUM ) OR ( l_batch_Name IS NOT NULL AND l_batch_name <>  FND_API.G_MISS_CHAR ) ) THEN
2799   --{
2800      IF ( l_batch_Id = FND_API.G_MISS_NUM ) THEN
2801      --{
2802         l_batch_Id := NULL;
2803      --}
2804      END IF;
2805      IF ( l_batch_name =  FND_API.G_MISS_CHAR ) THEN
2806      --{
2807         l_batch_name := NULL;
2808      --}
2809      END IF;
2810      IF ( ( l_batch_Id IS NOT NULL) OR ( l_batch_name IS NOT NULL ) ) THEN
2811      --{
2812         WSH_UTIL_VALIDATE.Validate_Picking_Batch_Name(
2813 	      p_picking_batch_Id	=> l_batch_Id,
2814 	      p_picking_batch_name      => l_batch_Name,
2815 	      x_return_status           => l_return_status);
2816 
2817         IF l_debug_on THEN
2818 	--{
2819            WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
2820         --}
2821 	END IF;
2822         --
2823         wsh_util_core.api_post_call(
2824                p_return_status => l_return_status,
2825                x_num_warnings  => l_number_of_warnings,
2826                x_num_errors    => l_number_of_errors,
2827                p_msg_data      => l_msg_data
2828                );
2829      --}
2830      END IF;
2831   ELSE
2832      --
2833      --
2834      FND_MESSAGE.SET_NAME('WSH','WSH_REQUIRED_FIELD_NULL');
2835      FND_MESSAGE.SET_TOKEN('FIELD_NAME ',' BATCH_ID OR BATCH_NAME ');
2836      x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2837      wsh_util_core.add_message(x_return_status);
2838      return;
2839   --}
2840   END IF;
2841 
2842 -- End of Batch Name Validations
2843 
2844 -- Validating the Release Mode
2845   IF ( ( p_release_mode IS NULL ) OR ( p_release_mode NOT IN ('CONCURRENT','ONLINE'))) THEN
2846   --{
2847     FND_MESSAGE.SET_NAME('WSH','WSH_OI_INVALID_ATTRIBUTE');
2848     FND_MESSAGE.SET_TOKEN('ATTRIBUTE','P_RELEASE_MODE');
2849     x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2850     wsh_util_core.add_message(x_return_status);
2851     return;
2852   --}
2853   END IF;
2854 -- End of Validating the Release Mode
2855 
2856 -- Validating the Log Level
2857   IF ( l_log_level <> 0 ) THEN
2858   --{
2859      WSH_UTIL_VALIDATE.Validate_Negative(
2860            	       p_value => l_log_level,
2861 	               x_return_status  => l_return_status);
2862 
2863      IF l_debug_on THEN
2864      --{
2865         WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
2866      --}
2867      END IF;
2868      --
2869      wsh_util_core.api_post_call(
2870                p_return_status => l_return_status,
2871                x_num_warnings  => l_number_of_warnings,
2872                x_num_errors    => l_number_of_errors,
2873                p_msg_data      => l_msg_data
2874                );
2875   --}
2876   END IF;
2877 -- End of Log Level Validation
2878 
2879 
2880   IF ( p_release_mode = 'CONCURRENT' ) THEN
2881   --{
2882      IF l_debug_on THEN
2883      --{
2884         WSH_DEBUG_SV.logmsg(l_module_name,'Calling  program unit WSH_PICKING_BATCHES_PKG.SUBMIT_RELEASE_REQUEST',WSH_DEBUG_SV.C_PROC_LEVEL);
2885      --}
2886      END IF;
2887      --
2888      x_request_id := WSH_PICKING_BATCHES_PKG.Submit_Release_Request(
2889 							p_batch_id       => l_batch_id,
2890 		 		                        p_log_level      => l_log_level,
2891 		 		                        p_num_workers    => p_num_workers);
2892      IF l_debug_on THEN
2893      --{
2894         WSH_DEBUG_SV.logmsg(l_module_name,'Calling  program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
2895      --}
2896      END IF;
2897      --
2898      wsh_util_core.api_post_call(
2899            p_return_status => l_return_status,
2900            x_num_warnings  => l_number_of_warnings,
2901            x_num_errors    => l_number_of_errors,
2902 	   p_msg_data      => l_msg_data
2903 	    );
2904 
2905      IF ( x_request_id > 0) THEN
2906      --{
2907         FND_MESSAGE.SET_NAME('ONT','SO_OTHER_CONCURRENT_REQUEST_ID');
2908         FND_MESSAGE.SET_TOKEN('REQUESTID',TO_CHAR(x_request_id));
2909      ELSE
2910        FND_MESSAGE.SET_NAME('WSH','WSH_PR_REVOKED');
2911        FND_MESSAGE.SET_NAME('ONT','SO_SH_NO_CREATE_PICK_SLIPS');
2912      --}
2913      END IF;
2914 
2915   ELSE
2916      IF l_debug_on THEN
2917      --{
2918         WSH_DEBUG_SV.logmsg(l_module_name,'Calling  program unit WSH_PICK_LIST.ONLINE_RELEASE',WSH_DEBUG_SV.C_PROC_LEVEL);
2919      --}
2920      END IF;
2921      --
2922      WSH_PICK_LIST.Online_Release(
2923                       p_batch_id       => l_batch_id,
2924 		      p_pick_result    => l_pick_result,
2925 		      p_pick_phase     => l_pick_phase,
2926   		      p_pick_skip      => l_pick_skip);
2927 
2928      IF l_debug_on THEN
2929      --{
2930         WSH_DEBUG_SV.logmsg(l_module_name,'Calling  program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
2931      --}
2932      END IF;
2933      --
2934      wsh_util_core.api_post_call(
2935            p_return_status => l_return_status,
2936            x_num_warnings  => l_number_of_warnings,
2937            x_num_errors    => l_number_of_errors,
2938 	   p_msg_data      => l_msg_data
2939 	    );
2940 
2941 
2942      IF (nvl(l_pick_result,'F') = 'F' ) then
2943      --{
2944         IF (nvl(l_pick_phase,'START') ='MOVE_ORDER_LINES') then
2945 	--{
2946            FND_MESSAGE.SET_NAME('WSH','WSH_PR_ONLINE_PARTIAL');
2947            FND_MESSAGE.SET_TOKEN('MOVE_ORDER', l_batch_name);
2948 	   x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2949 	   wsh_util_core.add_message(x_return_status,l_module_name);
2950         ELSE
2951 	   FND_MESSAGE.SET_NAME('WSH','WSH_PR_ONLINE_FAILED');
2952 	   x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2953 	   wsh_util_core.add_message(x_return_status,l_module_name);
2954         --}
2955 	END IF;
2956       ELSIF (nvl(l_pick_result, 'F') = 'W') then
2957         IF (nvl(l_pick_phase,'START') ='MOVE_ORDER_LINES') then
2958 	--{
2959             FND_MESSAGE.SET_NAME('WSH','WSH_PR_ONLINE_PART_WARN');
2960             FND_MESSAGE.SET_TOKEN('MOVE_ORDER', l_batch_name);
2961 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR;
2962  	    wsh_util_core.add_message(x_return_status,l_module_name);
2963         ELSE
2964           FND_MESSAGE.SET_NAME('WSH','WSH_PR_ONLINE_WARN');
2965           x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
2966 	  wsh_util_core.add_message(x_return_status,l_module_name);
2967         --}
2968 	END IF;
2969      ELSE
2970         FND_MESSAGE.SET_NAME('WSH','WSH_PR_ONLINE_SUCCESS');
2971         x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
2972 	wsh_util_core.add_message(x_return_status,l_module_name);
2973      --}
2974      END IF;
2975   --}
2976   END IF;
2977 
2978 
2979   IF l_debug_on	THEN
2980   --{
2981       WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
2982   --}
2983   END IF;
2984   --
2985   wsh_util_core.api_post_call(
2986         p_return_status => l_return_status,
2987 	x_num_warnings  => l_number_of_warnings,
2988 	x_num_errors    => l_number_of_errors,
2989 	p_msg_data      => l_msg_data
2990 	 );
2991 
2992   IF FND_API.TO_BOOLEAN(p_commit) THEN
2993   --{
2994      COMMIT WORK;
2995   --}
2996   END IF;
2997 
2998   FND_MSG_PUB.Count_And_Get
2999       (
3000  	p_count	=>  x_msg_count,
3001  	p_data	=>  x_msg_data,
3002  	p_encoded => FND_API.G_FALSE
3003       );
3004 
3005   IF l_debug_on THEN
3006   --{
3007      WSH_DEBUG_SV.pop(l_module_name);
3008   --}
3009   END IF;
3010   --
3011   EXCEPTION
3012 	WHEN FND_API.G_EXC_ERROR THEN
3013 	     ROLLBACK TO PICKING_BATCH_GRP;
3014 	     x_return_status :=	FND_API.G_RET_STS_ERROR	;
3015 	     wsh_util_core.add_message(x_return_status);
3016 	     FND_MSG_PUB.Count_And_Get
3017 		 (
3018 		   p_count  => x_msg_count,
3019 		   p_data  =>  x_msg_data,
3020 		   p_encoded =>	FND_API.G_FALSE
3021 		  );
3022 
3023 	    IF l_debug_on THEN
3024 	    --{
3025 		WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_ERROR exception has occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
3026 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_ERROR');
3027 	    --}
3028 	    END	IF;
3029              --
3030 
3031 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3032 	     ROLLBACK TO PICKING_BATCH_GRP;
3033 	     x_return_status :=	FND_API.G_RET_STS_UNEXP_ERROR ;
3034 	     wsh_util_core.add_message(x_return_status,	l_module_name);
3035 	     FND_MSG_PUB.Count_And_Get
3036 		 (
3037 		    p_count  =>	x_msg_count,
3038 		    p_data  =>	x_msg_data,
3039 		    p_encoded => FND_API.G_FALSE
3040 		 );
3041 		  --
3042 
3043 	    IF l_debug_on THEN
3044 	    --{
3045 		WSH_DEBUG_SV.logmsg(l_module_name,'FND_API.G_EXC_UNEXPECTED_ERROR exception has	occured.',WSH_DEBUG_SV.C_EXCEP_LEVEL);
3046 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:FND_API.G_EXC_UNEXPECTED_ERROR');
3047 	    --}
3048 	    END	IF;
3049        WHEN OTHERS THEN
3050 	    ROLLBACK TO	PICKING_BATCH_GRP;
3051 	    wsh_util_core.default_handler('WSH_PICKING_BATCHES_GRP.RELEASE_BATCH');
3052 	    x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
3053 	    FND_MSG_PUB.Count_And_Get
3054 		(
3055 		    p_count  =>	x_msg_count,
3056 		    p_data  =>	x_msg_data,
3057 		    p_encoded => FND_API.G_FALSE
3058 		 );
3059 
3060 	    IF l_debug_on THEN
3061 	    --{
3062 	       WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured.	Oracle error message is	'|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
3063 	       WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
3064 	    --}
3065 	    END	IF;
3066              --
3067 END Release_Batch;
3068 
3069 END WSH_PICKING_BATCHES_GRP;