7: g_no constant number := 2;
8:
9: PROCEDURE AssignResource(
10: p_api_version IN NUMBER,
11: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
12: p_commit IN VARCHAR2 := FND_API.G_FALSE,
13: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
14: x_return_status IN OUT NOCOPY VARCHAR2,
15: x_msg_count IN OUT NOCOPY NUMBER,
8:
9: PROCEDURE AssignResource(
10: p_api_version IN NUMBER,
11: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
12: p_commit IN VARCHAR2 := FND_API.G_FALSE,
13: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
14: x_return_status IN OUT NOCOPY VARCHAR2,
15: x_msg_count IN OUT NOCOPY NUMBER,
16: x_msg_data IN OUT NOCOPY VARCHAR2,
9: PROCEDURE AssignResource(
10: p_api_version IN NUMBER,
11: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
12: p_commit IN VARCHAR2 := FND_API.G_FALSE,
13: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
14: x_return_status IN OUT NOCOPY VARCHAR2,
15: x_msg_count IN OUT NOCOPY NUMBER,
16: x_msg_data IN OUT NOCOPY VARCHAR2,
17: p_resource_rec IN RESOURCE_REC_TYPE := G_MISS_RESOURCE_REC,
85: and bd.department_id = bos.department_id;
86:
87: BEGIN
88: -- Standard call to check for call compatibility.
89: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
90: G_PKG_NAME) THEN
91: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
92: END IF;
93: -- Initialize message list if p_init_msg_list is set to TRUE.
87: BEGIN
88: -- Standard call to check for call compatibility.
89: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
90: G_PKG_NAME) THEN
91: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
92: END IF;
93: -- Initialize message list if p_init_msg_list is set to TRUE.
94: IF FND_API.to_Boolean(p_init_msg_list) THEN
95: FND_MSG_PUB.initialize;
90: G_PKG_NAME) THEN
91: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
92: END IF;
93: -- Initialize message list if p_init_msg_list is set to TRUE.
94: IF FND_API.to_Boolean(p_init_msg_list) THEN
95: FND_MSG_PUB.initialize;
96: END IF;
97: -- Initialize API return status to success
98: x_return_status := FND_API.G_RET_STS_SUCCESS;
94: IF FND_API.to_Boolean(p_init_msg_list) THEN
95: FND_MSG_PUB.initialize;
96: END IF;
97: -- Initialize API return status to success
98: x_return_status := FND_API.G_RET_STS_SUCCESS;
99:
100: -- API body
101: l_resource_rec := p_resource_rec;
102:
100: -- API body
101: l_resource_rec := p_resource_rec;
102:
103: -- get routing info
104: If nvl(l_resource_rec.routing_sequence_id, FND_API.G_MISS_NUM) <>
105: FND_API.G_MISS_NUM then
106: For l_assy_rec in l_assy_csr(
107: P_RtgSeqId => l_resource_rec.routing_sequence_id) loop
108: l_resource_rec.assembly_item_id := l_assy_rec.assembly_item_id;
101: l_resource_rec := p_resource_rec;
102:
103: -- get routing info
104: If nvl(l_resource_rec.routing_sequence_id, FND_API.G_MISS_NUM) <>
105: FND_API.G_MISS_NUM then
106: For l_assy_rec in l_assy_csr(
107: P_RtgSeqId => l_resource_rec.routing_sequence_id) loop
108: l_resource_rec.assembly_item_id := l_assy_rec.assembly_item_id;
109: l_resource_rec.organization_id := l_assy_rec.organization_id;
113: End if; -- check routing
114:
115: -- set organization id
116:
117: If nvl(l_resource_rec.organization_code, FND_API.G_MISS_CHAR) <>
118: FND_API.G_MISS_CHAR then
119: l_resource_rec.organization_id := null;
120: For l_parameter_rec in l_parameter_csr(
121: P_Code => l_resource_rec.organization_code) loop
114:
115: -- set organization id
116:
117: If nvl(l_resource_rec.organization_code, FND_API.G_MISS_CHAR) <>
118: FND_API.G_MISS_CHAR then
119: l_resource_rec.organization_id := null;
120: For l_parameter_rec in l_parameter_csr(
121: P_Code => l_resource_rec.organization_code) loop
122: l_resource_rec.organization_id := l_parameter_rec.organization_id;
123: End loop;
124: If l_resource_rec.organization_id is null then
125: Fnd_Message.Set_Name('BOM', 'BOM_ORG_ID_MISSING');
126: FND_MSG_PUB.Add;
127: raise FND_API.G_EXC_ERROR;
128: End if; -- invalid org
129: End if; -- organization code
130:
131: -- get assembly item number
128: End if; -- invalid org
129: End if; -- organization code
130:
131: -- get assembly item number
132: If nvl(l_resource_rec.Assembly_Item_Number, FND_API.G_MISS_CHAR) <>
133: FND_API.G_MISS_CHAR then
134: l_ret_code := INVPUOPI.mtl_pr_trans_prod_item(
135: org_id => l_resource_rec.organization_id,
136: item_number_in => l_resource_rec.assembly_item_number,
129: End if; -- organization code
130:
131: -- get assembly item number
132: If nvl(l_resource_rec.Assembly_Item_Number, FND_API.G_MISS_CHAR) <>
133: FND_API.G_MISS_CHAR then
134: l_ret_code := INVPUOPI.mtl_pr_trans_prod_item(
135: org_id => l_resource_rec.organization_id,
136: item_number_in => l_resource_rec.assembly_item_number,
137: item_id_out => l_resource_rec.assembly_item_id,
138: err_text => l_err_text);
139: if l_ret_code <> 0 then
140: Fnd_Message.Set_Name('BOM', 'BOM_ASSY_ITEM_MISSING');
141: FND_MSG_PUB.Add;
142: raise FND_API.G_EXC_ERROR;
143: end if; -- parse failed
144: end if; -- assembly item number
145:
146: -- null routing sequence id
143: end if; -- parse failed
144: end if; -- assembly item number
145:
146: -- null routing sequence id
147: If nvl(l_resource_rec.routing_sequence_id, FND_API.G_MISS_NUM) =
148: FND_API.G_MISS_NUM then
149: If l_resource_rec.alternate_routing_designator = FND_API.G_MISS_CHAR then
150: l_resource_rec.alternate_routing_designator := null;
151: End if;
144: end if; -- assembly item number
145:
146: -- null routing sequence id
147: If nvl(l_resource_rec.routing_sequence_id, FND_API.G_MISS_NUM) =
148: FND_API.G_MISS_NUM then
149: If l_resource_rec.alternate_routing_designator = FND_API.G_MISS_CHAR then
150: l_resource_rec.alternate_routing_designator := null;
151: End if;
152: For l_routing_rec in l_routing_csr(
145:
146: -- null routing sequence id
147: If nvl(l_resource_rec.routing_sequence_id, FND_API.G_MISS_NUM) =
148: FND_API.G_MISS_NUM then
149: If l_resource_rec.alternate_routing_designator = FND_API.G_MISS_CHAR then
150: l_resource_rec.alternate_routing_designator := null;
151: End if;
152: For l_routing_rec in l_routing_csr(
153: P_AssyItemId => l_resource_rec.assembly_item_id,
158: End loop;
159: End if; -- get routing sequence id
160:
161: -- Can only be associated with non-referenced operations of type Event
162: If nvl(l_resource_rec.operation_sequence_id, Fnd_Api.G_Miss_Num) <>
163: Fnd_Api.G_Miss_Num then
164: l_EventFound := FALSE;
165: For l_event_rec in l_event_csr(
166: P_OpSeqId => l_resource_rec.operation_sequence_id) loop
159: End if; -- get routing sequence id
160:
161: -- Can only be associated with non-referenced operations of type Event
162: If nvl(l_resource_rec.operation_sequence_id, Fnd_Api.G_Miss_Num) <>
163: Fnd_Api.G_Miss_Num then
164: l_EventFound := FALSE;
165: For l_event_rec in l_event_csr(
166: P_OpSeqId => l_resource_rec.operation_sequence_id) loop
167: l_EventFound := TRUE;
168: If l_event_rec.reference_flag = g_yes or
169: l_event_rec.operation_type <> g_event then
170: Fnd_Message.Set_Name('BOM', 'BOM_EVENT_RESOURCE');
171: FND_MSG_PUB.Add;
172: Raise FND_API.G_EXC_ERROR;
173: End if;
174: End loop;
175: If not l_EventFound then
176: Fnd_Message.Set_Name('BOM', 'BOM_OP_SEQ_INVALID');
174: End loop;
175: If not l_EventFound then
176: Fnd_Message.Set_Name('BOM', 'BOM_OP_SEQ_INVALID');
177: FND_MSG_PUB.Add;
178: Raise FND_API.G_EXC_ERROR;
179: End if; -- invalid op seq id
180: End if; -- non-referenced event?
181:
182: -- Get operation sequence id
179: End if; -- invalid op seq id
180: End if; -- non-referenced event?
181:
182: -- Get operation sequence id
183: If nvl(l_resource_rec.operation_sequence_id, Fnd_Api.G_Miss_Num) =
184: Fnd_Api.G_Miss_Num then
185: For l_operation_rec in l_oper_csr(
186: P_RtgSeqId => l_resource_rec.routing_sequence_id,
187: P_SeqNum => l_resource_rec.operation_seq_num,
180: End if; -- non-referenced event?
181:
182: -- Get operation sequence id
183: If nvl(l_resource_rec.operation_sequence_id, Fnd_Api.G_Miss_Num) =
184: Fnd_Api.G_Miss_Num then
185: For l_operation_rec in l_oper_csr(
186: P_RtgSeqId => l_resource_rec.routing_sequence_id,
187: P_SeqNum => l_resource_rec.operation_seq_num,
188: P_EffDate => l_resource_rec.effectivity_date) loop
189: l_resource_rec.operation_sequence_id :=
190: l_operation_rec.operation_sequence_id;
191: End loop;
192: End if; -- get operation
193: If nvl(l_resource_rec.operation_sequence_id, Fnd_Api.G_Miss_Num) =
194: Fnd_Api.G_Miss_Num then
195: -- operation not found (must also be non-referenced event)
196: Fnd_Message.Set_Name('BOM', 'BOM_OP_SEQ_INVALID');
197: FND_MSG_PUB.Add;
190: l_operation_rec.operation_sequence_id;
191: End loop;
192: End if; -- get operation
193: If nvl(l_resource_rec.operation_sequence_id, Fnd_Api.G_Miss_Num) =
194: Fnd_Api.G_Miss_Num then
195: -- operation not found (must also be non-referenced event)
196: Fnd_Message.Set_Name('BOM', 'BOM_OP_SEQ_INVALID');
197: FND_MSG_PUB.Add;
198: Raise FND_API.G_EXC_ERROR;
194: Fnd_Api.G_Miss_Num then
195: -- operation not found (must also be non-referenced event)
196: Fnd_Message.Set_Name('BOM', 'BOM_OP_SEQ_INVALID');
197: FND_MSG_PUB.Add;
198: Raise FND_API.G_EXC_ERROR;
199: End if;
200:
201: -- Get resource_id
202: If nvl(l_resource_rec.resource_code, Fnd_Api.G_Miss_Char) <>
198: Raise FND_API.G_EXC_ERROR;
199: End if;
200:
201: -- Get resource_id
202: If nvl(l_resource_rec.resource_code, Fnd_Api.G_Miss_Char) <>
203: Fnd_Api.G_Miss_Char then
204: l_resource_rec.resource_id := null;
205: For l_SetUpResource_rec in l_NonOpResource_csr(
206: P_Code => l_resource_rec.resource_code,
199: End if;
200:
201: -- Get resource_id
202: If nvl(l_resource_rec.resource_code, Fnd_Api.G_Miss_Char) <>
203: Fnd_Api.G_Miss_Char then
204: l_resource_rec.resource_id := null;
205: For l_SetUpResource_rec in l_NonOpResource_csr(
206: P_Code => l_resource_rec.resource_code,
207: P_OrgId =>l_resource_rec.organization_id) loop
209: End loop;
210: If l_resource_rec.resource_id is null then
211: Fnd_Message.Set_Name('BOM', 'BOM_RESOURCE_ID_MISSING');
212: FND_MSG_PUB.Add;
213: Raise FND_API.G_EXC_ERROR;
214: End if; -- invalid resource
215: End if; -- get resource id
216:
217: -- Get activity_id
214: End if; -- invalid resource
215: End if; -- get resource id
216:
217: -- Get activity_id
218: If nvl(l_resource_rec.activity, Fnd_Api.G_Miss_Char) <>
219: Fnd_Api.G_Miss_Char then
220: l_resource_rec.activity_id := null;
221: For l_activity_rec in l_Activity_csr(
222: P_Code => l_resource_rec.activity,
215: End if; -- get resource id
216:
217: -- Get activity_id
218: If nvl(l_resource_rec.activity, Fnd_Api.G_Miss_Char) <>
219: Fnd_Api.G_Miss_Char then
220: l_resource_rec.activity_id := null;
221: For l_activity_rec in l_Activity_csr(
222: P_Code => l_resource_rec.activity,
223: P_OrgId => l_resource_rec.organization_id) loop
225: End loop;
226: If l_resource_rec.activity_id is null then
227: Fnd_Message.Set_Name('BOM', 'BOM_ACTIVITY_INVALID');
228: FND_MSG_PUB.Add;
229: Raise FND_API.G_EXC_ERROR;
230: End if; -- invalid activity
231: End if; -- get activity id
232:
233: -- usage rates
232:
233: -- usage rates
234: /* Bug 1349028 */
235: If (l_resource_rec.usage_rate_or_amount_inverse is null) or
236: ((l_resource_rec.usage_rate_or_amount_inverse = Fnd_Api.G_Miss_Num) and
237: (l_resource_rec.usage_rate_or_amount <> Fnd_Api.G_Miss_Num)) then
238: If l_resource_rec.usage_rate_or_amount = 0 then
239: l_resource_rec.usage_rate_or_amount_inverse := 0;
240: Else
233: -- usage rates
234: /* Bug 1349028 */
235: If (l_resource_rec.usage_rate_or_amount_inverse is null) or
236: ((l_resource_rec.usage_rate_or_amount_inverse = Fnd_Api.G_Miss_Num) and
237: (l_resource_rec.usage_rate_or_amount <> Fnd_Api.G_Miss_Num)) then
238: If l_resource_rec.usage_rate_or_amount = 0 then
239: l_resource_rec.usage_rate_or_amount_inverse := 0;
240: Else
241: -- Bug 1533214
245: End if;
246: End if; -- null inverse
247:
248: If (l_resource_rec.usage_rate_or_amount is null) or
249: ((l_resource_rec.usage_rate_or_amount = Fnd_Api.G_Miss_Num) and
250: (l_resource_rec.usage_rate_or_amount_inverse <> Fnd_Api.G_Miss_Num)) then
251: If l_resource_rec.usage_rate_or_amount_inverse = 0 then
252: l_resource_rec.usage_rate_or_amount := 0;
253: Else
246: End if; -- null inverse
247:
248: If (l_resource_rec.usage_rate_or_amount is null) or
249: ((l_resource_rec.usage_rate_or_amount = Fnd_Api.G_Miss_Num) and
250: (l_resource_rec.usage_rate_or_amount_inverse <> Fnd_Api.G_Miss_Num)) then
251: If l_resource_rec.usage_rate_or_amount_inverse = 0 then
252: l_resource_rec.usage_rate_or_amount := 0;
253: Else
254: -- Bug 1533214
284: p_count => x_msg_count,
285: p_data => x_msg_data
286: );
287: EXCEPTION
288: WHEN FND_API.G_EXC_ERROR THEN
289: x_return_status := FND_API.G_RET_STS_ERROR;
290: FND_MSG_PUB.Count_And_Get(
291: p_count => x_msg_count,
292: p_data => x_msg_data
285: p_data => x_msg_data
286: );
287: EXCEPTION
288: WHEN FND_API.G_EXC_ERROR THEN
289: x_return_status := FND_API.G_RET_STS_ERROR;
290: FND_MSG_PUB.Count_And_Get(
291: p_count => x_msg_count,
292: p_data => x_msg_data
293: );
290: FND_MSG_PUB.Count_And_Get(
291: p_count => x_msg_count,
292: p_data => x_msg_data
293: );
294: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
295: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
296: FND_MSG_PUB.Count_And_Get(
297: p_count => x_msg_count,
298: p_data => x_msg_data
291: p_count => x_msg_count,
292: p_data => x_msg_data
293: );
294: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
295: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
296: FND_MSG_PUB.Count_And_Get(
297: p_count => x_msg_count,
298: p_data => x_msg_data
299: );
297: p_count => x_msg_count,
298: p_data => x_msg_data
299: );
300: WHEN OTHERS THEN
301: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
302: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
303: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
304: END IF;
305: FND_MSG_PUB.Count_And_Get(
309: END AssignResource;
310:
311: PROCEDURE ValidateResource(
312: p_api_version IN NUMBER,
313: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
314: p_commit IN VARCHAR2 := FND_API.G_FALSE,
315: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
316: x_return_status IN OUT NOCOPY VARCHAR2,
317: x_msg_count IN OUT NOCOPY NUMBER,
310:
311: PROCEDURE ValidateResource(
312: p_api_version IN NUMBER,
313: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
314: p_commit IN VARCHAR2 := FND_API.G_FALSE,
315: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
316: x_return_status IN OUT NOCOPY VARCHAR2,
317: x_msg_count IN OUT NOCOPY NUMBER,
318: x_msg_data IN OUT NOCOPY VARCHAR2,
311: PROCEDURE ValidateResource(
312: p_api_version IN NUMBER,
313: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
314: p_commit IN VARCHAR2 := FND_API.G_FALSE,
315: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
316: x_return_status IN OUT NOCOPY VARCHAR2,
317: x_msg_count IN OUT NOCOPY NUMBER,
318: x_msg_data IN OUT NOCOPY VARCHAR2,
319: p_resource_rec IN RESOURCE_REC_TYPE := G_MISS_RESOURCE_REC,
450: and bd.department_id = bos.department_id
451: and bd.location_id is not null);
452: BEGIN
453: -- Standard call to check for call compatibility.
454: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
455: G_PKG_NAME) THEN
456: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
457: END IF;
458: -- Initialize message list if p_init_msg_list is set to TRUE.
452: BEGIN
453: -- Standard call to check for call compatibility.
454: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
455: G_PKG_NAME) THEN
456: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
457: END IF;
458: -- Initialize message list if p_init_msg_list is set to TRUE.
459: IF FND_API.to_Boolean(p_init_msg_list) THEN
460: FND_MSG_PUB.initialize;
455: G_PKG_NAME) THEN
456: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
457: END IF;
458: -- Initialize message list if p_init_msg_list is set to TRUE.
459: IF FND_API.to_Boolean(p_init_msg_list) THEN
460: FND_MSG_PUB.initialize;
461: END IF;
462: -- Initialize API return status to success
463: x_return_status := FND_API.G_RET_STS_SUCCESS;
459: IF FND_API.to_Boolean(p_init_msg_list) THEN
460: FND_MSG_PUB.initialize;
461: END IF;
462: -- Initialize API return status to success
463: x_return_status := FND_API.G_RET_STS_SUCCESS;
464:
465: -- API body
466: l_resource_rec := p_resource_rec;
467:
464:
465: -- API body
466: l_resource_rec := p_resource_rec;
467:
468: If p_validation_level = FND_API.G_VALID_LEVEL_FULL then
469: AssignResource(
470: p_api_version => 1,
471: p_init_msg_list => p_init_msg_list,
472: p_commit => p_commit,
469: AssignResource(
470: p_api_version => 1,
471: p_init_msg_list => p_init_msg_list,
472: p_commit => p_commit,
473: p_validation_level => FND_API.G_VALID_LEVEL_FULL,
474: x_return_status => l_return_status,
475: x_msg_count => l_msg_count,
476: x_msg_data => l_msg_data,
477: p_resource_rec => l_resource_rec,
475: x_msg_count => l_msg_count,
476: x_msg_data => l_msg_data,
477: p_resource_rec => l_resource_rec,
478: x_resource_rec => l_resource_rec);
479: If l_return_status = FND_API.G_RET_STS_ERROR then
480: Raise FND_API.G_EXC_ERROR;
481: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
482: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
483: End if; -- error
476: x_msg_data => l_msg_data,
477: p_resource_rec => l_resource_rec,
478: x_resource_rec => l_resource_rec);
479: If l_return_status = FND_API.G_RET_STS_ERROR then
480: Raise FND_API.G_EXC_ERROR;
481: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
482: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
483: End if; -- error
484: End if; -- assign values
477: p_resource_rec => l_resource_rec,
478: x_resource_rec => l_resource_rec);
479: If l_return_status = FND_API.G_RET_STS_ERROR then
480: Raise FND_API.G_EXC_ERROR;
481: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
482: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
483: End if; -- error
484: End if; -- assign values
485:
478: x_resource_rec => l_resource_rec);
479: If l_return_status = FND_API.G_RET_STS_ERROR then
480: Raise FND_API.G_EXC_ERROR;
481: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
482: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
483: End if; -- error
484: End if; -- assign values
485:
486: -- verify for existence of operation seq id
487: For l_operation_rec in l_operation_csr(
488: P_OpSeqId => l_resource_rec.operation_sequence_id) loop
489: Fnd_Message.Set_Name('BOM', 'BOM_OP_SEQ_INVALID');
490: FND_MSG_PUB.Add;
491: Raise FND_API.G_EXC_ERROR;
492: End loop;
493:
494: -- check for null resource seq num
495: If l_resource_rec.new_resource_seq_num is null then
494: -- check for null resource seq num
495: If l_resource_rec.new_resource_seq_num is null then
496: Fnd_Message.Set_Name('BOM', 'BOM_NULL_RESOURCE_SEQ_NUM');
497: FND_MSG_PUB.Add;
498: Raise FND_API.G_EXC_ERROR;
499: End if;
500:
501: -- check for duplicate resource seq num/operation sequence id
502: For l_DupResource_rec in l_DupResource_csr(
504: P_OldSeqNum => l_resource_rec.resource_seq_num,
505: P_NewSeqNum => l_resource_rec.new_resource_seq_num) loop
506: Fnd_Message.Set_Name('BOM', 'BOM_DUPLICATE_RES_NUM');
507: FND_MSG_PUB.Add;
508: Raise FND_API.G_EXC_ERROR;
509: End loop;
510:
511: -- validate resource exists and is enabled and belongs to dept
512: For l_InvalidResource_rec in l_resource_csr(
513: P_OpSeqId => l_resource_rec.operation_sequence_id,
514: P_ResourceId => l_resource_rec.resource_id) loop
515: Fnd_Message.Set_Name('BOM', 'BOM_DEPT_RES_INVALID');
516: FND_MSG_PUB.Add;
517: Raise FND_API.G_EXC_ERROR;
518: End loop;
519:
520: -- Check if resource is available 24 hours
521:
536: P_ActivityId => l_resource_rec.activity_id,
537: P_OpSeqId => l_resource_rec.operation_sequence_id) loop
538: Fnd_Message.Set_Name('BOM', 'BOM_ACTIVITY_ID_INVALID');
539: FND_MSG_PUB.Add;
540: Raise FND_API.G_EXC_ERROR;
541: End loop;
542: End if;
543:
544: -- get units of measure and uom classes
562: If l_resource_rec.schedule_flag <> g_no then
563: If l_HourUomClass <> l_ResUomClass then
564: Fnd_Message.Set_Name('BOM', 'BOM_OP_RES_SCHED_NO');
565: FND_MSG_PUB.Add;
566: Raise FND_API.G_EXC_ERROR;
567: End if; -- not time based class
568: For l_conversion_rec in l_conversion_csr loop
569: Fnd_Message.Set_Name('BOM', 'BOM_OP_RES_SCHED_NO');
570: FND_MSG_PUB.Add;
567: End if; -- not time based class
568: For l_conversion_rec in l_conversion_csr loop
569: Fnd_Message.Set_Name('BOM', 'BOM_OP_RES_SCHED_NO');
570: FND_MSG_PUB.Add;
571: Raise FND_API.G_EXC_ERROR;
572: End loop;
573: end if; -- schedule flag
574:
575: -- cannot have more than one Next or Prior scheduled resource
581: P_SeqNum => l_resource_rec.resource_seq_num,
582: P_SchedType => l_resource_rec.schedule_flag) loop
583: Fnd_Message.Set_Name('BOM', 'BOM_OP_RES_PRIOR_ERROR');
584: FND_MSG_PUB.Add;
585: Raise FND_API.G_EXC_ERROR;
586: End loop;
587: End if; -- prior
588:
589: If l_resource_rec.schedule_flag = l_Next then
592: P_SeqNum => l_resource_rec.resource_seq_num,
593: P_SchedType => l_resource_rec.schedule_flag) loop
594: Fnd_Message.Set_Name('BOM', 'BOM_OP_RES_NEXT_ERROR');
595: FND_MSG_PUB.Add;
596: Raise FND_API.G_EXC_ERROR;
597: End loop;
598: End if; -- next
599:
600: -- cannot have negative usage rate if one of the following is true:
604: If l_resource_rec.usage_rate_or_amount < 0 then
605: If l_resource_rec.autocharge_type in (3, 4) then
606: Fnd_Message.Set_Name('BOM', 'BOM_NEGATIVE_USAGE_RATE');
607: FND_MSG_PUB.Add;
608: Raise FND_API.G_EXC_ERROR;
609: End if;
610: If l_HourUomClass = l_ResUomClass then
611: Fnd_Message.Set_Name('BOM', 'BOM_NEGATIVE_USAGE_RATE');
612: FND_MSG_PUB.Add;
609: End if;
610: If l_HourUomClass = l_ResUomClass then
611: Fnd_Message.Set_Name('BOM', 'BOM_NEGATIVE_USAGE_RATE');
612: FND_MSG_PUB.Add;
613: Raise FND_API.G_EXC_ERROR;
614: End if;
615: End if; -- negative usage
616:
617: -- assigned units cannot be less than or equal to .00001
617: -- assigned units cannot be less than or equal to .00001
618: If l_resource_rec.assigned_units <= .00001 then
619: Fnd_Message.Set_Name('BOM', 'BOM_ASSIGNED_UNIT_ERROR');
620: FND_MSG_PUB.Add;
621: Raise FND_API.G_EXC_ERROR;
622: End if;
623:
624: -- check if basis type,standard rate flag, schedule flag
625: -- and autocharge type are valid
628: (l_resource_rec.schedule_flag not in (1,2,3,4)) or
629: (l_resource_rec.autocharge_type not in (1,2,3,4)) then
630: Fnd_Message.Set_Name('BOM', 'BOM_OP_RES_LOOKUP_ERROR');
631: FND_MSG_PUB.Add;
632: Raise FND_API.G_EXC_ERROR;
633: End if;
634:
635: -- Only one PO move per operation
636: If l_resource_rec.autocharge_type = l_POMove then
638: P_OpSeqId => l_resource_rec.operation_sequence_id,
639: P_SeqNum => l_resource_rec.resource_seq_num) loop
640: Fnd_Message.Set_Name('BOM', 'BOM_AUTOCHARGE_INVALID');
641: FND_MSG_PUB.Add;
642: Raise FND_API.G_EXC_ERROR;
643: End loop;
644: End if; -- PO Move
645:
646: -- Autocharge cannot be PO Move or PO Receipt if
649: For l_location_rec in l_CheckLocation_csr(
650: P_OpSeqId => l_resource_rec.operation_sequence_id) loop
651: Fnd_Message.Set_Name('BOM','BOM_AUTOCHARGE_INVALID');
652: FND_MSG_PUB.Add;
653: Raise FND_API.G_EXC_ERROR;
654: End loop;
655: End if;
656:
657: -- Check offset percent
657: -- Check offset percent
658: If l_resource_rec.resource_offset_percent not between 0 and 100 then
659: Fnd_Message.Set_Name('BOM', 'BOM_OFFSET_PERCENT_INVALID');
660: FND_MSG_PUB.Add;
661: Raise FND_API.G_EXC_ERROR;
662: End if;
663:
664: -- Bug 2514018 Check Principle Flag
665: If l_resource_rec.principle_flag IS NOT NULL and
663:
664: -- Bug 2514018 Check Principle Flag
665: If l_resource_rec.principle_flag IS NOT NULL and
666: l_resource_rec.principle_flag NOT IN (1,2)
667: and l_resource_rec.principle_flag <> FND_API.G_MISS_NUM then
668: Fnd_Message.Set_Name('BOM', 'BOM_RES_PCLFLAG_INVALID');
669: FND_MSG_PUB.Add;
670: Raise FND_API.G_EXC_ERROR;
671: END IF;
666: l_resource_rec.principle_flag NOT IN (1,2)
667: and l_resource_rec.principle_flag <> FND_API.G_MISS_NUM then
668: Fnd_Message.Set_Name('BOM', 'BOM_RES_PCLFLAG_INVALID');
669: FND_MSG_PUB.Add;
670: Raise FND_API.G_EXC_ERROR;
671: END IF;
672: --Bug 2514018
673:
674: -- Check usage rate and usage rate inverse
678: If round(l_resource_rec.usage_rate_or_amount, 6) <>
679: round((1 / l_resource_rec.usage_rate_or_amount_inverse), 6) then
680: Fnd_Message.Set_Name('BOM', 'BOM_USAGE_RATE_INVALID');
681: FND_MSG_PUB.Add;
682: Raise FND_API.G_EXC_ERROR;
683: End if;
684: Elsif l_resource_rec.usage_rate_or_amount = 0 then
685: If l_resource_rec.usage_rate_or_amount_inverse <> 0 then
686: Fnd_Message.Set_Name('BOM', 'BOM_USAGE_RATE_INVALID');
684: Elsif l_resource_rec.usage_rate_or_amount = 0 then
685: If l_resource_rec.usage_rate_or_amount_inverse <> 0 then
686: Fnd_Message.Set_Name('BOM', 'BOM_USAGE_RATE_INVALID');
687: FND_MSG_PUB.Add;
688: Raise FND_API.G_EXC_ERROR;
689: End if;
690: End if;
691: */
692: -- rate_invalid is 0 when usage_rate is invalid
715: if (rate_invalid = 0)
716: then
717: Fnd_Message.Set_Name('BOM','BOM_USAGE_RATE_INVALID');
718: FND_MSG_PUB.Add;
719: Raise FND_API.G_EXC_ERROR;
720: end if;
721: --
722:
723: x_resource_rec := l_resource_rec;
728: p_count => x_msg_count,
729: p_data => x_msg_data
730: );
731: EXCEPTION
732: WHEN FND_API.G_EXC_ERROR THEN
733: x_return_status := FND_API.G_RET_STS_ERROR;
734: FND_MSG_PUB.Count_And_Get(
735: p_count => x_msg_count,
736: p_data => x_msg_data
729: p_data => x_msg_data
730: );
731: EXCEPTION
732: WHEN FND_API.G_EXC_ERROR THEN
733: x_return_status := FND_API.G_RET_STS_ERROR;
734: FND_MSG_PUB.Count_And_Get(
735: p_count => x_msg_count,
736: p_data => x_msg_data
737: );
734: FND_MSG_PUB.Count_And_Get(
735: p_count => x_msg_count,
736: p_data => x_msg_data
737: );
738: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
739: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
740: FND_MSG_PUB.Count_And_Get(
741: p_count => x_msg_count,
742: p_data => x_msg_data
735: p_count => x_msg_count,
736: p_data => x_msg_data
737: );
738: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
739: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
740: FND_MSG_PUB.Count_And_Get(
741: p_count => x_msg_count,
742: p_data => x_msg_data
743: );
741: p_count => x_msg_count,
742: p_data => x_msg_data
743: );
744: WHEN OTHERS THEN
745: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
746: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
747: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
748: END IF;
749: FND_MSG_PUB.Count_And_Get(
752: );
753: END ValidateResource;
754: PROCEDURE CreateResource(
755: p_api_version IN NUMBER,
756: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
757: p_commit IN VARCHAR2 := FND_API.G_FALSE,
758: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
759: x_return_status IN OUT NOCOPY VARCHAR2,
760: x_msg_count IN OUT NOCOPY NUMBER,
753: END ValidateResource;
754: PROCEDURE CreateResource(
755: p_api_version IN NUMBER,
756: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
757: p_commit IN VARCHAR2 := FND_API.G_FALSE,
758: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
759: x_return_status IN OUT NOCOPY VARCHAR2,
760: x_msg_count IN OUT NOCOPY NUMBER,
761: x_msg_data IN OUT NOCOPY VARCHAR2,
754: PROCEDURE CreateResource(
755: p_api_version IN NUMBER,
756: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
757: p_commit IN VARCHAR2 := FND_API.G_FALSE,
758: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
759: x_return_status IN OUT NOCOPY VARCHAR2,
760: x_msg_count IN OUT NOCOPY NUMBER,
761: x_msg_data IN OUT NOCOPY VARCHAR2,
762: p_resource_rec IN RESOURCE_REC_TYPE := G_MISS_RESOURCE_REC,
777: BEGIN
778: -- Standard Start of API savepoint
779: SAVEPOINT CreateResource_Pvt;
780: -- Standard call to check for call compatibility.
781: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
782: G_PKG_NAME) THEN
783: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
784: END IF;
785: -- Initialize message list if p_init_msg_list is set to TRUE.
779: SAVEPOINT CreateResource_Pvt;
780: -- Standard call to check for call compatibility.
781: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
782: G_PKG_NAME) THEN
783: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
784: END IF;
785: -- Initialize message list if p_init_msg_list is set to TRUE.
786: IF FND_API.to_Boolean(p_init_msg_list) THEN
787: FND_MSG_PUB.initialize;
782: G_PKG_NAME) THEN
783: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
784: END IF;
785: -- Initialize message list if p_init_msg_list is set to TRUE.
786: IF FND_API.to_Boolean(p_init_msg_list) THEN
787: FND_MSG_PUB.initialize;
788: END IF;
789: -- Initialize API return status to success
790: x_return_status := FND_API.G_RET_STS_SUCCESS;
786: IF FND_API.to_Boolean(p_init_msg_list) THEN
787: FND_MSG_PUB.initialize;
788: END IF;
789: -- Initialize API return status to success
790: x_return_status := FND_API.G_RET_STS_SUCCESS;
791:
792: -- API body
793: l_resource_rec := p_resource_rec;
794:
792: -- API body
793: l_resource_rec := p_resource_rec;
794:
795: -- initialize record
796: If l_resource_rec.operation_sequence_id = Fnd_Api.G_Miss_Num then
797: l_resource_rec.operation_sequence_id := null;
798: End if;
799:
800: If nvl(l_resource_rec.new_resource_seq_num, Fnd_Api.G_Miss_Num) =
796: If l_resource_rec.operation_sequence_id = Fnd_Api.G_Miss_Num then
797: l_resource_rec.operation_sequence_id := null;
798: End if;
799:
800: If nvl(l_resource_rec.new_resource_seq_num, Fnd_Api.G_Miss_Num) =
801: Fnd_Api.G_Miss_Num then
802: l_resource_rec.new_resource_seq_num := l_resource_rec.resource_seq_num;
803: End if;
804: l_resource_rec.resource_seq_num := null;
797: l_resource_rec.operation_sequence_id := null;
798: End if;
799:
800: If nvl(l_resource_rec.new_resource_seq_num, Fnd_Api.G_Miss_Num) =
801: Fnd_Api.G_Miss_Num then
802: l_resource_rec.new_resource_seq_num := l_resource_rec.resource_seq_num;
803: End if;
804: l_resource_rec.resource_seq_num := null;
805:
802: l_resource_rec.new_resource_seq_num := l_resource_rec.resource_seq_num;
803: End if;
804: l_resource_rec.resource_seq_num := null;
805:
806: If l_resource_rec.resource_id = Fnd_Api.G_Miss_Num then
807: l_resource_rec.resource_id := null;
808: End if;
809:
810: If l_resource_rec.activity_id = Fnd_Api.G_Miss_Num then
806: If l_resource_rec.resource_id = Fnd_Api.G_Miss_Num then
807: l_resource_rec.resource_id := null;
808: End if;
809:
810: If l_resource_rec.activity_id = Fnd_Api.G_Miss_Num then
811: l_resource_rec.activity_id := null;
812: End if;
813:
814: If nvl(l_resource_rec.standard_rate_flag, Fnd_Api.G_Miss_Num) =
810: If l_resource_rec.activity_id = Fnd_Api.G_Miss_Num then
811: l_resource_rec.activity_id := null;
812: End if;
813:
814: If nvl(l_resource_rec.standard_rate_flag, Fnd_Api.G_Miss_Num) =
815: Fnd_Api.G_Miss_Num then
816: --bug 2117759 standard_rate_flag will be defaulted from res definition
817: l_resource_rec.standard_rate_flag := null;
818: End if;
811: l_resource_rec.activity_id := null;
812: End if;
813:
814: If nvl(l_resource_rec.standard_rate_flag, Fnd_Api.G_Miss_Num) =
815: Fnd_Api.G_Miss_Num then
816: --bug 2117759 standard_rate_flag will be defaulted from res definition
817: l_resource_rec.standard_rate_flag := null;
818: End if;
819:
816: --bug 2117759 standard_rate_flag will be defaulted from res definition
817: l_resource_rec.standard_rate_flag := null;
818: End if;
819:
820: If nvl(l_resource_rec.assigned_units, Fnd_Api.G_Miss_Num) =
821: Fnd_Api.G_Miss_Num then
822: l_resource_rec.assigned_units := 1;
823: End if;
824:
817: l_resource_rec.standard_rate_flag := null;
818: End if;
819:
820: If nvl(l_resource_rec.assigned_units, Fnd_Api.G_Miss_Num) =
821: Fnd_Api.G_Miss_Num then
822: l_resource_rec.assigned_units := 1;
823: End if;
824:
825: If (nvl(l_resource_rec.usage_rate_or_amount, Fnd_Api.G_Miss_Num) =
821: Fnd_Api.G_Miss_Num then
822: l_resource_rec.assigned_units := 1;
823: End if;
824:
825: If (nvl(l_resource_rec.usage_rate_or_amount, Fnd_Api.G_Miss_Num) =
826: Fnd_Api.G_Miss_Num and
827: nvl(l_resource_rec.usage_rate_or_amount_inverse, Fnd_Api.G_Miss_Num) =
828: Fnd_Api.G_Miss_Num) then
829: l_resource_rec.usage_rate_or_amount := 1;
822: l_resource_rec.assigned_units := 1;
823: End if;
824:
825: If (nvl(l_resource_rec.usage_rate_or_amount, Fnd_Api.G_Miss_Num) =
826: Fnd_Api.G_Miss_Num and
827: nvl(l_resource_rec.usage_rate_or_amount_inverse, Fnd_Api.G_Miss_Num) =
828: Fnd_Api.G_Miss_Num) then
829: l_resource_rec.usage_rate_or_amount := 1;
830: l_resource_rec.usage_rate_or_amount_inverse := 1;
823: End if;
824:
825: If (nvl(l_resource_rec.usage_rate_or_amount, Fnd_Api.G_Miss_Num) =
826: Fnd_Api.G_Miss_Num and
827: nvl(l_resource_rec.usage_rate_or_amount_inverse, Fnd_Api.G_Miss_Num) =
828: Fnd_Api.G_Miss_Num) then
829: l_resource_rec.usage_rate_or_amount := 1;
830: l_resource_rec.usage_rate_or_amount_inverse := 1;
831: End if;
824:
825: If (nvl(l_resource_rec.usage_rate_or_amount, Fnd_Api.G_Miss_Num) =
826: Fnd_Api.G_Miss_Num and
827: nvl(l_resource_rec.usage_rate_or_amount_inverse, Fnd_Api.G_Miss_Num) =
828: Fnd_Api.G_Miss_Num) then
829: l_resource_rec.usage_rate_or_amount := 1;
830: l_resource_rec.usage_rate_or_amount_inverse := 1;
831: End if;
832:
829: l_resource_rec.usage_rate_or_amount := 1;
830: l_resource_rec.usage_rate_or_amount_inverse := 1;
831: End if;
832:
833: If nvl(l_resource_rec.basis_type, Fnd_Api.G_Miss_Num) =
834: Fnd_Api.G_Miss_Num then
835: l_resource_rec.basis_type := null;
836: End if;
837:
830: l_resource_rec.usage_rate_or_amount_inverse := 1;
831: End if;
832:
833: If nvl(l_resource_rec.basis_type, Fnd_Api.G_Miss_Num) =
834: Fnd_Api.G_Miss_Num then
835: l_resource_rec.basis_type := null;
836: End if;
837:
838: If nvl(l_resource_rec.schedule_flag, Fnd_Api.G_Miss_Num) =
834: Fnd_Api.G_Miss_Num then
835: l_resource_rec.basis_type := null;
836: End if;
837:
838: If nvl(l_resource_rec.schedule_flag, Fnd_Api.G_Miss_Num) =
839: Fnd_Api.G_Miss_Num then
840: l_resource_rec.schedule_flag := 2;
841: End if;
842:
835: l_resource_rec.basis_type := null;
836: End if;
837:
838: If nvl(l_resource_rec.schedule_flag, Fnd_Api.G_Miss_Num) =
839: Fnd_Api.G_Miss_Num then
840: l_resource_rec.schedule_flag := 2;
841: End if;
842:
843: If l_resource_rec.resource_offset_percent = Fnd_Api.G_Miss_Num then
839: Fnd_Api.G_Miss_Num then
840: l_resource_rec.schedule_flag := 2;
841: End if;
842:
843: If l_resource_rec.resource_offset_percent = Fnd_Api.G_Miss_Num then
844: l_resource_rec.resource_offset_percent := null;
845: End if;
846:
847: If l_resource_rec.autocharge_type = Fnd_Api.G_Miss_Num then
843: If l_resource_rec.resource_offset_percent = Fnd_Api.G_Miss_Num then
844: l_resource_rec.resource_offset_percent := null;
845: End if;
846:
847: If l_resource_rec.autocharge_type = Fnd_Api.G_Miss_Num then
848: l_resource_rec.autocharge_type := null;
849: End if;
850:
851: If l_resource_rec.attribute_category = Fnd_Api.G_Miss_Char then
847: If l_resource_rec.autocharge_type = Fnd_Api.G_Miss_Num then
848: l_resource_rec.autocharge_type := null;
849: End if;
850:
851: If l_resource_rec.attribute_category = Fnd_Api.G_Miss_Char then
852: l_resource_rec.attribute_category := null;
853: End if;
854:
855: If l_resource_rec.attribute1 = Fnd_Api.G_Miss_Char then
851: If l_resource_rec.attribute_category = Fnd_Api.G_Miss_Char then
852: l_resource_rec.attribute_category := null;
853: End if;
854:
855: If l_resource_rec.attribute1 = Fnd_Api.G_Miss_Char then
856: l_resource_rec.attribute1 := null;
857: End if;
858:
859: If l_resource_rec.attribute2 = Fnd_Api.G_Miss_Char then
855: If l_resource_rec.attribute1 = Fnd_Api.G_Miss_Char then
856: l_resource_rec.attribute1 := null;
857: End if;
858:
859: If l_resource_rec.attribute2 = Fnd_Api.G_Miss_Char then
860: l_resource_rec.attribute2 := null;
861: End if;
862:
863: If l_resource_rec.attribute3 = Fnd_Api.G_Miss_Char then
859: If l_resource_rec.attribute2 = Fnd_Api.G_Miss_Char then
860: l_resource_rec.attribute2 := null;
861: End if;
862:
863: If l_resource_rec.attribute3 = Fnd_Api.G_Miss_Char then
864: l_resource_rec.attribute3 := null;
865: End if;
866:
867: If l_resource_rec.attribute4 = Fnd_Api.G_Miss_Char then
863: If l_resource_rec.attribute3 = Fnd_Api.G_Miss_Char then
864: l_resource_rec.attribute3 := null;
865: End if;
866:
867: If l_resource_rec.attribute4 = Fnd_Api.G_Miss_Char then
868: l_resource_rec.attribute4 := null;
869: End if;
870:
871: If l_resource_rec.attribute5 = Fnd_Api.G_Miss_Char then
867: If l_resource_rec.attribute4 = Fnd_Api.G_Miss_Char then
868: l_resource_rec.attribute4 := null;
869: End if;
870:
871: If l_resource_rec.attribute5 = Fnd_Api.G_Miss_Char then
872: l_resource_rec.attribute5 := null;
873: End if;
874:
875: If l_resource_rec.attribute6 = Fnd_Api.G_Miss_Char then
871: If l_resource_rec.attribute5 = Fnd_Api.G_Miss_Char then
872: l_resource_rec.attribute5 := null;
873: End if;
874:
875: If l_resource_rec.attribute6 = Fnd_Api.G_Miss_Char then
876: l_resource_rec.attribute6 := null;
877: End if;
878:
879: If l_resource_rec.attribute7 = Fnd_Api.G_Miss_Char then
875: If l_resource_rec.attribute6 = Fnd_Api.G_Miss_Char then
876: l_resource_rec.attribute6 := null;
877: End if;
878:
879: If l_resource_rec.attribute7 = Fnd_Api.G_Miss_Char then
880: l_resource_rec.attribute7 := null;
881: End if;
882:
883:
880: l_resource_rec.attribute7 := null;
881: End if;
882:
883:
884: If l_resource_rec.attribute8 = Fnd_Api.G_Miss_Char then
885: l_resource_rec.attribute8 := null;
886: End if;
887:
888: If l_resource_rec.attribute9 = Fnd_Api.G_Miss_Char then
884: If l_resource_rec.attribute8 = Fnd_Api.G_Miss_Char then
885: l_resource_rec.attribute8 := null;
886: End if;
887:
888: If l_resource_rec.attribute9 = Fnd_Api.G_Miss_Char then
889: l_resource_rec.attribute9 := null;
890: End if;
891:
892: If l_resource_rec.attribute10 = Fnd_Api.G_Miss_Char then
888: If l_resource_rec.attribute9 = Fnd_Api.G_Miss_Char then
889: l_resource_rec.attribute9 := null;
890: End if;
891:
892: If l_resource_rec.attribute10 = Fnd_Api.G_Miss_Char then
893: l_resource_rec.attribute10 := null;
894: End if;
895:
896: If l_resource_rec.attribute11 = Fnd_Api.G_Miss_Char then
892: If l_resource_rec.attribute10 = Fnd_Api.G_Miss_Char then
893: l_resource_rec.attribute10 := null;
894: End if;
895:
896: If l_resource_rec.attribute11 = Fnd_Api.G_Miss_Char then
897: l_resource_rec.attribute11 := null;
898: End if;
899:
900: If l_resource_rec.attribute12 = Fnd_Api.G_Miss_Char then
896: If l_resource_rec.attribute11 = Fnd_Api.G_Miss_Char then
897: l_resource_rec.attribute11 := null;
898: End if;
899:
900: If l_resource_rec.attribute12 = Fnd_Api.G_Miss_Char then
901: l_resource_rec.attribute12 := null;
902: End if;
903:
904: If l_resource_rec.attribute13 = Fnd_Api.G_Miss_Char then
900: If l_resource_rec.attribute12 = Fnd_Api.G_Miss_Char then
901: l_resource_rec.attribute12 := null;
902: End if;
903:
904: If l_resource_rec.attribute13 = Fnd_Api.G_Miss_Char then
905: l_resource_rec.attribute13 := null;
906: End if;
907:
908: If l_resource_rec.attribute14 = Fnd_Api.G_Miss_Char then
904: If l_resource_rec.attribute13 = Fnd_Api.G_Miss_Char then
905: l_resource_rec.attribute13 := null;
906: End if;
907:
908: If l_resource_rec.attribute14 = Fnd_Api.G_Miss_Char then
909: l_resource_rec.attribute14 := null;
910: End if;
911:
912: If l_resource_rec.attribute15 = Fnd_Api.G_Miss_Char then
908: If l_resource_rec.attribute14 = Fnd_Api.G_Miss_Char then
909: l_resource_rec.attribute14 := null;
910: End if;
911:
912: If l_resource_rec.attribute15 = Fnd_Api.G_Miss_Char then
913: l_resource_rec.attribute15 := null;
914: End if;
915:
916: If l_resource_rec.assembly_item_id = Fnd_Api.G_Miss_Num then
912: If l_resource_rec.attribute15 = Fnd_Api.G_Miss_Char then
913: l_resource_rec.attribute15 := null;
914: End if;
915:
916: If l_resource_rec.assembly_item_id = Fnd_Api.G_Miss_Num then
917: l_resource_rec.assembly_item_id := null;
918: End if;
919:
920: If l_resource_rec.alternate_routing_designator = Fnd_Api.G_Miss_Char then
916: If l_resource_rec.assembly_item_id = Fnd_Api.G_Miss_Num then
917: l_resource_rec.assembly_item_id := null;
918: End if;
919:
920: If l_resource_rec.alternate_routing_designator = Fnd_Api.G_Miss_Char then
921: l_resource_rec.alternate_routing_designator := null;
922: End if;
923:
924: If l_resource_rec.organization_id = Fnd_Api.G_Miss_Num then
920: If l_resource_rec.alternate_routing_designator = Fnd_Api.G_Miss_Char then
921: l_resource_rec.alternate_routing_designator := null;
922: End if;
923:
924: If l_resource_rec.organization_id = Fnd_Api.G_Miss_Num then
925: l_resource_rec.organization_id := null;
926: End if;
927:
928: If l_resource_rec.operation_seq_num = Fnd_Api.G_Miss_Num then
924: If l_resource_rec.organization_id = Fnd_Api.G_Miss_Num then
925: l_resource_rec.organization_id := null;
926: End if;
927:
928: If l_resource_rec.operation_seq_num = Fnd_Api.G_Miss_Num then
929: l_resource_rec.operation_seq_num := null;
930: End if;
931:
932: If l_resource_rec.effectivity_date = Fnd_Api.G_Miss_Date then
928: If l_resource_rec.operation_seq_num = Fnd_Api.G_Miss_Num then
929: l_resource_rec.operation_seq_num := null;
930: End if;
931:
932: If l_resource_rec.effectivity_date = Fnd_Api.G_Miss_Date then
933: l_resource_rec.effectivity_date := null;
934: End if;
935:
936: If l_resource_rec.routing_sequence_id = Fnd_Api.G_Miss_Num then
932: If l_resource_rec.effectivity_date = Fnd_Api.G_Miss_Date then
933: l_resource_rec.effectivity_date := null;
934: End if;
935:
936: If l_resource_rec.routing_sequence_id = Fnd_Api.G_Miss_Num then
937: l_resource_rec.routing_sequence_id := null;
938: End if;
939:
940: If l_resource_rec.organization_code = Fnd_Api.G_Miss_Char then
936: If l_resource_rec.routing_sequence_id = Fnd_Api.G_Miss_Num then
937: l_resource_rec.routing_sequence_id := null;
938: End if;
939:
940: If l_resource_rec.organization_code = Fnd_Api.G_Miss_Char then
941: l_resource_rec.organization_code := null;
942: End if;
943:
944: If l_resource_rec.assembly_item_number = Fnd_Api.G_Miss_Char then
940: If l_resource_rec.organization_code = Fnd_Api.G_Miss_Char then
941: l_resource_rec.organization_code := null;
942: End if;
943:
944: If l_resource_rec.assembly_item_number = Fnd_Api.G_Miss_Char then
945: l_resource_rec.assembly_item_number := null;
946: End if;
947:
948: If l_resource_rec.resource_code = Fnd_Api.G_Miss_Char then
944: If l_resource_rec.assembly_item_number = Fnd_Api.G_Miss_Char then
945: l_resource_rec.assembly_item_number := null;
946: End if;
947:
948: If l_resource_rec.resource_code = Fnd_Api.G_Miss_Char then
949: l_resource_rec.resource_code := null;
950: End if;
951:
952: If l_resource_rec.activity = Fnd_Api.G_Miss_Char then
948: If l_resource_rec.resource_code = Fnd_Api.G_Miss_Char then
949: l_resource_rec.resource_code := null;
950: End if;
951:
952: If l_resource_rec.activity = Fnd_Api.G_Miss_Char then
953: l_resource_rec.activity := null;
954: End if;
955:
956: --Bug 2514018
953: l_resource_rec.activity := null;
954: End if;
955:
956: --Bug 2514018
957: if nvl(l_resource_rec.principle_flag,Fnd_Api.G_Miss_Num) =
958: Fnd_Api.G_Miss_Num then
959: l_resource_rec.principle_flag := 2;
960: End if;
961: --Bug 2514018
954: End if;
955:
956: --Bug 2514018
957: if nvl(l_resource_rec.principle_flag,Fnd_Api.G_Miss_Num) =
958: Fnd_Api.G_Miss_Num then
959: l_resource_rec.principle_flag := 2;
960: End if;
961: --Bug 2514018
962:
959: l_resource_rec.principle_flag := 2;
960: End if;
961: --Bug 2514018
962:
963: If p_validation_level > FND_API.G_VALID_LEVEL_NONE then
964: ValidateResource(
965: p_api_version => 1,
966: p_init_msg_list => p_init_msg_list,
967: p_commit => p_commit,
970: x_msg_count => l_msg_count,
971: x_msg_data => l_msg_data,
972: p_resource_rec => l_resource_rec,
973: x_resource_rec => l_resource_rec);
974: If l_return_status = FND_API.G_RET_STS_ERROR then
975: Raise FND_API.G_EXC_ERROR;
976: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
977: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
978: End if; -- validation error
971: x_msg_data => l_msg_data,
972: p_resource_rec => l_resource_rec,
973: x_resource_rec => l_resource_rec);
974: If l_return_status = FND_API.G_RET_STS_ERROR then
975: Raise FND_API.G_EXC_ERROR;
976: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
977: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
978: End if; -- validation error
979: End if; -- validate before inserting
972: p_resource_rec => l_resource_rec,
973: x_resource_rec => l_resource_rec);
974: If l_return_status = FND_API.G_RET_STS_ERROR then
975: Raise FND_API.G_EXC_ERROR;
976: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
977: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
978: End if; -- validation error
979: End if; -- validate before inserting
980:
973: x_resource_rec => l_resource_rec);
974: If l_return_status = FND_API.G_RET_STS_ERROR then
975: Raise FND_API.G_EXC_ERROR;
976: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
977: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
978: End if; -- validation error
979: End if; -- validate before inserting
980:
981: l_UserId := nvl(Fnd_Global.USER_ID, -1);
1076: x_resource_rec := l_resource_rec;
1077: -- End of API body.
1078:
1079: -- Standard check of p_commit.
1080: IF FND_API.To_Boolean(p_commit) THEN
1081: COMMIT WORK;
1082: END IF;
1083: -- Standard call to get message count and if count is 1, get message info.
1084: FND_MSG_PUB.Count_And_Get(
1085: p_count => x_msg_count,
1086: p_data => x_msg_data
1087: );
1088: EXCEPTION
1089: WHEN FND_API.G_EXC_ERROR THEN
1090: ROLLBACK TO CreateResource_Pvt;
1091: x_return_status := FND_API.G_RET_STS_ERROR;
1092: FND_MSG_PUB.Count_And_Get(
1093: p_count => x_msg_count,
1087: );
1088: EXCEPTION
1089: WHEN FND_API.G_EXC_ERROR THEN
1090: ROLLBACK TO CreateResource_Pvt;
1091: x_return_status := FND_API.G_RET_STS_ERROR;
1092: FND_MSG_PUB.Count_And_Get(
1093: p_count => x_msg_count,
1094: p_data => x_msg_data
1095: );
1092: FND_MSG_PUB.Count_And_Get(
1093: p_count => x_msg_count,
1094: p_data => x_msg_data
1095: );
1096: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1097: ROLLBACK TO CreateResource_Pvt;
1098: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1099: FND_MSG_PUB.Count_And_Get(
1100: p_count => x_msg_count,
1094: p_data => x_msg_data
1095: );
1096: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1097: ROLLBACK TO CreateResource_Pvt;
1098: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1099: FND_MSG_PUB.Count_And_Get(
1100: p_count => x_msg_count,
1101: p_data => x_msg_data
1102: );
1101: p_data => x_msg_data
1102: );
1103: WHEN OTHERS THEN
1104: ROLLBACK TO CreateResource_Pvt;
1105: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1106: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1107: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1108: END IF;
1109: FND_MSG_PUB.Count_And_Get(
1112: );
1113: END CreateResource;
1114: PROCEDURE UpdateResource(
1115: p_api_version IN NUMBER,
1116: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1117: p_commit IN VARCHAR2 := FND_API.G_FALSE,
1118: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1119: x_return_status IN OUT NOCOPY VARCHAR2,
1120: x_msg_count IN OUT NOCOPY NUMBER,
1113: END CreateResource;
1114: PROCEDURE UpdateResource(
1115: p_api_version IN NUMBER,
1116: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1117: p_commit IN VARCHAR2 := FND_API.G_FALSE,
1118: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1119: x_return_status IN OUT NOCOPY VARCHAR2,
1120: x_msg_count IN OUT NOCOPY NUMBER,
1121: x_msg_data IN OUT NOCOPY VARCHAR2,
1114: PROCEDURE UpdateResource(
1115: p_api_version IN NUMBER,
1116: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1117: p_commit IN VARCHAR2 := FND_API.G_FALSE,
1118: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1119: x_return_status IN OUT NOCOPY VARCHAR2,
1120: x_msg_count IN OUT NOCOPY NUMBER,
1121: x_msg_data IN OUT NOCOPY VARCHAR2,
1122: p_resource_rec IN RESOURCE_REC_TYPE := G_MISS_RESOURCE_REC,
1144: BEGIN
1145: -- Standard Start of API savepoint
1146: SAVEPOINT UpdateResource_Pvt;
1147: -- Standard call to check for call compatibility.
1148: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
1149: G_PKG_NAME) THEN
1150: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1151: END IF;
1152: -- Initialize message list if p_init_msg_list is set to TRUE.
1146: SAVEPOINT UpdateResource_Pvt;
1147: -- Standard call to check for call compatibility.
1148: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
1149: G_PKG_NAME) THEN
1150: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1151: END IF;
1152: -- Initialize message list if p_init_msg_list is set to TRUE.
1153: IF FND_API.to_Boolean(p_init_msg_list) THEN
1154: FND_MSG_PUB.initialize;
1149: G_PKG_NAME) THEN
1150: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1151: END IF;
1152: -- Initialize message list if p_init_msg_list is set to TRUE.
1153: IF FND_API.to_Boolean(p_init_msg_list) THEN
1154: FND_MSG_PUB.initialize;
1155: END IF;
1156: -- Initialize API return status to success
1157: x_return_status := FND_API.G_RET_STS_SUCCESS;
1153: IF FND_API.to_Boolean(p_init_msg_list) THEN
1154: FND_MSG_PUB.initialize;
1155: END IF;
1156: -- Initialize API return status to success
1157: x_return_status := FND_API.G_RET_STS_SUCCESS;
1158:
1159: -- API body
1160: l_resource_rec := p_resource_rec;
1161:
1158:
1159: -- API body
1160: l_resource_rec := p_resource_rec;
1161:
1162: If p_validation_level = FND_API.G_VALID_LEVEL_FULL then
1163: AssignResource(
1164: p_api_version => 1,
1165: p_init_msg_list => p_init_msg_list,
1166: p_commit => p_commit,
1170: x_msg_data => l_msg_data,
1171: p_resource_rec => l_resource_rec,
1172: x_resource_rec => l_resource_rec
1173: );
1174: If l_return_status = FND_API.G_RET_STS_ERROR then
1175: Raise FND_API.G_EXC_ERROR;
1176: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1177: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1178: End if; -- assign error
1171: p_resource_rec => l_resource_rec,
1172: x_resource_rec => l_resource_rec
1173: );
1174: If l_return_status = FND_API.G_RET_STS_ERROR then
1175: Raise FND_API.G_EXC_ERROR;
1176: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1177: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1178: End if; -- assign error
1179: End If; -- assign
1172: x_resource_rec => l_resource_rec
1173: );
1174: If l_return_status = FND_API.G_RET_STS_ERROR then
1175: Raise FND_API.G_EXC_ERROR;
1176: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1177: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1178: End if; -- assign error
1179: End If; -- assign
1180:
1173: );
1174: If l_return_status = FND_API.G_RET_STS_ERROR then
1175: Raise FND_API.G_EXC_ERROR;
1176: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1177: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1178: End if; -- assign error
1179: End If; -- assign
1180:
1181:
1186: P_OpSeqId => l_resource_rec.operation_sequence_id,
1187: P_SeqNum => l_resource_rec.resource_seq_num) loop
1188: l_ResourceFound := true;
1189:
1190: If l_resource_rec.resource_id = Fnd_Api.G_Miss_Num then
1191: l_resource_rec.resource_id := l_OldResource_rec.resource_id;
1192: End if;
1193:
1194: If l_resource_rec.activity_id = Fnd_Api.G_Miss_Num then
1190: If l_resource_rec.resource_id = Fnd_Api.G_Miss_Num then
1191: l_resource_rec.resource_id := l_OldResource_rec.resource_id;
1192: End if;
1193:
1194: If l_resource_rec.activity_id = Fnd_Api.G_Miss_Num then
1195: l_resource_rec.activity_id := l_OldResource_rec.activity_id;
1196: End if;
1197:
1198: If l_resource_rec.standard_rate_flag = Fnd_Api.G_Miss_Num then
1194: If l_resource_rec.activity_id = Fnd_Api.G_Miss_Num then
1195: l_resource_rec.activity_id := l_OldResource_rec.activity_id;
1196: End if;
1197:
1198: If l_resource_rec.standard_rate_flag = Fnd_Api.G_Miss_Num then
1199: l_resource_rec.standard_rate_flag :=
1200: l_OldResource_rec.standard_rate_flag;
1201: End if;
1202:
1199: l_resource_rec.standard_rate_flag :=
1200: l_OldResource_rec.standard_rate_flag;
1201: End if;
1202:
1203: If l_resource_rec.assigned_units = Fnd_Api.G_Miss_Num then
1204: l_resource_rec.assigned_units := l_OldResource_rec.assigned_units;
1205: End if;
1206:
1207: If l_resource_rec.usage_rate_or_amount = Fnd_Api.G_Miss_Num then
1203: If l_resource_rec.assigned_units = Fnd_Api.G_Miss_Num then
1204: l_resource_rec.assigned_units := l_OldResource_rec.assigned_units;
1205: End if;
1206:
1207: If l_resource_rec.usage_rate_or_amount = Fnd_Api.G_Miss_Num then
1208: l_resource_rec.usage_rate_or_amount :=
1209: l_OldResource_rec.usage_rate_or_amount;
1210: End if;
1211:
1208: l_resource_rec.usage_rate_or_amount :=
1209: l_OldResource_rec.usage_rate_or_amount;
1210: End if;
1211:
1212: If l_resource_rec.usage_rate_or_amount_inverse = Fnd_Api.G_Miss_Num then
1213: l_resource_rec.usage_rate_or_amount_inverse :=
1214: l_OldResource_rec.usage_rate_or_amount_inverse;
1215: End if;
1216:
1213: l_resource_rec.usage_rate_or_amount_inverse :=
1214: l_OldResource_rec.usage_rate_or_amount_inverse;
1215: End if;
1216:
1217: If l_resource_rec.basis_type = Fnd_Api.G_Miss_Num then
1218: l_resource_rec.basis_type := l_OldResource_rec.basis_type;
1219: End if;
1220:
1221: If l_resource_rec.schedule_flag = Fnd_Api.G_Miss_Num then
1217: If l_resource_rec.basis_type = Fnd_Api.G_Miss_Num then
1218: l_resource_rec.basis_type := l_OldResource_rec.basis_type;
1219: End if;
1220:
1221: If l_resource_rec.schedule_flag = Fnd_Api.G_Miss_Num then
1222: l_resource_rec.schedule_flag := l_OldResource_rec.schedule_flag;
1223: End if;
1224:
1225: If l_resource_rec.resource_offset_percent = Fnd_Api.G_Miss_Num then
1221: If l_resource_rec.schedule_flag = Fnd_Api.G_Miss_Num then
1222: l_resource_rec.schedule_flag := l_OldResource_rec.schedule_flag;
1223: End if;
1224:
1225: If l_resource_rec.resource_offset_percent = Fnd_Api.G_Miss_Num then
1226: l_resource_rec.resource_offset_percent :=
1227: l_OldResource_rec.resource_offset_percent;
1228: End if;
1229:
1226: l_resource_rec.resource_offset_percent :=
1227: l_OldResource_rec.resource_offset_percent;
1228: End if;
1229:
1230: If l_resource_rec.autocharge_type = Fnd_Api.G_Miss_Num then
1231: l_resource_rec.autocharge_type := l_OldResource_rec.autocharge_type;
1232: End if;
1233:
1234: If l_resource_rec.attribute_category = Fnd_Api.G_Miss_Char then
1230: If l_resource_rec.autocharge_type = Fnd_Api.G_Miss_Num then
1231: l_resource_rec.autocharge_type := l_OldResource_rec.autocharge_type;
1232: End if;
1233:
1234: If l_resource_rec.attribute_category = Fnd_Api.G_Miss_Char then
1235: l_resource_rec.attribute_category :=
1236: l_OldResource_rec.attribute_category;
1237: End if;
1238:
1235: l_resource_rec.attribute_category :=
1236: l_OldResource_rec.attribute_category;
1237: End if;
1238:
1239: If l_resource_rec.attribute1 = Fnd_Api.G_Miss_Char then
1240: l_resource_rec.attribute1 := l_OldResource_rec.attribute1;
1241: End if;
1242:
1243: If l_resource_rec.attribute2 = Fnd_Api.G_Miss_Char then
1239: If l_resource_rec.attribute1 = Fnd_Api.G_Miss_Char then
1240: l_resource_rec.attribute1 := l_OldResource_rec.attribute1;
1241: End if;
1242:
1243: If l_resource_rec.attribute2 = Fnd_Api.G_Miss_Char then
1244: l_resource_rec.attribute2 := l_OldResource_rec.attribute2;
1245: End if;
1246:
1247: If l_resource_rec.attribute3 = Fnd_Api.G_Miss_Char then
1243: If l_resource_rec.attribute2 = Fnd_Api.G_Miss_Char then
1244: l_resource_rec.attribute2 := l_OldResource_rec.attribute2;
1245: End if;
1246:
1247: If l_resource_rec.attribute3 = Fnd_Api.G_Miss_Char then
1248: l_resource_rec.attribute3 := l_OldResource_rec.attribute3;
1249: End if;
1250:
1251: If l_resource_rec.attribute4 = Fnd_Api.G_Miss_Char then
1247: If l_resource_rec.attribute3 = Fnd_Api.G_Miss_Char then
1248: l_resource_rec.attribute3 := l_OldResource_rec.attribute3;
1249: End if;
1250:
1251: If l_resource_rec.attribute4 = Fnd_Api.G_Miss_Char then
1252: l_resource_rec.attribute4 := l_OldResource_rec.attribute4;
1253: End if;
1254:
1255: If l_resource_rec.attribute5 = Fnd_Api.G_Miss_Char then
1251: If l_resource_rec.attribute4 = Fnd_Api.G_Miss_Char then
1252: l_resource_rec.attribute4 := l_OldResource_rec.attribute4;
1253: End if;
1254:
1255: If l_resource_rec.attribute5 = Fnd_Api.G_Miss_Char then
1256: l_resource_rec.attribute5 := l_OldResource_rec.attribute5;
1257: End if;
1258:
1259: If l_resource_rec.attribute6 = Fnd_Api.G_Miss_Char then
1255: If l_resource_rec.attribute5 = Fnd_Api.G_Miss_Char then
1256: l_resource_rec.attribute5 := l_OldResource_rec.attribute5;
1257: End if;
1258:
1259: If l_resource_rec.attribute6 = Fnd_Api.G_Miss_Char then
1260: l_resource_rec.attribute6 := l_OldResource_rec.attribute6;
1261: End if;
1262:
1263: If l_resource_rec.attribute7 = Fnd_Api.G_Miss_Char then
1259: If l_resource_rec.attribute6 = Fnd_Api.G_Miss_Char then
1260: l_resource_rec.attribute6 := l_OldResource_rec.attribute6;
1261: End if;
1262:
1263: If l_resource_rec.attribute7 = Fnd_Api.G_Miss_Char then
1264: l_resource_rec.attribute7 := l_OldResource_rec.attribute7;
1265: End if;
1266:
1267: If l_resource_rec.attribute8 = Fnd_Api.G_Miss_Char then
1263: If l_resource_rec.attribute7 = Fnd_Api.G_Miss_Char then
1264: l_resource_rec.attribute7 := l_OldResource_rec.attribute7;
1265: End if;
1266:
1267: If l_resource_rec.attribute8 = Fnd_Api.G_Miss_Char then
1268: l_resource_rec.attribute8 := l_OldResource_rec.attribute8;
1269: End if;
1270:
1271: If l_resource_rec.attribute9 = Fnd_Api.G_Miss_Char then
1267: If l_resource_rec.attribute8 = Fnd_Api.G_Miss_Char then
1268: l_resource_rec.attribute8 := l_OldResource_rec.attribute8;
1269: End if;
1270:
1271: If l_resource_rec.attribute9 = Fnd_Api.G_Miss_Char then
1272: l_resource_rec.attribute9 := l_OldResource_rec.attribute9;
1273: End if;
1274:
1275: If l_resource_rec.attribute10 = Fnd_Api.G_Miss_Char then
1271: If l_resource_rec.attribute9 = Fnd_Api.G_Miss_Char then
1272: l_resource_rec.attribute9 := l_OldResource_rec.attribute9;
1273: End if;
1274:
1275: If l_resource_rec.attribute10 = Fnd_Api.G_Miss_Char then
1276: l_resource_rec.attribute10 := l_OldResource_rec.attribute10;
1277: End if;
1278:
1279: If l_resource_rec.attribute11 = Fnd_Api.G_Miss_Char then
1275: If l_resource_rec.attribute10 = Fnd_Api.G_Miss_Char then
1276: l_resource_rec.attribute10 := l_OldResource_rec.attribute10;
1277: End if;
1278:
1279: If l_resource_rec.attribute11 = Fnd_Api.G_Miss_Char then
1280: l_resource_rec.attribute11 := l_OldResource_rec.attribute11;
1281: End if;
1282:
1283: If l_resource_rec.attribute12 = Fnd_Api.G_Miss_Char then
1279: If l_resource_rec.attribute11 = Fnd_Api.G_Miss_Char then
1280: l_resource_rec.attribute11 := l_OldResource_rec.attribute11;
1281: End if;
1282:
1283: If l_resource_rec.attribute12 = Fnd_Api.G_Miss_Char then
1284: l_resource_rec.attribute12 := l_OldResource_rec.attribute12;
1285: End if;
1286:
1287: If l_resource_rec.attribute13 = Fnd_Api.G_Miss_Char then
1283: If l_resource_rec.attribute12 = Fnd_Api.G_Miss_Char then
1284: l_resource_rec.attribute12 := l_OldResource_rec.attribute12;
1285: End if;
1286:
1287: If l_resource_rec.attribute13 = Fnd_Api.G_Miss_Char then
1288: l_resource_rec.attribute13 := l_OldResource_rec.attribute13;
1289: End if;
1290:
1291: If l_resource_rec.attribute14 = Fnd_Api.G_Miss_Char then
1287: If l_resource_rec.attribute13 = Fnd_Api.G_Miss_Char then
1288: l_resource_rec.attribute13 := l_OldResource_rec.attribute13;
1289: End if;
1290:
1291: If l_resource_rec.attribute14 = Fnd_Api.G_Miss_Char then
1292: l_resource_rec.attribute14 := l_OldResource_rec.attribute14;
1293: End if;
1294:
1295: If l_resource_rec.attribute15 = Fnd_Api.G_Miss_Char then
1291: If l_resource_rec.attribute14 = Fnd_Api.G_Miss_Char then
1292: l_resource_rec.attribute14 := l_OldResource_rec.attribute14;
1293: End if;
1294:
1295: If l_resource_rec.attribute15 = Fnd_Api.G_Miss_Char then
1296: l_resource_rec.attribute15 := l_OldResource_rec.attribute15;
1297: End if;
1298:
1299: If l_resource_rec.principle_flag = Fnd_Api.G_Miss_Num then
1295: If l_resource_rec.attribute15 = Fnd_Api.G_Miss_Char then
1296: l_resource_rec.attribute15 := l_OldResource_rec.attribute15;
1297: End if;
1298:
1299: If l_resource_rec.principle_flag = Fnd_Api.G_Miss_Num then
1300: l_resource_rec.principle_flag := l_OldResource_rec.principle_flag;
1301: End if;
1302:
1303: If l_resource_rec.new_resource_seq_num = Fnd_Api.G_Miss_Num then
1299: If l_resource_rec.principle_flag = Fnd_Api.G_Miss_Num then
1300: l_resource_rec.principle_flag := l_OldResource_rec.principle_flag;
1301: End if;
1302:
1303: If l_resource_rec.new_resource_seq_num = Fnd_Api.G_Miss_Num then
1304: l_resource_rec.new_resource_seq_num := l_resource_rec.resource_seq_num;
1305: End if;
1306: End loop; -- get old values
1307:
1307:
1308: If not l_ResourceFound then
1309: Fnd_Message.Set_Name('BOM', 'BOM_INVALID_OP_RESOURCE');
1310: FND_MSG_PUB.Add;
1311: Raise FND_API.G_EXC_ERROR;
1312: End if; -- missing op resource
1313:
1314: If p_validation_level > FND_API.G_VALID_LEVEL_NONE then
1315: ValidateResource(
1310: FND_MSG_PUB.Add;
1311: Raise FND_API.G_EXC_ERROR;
1312: End if; -- missing op resource
1313:
1314: If p_validation_level > FND_API.G_VALID_LEVEL_NONE then
1315: ValidateResource(
1316: p_api_version => 1,
1317: p_init_msg_list => p_init_msg_list,
1318: p_commit => p_commit,
1315: ValidateResource(
1316: p_api_version => 1,
1317: p_init_msg_list => p_init_msg_list,
1318: p_commit => p_commit,
1319: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
1320: x_return_status => l_return_status,
1321: x_msg_count => l_msg_count,
1322: x_msg_data => l_msg_data,
1323: p_resource_rec => l_resource_rec,
1322: x_msg_data => l_msg_data,
1323: p_resource_rec => l_resource_rec,
1324: x_resource_rec => l_resource_rec
1325: );
1326: If l_return_status = FND_API.G_RET_STS_ERROR then
1327: Raise FND_API.G_EXC_ERROR;
1328: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1329: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1330: End if; -- validation error
1323: p_resource_rec => l_resource_rec,
1324: x_resource_rec => l_resource_rec
1325: );
1326: If l_return_status = FND_API.G_RET_STS_ERROR then
1327: Raise FND_API.G_EXC_ERROR;
1328: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1329: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1330: End if; -- validation error
1331: End If; -- validation
1324: x_resource_rec => l_resource_rec
1325: );
1326: If l_return_status = FND_API.G_RET_STS_ERROR then
1327: Raise FND_API.G_EXC_ERROR;
1328: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1329: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1330: End if; -- validation error
1331: End If; -- validation
1332:
1325: );
1326: If l_return_status = FND_API.G_RET_STS_ERROR then
1327: Raise FND_API.G_EXC_ERROR;
1328: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1329: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1330: End if; -- validation error
1331: End If; -- validation
1332:
1333: -- update operation resource
1388: x_resource_rec := l_resource_rec;
1389: -- End of API body.
1390:
1391: -- Standard check of p_commit.
1392: IF FND_API.To_Boolean(p_commit) THEN
1393: COMMIT WORK;
1394: END IF;
1395: -- Standard call to get message count and if count is 1, get message info.
1396: FND_MSG_PUB.Count_And_Get(
1397: p_count => x_msg_count,
1398: p_data => x_msg_data
1399: );
1400: EXCEPTION
1401: WHEN FND_API.G_EXC_ERROR THEN
1402: ROLLBACK TO UpdateResource_Pvt;
1403: x_return_status := FND_API.G_RET_STS_ERROR;
1404: FND_MSG_PUB.Count_And_Get(
1405: p_count => x_msg_count,
1399: );
1400: EXCEPTION
1401: WHEN FND_API.G_EXC_ERROR THEN
1402: ROLLBACK TO UpdateResource_Pvt;
1403: x_return_status := FND_API.G_RET_STS_ERROR;
1404: FND_MSG_PUB.Count_And_Get(
1405: p_count => x_msg_count,
1406: p_data => x_msg_data
1407: );
1404: FND_MSG_PUB.Count_And_Get(
1405: p_count => x_msg_count,
1406: p_data => x_msg_data
1407: );
1408: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1409: ROLLBACK TO UpdateResource_Pvt;
1410: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1411: FND_MSG_PUB.Count_And_Get(
1412: p_count => x_msg_count,
1406: p_data => x_msg_data
1407: );
1408: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1409: ROLLBACK TO UpdateResource_Pvt;
1410: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1411: FND_MSG_PUB.Count_And_Get(
1412: p_count => x_msg_count,
1413: p_data => x_msg_data
1414: );
1413: p_data => x_msg_data
1414: );
1415: WHEN OTHERS THEN
1416: ROLLBACK TO UpdateResource_Pvt;
1417: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1418: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1419: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1420: END IF;
1421: FND_MSG_PUB.Count_And_Get(
1424: );
1425: END UpdateResource;
1426: PROCEDURE DeleteResource(
1427: p_api_version IN NUMBER,
1428: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1429: p_commit IN VARCHAR2 := FND_API.G_FALSE,
1430: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1431: x_return_status IN OUT NOCOPY VARCHAR2,
1432: x_msg_count IN OUT NOCOPY NUMBER,
1425: END UpdateResource;
1426: PROCEDURE DeleteResource(
1427: p_api_version IN NUMBER,
1428: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1429: p_commit IN VARCHAR2 := FND_API.G_FALSE,
1430: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1431: x_return_status IN OUT NOCOPY VARCHAR2,
1432: x_msg_count IN OUT NOCOPY NUMBER,
1433: x_msg_data IN OUT NOCOPY VARCHAR2,
1426: PROCEDURE DeleteResource(
1427: p_api_version IN NUMBER,
1428: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1429: p_commit IN VARCHAR2 := FND_API.G_FALSE,
1430: p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1431: x_return_status IN OUT NOCOPY VARCHAR2,
1432: x_msg_count IN OUT NOCOPY NUMBER,
1433: x_msg_data IN OUT NOCOPY VARCHAR2,
1434: p_resource_rec IN RESOURCE_REC_TYPE := G_MISS_RESOURCE_REC,
1443: BEGIN
1444: -- Standard Start of API savepoint
1445: SAVEPOINT DeleteResource_Pvt;
1446: -- Standard call to check for call compatibility.
1447: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
1448: G_PKG_NAME) THEN
1449: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1450: END IF;
1451: -- Initialize message list if p_init_msg_list is set to TRUE.
1445: SAVEPOINT DeleteResource_Pvt;
1446: -- Standard call to check for call compatibility.
1447: IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
1448: G_PKG_NAME) THEN
1449: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1450: END IF;
1451: -- Initialize message list if p_init_msg_list is set to TRUE.
1452: IF FND_API.to_Boolean(p_init_msg_list) THEN
1453: FND_MSG_PUB.initialize;
1448: G_PKG_NAME) THEN
1449: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1450: END IF;
1451: -- Initialize message list if p_init_msg_list is set to TRUE.
1452: IF FND_API.to_Boolean(p_init_msg_list) THEN
1453: FND_MSG_PUB.initialize;
1454: END IF;
1455: -- Initialize API return status to success
1456: x_return_status := FND_API.G_RET_STS_SUCCESS;
1452: IF FND_API.to_Boolean(p_init_msg_list) THEN
1453: FND_MSG_PUB.initialize;
1454: END IF;
1455: -- Initialize API return status to success
1456: x_return_status := FND_API.G_RET_STS_SUCCESS;
1457:
1458: -- API body
1459: l_resource_rec := p_resource_rec;
1460:
1457:
1458: -- API body
1459: l_resource_rec := p_resource_rec;
1460:
1461: If p_validation_level = FND_API.G_VALID_LEVEL_FULL then
1462: AssignResource(
1463: p_api_version => 1,
1464: p_init_msg_list => p_init_msg_list,
1465: p_commit => p_commit,
1469: x_msg_data => l_msg_data,
1470: p_resource_rec => l_resource_rec,
1471: x_resource_rec => l_resource_rec
1472: );
1473: If l_return_status = FND_API.G_RET_STS_ERROR then
1474: Raise FND_API.G_EXC_ERROR;
1475: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1476: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1477: End if; -- assign error
1470: p_resource_rec => l_resource_rec,
1471: x_resource_rec => l_resource_rec
1472: );
1473: If l_return_status = FND_API.G_RET_STS_ERROR then
1474: Raise FND_API.G_EXC_ERROR;
1475: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1476: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1477: End if; -- assign error
1478: End If; -- assign
1471: x_resource_rec => l_resource_rec
1472: );
1473: If l_return_status = FND_API.G_RET_STS_ERROR then
1474: Raise FND_API.G_EXC_ERROR;
1475: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1476: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1477: End if; -- assign error
1478: End If; -- assign
1479:
1472: );
1473: If l_return_status = FND_API.G_RET_STS_ERROR then
1474: Raise FND_API.G_EXC_ERROR;
1475: Elsif l_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1476: Raise FND_API.G_EXC_UNEXPECTED_ERROR;
1477: End if; -- assign error
1478: End If; -- assign
1479:
1480: x_resource_rec := l_resource_rec;
1485:
1486: If sql%notfound then
1487: Fnd_Message.Set_Name('BOM', 'BOM_INVALID_OP_RESOURCE');
1488: FND_MSG_PUB.Add;
1489: Raise FND_API.G_EXC_ERROR;
1490: End if; -- missing op resource
1491:
1492: -- End of API body.
1493:
1491:
1492: -- End of API body.
1493:
1494: -- Standard check of p_commit.
1495: IF FND_API.To_Boolean(p_commit) THEN
1496: COMMIT WORK;
1497: END IF;
1498: -- Standard call to get message count and if count is 1, get message info.
1499: FND_MSG_PUB.Count_And_Get(
1500: p_count => x_msg_count,
1501: p_data => x_msg_data
1502: );
1503: EXCEPTION
1504: WHEN FND_API.G_EXC_ERROR THEN
1505: ROLLBACK TO DeleteResource_Pvt;
1506: x_return_status := FND_API.G_RET_STS_ERROR;
1507: FND_MSG_PUB.Count_And_Get(
1508: p_count => x_msg_count,
1502: );
1503: EXCEPTION
1504: WHEN FND_API.G_EXC_ERROR THEN
1505: ROLLBACK TO DeleteResource_Pvt;
1506: x_return_status := FND_API.G_RET_STS_ERROR;
1507: FND_MSG_PUB.Count_And_Get(
1508: p_count => x_msg_count,
1509: p_data => x_msg_data
1510: );
1507: FND_MSG_PUB.Count_And_Get(
1508: p_count => x_msg_count,
1509: p_data => x_msg_data
1510: );
1511: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1512: ROLLBACK TO DeleteResource_Pvt;
1513: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1514: FND_MSG_PUB.Count_And_Get(
1515: p_count => x_msg_count,
1509: p_data => x_msg_data
1510: );
1511: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1512: ROLLBACK TO DeleteResource_Pvt;
1513: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1514: FND_MSG_PUB.Count_And_Get(
1515: p_count => x_msg_count,
1516: p_data => x_msg_data
1517: );
1516: p_data => x_msg_data
1517: );
1518: WHEN OTHERS THEN
1519: ROLLBACK TO DeleteResource_Pvt;
1520: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1521: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1522: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1523: END IF;
1524: FND_MSG_PUB.Count_And_Get(