34: -- klou 11/09/99 Create.
35: --
36: -- NOTES: If validations have been done in the precedent procedure from which this one is being called, doing a
37: -- full validation here is unnecessary. To avoid repeating the same validations, you can set the
38: -- p_validation_level to fnd_api.g_valid_level_none when making the procedure call. However, it is your
39: -- responsibility to make sure all proper validations have been done before calling this procedure.
40: -- You are recommended to let this procedure handle the validations if you are not sure.
41: --
42: -- NOTES: This procedure does not consider the fnd_api.g_miss_num and fnd_api.g_miss_char.
38: -- p_validation_level to fnd_api.g_valid_level_none when making the procedure call. However, it is your
39: -- responsibility to make sure all proper validations have been done before calling this procedure.
40: -- You are recommended to let this procedure handle the validations if you are not sure.
41: --
42: -- NOTES: This procedure does not consider the fnd_api.g_miss_num and fnd_api.g_miss_char.
43: --
44: -- CAUTIONS: This procedure *ALWAYS* calls other procedures with validation_level set to FND_API.G_VALID_LEVEL_NONE.
45: -- If you do not do your own validations before calling this procedure, you should set the p_validation_level
46: -- to FND_API.G_VALID_LEVEL_FULL when making the call.
40: -- You are recommended to let this procedure handle the validations if you are not sure.
41: --
42: -- NOTES: This procedure does not consider the fnd_api.g_miss_num and fnd_api.g_miss_char.
43: --
44: -- CAUTIONS: This procedure *ALWAYS* calls other procedures with validation_level set to FND_API.G_VALID_LEVEL_NONE.
45: -- If you do not do your own validations before calling this procedure, you should set the p_validation_level
46: -- to FND_API.G_VALID_LEVEL_FULL when making the call.
47: --
48: --End of Comments
42: -- NOTES: This procedure does not consider the fnd_api.g_miss_num and fnd_api.g_miss_char.
43: --
44: -- CAUTIONS: This procedure *ALWAYS* calls other procedures with validation_level set to FND_API.G_VALID_LEVEL_NONE.
45: -- If you do not do your own validations before calling this procedure, you should set the p_validation_level
46: -- to FND_API.G_VALID_LEVEL_FULL when making the call.
47: --
48: --End of Comments
49: P_Api_Version_Number IN NUMBER
50: ,P_Init_Msg_List IN VARCHAR2 := FND_API.G_FALSE
46: -- to FND_API.G_VALID_LEVEL_FULL when making the call.
47: --
48: --End of Comments
49: P_Api_Version_Number IN NUMBER
50: ,P_Init_Msg_List IN VARCHAR2 := FND_API.G_FALSE
51: ,P_Commit IN VARCHAR2 := FND_API.G_FALSE
52: ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
53: ,p_action_code IN NUMBER -- 0 = insert, 1 = update, 2 = delete
54: ,px_CSP_INV_LOC_ASSIGNMENT_ID IN OUT NOCOPY NUMBER
47: --
48: --End of Comments
49: P_Api_Version_Number IN NUMBER
50: ,P_Init_Msg_List IN VARCHAR2 := FND_API.G_FALSE
51: ,P_Commit IN VARCHAR2 := FND_API.G_FALSE
52: ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
53: ,p_action_code IN NUMBER -- 0 = insert, 1 = update, 2 = delete
54: ,px_CSP_INV_LOC_ASSIGNMENT_ID IN OUT NOCOPY NUMBER
55: ,p_CREATED_BY IN NUMBER
48: --End of Comments
49: P_Api_Version_Number IN NUMBER
50: ,P_Init_Msg_List IN VARCHAR2 := FND_API.G_FALSE
51: ,P_Commit IN VARCHAR2 := FND_API.G_FALSE
52: ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
53: ,p_action_code IN NUMBER -- 0 = insert, 1 = update, 2 = delete
54: ,px_CSP_INV_LOC_ASSIGNMENT_ID IN OUT NOCOPY NUMBER
55: ,p_CREATED_BY IN NUMBER
56: ,p_CREATION_DATE IN DATE
96: l_check_existence NUMBER := 0;
97: l_resource_type VARCHAR2(50);
98: l_assignment_id NUMBER;
99: l_default_code VARCHAR2(10) := p_default_code;
100: l_invalid_default_code VARCHAR2(1) := FND_API.G_FALSE;
101: EXCP_USER_DEFINED EXCEPTION;
102: l_record_status VARCHAR2(1) := FND_API.G_TRUE;
103: l_resource_name VARCHAR2(360);
104:
98: l_assignment_id NUMBER;
99: l_default_code VARCHAR2(10) := p_default_code;
100: l_invalid_default_code VARCHAR2(1) := FND_API.G_FALSE;
101: EXCP_USER_DEFINED EXCEPTION;
102: l_record_status VARCHAR2(1) := FND_API.G_TRUE;
103: l_resource_name VARCHAR2(360);
104:
105: BEGIN
106: -- Start of API savepoint
106: -- Start of API savepoint
107: SAVEPOINT ASSIGN_RESOURCE_INV_LOC_PUB;
108:
109: -- initialize message list
110: IF fnd_api.to_boolean(p_init_msg_list) THEN
111: FND_MSG_PUB.initialize;
112: END IF;
113:
114: -- Standard call to check for call compatibility.
111: FND_MSG_PUB.initialize;
112: END IF;
113:
114: -- Standard call to check for call compatibility.
115: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
116: p_api_version_number,
117: l_api_name,
118: G_PKG_NAME)
119: THEN
116: p_api_version_number,
117: l_api_name,
118: G_PKG_NAME)
119: THEN
120: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
121: END IF;
122: -- END IF;
123:
124: -- check p_action_code
127: RAISE EXCP_USER_DEFINED;
128: END IF;*/
129:
130: IF p_action_code in (0,1) THEN
131: IF p_validation_level = FND_API.G_VALID_LEVEL_FULL THEN
132:
133: -- start full validations
134: IF p_organization_id IS NULL THEN
135: FND_MESSAGE.SET_NAME ('CSP', 'CSP_MISSING_PARAMETERS');
263: p_default_code = NULL, do nothing.
264: -- */
265: DECLARE
266: l_subinventory_type VARCHAR2(10);
267: l_good_type VARCHAR2(1) := fnd_api.g_false;
268: l_bad_type VARCHAR2(1) := fnd_api.g_false;
269: CURSOR c_Get_Condition_Type IS
270: SELECT condition_type
271: FROM csp_sec_inventories
264: -- */
265: DECLARE
266: l_subinventory_type VARCHAR2(10);
267: l_good_type VARCHAR2(1) := fnd_api.g_false;
268: l_bad_type VARCHAR2(1) := fnd_api.g_false;
269: CURSOR c_Get_Condition_Type IS
270: SELECT condition_type
271: FROM csp_sec_inventories
272: WHERE secondary_inventory_name = p_subinventory_code
279:
280: FETCH c_Get_Condition_Type into l_subinventory_type;
281: EXIT WHEN c_Get_Condition_Type%NOTFOUND;
282: if l_subinventory_type = 'G' then
283: l_good_type := fnd_api.g_true;
284: elsif l_subinventory_type = 'B' then
285: l_bad_type := fnd_api.g_true;
286: else null;
287: end if;
281: EXIT WHEN c_Get_Condition_Type%NOTFOUND;
282: if l_subinventory_type = 'G' then
283: l_good_type := fnd_api.g_true;
284: elsif l_subinventory_type = 'B' then
285: l_bad_type := fnd_api.g_true;
286: else null;
287: end if;
288: END LOOP;
289: CLOSE c_Get_Condition_Type;
288: END LOOP;
289: CLOSE c_Get_Condition_Type;
290:
291: IF upper(l_default_code) = 'IN' THEN
292: IF fnd_api.to_boolean(l_bad_type) AND NOT fnd_api.to_boolean(l_good_type) THEN
293:
294: fnd_message.set_name('CSP', 'CSP_INVALID_IN_OUT_SUB');
295: fnd_msg_pub.ADD;
296: RAISE EXCP_USER_DEFINED;
296: RAISE EXCP_USER_DEFINED;
297: END IF;
298:
299: ELSIF upper(l_default_code) = 'OUT' THEN
300: IF fnd_api.to_boolean(l_good_type) AND NOT fnd_api.to_boolean(l_bad_type)THEN
301:
302: fnd_message.set_name('CSP', 'CSP_INVALID_IN_OUT_SUB');
303: fnd_msg_pub.ADD;
304: RAISE EXCP_USER_DEFINED;
303: fnd_msg_pub.ADD;
304: RAISE EXCP_USER_DEFINED;
305: END IF;
306:
307: ELSIF l_default_code IS NOT NULL AND NOT fnd_api.to_boolean(l_good_type)
308: AND NOT fnd_api.to_boolean(l_bad_type) AND p_action_code = 0 THEN
309:
310: fnd_message.set_name('CSP', 'CSP_RES_INV_WARNING');
311: fnd_msg_pub.ADD;
304: RAISE EXCP_USER_DEFINED;
305: END IF;
306:
307: ELSIF l_default_code IS NOT NULL AND NOT fnd_api.to_boolean(l_good_type)
308: AND NOT fnd_api.to_boolean(l_bad_type) AND p_action_code = 0 THEN
309:
310: fnd_message.set_name('CSP', 'CSP_RES_INV_WARNING');
311: fnd_msg_pub.ADD;
312: l_default_code := NULL;
359: ,p_subinventory_code => p_subinventory_code
360: ,p_default_code => p_default_code
361: ,x_return_status => l_record_status);
362:
363: IF FND_API.to_Boolean(l_record_status ) THEN
364: fnd_message.set_name('CSP', 'CSP_DUPLICATE_RECORD');
365: fnd_msg_pub.ADD;
366: RAISE EXCP_USER_DEFINED;
367: END IF;
399: l_csp_rec.ATTRIBUTE15 := p_ATTRIBUTE15;
400:
401: CSP_RESOURCE_PVT.Create_resource(
402: P_Api_Version_Number => p_api_version_number,
403: P_Init_Msg_List => FND_API.G_TRUE,
404: P_Commit => FND_API.G_FALSE,
405: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
406: P_CSP_Rec => l_csp_rec,
407: X_CSP_INV_LOC_ASSIGNMENT_ID => l_assignment_id,
400:
401: CSP_RESOURCE_PVT.Create_resource(
402: P_Api_Version_Number => p_api_version_number,
403: P_Init_Msg_List => FND_API.G_TRUE,
404: P_Commit => FND_API.G_FALSE,
405: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
406: P_CSP_Rec => l_csp_rec,
407: X_CSP_INV_LOC_ASSIGNMENT_ID => l_assignment_id,
408: X_Return_Status => l_return_status,
401: CSP_RESOURCE_PVT.Create_resource(
402: P_Api_Version_Number => p_api_version_number,
403: P_Init_Msg_List => FND_API.G_TRUE,
404: P_Commit => FND_API.G_FALSE,
405: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
406: P_CSP_Rec => l_csp_rec,
407: X_CSP_INV_LOC_ASSIGNMENT_ID => l_assignment_id,
408: X_Return_Status => l_return_status,
409: X_Msg_Count => l_msg_count,
553: p_default_code = NULL, do nothing.
554: -- */
555: /*DECLARE
556: l_subinventory_type VARCHAR2(10);
557: l_good_type VARCHAR2(1) := fnd_api.g_false;
558: l_bad_type VARCHAR2(1) := fnd_api.g_false;
559: CURSOR c_Get_Condition_Type IS
560: SELECT condition_type
561: FROM csp_sec_inventories
554: -- */
555: /*DECLARE
556: l_subinventory_type VARCHAR2(10);
557: l_good_type VARCHAR2(1) := fnd_api.g_false;
558: l_bad_type VARCHAR2(1) := fnd_api.g_false;
559: CURSOR c_Get_Condition_Type IS
560: SELECT condition_type
561: FROM csp_sec_inventories
562: WHERE secondary_inventory_name = decode(p_subinventory_code, null, l_csp_rec_update.subinventory_code, p_subinventory_code)
569: FETCH c_Get_Condition_Type into l_subinventory_type;
570: EXIT WHEN c_Get_Condition_Type%NOTFOUND;
571:
572: if l_subinventory_type = 'G' then
573: l_good_type := fnd_api.g_true;
574: elsif l_subinventory_type = 'B' then
575: l_bad_type := fnd_api.g_true;
576: else null;
577: end if;
571:
572: if l_subinventory_type = 'G' then
573: l_good_type := fnd_api.g_true;
574: elsif l_subinventory_type = 'B' then
575: l_bad_type := fnd_api.g_true;
576: else null;
577: end if;
578: END LOOP;
579: IF c_Get_Condition_Type%rowcount = 0 THEN
583: END IF;
584: CLOSE c_Get_Condition_Type;
585:
586: IF upper(nvl(p_default_code, l_csp_rec_update.default_code)) = 'IN' THEN
587: IF fnd_api.to_boolean(l_bad_type) AND NOT fnd_api.to_boolean(l_good_type) THEN
588: l_msg_data := 'Only a Good subinventory is allowed to be assigned as a Part-In subinventory.';
589: l_msg_data := l_msg_data ||' Please check the condition type of subinventory '||p_subinventory_code||'.';
590: RAISE EXCP_USER_DEFINED;
591: END IF;
590: RAISE EXCP_USER_DEFINED;
591: END IF;
592:
593: ELSIF upper(nvl(p_default_code, l_csp_rec_update.default_code)) = 'OUT' THEN
594: IF fnd_api.to_boolean(l_good_type) AND NOT fnd_api.to_boolean(l_bad_type)THEN
595: l_msg_data := 'Only a Bad subinventory is allowed to be assigned as a Part-Out subinventory.';
596: l_msg_data := l_msg_data ||' Please check the condition type of subinventory '||p_subinventory_code||'.';
597: RAISE EXCP_USER_DEFINED;
598: END IF;
596: l_msg_data := l_msg_data ||' Please check the condition type of subinventory '||p_subinventory_code||'.';
597: RAISE EXCP_USER_DEFINED;
598: END IF;
599:
600: -- ELSIF decode(p_default_code, null, l_csp_rec_update.default_code, p_default_code) IS NOT NULL AND NOT fnd_api.to_boolean(l_good_type)
601: -- AND NOT fnd_api.to_boolean(l_bad_type) THEN
602: -- l_msg_data := 'Warning: Default Code is not an "IN" or an "OUT" type. Please query the record and re-assign a valid Default Code.';
603: -- fnd_message.set_name(l_msg_data, 'API_ASSIGN_RESOURCE_INV_LOC');
604: -- fnd_message.set_token('ROUTINE', 'Assign_Resource_Inv_Loc');
597: RAISE EXCP_USER_DEFINED;
598: END IF;
599:
600: -- ELSIF decode(p_default_code, null, l_csp_rec_update.default_code, p_default_code) IS NOT NULL AND NOT fnd_api.to_boolean(l_good_type)
601: -- AND NOT fnd_api.to_boolean(l_bad_type) THEN
602: -- l_msg_data := 'Warning: Default Code is not an "IN" or an "OUT" type. Please query the record and re-assign a valid Default Code.';
603: -- fnd_message.set_name(l_msg_data, 'API_ASSIGN_RESOURCE_INV_LOC');
604: -- fnd_message.set_token('ROUTINE', 'Assign_Resource_Inv_Loc');
605: -- fnd_msg_pub.ADD;
660: END;
661: END IF;
662: CSP_RESOURCE_PVT.Update_resource(
663: P_Api_Version_Number => p_api_version_number,
664: P_Init_Msg_List => FND_API.G_TRUE,
665: P_Commit => FND_API.G_FALSE,
666: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
667: P_CSP_Rec => l_csp_rec,
668: X_Return_Status => l_return_status,
661: END IF;
662: CSP_RESOURCE_PVT.Update_resource(
663: P_Api_Version_Number => p_api_version_number,
664: P_Init_Msg_List => FND_API.G_TRUE,
665: P_Commit => FND_API.G_FALSE,
666: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
667: P_CSP_Rec => l_csp_rec,
668: X_Return_Status => l_return_status,
669: X_Msg_Count => l_msg_count,
662: CSP_RESOURCE_PVT.Update_resource(
663: P_Api_Version_Number => p_api_version_number,
664: P_Init_Msg_List => FND_API.G_TRUE,
665: P_Commit => FND_API.G_FALSE,
666: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
667: P_CSP_Rec => l_csp_rec,
668: X_Return_Status => l_return_status,
669: X_Msg_Count => l_msg_count,
670: X_Msg_Data => l_msg_data
672: ELSE
673: -- call the delete procedure
674: CSP_RESOURCE_PVT.Delete_resource(
675: P_Api_Version_Number => p_api_version_number,
676: P_Init_Msg_List => FND_API.G_TRUE,
677: P_Commit => FND_API.G_FALSE,
678: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
679: P_CSP_Rec => l_csp_rec,
680: X_Return_Status => l_return_status,
673: -- call the delete procedure
674: CSP_RESOURCE_PVT.Delete_resource(
675: P_Api_Version_Number => p_api_version_number,
676: P_Init_Msg_List => FND_API.G_TRUE,
677: P_Commit => FND_API.G_FALSE,
678: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
679: P_CSP_Rec => l_csp_rec,
680: X_Return_Status => l_return_status,
681: X_Msg_Count => l_msg_count,
674: CSP_RESOURCE_PVT.Delete_resource(
675: P_Api_Version_Number => p_api_version_number,
676: P_Init_Msg_List => FND_API.G_TRUE,
677: P_Commit => FND_API.G_FALSE,
678: p_validation_level => FND_API.G_VALID_LEVEL_NONE,
679: P_CSP_Rec => l_csp_rec,
680: X_Return_Status => l_return_status,
681: X_Msg_Count => l_msg_count,
682: X_Msg_Data => l_msg_data
690: fnd_msg_pub.add;
691: RAISE EXCP_USER_DEFINED;
692: END IF;
693:
694: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
695: RAISE FND_API.G_EXC_ERROR;
696: ELSE
697: x_return_status := fnd_api.g_ret_sts_success;
698: px_CSP_INV_LOC_ASSIGNMENT_ID := l_assignment_id;
691: RAISE EXCP_USER_DEFINED;
692: END IF;
693:
694: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
695: RAISE FND_API.G_EXC_ERROR;
696: ELSE
697: x_return_status := fnd_api.g_ret_sts_success;
698: px_CSP_INV_LOC_ASSIGNMENT_ID := l_assignment_id;
699: IF fnd_api.to_boolean(p_commit) THEN
693:
694: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
695: RAISE FND_API.G_EXC_ERROR;
696: ELSE
697: x_return_status := fnd_api.g_ret_sts_success;
698: px_CSP_INV_LOC_ASSIGNMENT_ID := l_assignment_id;
699: IF fnd_api.to_boolean(p_commit) THEN
700: commit work;
701: END IF;
695: RAISE FND_API.G_EXC_ERROR;
696: ELSE
697: x_return_status := fnd_api.g_ret_sts_success;
698: px_CSP_INV_LOC_ASSIGNMENT_ID := l_assignment_id;
699: IF fnd_api.to_boolean(p_commit) THEN
700: commit work;
701: END IF;
702: END IF;
703:
706:
707: fnd_msg_pub.count_and_get
708: ( p_count => x_msg_count
709: , p_data => x_msg_data);
710: x_return_status := FND_API.G_RET_STS_ERROR;
711:
712: WHEN FND_API.G_EXC_ERROR THEN
713:
714: JTF_PLSQL_API.HANDLE_EXCEPTIONS(
708: ( p_count => x_msg_count
709: , p_data => x_msg_data);
710: x_return_status := FND_API.G_RET_STS_ERROR;
711:
712: WHEN FND_API.G_EXC_ERROR THEN
713:
714: JTF_PLSQL_API.HANDLE_EXCEPTIONS(
715: P_API_NAME => L_API_NAME
716: ,P_PKG_NAME => G_PKG_NAME
719: ,X_MSG_COUNT => X_MSG_COUNT
720: ,X_MSG_DATA => X_MSG_DATA
721: ,X_RETURN_STATUS => X_RETURN_STATUS);
722:
723: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
724:
725: JTF_PLSQL_API.HANDLE_EXCEPTIONS(
726: P_API_NAME => L_API_NAME
727: ,P_PKG_NAME => G_PKG_NAME
754: -- History :
755: -- 11-Dev-1999, modified to include the case where p_default_code is null.
756: -- 15-Dec-1999, created by vernon.
757: --
758: -- Note : If the record already exists, x_return_status is set to fnd_api.g_true, if not to fnd_api.g_false.
759: --End of Comments
760:
761: p_resource_id IN NUMBER
762: ,p_resource_type IN VARCHAR2
787: END IF;
788:
789:
790: -- If the no_data_found exception was not thrown by the above statement, the record should already exits.
791: x_return_status := FND_API.G_TRUE;
792:
793: EXCEPTION
794: WHEN NO_DATA_FOUND THEN
795: x_return_status := FND_API.G_FALSE;
791: x_return_status := FND_API.G_TRUE;
792:
793: EXCEPTION
794: WHEN NO_DATA_FOUND THEN
795: x_return_status := FND_API.G_FALSE;
796: WHEN OTHERS THEN
797: -- any other exceptions besides no_data_found should be considered invalid situations.
798: x_return_status := FND_API.G_TRUE;
799:
794: WHEN NO_DATA_FOUND THEN
795: x_return_status := FND_API.G_FALSE;
796: WHEN OTHERS THEN
797: -- any other exceptions besides no_data_found should be considered invalid situations.
798: x_return_status := FND_API.G_TRUE;
799:
800: END Validate_Assignment_Record;
801:
802: End CSP_RESOURCE_PUB;