121: Begin
122:
123: If P_Init_Debugging_Flag = 'Y' Then
124:
125: Pa_Debug.G_Path := ' ';
126:
127: End If;
128:
129: Pa_Debug.G_Stage := 'Entering Update_Working_Version() Pub.';
125: Pa_Debug.G_Path := ' ';
126:
127: End If;
128:
129: Pa_Debug.G_Stage := 'Entering Update_Working_Version() Pub.';
130: Pa_Debug.TrackPath('ADD','Update_Working_Version Pub');
131:
132: Pa_Debug.G_Stage := 'Call Compatibility API.';
133: If Not Fnd_Api.Compatible_API_Call (
126:
127: End If;
128:
129: Pa_Debug.G_Stage := 'Entering Update_Working_Version() Pub.';
130: Pa_Debug.TrackPath('ADD','Update_Working_Version Pub');
131:
132: Pa_Debug.G_Stage := 'Call Compatibility API.';
133: If Not Fnd_Api.Compatible_API_Call (
134: Pa_Rbs_Versions_Pub.G_Api_Version_Number,
128:
129: Pa_Debug.G_Stage := 'Entering Update_Working_Version() Pub.';
130: Pa_Debug.TrackPath('ADD','Update_Working_Version Pub');
131:
132: Pa_Debug.G_Stage := 'Call Compatibility API.';
133: If Not Fnd_Api.Compatible_API_Call (
134: Pa_Rbs_Versions_Pub.G_Api_Version_Number,
135: P_Api_Version_Number,
136: l_Api_Name,
139: Raise Fnd_Api.G_Exc_Unexpected_Error;
140:
141: End If;
142:
143: Pa_Debug.G_Stage := 'Check if need to initialize message stack.';
144: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
145:
146: Pa_Debug.G_Stage := 'Initialize Message Stack.';
147: Fnd_Msg_Pub.Initialize;
142:
143: Pa_Debug.G_Stage := 'Check if need to initialize message stack.';
144: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
145:
146: Pa_Debug.G_Stage := 'Initialize Message Stack.';
147: Fnd_Msg_Pub.Initialize;
148:
149: End If;
150:
147: Fnd_Msg_Pub.Initialize;
148:
149: End If;
150:
151: Pa_Debug.G_Stage := 'Initialize error handling variables.';
152: X_Msg_Count := 0;
153: X_Error_Msg_Data := Null;
154: X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
155:
152: X_Msg_Count := 0;
153: X_Error_Msg_Data := Null;
154: X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
155:
156: Pa_Debug.G_Stage := 'Lock the version record.';
157: Open c1(P_Rbs_Ver_Id => P_Rbs_Version_Id, P_Rec_Num => P_Record_Version_Number);
158: Fetch c1 Into l_Ver_Rec;
159:
160: Pa_Debug.G_Stage := 'Check able to lock version rec for update.';
156: Pa_Debug.G_Stage := 'Lock the version record.';
157: Open c1(P_Rbs_Ver_Id => P_Rbs_Version_Id, P_Rec_Num => P_Record_Version_Number);
158: Fetch c1 Into l_Ver_Rec;
159:
160: Pa_Debug.G_Stage := 'Check able to lock version rec for update.';
161: If c1%NotFound Then
162:
163: Pa_Debug.G_Stage := 'Unable to lock version record for update. ' ||
164: 'Add error message to stack.';
159:
160: Pa_Debug.G_Stage := 'Check able to lock version rec for update.';
161: If c1%NotFound Then
162:
163: Pa_Debug.G_Stage := 'Unable to lock version record for update. ' ||
164: 'Add error message to stack.';
165: Pa_Utils.Add_Message(
166: P_App_Short_Name => 'PA',
167: P_Msg_Name => 'PA_RECORD_ALREADY_UPDATED');
173: Open c2(P_Rbs_Ver_Id => P_Rbs_Version_Id);
174: Fetch c2 Into l_Hdr_Rec;
175: Close c2;
176:
177: Pa_Debug.G_Stage := 'Check if the version start date is not null.';
178: If P_Version_Start_Date is not null Then
179:
180: Pa_Debug.G_Stage := 'The version start date is Null.';
181: If P_Version_Start_Date < l_Hdr_Rec.Effective_From_Date Then
176:
177: Pa_Debug.G_Stage := 'Check if the version start date is not null.';
178: If P_Version_Start_Date is not null Then
179:
180: Pa_Debug.G_Stage := 'The version start date is Null.';
181: If P_Version_Start_Date < l_Hdr_Rec.Effective_From_Date Then
182:
183: Pa_Debug.G_Stage := 'The version start date is before the header from date.';
184: Pa_Utils.Add_Message(
179:
180: Pa_Debug.G_Stage := 'The version start date is Null.';
181: If P_Version_Start_Date < l_Hdr_Rec.Effective_From_Date Then
182:
183: Pa_Debug.G_Stage := 'The version start date is before the header from date.';
184: Pa_Utils.Add_Message(
185: P_App_Short_Name => 'PA',
186: P_Msg_Name => 'PA_VER_START_<_HDR_FROM_DATE',
187: P_Token1 => 'RBSNAME',
192: End If;
193:
194: Else
195:
196: Pa_Debug.G_Stage := 'The version start date is null. Add error message to stack.';
197: Pa_Utils.Add_Message(
198: P_App_Short_Name => 'PA',
199: P_Msg_Name => 'PA_VER_START_DATE_IS_NULL',
200: P_Token1 => 'RBSNAME',
204:
205: End If;
206:
207: -- Per bug 3602821 don't need to check the end date of the header for anything.
208: -- Pa_Debug.G_Stage := 'Check and see if the version start date is after the header end date.';
209: -- If P_Version_Start_Date > Nvl(l_Hdr_Rec.Effective_To_Date,P_Version_Start_Date) Then
210:
211: -- Pa_Debug.G_Stage := 'The version start date is after the header end date.';
212: -- Pa_Utils.Add_Message(
207: -- Per bug 3602821 don't need to check the end date of the header for anything.
208: -- Pa_Debug.G_Stage := 'Check and see if the version start date is after the header end date.';
209: -- If P_Version_Start_Date > Nvl(l_Hdr_Rec.Effective_To_Date,P_Version_Start_Date) Then
210:
211: -- Pa_Debug.G_Stage := 'The version start date is after the header end date.';
212: -- Pa_Utils.Add_Message(
213: -- P_App_Short_Name => 'PA',
214: -- P_Msg_Name => 'PA_VER_START_>_HDR_TO_DATE',
215: -- P_Token1 => 'RBSNAME',
218: -- Raise l_Error;
219:
220: -- End If;
221:
222: Pa_Debug.G_Stage := 'Get the prior working version rbs version id if exists.';
223: Open GetLatestFrozenRbsVersionId(P_Id => l_Hdr_Rec.Rbs_Header_Id);
224: Fetch GetLatestFrozenRbsVersionId Into l_Prior_Rbs_Ver_Id;
225:
226: If GetLatestFrozenRbsVersionId%NotFound Then
230: Else
231:
232: Close GetLatestFrozenRbsVersionId;
233:
234: Pa_Debug.G_Stage := 'Get the prior working version end date.';
235: Open GetVersionEndDate(P_Id => l_Prior_Rbs_Ver_Id);
236: Fetch GetVersionEndDate Into l_Prior_Rbs_Ver_Rec;
237: Close GetVersionEndDate;
238:
237: Close GetVersionEndDate;
238:
239: If P_Version_Start_Date < l_Prior_Rbs_Ver_Rec.Version_Start_Date Then
240:
241: Pa_Debug.G_Stage := 'Version Start Date less than prior version. Add error message to stack.';
242: Pa_Utils.Add_Message(
243: P_App_Short_Name => 'PA',
244: P_Msg_Name => 'PA_RBS_VER_DATES_OVERLAP');
245:
252: -- Check If the job_group has changed and if it has then check to see if there are job assigned to any of the
253: -- elements/nodes for the rbs. If there are job elements then raise an error. You can't change the job_group
254: -- when there are element/nodes with jobs assigned to them.
255:
256: Pa_Debug.G_Stage := 'Check if the current working record job group is populated.';
257: If l_Ver_Rec.Job_Group_Id Is Not Null Then
258:
259: Pa_Debug.G_Stage := 'Check if the current parameter job group is populated.';
260: If P_Job_Group_Id Is Not Null Then
255:
256: Pa_Debug.G_Stage := 'Check if the current working record job group is populated.';
257: If l_Ver_Rec.Job_Group_Id Is Not Null Then
258:
259: Pa_Debug.G_Stage := 'Check if the current parameter job group is populated.';
260: If P_Job_Group_Id Is Not Null Then
261:
262: If P_Job_Group_Id <> l_Ver_Rec.Job_Group_Id Then
263:
266: Close CheckJobsExist;
267:
268: If l_Job_Count > 0 Then
269:
270: Pa_Debug.G_Stage := 'There are elements with jobs. Cannot change job group. Raise error.';
271: Pa_Utils.Add_Message(
272: P_App_Short_Name => 'PA',
273: P_Msg_Name => 'PA_RBS_CANT_CHANGE_JOB_GROUP');
274:
285: Close CheckJobsExist;
286:
287: If l_Job_Count > 0 Then
288:
289: Pa_Debug.G_Stage := 'There are element with jobs. Cannot change job group. Raise error.';
290: Pa_Utils.Add_Message(
291: P_App_Short_Name => 'PA',
292: P_Msg_Name => 'PA_RBS_CANT_CHANGE_JOB_GROUP');
293:
298: End If;
299:
300: End If;
301:
302: Pa_Debug.G_Stage := 'Call Pa_Rbs_Versions_Pvt.Update_Working_Version() procedure.';
303: Pa_Rbs_Versions_Pvt.Update_Working_Version(
304: P_Rbs_Version_Id => P_Rbs_Version_Id,
305: P_Name => P_Name,
306: P_Description => P_Description,
315: Raise l_Error;
316:
317: End If;
318:
319: Pa_Debug.G_Stage := 'Check to do commit(T-True,F-False) - ' || P_Commit;
320: If Fnd_Api.To_Boolean(Nvl(P_Commit,Fnd_Api.G_False)) Then
321:
322: Commit;
323:
322: Commit;
323:
324: End If;
325:
326: Pa_Debug.G_Stage := 'Leaving Update_Working_Version() Pub procedure.';
327: Pa_Debug.TrackPath('STRIP','Update_Working_Version Pub');
328:
329: Exception
330: When l_Error Then
323:
324: End If;
325:
326: Pa_Debug.G_Stage := 'Leaving Update_Working_Version() Pub procedure.';
327: Pa_Debug.TrackPath('STRIP','Update_Working_Version Pub');
328:
329: Exception
330: When l_Error Then
331: X_Return_Status := 'E';
329: Exception
330: When l_Error Then
331: X_Return_Status := 'E';
332: X_Msg_Count := 1;
333: Pa_Debug.G_Stage := 'Leaving Update_Working_Version() Pub procedure.';
334: Pa_Debug.TrackPath('STRIP','Update_Working_Version Pub');
335: When Others Then
336: X_Return_Status := 'U';
337: X_Msg_Count := 1;
330: When l_Error Then
331: X_Return_Status := 'E';
332: X_Msg_Count := 1;
333: Pa_Debug.G_Stage := 'Leaving Update_Working_Version() Pub procedure.';
334: Pa_Debug.TrackPath('STRIP','Update_Working_Version Pub');
335: When Others Then
336: X_Return_Status := 'U';
337: X_Msg_Count := 1;
338: X_Error_Msg_Data := Pa_Rbs_Versions_Pub.G_Pkg_Name || ':::' || Pa_Debug.G_Path || '::' || Pa_Debug.G_Stage ||
334: Pa_Debug.TrackPath('STRIP','Update_Working_Version Pub');
335: When Others Then
336: X_Return_Status := 'U';
337: X_Msg_Count := 1;
338: X_Error_Msg_Data := Pa_Rbs_Versions_Pub.G_Pkg_Name || ':::' || Pa_Debug.G_Path || '::' || Pa_Debug.G_Stage ||
339: ':' || SqlErrm;
340: If P_Init_Debugging_Flag = 'Y' Then
341: Rollback;
342: Else
386:
387: Begin
388:
389:
390: Pa_Debug.G_Path := ' ';
391:
392: Pa_Debug.G_Stage := 'Entering Delete_Working_Version() Pub.';
393: Pa_Debug.TrackPath('ADD','Delete_Working_Version Pub');
394:
388:
389:
390: Pa_Debug.G_Path := ' ';
391:
392: Pa_Debug.G_Stage := 'Entering Delete_Working_Version() Pub.';
393: Pa_Debug.TrackPath('ADD','Delete_Working_Version Pub');
394:
395: Pa_Debug.G_Stage := 'Call Compatibility API.';
396: If Not Fnd_Api.Compatible_API_Call (
389:
390: Pa_Debug.G_Path := ' ';
391:
392: Pa_Debug.G_Stage := 'Entering Delete_Working_Version() Pub.';
393: Pa_Debug.TrackPath('ADD','Delete_Working_Version Pub');
394:
395: Pa_Debug.G_Stage := 'Call Compatibility API.';
396: If Not Fnd_Api.Compatible_API_Call (
397: Pa_Rbs_Versions_Pub.G_Api_Version_Number,
391:
392: Pa_Debug.G_Stage := 'Entering Delete_Working_Version() Pub.';
393: Pa_Debug.TrackPath('ADD','Delete_Working_Version Pub');
394:
395: Pa_Debug.G_Stage := 'Call Compatibility API.';
396: If Not Fnd_Api.Compatible_API_Call (
397: Pa_Rbs_Versions_Pub.G_Api_Version_Number,
398: P_Api_Version_Number,
399: l_Api_Name,
402: Raise Fnd_Api.G_Exc_Unexpected_Error;
403:
404: End If;
405:
406: Pa_Debug.G_Stage := 'Check if need to initialize message stack.';
407: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
408:
409: Pa_Debug.G_Stage := 'Initialize Message Stack.';
410: Fnd_Msg_Pub.Initialize;
405:
406: Pa_Debug.G_Stage := 'Check if need to initialize message stack.';
407: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
408:
409: Pa_Debug.G_Stage := 'Initialize Message Stack.';
410: Fnd_Msg_Pub.Initialize;
411:
412: End If;
413:
410: Fnd_Msg_Pub.Initialize;
411:
412: End If;
413:
414: Pa_Debug.G_Stage := 'Initialize error handling variables.';
415: X_Msg_Count := 0;
416: X_Error_Msg_Data := Null;
417: X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
418:
415: X_Msg_Count := 0;
416: X_Error_Msg_Data := Null;
417: X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
418:
419: Pa_Debug.G_Stage := 'Call Pa_Rbs_Versions_Pvt.Delete_Working_Version() procedure.';
420: Pa_Rbs_Versions_Pvt.Delete_Working_Version(
421: P_Rbs_Version_Id => P_RBS_Version_Id,
422: P_Record_Version_Number => P_Record_Version_Number,
423: P_Mode => Null,
422: P_Record_Version_Number => P_Record_Version_Number,
423: P_Mode => Null,
424: X_Error_Msg_Data => X_Error_Msg_Data);
425:
426: Pa_Debug.G_Stage := 'Check if error message data is populated.';
427: If X_Error_Msg_Data Is Not Null Then
428:
429: Pa_Debug.G_Stage := 'Raise user defined error due to error msg data parameter being populated.';
430: Raise l_error;
425:
426: Pa_Debug.G_Stage := 'Check if error message data is populated.';
427: If X_Error_Msg_Data Is Not Null Then
428:
429: Pa_Debug.G_Stage := 'Raise user defined error due to error msg data parameter being populated.';
430: Raise l_error;
431:
432: End If;
433:
430: Raise l_error;
431:
432: End If;
433:
434: Pa_Debug.G_Stage := 'Check to do commit(T-True,F-False) - ' || P_Commit;
435: If Fnd_Api.To_Boolean(Nvl(P_Commit,Fnd_Api.G_False)) Then
436:
437: Commit;
438:
437: Commit;
438:
439: End If;
440:
441: Pa_Debug.G_Stage := 'Leaving Delete_Working_Version() Pub procedure.';
442: Pa_Debug.TrackPath('STRIP','Delete_Working_Version Pub');
443:
444: Exception
445: When l_Error Then
438:
439: End If;
440:
441: Pa_Debug.G_Stage := 'Leaving Delete_Working_Version() Pub procedure.';
442: Pa_Debug.TrackPath('STRIP','Delete_Working_Version Pub');
443:
444: Exception
445: When l_Error Then
446: X_Return_Status := 'E';
447: X_Msg_Count := 1;
448: When Others Then
449: X_Return_Status := 'U';
450: X_Msg_Count := 1;
451: X_Error_Msg_Data := Pa_Rbs_Versions_Pub.G_Pkg_Name || ':::' || Pa_Debug.G_Path || '::' || Pa_Debug.G_Stage ||
452: ':' || SqlErrm;
453: Rollback;
454:
455: End Delete_Working_Version;
498:
499: Begin
500:
501: If P_Init_Debugging_Flag = 'Y' Then
502: Pa_Debug.G_Path := ' ';
503: End If;
504:
505: Pa_Debug.G_Stage := 'Entering Create_Working_Version().';
506: Pa_Debug.TrackPath('ADD','Create_Working_Version');
501: If P_Init_Debugging_Flag = 'Y' Then
502: Pa_Debug.G_Path := ' ';
503: End If;
504:
505: Pa_Debug.G_Stage := 'Entering Create_Working_Version().';
506: Pa_Debug.TrackPath('ADD','Create_Working_Version');
507:
508: Pa_Debug.G_Stage := 'Call Compatibility API.';
509: If Not Fnd_Api.Compatible_API_Call (
502: Pa_Debug.G_Path := ' ';
503: End If;
504:
505: Pa_Debug.G_Stage := 'Entering Create_Working_Version().';
506: Pa_Debug.TrackPath('ADD','Create_Working_Version');
507:
508: Pa_Debug.G_Stage := 'Call Compatibility API.';
509: If Not Fnd_Api.Compatible_API_Call (
510: Pa_Rbs_Versions_Pub.G_Api_Version_Number,
504:
505: Pa_Debug.G_Stage := 'Entering Create_Working_Version().';
506: Pa_Debug.TrackPath('ADD','Create_Working_Version');
507:
508: Pa_Debug.G_Stage := 'Call Compatibility API.';
509: If Not Fnd_Api.Compatible_API_Call (
510: Pa_Rbs_Versions_Pub.G_Api_Version_Number,
511: P_Api_Version_Number,
512: l_Api_Name,
515: Raise Fnd_Api.G_Exc_Unexpected_Error;
516:
517: End If;
518:
519: Pa_Debug.G_Stage := 'Check if need to initialize message stack.';
520: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
521:
522: Pa_Debug.G_Stage := 'Initialize Message Stack.';
523: Fnd_Msg_Pub.Initialize;
518:
519: Pa_Debug.G_Stage := 'Check if need to initialize message stack.';
520: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
521:
522: Pa_Debug.G_Stage := 'Initialize Message Stack.';
523: Fnd_Msg_Pub.Initialize;
524:
525: End If;
526:
523: Fnd_Msg_Pub.Initialize;
524:
525: End If;
526:
527: Pa_Debug.G_Stage := 'Initialize error handling variables.';
528: X_Msg_Count := 0;
529: X_Error_Msg_Data := Null;
530: X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
531:
528: X_Msg_Count := 0;
529: X_Error_Msg_Data := Null;
530: X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
531:
532: Pa_Debug.G_Stage := 'Call Pa_Rbs_Versions_Pvt.Create_New_Working_Version() procedure.';
533: Pa_Rbs_Versions_Pvt.Create_New_Working_Version(
534: P_RBS_Version_Id => P_RBS_Version_Id,
535: P_Rbs_Header_Id => P_Rbs_Header_Id,
536: P_Record_Version_Number => P_Rec_Version_Number,
535: P_Rbs_Header_Id => P_Rbs_Header_Id,
536: P_Record_Version_Number => P_Rec_Version_Number,
537: X_Error_Msg_Data => X_Error_Msg_Data);
538:
539: Pa_Debug.G_Stage := 'Check if error message data is populated.';
540: If X_Error_Msg_Data Is Not Null Then
541:
542: Pa_Debug.G_Stage := 'Raise user defined error due to error msg data parameter being populated.';
543: Raise l_error;
538:
539: Pa_Debug.G_Stage := 'Check if error message data is populated.';
540: If X_Error_Msg_Data Is Not Null Then
541:
542: Pa_Debug.G_Stage := 'Raise user defined error due to error msg data parameter being populated.';
543: Raise l_error;
544:
545: End If;
546:
543: Raise l_error;
544:
545: End If;
546:
547: Pa_Debug.G_Stage := 'Check to do commit(T-True,F-False) - ' || P_Commit;
548: If Fnd_Api.To_Boolean(Nvl(P_Commit,Fnd_Api.G_False)) Then
549:
550: Commit;
551:
550: Commit;
551:
552: End If;
553:
554: Pa_Debug.G_Stage := 'Leaving Create_Working_Version() procedure.';
555: Pa_Debug.TrackPath('STRIP','Create_Working_Version');
556:
557: Exception
558: When l_Error Then
551:
552: End If;
553:
554: Pa_Debug.G_Stage := 'Leaving Create_Working_Version() procedure.';
555: Pa_Debug.TrackPath('STRIP','Create_Working_Version');
556:
557: Exception
558: When l_Error Then
559: X_Return_Status := 'E';
560: X_Msg_Count := 1;
561: When Others Then
562: X_Return_Status := 'U';
563: X_Msg_Count := 1;
564: X_Error_Msg_Data := Pa_Rbs_Versions_Pub.G_Pkg_Name || ':::' || Pa_Debug.G_Path || '::' || Pa_Debug.G_Stage ||
565: ':' || SqlErrm;
566: If P_Init_Debugging_Flag = 'Y' Then
567: Rollback;
568: Else
661:
662: BEGIN
663:
664: If P_Init_Debugging_Flag = 'Y' Then
665: Pa_Debug.G_Path := ' ';
666: End If;
667:
668: Pa_Debug.G_Stage := 'Entering Freeze_Working_Version().';
669: Pa_Debug.TrackPath('ADD','Freeze_Working_Version');
664: If P_Init_Debugging_Flag = 'Y' Then
665: Pa_Debug.G_Path := ' ';
666: End If;
667:
668: Pa_Debug.G_Stage := 'Entering Freeze_Working_Version().';
669: Pa_Debug.TrackPath('ADD','Freeze_Working_Version');
670:
671: --Initialize the message stack if not initialized
672: Pa_Debug.G_Stage := 'Check if need to initialize the error message stack.';
665: Pa_Debug.G_Path := ' ';
666: End If;
667:
668: Pa_Debug.G_Stage := 'Entering Freeze_Working_Version().';
669: Pa_Debug.TrackPath('ADD','Freeze_Working_Version');
670:
671: --Initialize the message stack if not initialized
672: Pa_Debug.G_Stage := 'Check if need to initialize the error message stack.';
673: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
668: Pa_Debug.G_Stage := 'Entering Freeze_Working_Version().';
669: Pa_Debug.TrackPath('ADD','Freeze_Working_Version');
670:
671: --Initialize the message stack if not initialized
672: Pa_Debug.G_Stage := 'Check if need to initialize the error message stack.';
673: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
674:
675: Pa_Debug.G_Stage := 'Initialize the error message stack by calling Fnd_Msg_Pub.Initialize().';
676: Fnd_Msg_Pub.Initialize;
671: --Initialize the message stack if not initialized
672: Pa_Debug.G_Stage := 'Check if need to initialize the error message stack.';
673: If Fnd_Api.To_Boolean(nvl(P_Init_Msg_List,Fnd_Api.G_True)) Then
674:
675: Pa_Debug.G_Stage := 'Initialize the error message stack by calling Fnd_Msg_Pub.Initialize().';
676: Fnd_Msg_Pub.Initialize;
677:
678: End If;
679:
676: Fnd_Msg_Pub.Initialize;
677:
678: End If;
679:
680: Pa_Debug.G_Stage := 'Initialize error handling variables.';
681: X_Msg_Count := 0;
682: X_Error_Msg_Data := Null;
683: X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
684:
682: X_Error_Msg_Data := Null;
683: X_Return_Status := Fnd_Api.G_Ret_Sts_Success;
684:
685:
686: Pa_Debug.G_Stage := 'Check if the version record is locked.';
687: Open c_record_ver_no;
688: Fetch c_record_ver_no Into recinfo;
689:
690: If (c_Record_Ver_No%NotFound) Then
692: End If;
693:
694: Close c_record_ver_no;
695:
696: Pa_Debug.G_Stage := 'Check if Rbs Version record_version_number matches.';
697: IF RecInfo.Record_Version_Number = P_Rbs_Version_Record_Ver_Num Then
698:
699: Null;
700:
699: Null;
700:
701: Else
702:
703: Pa_Debug.G_Stage := 'Rbs Version record_version_number does not match. Add error to message stack.';
704: x_return_status := Fnd_Api.G_Ret_Sts_Error;
705:
706: Pa_Utils.Add_Message(
707: P_App_Short_Name => 'FND', /* Bug 3819654: Changed short name from PA to FND */
730: Raise l_error;
731:
732: END IF;
733:
734: Pa_Debug.G_Stage := 'Get the Version_Start_Date and Rbs_Header_Id of working version.';
735: Select
736: Version_Start_Date,
737: Rbs_Header_Id
738: Into
753: -- Pa_Rbs_Headers_b
754: --Where
755: -- Rbs_Header_Id=l_Rbs_Header_Id;
756:
757: Pa_Debug.G_Stage:= 'Getting version id of the latest freezed version';
758: Open GetLatestFrozenRbsVersionId(l_Rbs_Header_Id);
759: Fetch GetLatestFrozenRbsVersionId Into l_latest_freezed_version_id;
760: Close GetLatestFrozenRbsVersionId;
761:
761:
762: --If either resource type id or resource source id is different for each element of working version compared to latest,
763: --freezed version,give them new element identifiers.
764:
765: Pa_Debug.G_Stage:= 'Updating element identifiers of the rbs elements for the working version which do not match latest freeze.';
766: -- Bug 3635614 changed the update statement by removing the start with and connect by prior clause and used where clause instead
767: Update pa_rbs_elements
768: Set
769: Element_Identifier = Pa_Rbs_Element_Identifier_S.NextVal
793:
794: IF PA_RBS_HEADER_PVT.Validate_Rbs_For_Allocations(p_rbs_id=>l_Rbs_Header_Id)='N' Then --When RBS has no rules as its element
795: --If l_use_for_alloc_flag='Y' Then
796:
797: Pa_Debug.G_Stage:= 'Copying All Elements With user_created_Flag = N';
798:
799: Pa_Debug.G_Stage:= 'Delete All Records From Pa_Rbs_Elements_Temp';
800: Begin
801:
795: --If l_use_for_alloc_flag='Y' Then
796:
797: Pa_Debug.G_Stage:= 'Copying All Elements With user_created_Flag = N';
798:
799: Pa_Debug.G_Stage:= 'Delete All Records From Pa_Rbs_Elements_Temp';
800: Begin
801:
802: Delete
803: From Pa_Rbs_Elements_Temp;
807: null;
808:
809: End;
810:
811: Pa_Debug.G_Stage:= 'Insert Pa_Rbs_Elements_Temp table with new element_ids';
812:
813: Insert Into Pa_Rbs_Elements_Temp(
814: New_Element_Id,
815: Old_Element_Id,
834: Pa_Rbs_Elements_Temp Tmp2
835: Where
836: Tmp1.Old_Parent_Element_Id = Tmp2.Old_Element_Id);
837:
838: Pa_Debug.G_Stage:= 'Insert all records with user_created_flag=N with new element ids updated with new parent element ids';
839:
840: /*Bug 4377886 : Included explicitly the column names in the INSERT statement
841: to remove the GSCC Warning File.Sql.33 */
842: Insert Into pa_rbs_elements
927: Tmp.Old_Element_Id=Ele.Rbs_Element_Id;
928:
929: End IF; --End of changes made for bug 3659078. modified for bug 3703364
930:
931: Pa_Debug.G_Stage := 'Mark the working version as frozen.';
932: Update Pa_Rbs_Versions_B
933: Set
934: Status_code = 'FROZEN'
935: Where
940: Fetch c_GetVersionDates Into l_Ver_Dates_Rec;
941: Close c_GetVersionDates;
942:
943:
944: Pa_Debug.G_Stage := 'Set the version end date of latest freezed version to 1 minus start date of version being freezed,';
945: Pa_Debug.G_Stage := 'if they are not equal';
946:
947: Pa_Debug.G_Stage := 'Set the version end date of latest freezed version to start date of version being freezed,';
948: Pa_Debug.G_Stage := 'if they are equal';
941: Close c_GetVersionDates;
942:
943:
944: Pa_Debug.G_Stage := 'Set the version end date of latest freezed version to 1 minus start date of version being freezed,';
945: Pa_Debug.G_Stage := 'if they are not equal';
946:
947: Pa_Debug.G_Stage := 'Set the version end date of latest freezed version to start date of version being freezed,';
948: Pa_Debug.G_Stage := 'if they are equal';
949:
943:
944: Pa_Debug.G_Stage := 'Set the version end date of latest freezed version to 1 minus start date of version being freezed,';
945: Pa_Debug.G_Stage := 'if they are not equal';
946:
947: Pa_Debug.G_Stage := 'Set the version end date of latest freezed version to start date of version being freezed,';
948: Pa_Debug.G_Stage := 'if they are equal';
949:
950: If ((l_version_start_date-1)<(l_ver_dates_rec.Version_start_date)) Then
951:
944: Pa_Debug.G_Stage := 'Set the version end date of latest freezed version to 1 minus start date of version being freezed,';
945: Pa_Debug.G_Stage := 'if they are not equal';
946:
947: Pa_Debug.G_Stage := 'Set the version end date of latest freezed version to start date of version being freezed,';
948: Pa_Debug.G_Stage := 'if they are equal';
949:
950: If ((l_version_start_date-1)<(l_ver_dates_rec.Version_start_date)) Then
951:
952: l_end_date := l_version_start_date;
1017: x_return_status => x_return_status,
1018: x_error_code => x_error_msg_data);
1019:
1020: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1021: pa_debug.G_Stage := 'Error in API PA_ALLOC_UTILS.ASSOCIATE_RBS_TO_ALLOC_RULE';
1022: Raise l_error;
1023: END IF;
1024:
1025: END IF; /* End of Bug 3987478 changes */
1023: END IF;
1024:
1025: END IF; /* End of Bug 3987478 changes */
1026:
1027: Pa_Debug.G_Stage := 'Check if we have a error message populated.';
1028: If X_Error_Msg_Data Is Not Null Then
1029:
1030: Pa_Debug.G_Stage := 'We have a error message populated. Raise error.';
1031: Raise l_error;
1026:
1027: Pa_Debug.G_Stage := 'Check if we have a error message populated.';
1028: If X_Error_Msg_Data Is Not Null Then
1029:
1030: Pa_Debug.G_Stage := 'We have a error message populated. Raise error.';
1031: Raise l_error;
1032:
1033: Else
1034:
1031: Raise l_error;
1032:
1033: Else
1034:
1035: Pa_Debug.G_Stage := 'Prepare to call Pji_FM_Xbs_Accum_Maint.Rbs_Push() procedure.';
1036: l_Old_Rbs_Version_Id := l_latest_freezed_version_id;
1037: l_New_Rbs_Version_Id := P_Rbs_Version_Id;
1038:
1039: Pa_Debug.G_Stage := 'Call Pji_FM_Xbs_Accum_Maint.Rbs_Push() procedure.';
1035: Pa_Debug.G_Stage := 'Prepare to call Pji_FM_Xbs_Accum_Maint.Rbs_Push() procedure.';
1036: l_Old_Rbs_Version_Id := l_latest_freezed_version_id;
1037: l_New_Rbs_Version_Id := P_Rbs_Version_Id;
1038:
1039: Pa_Debug.G_Stage := 'Call Pji_FM_Xbs_Accum_Maint.Rbs_Push() procedure.';
1040: Pji_FM_Xbs_Accum_Maint.Rbs_Push(
1041: P_Old_Rbs_Version_Id => l_Old_Rbs_Version_Id,
1042: P_New_Rbs_Version_Id => l_New_Rbs_Version_Id,
1043: P_Project_Id => l_Project_Id,
1047: End If;
1048:
1049: --For Bug 3678165
1050: If X_Error_Msg_Data Is Not Null Then
1051: Pa_Debug.G_Stage := 'We have a error message populated. Raise error.';
1052: Raise l_error;
1053:
1054: Else
1055:
1052: Raise l_error;
1053:
1054: Else
1055:
1056: Pa_Debug.G_Stage := 'Prepare to call pa_rbs_mapping.create_mapping_rules() procedure.';
1057: Pa_Rbs_Mapping.Create_Mapping_Rules(
1058: P_Rbs_Version_Id => P_Rbs_Version_Id,
1059: X_Return_Status => X_Return_Status,
1060: X_Msg_Count => X_Msg_Count,
1062: End If;
1063:
1064: l_Api_Version_Number := 1;
1065:
1066: Pa_Debug.G_Stage := 'Create a copy of the version being freezed which will be the working version for this header.';
1067: Pa_Rbs_Versions_Pub.Create_Working_Version(
1068: P_Commit => Fnd_Api.G_False,
1069: P_Init_Msg_List => Fnd_Api.G_False,
1070: P_Api_Version_Number => l_Api_Version_Number,
1075: X_Return_Status => X_Return_Status,
1076: X_Msg_Count => X_Msg_Count,
1077: X_Error_Msg_Data => X_Error_Msg_Data);
1078:
1079: Pa_Debug.G_Stage := 'Check if Pa_Rbs_Versions_Pub.Create_Working_Version() procedure return error.';
1080: IF X_Error_Msg_Data Is Not Null Then
1081:
1082: Pa_Debug.G_Stage := 'Check if Pa_Rbs_Versions_Pub.Create_Working_Version() procedure return error.';
1083: Raise l_error;
1078:
1079: Pa_Debug.G_Stage := 'Check if Pa_Rbs_Versions_Pub.Create_Working_Version() procedure return error.';
1080: IF X_Error_Msg_Data Is Not Null Then
1081:
1082: Pa_Debug.G_Stage := 'Check if Pa_Rbs_Versions_Pub.Create_Working_Version() procedure return error.';
1083: Raise l_error;
1084:
1085: END IF;
1086:
1083: Raise l_error;
1084:
1085: END IF;
1086:
1087: Pa_Debug.G_Stage := 'Check if need to do commit.';
1088: If Fnd_Api.To_Boolean(Nvl(P_Commit,Fnd_Api.G_False)) Then
1089:
1090: Pa_Debug.G_Stage := 'Commit changes to the db.';
1091: Commit;
1086:
1087: Pa_Debug.G_Stage := 'Check if need to do commit.';
1088: If Fnd_Api.To_Boolean(Nvl(P_Commit,Fnd_Api.G_False)) Then
1089:
1090: Pa_Debug.G_Stage := 'Commit changes to the db.';
1091: Commit;
1092:
1093: End If;
1094:
1091: Commit;
1092:
1093: End If;
1094:
1095: Pa_Debug.G_Stage := 'Leaving Freeze_Working_Version() procedure.';
1096: Pa_Debug.TrackPath('STRIP','Freeze_Working_Version');
1097:
1098: Exception
1099: When l_Error Then
1092:
1093: End If;
1094:
1095: Pa_Debug.G_Stage := 'Leaving Freeze_Working_Version() procedure.';
1096: Pa_Debug.TrackPath('STRIP','Freeze_Working_Version');
1097:
1098: Exception
1099: When l_Error Then
1100: X_Return_Status := 'E';
1102:
1103: When Others Then
1104: X_Return_Status := 'E';
1105: X_Msg_Count := 1;
1106: X_Error_Msg_Data := Pa_Rbs_Versions_Pub.G_Pkg_Name || ':::' || Pa_Debug.G_Path || '::' || Pa_Debug.G_Stage ||
1107: ':' || SqlErrm;
1108: If P_Init_Debugging_Flag = 'Y' Then
1109: Rollback;
1110: Else