DBA Data[Home] [Help]

PACKAGE BODY: APPS.WIP_BOMROUTING_PVT

Source


1 package body wip_bomRouting_pvt as
2  /* $Header: wipbmrtb.pls 120.15 2006/09/21 10:36:17 mprathap noship $ */
3 
4   g_pkgName constant varchar2(30) := 'wip_bomRouting_pvt';
5 
6   -- This procedure is used to explode the bom and routing and schedule the job if needed.
7   -- p_schedulingMethod: if the value is routing based, then you must provide one of the p_startDate
8   --                     and p_endDate, you can not provide both, however.
9   --                     if it is not routing based, then you must provide both.
10   -- p_startDate: forward schedule the job if it is not null
11   -- p_endDate: backward schedule the job it it is not null
12   -- p_rtgRefID: only useful when p_jobType is nonstandard
13   -- p_bomRefID: only useful when p_jobType is nonstandard
14   -- p_unitNumber: To explode components properly based on unit number for unit effective assemblies.
15   procedure createJob(p_orgID       in number,
16                       p_wipEntityID in number,
17                       p_jobType     in number,
18                       p_itemID      in number,
19                       p_schedulingMethod in number,
20                       p_altRouting  in varchar2,
21                       p_routingRevDate in date,
22                       p_altBOM      in varchar2,
23                       p_bomRevDate  in date,
24                       p_qty         in number,
25                       p_startDate   in date,
26                       p_endDate     in date,
27                       p_projectID   in number,
28                       p_taskID      in number,
29                       p_rtgRefID    in number,
30                       p_bomRefID    in number,
31 		      p_unitNumber  in varchar2 DEFAULT '', /* added for bug 5332615 */
32                       x_serStartOp   out nocopy number,
33                       x_returnStatus out nocopy varchar2,
34                       x_errorMsg     out nocopy varchar2) is
35     l_params wip_logger.param_tbl_t;
36     l_procName varchar2(30) := 'createJob';
37     l_logLevel number := to_number(fnd_log.g_current_runtime_level);
38     l_retStatus varchar2(1);
39     l_msg varchar2(240);
40 
41     l_startDate date;
42     l_endDate date;
43     l_rtgItemID number;
44     l_bomItemID number;
45   begin
46     x_returnStatus := fnd_api.g_ret_sts_success;
47     if (l_logLevel <= wip_constants.trace_logging) then
48       l_params(1).paramName := 'p_orgID';
49       l_params(1).paramValue := p_orgID;
50       l_params(2).paramName := 'p_wipEntityID';
51       l_params(2).paramValue := p_wipEntityID;
52       l_params(3).paramName := 'p_jobType';
53       l_params(3).paramValue := p_jobType;
54       l_params(4).paramName := 'p_itemID';
55       l_params(4).paramValue := p_itemID;
56       l_params(5).paramName := 'p_schedulingMethod';
57       l_params(5).paramValue := p_schedulingMethod;
58       l_params(6).paramName := 'p_altRouting';
59       l_params(6).paramValue := p_altRouting;
60       l_params(7).paramName := 'p_routingRevDate';
61       l_params(7).paramValue := p_routingRevDate;
62       l_params(8).paramName := 'p_altBOM';
63       l_params(8).paramValue := p_altBOM;
64       l_params(9).paramName := 'p_bomRevDate';
65       l_params(9).paramValue := p_bomRevDate;
66       l_params(10).paramName := 'p_qty';
67       l_params(10).paramValue := p_qty;
68       l_params(11).paramName := 'p_startDate';
69       l_params(11).paramValue := p_startDate;
70       l_params(12).paramName := 'p_endDate';
71       l_params(12).paramValue := p_endDate;
72       l_params(13).paramName := 'p_projectID';
73       l_params(13).paramValue := p_projectID;
74       l_params(14).paramName := 'p_taskID';
75       l_params(14).paramValue := p_taskID;
76       l_params(15).paramName := 'p_rtgRefID';
77       l_params(15).paramValue := p_rtgRefID;
78       l_params(16).paramName := 'p_bomRefID';
79       l_params(16).paramValue := p_bomRefID;
80       wip_logger.entryPoint(p_procName     => g_pkgName || '.' || l_procName,
81                             p_params       => l_params,
82                             x_returnStatus => x_returnStatus);
83       if(x_returnStatus <> fnd_api.g_ret_sts_success) then
84         raise fnd_api.g_exc_unexpected_error;
85       end if;
86     end if;
87 
88     if ( p_schedulingMethod = wip_constants.routing ) then
89       if ( (p_startDate is null and p_endDate is null) or
90            ((p_startDate is not null and p_endDate is not null) and
91            /* Bug 4515999 Non standard jobs cannot have both dates not null */
92 	     p_jobType = wip_constants.standard) ) then
93         x_errorMsg := 'Must only provide one of the p_startDate and p_endDate for routing based scheduling';
94         raise fnd_api.g_exc_unexpected_error;
95       else
96         -- populate some value and then we will reschedule it later on.
97         l_startDate := nvl(p_startDate, p_endDate);
98         l_endDate := l_startDate;
99       end if;
100     else
101       if ( p_startDate is null or p_endDate is null ) then
102         x_errorMsg := 'Must provide both of the dates if it is not routing based scheduling';
103         raise fnd_api.g_exc_unexpected_error;
104       else
105         l_startDate := p_startDate;
106         l_endDate := p_endDate;
107       end if;
108     end if;
109 
110     if ( p_jobType = wip_constants.standard ) then
111       l_rtgItemID := p_itemID;
112       l_bomItemID := p_itemID;
113     else
114       l_rtgItemID := p_rtgRefID;
115       l_bomItemID := p_bomRefID;
116     end if;
117 
118     wip_bomRoutingUtil_pvt.explodeRouting(p_orgID => p_orgID,
119                                       p_wipEntityID => p_wipEntityID,
120                                       p_repSchedID => null,
121                                       p_itemID => l_rtgItemID,
122                                       p_altRouting => p_altRouting,
123                                       p_routingRevDate => p_routingRevDate,
124                                       p_qty => p_qty,
125                                       p_startDate => l_startDate,
126                                       p_endDate => l_endDate,
127                                       x_serStartOp => x_serStartOp,
128                                       x_returnStatus => x_returnStatus,
129                                       x_errorMsg => x_errorMsg);
130     if ( x_returnStatus <> fnd_api.g_ret_sts_success ) then
131       raise fnd_api.g_exc_unexpected_error;
132     end if;
133 
134     if ( p_schedulingMethod = wip_constants.routing ) then
135       wip_infinite_scheduler_pvt.schedule(
136           p_orgID => p_orgID,
137           p_wipEntityID => p_wipEntityID,
138           p_startDate => p_startDate,
139           p_endDate => p_endDate,
140           x_returnStatus => x_returnStatus,
141           x_errorMsg => x_errorMsg);
142       if ( x_returnStatus <> fnd_api.g_ret_sts_success ) then
143         raise fnd_api.g_exc_unexpected_error;
144       end if;
145     end if;
146 
147     -- explode the bom
148     select wdj.scheduled_start_date,
149            wdj.scheduled_completion_date
150       into l_startDate, l_endDate
151       from wip_discrete_jobs wdj
152      where wdj.organization_id = p_orgID
153        and wdj.wip_entity_id = p_wipEntityID;
154 
155     wip_bomRoutingUtil_pvt.explodeBOM(p_orgID => p_orgID,
156                                   p_wipEntityID => p_wipEntityID,
157                                   p_jobType => p_jobType,
158                                   p_repSchedID => null,
159                                   p_itemID => l_bomItemID,
160                                   p_altBOM => p_altBOM,
161                                   p_bomRevDate => p_bomRevDate,
162                                   p_altRouting => p_altRouting,
163                                   p_routingRevDate => p_routingRevDate,
164                                   p_qty => p_qty,
165                                   p_jobStartDate => l_startDate,
166                                   p_projectID => p_projectID,
167                                   p_taskID => p_taskID,
168 				  p_unitNumber => p_unitNumber, /* added for bug 5332615 */
169                                   x_returnStatus => x_returnStatus,
170                                   x_errorMsg => x_errorMsg);
171     if ( x_returnStatus <> fnd_api.g_ret_sts_success ) then
172       raise fnd_api.g_exc_unexpected_error;
173     end if;
174 
175     -- for bug 3041013
176     delete wip_operation_resource_usage
177      where wip_entity_id = p_wipEntityID;
178 
179     -- for bug 3041018
180     wip_op_resources_utilities.update_resource_instances(
181         p_wip_entity_id => p_wipEntityID,
182         p_org_id => p_orgID);
183 
184     if (l_logLevel <= wip_constants.trace_logging) then
185       wip_logger.exitPoint(p_procName         => g_pkgName || '.' || l_procName,
186                            p_procReturnStatus => x_returnStatus,
187                            p_msg              => 'success',
188                            x_returnStatus     => l_retStatus);
189     end if;
190   exception
191   when others then
192     x_returnStatus := fnd_api.g_ret_sts_unexp_error;
193     -- Fixed for bug 5255226
194     -- Don't need to add the x_errormsg again to stack by calling fnd_msg_pub.add_exc_msg
195     -- Removed this API call. Instead adding this error message to debug log using
196     if (l_logLevel <= wip_constants.trace_logging) then
197        wip_logger.log(x_errorMsg,l_retstatus);
198     End if;
199     -- End of Fix for bug 5255226
200 
201     if(l_logLevel <= wip_constants.trace_logging) then
202         wip_logger.exitPoint(p_procName         => g_pkgName || '.' || l_procName,
203                              p_procReturnStatus => x_returnStatus,
204                              p_msg              => x_errorMsg,
205                              x_returnStatus     => l_retStatus);
206     end if;
207   end;
208 
209   -- This procedure is used to reexplode the bom/routing if applicable and reschedule the job.
210   -- p_schedulingMethod: if the value is routing based, then you must provide one of the p_startDate
211   --                     and p_endDate, you can not provide both, however.
212   --                     if it is not routing based, then you must provide both.
213   -- p_startDate: forward schedule the job if it is not null
214   -- p_endDate: backward schedule the job it it is not null
215   -- p_rtgRefID: only useful when p_jobType is nonstandard
216   -- p_bomRefID: only useful when p_jobType is nonstandard
217   -- p_unitNumber: To explode components properly based on unit number for unit effective assemblies.
218   -- for anything related to do not want to change, for instance, bom_reference_id, you must pass the original
219   -- value queried up from the job. If you pass null, this API will consider that you want to change the
220   -- value to null instead of not touching it at all.
221   --
222   procedure reexplodeJob(p_orgID       in number,
223                          p_wipEntityID in number,
224                          p_schedulingMethod in number,
225                          p_altRouting  in varchar2,
226                          p_routingRevDate in date,
227                          p_altBOM      in varchar2,
228                          p_bomRevDate  in date,
229                          p_qty         in number,
230                          p_startDate   in date,
231                          p_endDate     in date,
232 			 p_projectID   in number,
233 			 p_taskID   in number,
234                          p_rtgRefID    in number,
235                          p_bomRefID    in number,
236                          p_allowExplosion in boolean,
237 			 p_unitNumber  in varchar2 DEFAULT '', /* added for bug 5332615 */
238                          x_returnStatus out nocopy varchar2,
239                          x_errorMsg     out nocopy varchar2) is
240     l_params wip_logger.param_tbl_t;
241     l_procName varchar2(30) := 'reexplodeJob';
242     l_logLevel number := to_number(fnd_log.g_current_runtime_level);
243     l_retStatus varchar2(1);
244     l_msg varchar2(240);
245     l_serStartOp number;
246 
247     l_jobType number;
248     l_jobStatus number;
249     l_bomRefID number;
250     l_rtgRefID number;
251     l_bomRevDate date;
252     l_rtgRevDate date;
253     l_altBom varchar2(10);
254     l_altRtg varchar2(10);
255 
256     l_expRtgRequired boolean := false;
257     l_expBomRequired boolean := false;
258     l_rtgItemID number;
259     l_bomItemID number;
260     l_assemblyID number;
261     l_startDate date;
262     l_endDate date;
263 
264     l_usePhantomRouting number;
265     cursor c_phantoms is
266       select inventory_item_id,
267              -1*operation_seq_num operation_seq_num
268         from wip_requirement_operations
269        where organization_id = p_orgID
270          and wip_entity_id = p_wipEntityID
271          and operation_seq_num < 0
272          and wip_supply_type = wip_constants.phantom;
273   begin
274 
275     x_returnStatus := fnd_api.g_ret_sts_success;
276     if (l_logLevel <= wip_constants.trace_logging) then
277       l_params(1).paramName := 'p_orgID';
278       l_params(1).paramValue := p_orgID;
279       l_params(2).paramName := 'p_wipEntityID';
280       l_params(2).paramValue := p_wipEntityID;
281       wip_logger.entryPoint(p_procName     => g_pkgName || '.' || l_procName,
282                             p_params       => l_params,
283                             x_returnStatus => x_returnStatus);
284       if(x_returnStatus <> fnd_api.g_ret_sts_success) then
285         raise fnd_api.g_exc_unexpected_error;
286       end if;
287     end if;
288 
289     select job_type,
290            status_type,
291            primary_item_id,
292            bom_reference_id,
293            routing_reference_id,
294            bom_revision_date,
295            routing_revision_date,
296            alternate_bom_designator,
297            alternate_routing_designator
298       into l_jobType,
299            l_jobStatus,
300            l_assemblyID,
301            l_bomRefID,
302            l_rtgRefID,
303            l_bomRevDate,
304            l_rtgRevDate,
305            l_altBom,
306            l_altRtg
307       from wip_discrete_jobs
308      where organization_id = p_orgID
309        and wip_entity_id = p_wipEntityID;
310 
311     if ( /*Fix for bug 5020741. Routing should be exploded if any relevant feild is not null.
312          nvl(p_altRouting, fnd_api.g_miss_char) <> nvl(l_altRtg, fnd_api.g_miss_char) or
313          nvl(p_routingRevDate, fnd_api.g_miss_date) <> nvl(l_rtgRevDate, fnd_api.g_miss_date)*/
314          --Bug 5464449:Comparision of routing info is fixed
315 	 --p_altRouting IS NOT NULL or
316 	 --p_routingRevDate IS NOT NULL or
317  nvl(p_altRouting, nvl(l_altRtg,fnd_api.g_miss_char)) <> nvl(l_altRtg, fnd_api.g_miss_char) or
318  nvl(p_routingRevDate, nvl(l_rtgRevDate, fnd_api.g_miss_date)) <> nvl(l_rtgRevDate, fnd_api.g_miss_date) OR
319  --Bug 5464449:End of changes
320          (l_jobType = wip_constants.nonstandard and
321           nvl(p_rtgRefID, -1) <> nvl(l_rtgRefID, -1)) ) then
322       l_expRtgRequired := true;
323     else
324       l_expRtgRequired := false;
325     end if;
326 
327     if ( /* Fix for bug 5020741. Bom should be exploded if any relevant feild is not null.
328          nvl(p_altBom, fnd_api.g_miss_char) <> nvl(l_altBom, fnd_api.g_miss_char) or
329          nvl(p_bomRevDate, fnd_api.g_miss_date) <> nvl(l_bomRevDate, fnd_api.g_miss_date)*/
330 --Bug 5464449:Comparision of bom info is fixed
331 	 --p_altBom IS NOT NULL or
332 	 --p_bomRevDate IS NOT NULL or
333  nvl(p_altBom, nvl(l_altBom, fnd_api.g_miss_char)) <> nvl(l_altBom, fnd_api.g_miss_char) or
334  nvl(p_bomRevDate, nvl(l_bomRevDate, fnd_api.g_miss_date)) <> nvl(l_bomRevDate, fnd_api.g_miss_date) or
335  --Bug 5464449:End of changes
336          (l_jobType = wip_constants.nonstandard and
337           nvl(p_bomRefID, -1) <> nvl(l_bomRefID, -1)) ) then
338       l_expBomRequired := true;
339     else
340       l_expBomRequired := false;
341     end if;
342 
343     -- unless the job is unreleased, you can never explode again from bom
344     if ( not p_allowExplosion or l_jobStatus <> wip_constants.unreleased ) then
345       l_expRtgRequired := false;
346       l_expBomRequired := false;
347     end if;
348 
349     if ( p_schedulingMethod = wip_constants.routing ) then
350       if ( (p_startDate is null and p_endDate is null) or
351            (p_startDate is not null and p_endDate is not null) ) then
352         x_errorMsg := 'Must only provide one of the p_startDate and p_endDate for routing based scheduling';
353         raise fnd_api.g_exc_unexpected_error;
354       else
355         -- populate some value and then we will reschedule it later on.
356         l_startDate := nvl(p_startDate, p_endDate);
357         l_endDate := l_startDate;
358       end if;
359     else
360       if (p_schedulingMethod = wip_constants.ml_manual and (p_startDate is null or p_endDate is null) ) then
361         x_errorMsg := 'Must provide both of the dates if it is not routing based scheduling';
362         raise fnd_api.g_exc_unexpected_error;
363       end if;
364       l_startDate := p_startDate;
365       l_endDate := p_endDate;
366     end if;
367 
368     if ( l_expRtgRequired ) then
369       -- remove any setup resource for this job
370       wip_update_setup_resources.delete_setup_resources_pub(
371              p_wip_entity_id => p_wipEntityID,
372              p_organization_id => p_orgID);
373 
374       delete from wip_operations
375        where wip_entity_id = p_wipEntityID
376          and organization_id = p_orgID;
377 
378       delete from wip_operation_resources
379        where wip_entity_id = p_wipEntityID
380          and organization_id = p_orgID;
381 
382       delete from wip_sub_operation_resources
383        where wip_entity_id = p_wipEntityID
384          and organization_id = p_orgID;
385 
386       fnd_attached_documents2_pkg.delete_attachments(
387         x_entity_name => 'WIP_DISCRETE_OPERATIONS',
388         x_pk1_value => to_char(p_wipEntityID),
389         x_pk3_value => to_char(p_orgID),
390         x_delete_document_flag => 'Y');
391 
392       if ( l_jobType = wip_constants.standard ) then
393         l_rtgItemID := l_assemblyID;
394       else
395         l_rtgItemID := p_rtgRefID;
396       end if;
397 
398       wip_bomRoutingUtil_pvt.explodeRouting(
399                                p_orgID => p_orgID,
400                                p_wipEntityID => p_wipEntityID,
401                                p_repSchedID => null,
402                                p_itemID => l_rtgItemID,
403                                p_altRouting => p_altRouting,
404                                p_routingRevDate => p_routingRevDate,
405                                p_qty => p_qty,
406                                p_startDate => l_startDate,
407                                p_endDate => l_endDate,
408                                x_serStartOp => l_serStartOp,
409                                x_returnStatus => x_returnStatus,
410                                x_errorMsg => x_errorMsg);
411       if ( x_returnStatus <> fnd_api.g_ret_sts_success ) then
412         raise fnd_api.g_exc_unexpected_error;
413       end if;
414     end if;
415     /* fix bug 5238435. Move the scheduler call outside the if condition since job can be
416        rescheduled even without exploding the routing when user just changes the dates */
417 
418       if ( p_schedulingMethod = wip_constants.routing ) then
419         wip_infinite_scheduler_pvt.schedule(
420             p_orgID => p_orgID,
421             p_wipEntityID => p_wipEntityID,
422             p_startDate => p_startDate,
423             p_endDate => p_endDate,
424 	    p_quantity => p_qty, --- Added for bug 5440007
425             x_returnStatus => x_returnStatus,
426             x_errorMsg => x_errorMsg);
427         if ( x_returnStatus <> fnd_api.g_ret_sts_success ) then
428           raise fnd_api.g_exc_unexpected_error;
429         end if;
430 
431         select wdj.scheduled_start_date,
432                wdj.scheduled_completion_date
433           into l_startDate, l_endDate
434           from wip_discrete_jobs wdj
435          where wdj.organization_id = p_orgID
436            and wdj.wip_entity_id = p_wipEntityID;
437       end if;
438 
439 
440     -- after reexplode the routing, some op reference in WRO might be invalid. We need to set those
441     -- properly. We only need to do it if bom reexplosion is not required.
442     -- we also need to add the phantom resource back since it was deleted before
443     if ( l_expRtgRequired and not l_expBomRequired ) then
444       if ( l_logLevel <= wip_constants.trace_logging ) then
445         wip_logger.log('Resetting the op reference in WRO.....', l_retStatus);
446       end if;
447       wip_fix_req_ops_pkg.fix(x_wip_entity_id => p_wipEntityID,
448                               x_organization_id => p_orgID,
449                               x_repetitive_schedule_id => null,
450                               x_entity_start_date => l_startDate);
451       l_usePhantomRouting := wip_globals.use_phantom_routings(p_orgID);
452       if ( l_usePhantomRouting = wip_constants.yes ) then
453         for phan in c_phantoms loop
454           wip_explode_phantom_rtgs.explode_resources(
455               p_wip_entity_id => p_wipEntityID,
456               p_sched_id => null,
457               p_org_id => p_orgID,
458               p_entity_type => wip_constants.discrete,
459               p_phantom_item_id => phan.inventory_item_id,
460               p_op_seq_num => phan.operation_seq_num,
461               p_rtg_rev_date => p_routingRevDate);
462         end loop;
463       end if;
464     end if;
465 
466     if ( l_expBomRequired ) then
467       delete from wip_requirement_operations
468        where wip_entity_id = p_wipEntityID
469          and organization_id = p_orgID;
470 
471       if ( l_jobType = wip_constants.standard ) then
472         l_bomItemID := l_assemblyID;
473       else
474         l_bomItemID := p_bomRefID;
475       end if;
476 
477       wip_bomRoutingUtil_pvt.explodeBOM(
478                                   p_orgID => p_orgID,
479                                   p_wipEntityID => p_wipEntityID,
480                                   p_jobType => l_jobType,
481                                   p_repSchedID => null,
482                                   p_itemID => l_bomItemID,
483                                   p_altBOM => p_altBOM,
484                                   p_bomRevDate => p_bomRevDate,
485                                   p_altRouting => p_altRouting,
486                                   p_routingRevDate => p_routingRevDate,
487                                   p_qty => p_qty,
488                                   p_jobStartDate => l_startDate,
489                                   p_projectID => p_projectID,
490                                   p_taskID => p_taskID,
491 				  p_unitNumber => p_unitNumber, /* added for bug 5332615 */
492                                   x_returnStatus => x_returnStatus,
493                                   x_errorMsg => x_errorMsg);
494       if ( x_returnStatus <> fnd_api.g_ret_sts_success ) then
495         raise fnd_api.g_exc_unexpected_error;
496       end if;
497     end if;
498 
499     -- for bug 3041013
500     delete wip_operation_resource_usage
501      where wip_entity_id = p_wipEntityID;
502 
503     -- for bug 3041018
504     wip_op_resources_utilities.update_resource_instances(
505         p_wip_entity_id => p_wipEntityID,
506         p_org_id => p_orgID);
507 
508     -- if it is only date changes or qty changes, then the flow should be here
509     if ( not l_expBomRequired and not l_expRtgRequired ) then
510      --Bug 5464449: Quantity should be adjusted only when explode is yes at header level.
511      if  p_allowExplosion  then
512       wip_bomRoutingUtil_pvt.adjustQtyChange(
513                                   p_orgID => p_orgID,
514                                   p_wipEntityID => p_wipEntityID,
515                                   p_qty => p_qty,
516                                   x_returnStatus => x_returnStatus,
517                                   x_errorMsg => x_errorMsg);
518       if ( x_returnStatus <> fnd_api.g_ret_sts_success ) then
519         raise fnd_api.g_exc_unexpected_error;
520       end if;
521      end if; --End of check on p_allowExplosion.
522       if ( p_schedulingMethod = wip_constants.routing ) then
523         wip_infinite_scheduler_pvt.schedule(
524             p_orgID => p_orgID,
525             p_wipEntityID => p_wipEntityID,
526             p_startDate => p_startDate,
527             p_endDate => p_endDate,
528 	    p_quantity => p_qty,
529             x_returnStatus => x_returnStatus,
530             x_errorMsg => x_errorMsg);
531         if ( x_returnStatus <> fnd_api.g_ret_sts_success ) then
532           raise fnd_api.g_exc_unexpected_error;
533         end if;
534       else
535         update wip_operations
536            set first_unit_start_date = p_startDate,
537                first_unit_completion_date = p_startDate,
538                last_unit_start_date = p_startDate,
539                last_unit_completion_date = p_startDate
540          where organization_id = p_orgID
541            and wip_entity_id = p_wipEntityID;
542 
543         update wip_operation_resources
544            set start_date = p_startDate,
545                completion_date = p_startDate
546          where organization_id = p_orgID
547            and wip_entity_id = p_wipEntityID;
548 
549         update wip_sub_operation_resources
550            set start_date = p_startDate,
551                completion_date = p_startDate
552          where organization_id = p_orgID
553            and wip_entity_id = p_wipEntityID;
554 
555         -- need to adjust the data required field
556         update wip_requirement_operations wro
557            set wro.date_required = (select nvl(max(wo.first_unit_start_date), l_startDate)
558                                    from wip_operations wo
559                                   where wo.organization_id = wro.organization_id
560                                     and wo.wip_entity_id = wro.wip_entity_id
561                                     and wo.operation_seq_num = abs(wro.operation_seq_num))
562         where wro.wip_entity_id = p_wipEntityID
563           and wro.organization_id = p_orgID;
564       end if;
565 
566     end if;
567 
568     if (l_logLevel <= wip_constants.trace_logging) then
569       wip_logger.exitPoint(p_procName         => g_pkgName || '.' || l_procName,
570                            p_procReturnStatus => x_returnStatus,
571                            p_msg              => 'success',
572                            x_returnStatus     => l_retStatus);
573     end if;
574   exception
575   when others then
576     x_returnStatus := fnd_api.g_ret_sts_unexp_error;
577     fnd_msg_pub.add_exc_msg(p_pkg_name => g_pkgName,
578                             p_procedure_name => l_procName,
579                             p_error_text => x_errorMsg);
580     if(l_logLevel <= wip_constants.trace_logging) then
581         wip_logger.exitPoint(p_procName         => g_pkgName || '.' || l_procName,
582                              p_procReturnStatus => x_returnStatus,
583                              p_msg              => x_errorMsg,
584                              x_returnStatus     => l_retStatus);
585     end if;
586   end reexplodeJob;
587 
588 end wip_bomRouting_pvt;