1: PACKAGE BODY OE_ITORD_PUB AS
2: /* $Header: OEXPITOB.pls 120.1 2008/01/24 08:37:30 smanian noship $ */
3:
4:
5: G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_ITORD_PUB';
1: PACKAGE BODY OE_ITORD_PUB AS
2: /* $Header: OEXPITOB.pls 120.1 2008/01/24 08:37:30 smanian noship $ */
3:
4:
5: G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_ITORD_PUB';
6:
7: /* This procedure shall be called by custom programs to import item orderability rules into OM */
8:
9: Procedure Import_Item_orderability_rules ( p_Item_Orderability_Import_Tbl IN OUT NOCOPY OE_ITORD_PUB.Item_Orderability_Import_Tbl
5: G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_ITORD_PUB';
6:
7: /* This procedure shall be called by custom programs to import item orderability rules into OM */
8:
9: Procedure Import_Item_orderability_rules ( p_Item_Orderability_Import_Tbl IN OUT NOCOPY OE_ITORD_PUB.Item_Orderability_Import_Tbl
10: , p_commit_flag IN VARCHAR2 DEFAULT 'N') IS
11: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
12: begin
13:
12: begin
13:
14:
15: IF l_debug_level > 0 then
16: oe_debug_pub.add('Entering OE_ITORD_PUB.Import_Item_orderability_rules');
17: End If;
18:
19: for i in 1..p_Item_Orderability_Import_Tbl.count loop
20:
17: End If;
18:
19: for i in 1..p_Item_Orderability_Import_Tbl.count loop
20:
21: OE_ITORD_PUB.Check_required_fields( p_Item_Orderability_Import_Tbl(i));
22: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
23: OE_ITORD_PUB.Validate_required_fields ( p_Item_Orderability_Import_Tbl(i));
24: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
25: OE_ITORD_PUB.Validate_conditional_fields ( p_Item_Orderability_Import_Tbl(i));
19: for i in 1..p_Item_Orderability_Import_Tbl.count loop
20:
21: OE_ITORD_PUB.Check_required_fields( p_Item_Orderability_Import_Tbl(i));
22: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
23: OE_ITORD_PUB.Validate_required_fields ( p_Item_Orderability_Import_Tbl(i));
24: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
25: OE_ITORD_PUB.Validate_conditional_fields ( p_Item_Orderability_Import_Tbl(i));
26: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
27: OE_ITORD_PUB.check_duplicate_rules ( p_Item_Orderability_Import_Tbl(i) );
21: OE_ITORD_PUB.Check_required_fields( p_Item_Orderability_Import_Tbl(i));
22: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
23: OE_ITORD_PUB.Validate_required_fields ( p_Item_Orderability_Import_Tbl(i));
24: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
25: OE_ITORD_PUB.Validate_conditional_fields ( p_Item_Orderability_Import_Tbl(i));
26: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
27: OE_ITORD_PUB.check_duplicate_rules ( p_Item_Orderability_Import_Tbl(i) );
28: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
29: OE_ITORD_PUB.Validate_rules_DFF (p_Item_Orderability_Import_Tbl(i));
23: OE_ITORD_PUB.Validate_required_fields ( p_Item_Orderability_Import_Tbl(i));
24: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
25: OE_ITORD_PUB.Validate_conditional_fields ( p_Item_Orderability_Import_Tbl(i));
26: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
27: OE_ITORD_PUB.check_duplicate_rules ( p_Item_Orderability_Import_Tbl(i) );
28: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
29: OE_ITORD_PUB.Validate_rules_DFF (p_Item_Orderability_Import_Tbl(i));
30: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
31: OE_ITORD_PUB.insert_rules(p_Item_Orderability_Import_Tbl(i));
25: OE_ITORD_PUB.Validate_conditional_fields ( p_Item_Orderability_Import_Tbl(i));
26: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
27: OE_ITORD_PUB.check_duplicate_rules ( p_Item_Orderability_Import_Tbl(i) );
28: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
29: OE_ITORD_PUB.Validate_rules_DFF (p_Item_Orderability_Import_Tbl(i));
30: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
31: OE_ITORD_PUB.insert_rules(p_Item_Orderability_Import_Tbl(i));
32: END IF;
33:
27: OE_ITORD_PUB.check_duplicate_rules ( p_Item_Orderability_Import_Tbl(i) );
28: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
29: OE_ITORD_PUB.Validate_rules_DFF (p_Item_Orderability_Import_Tbl(i));
30: IF p_Item_Orderability_Import_Tbl(i).status = FND_API.G_RET_STS_SUCCESS then
31: OE_ITORD_PUB.insert_rules(p_Item_Orderability_Import_Tbl(i));
32: END IF;
33:
34: END IF;
35: END IF;
44: rollback;
45: End If;
46:
47: IF l_debug_level > 0 then
48: oe_debug_pub.add('Leaving OE_ITORD_PUB.Import_Item_orderability_rules');
49: End If;
50:
51: Exception
52: when others then
57: );
58: End Import_Item_orderability_rules;
59:
60:
61: Procedure Check_required_fields ( p_Item_Orderability_Import_Rec IN OUT NOCOPY OE_ITORD_PUB.Item_Orderability_Import_Rec )
62: IS
63: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
64: begin
65:
64: begin
65:
66:
67: IF l_debug_level > 0 then
68: oe_debug_pub.add('Entering OE_ITORD_PUB.Check_required_fields');
69: End If;
70:
71: p_Item_Orderability_Import_Rec.status := FND_API.G_RET_STS_SUCCESS;
72: p_Item_Orderability_Import_Rec.msg_data := NULL;
140: END IF;
141:
142:
143: IF l_debug_level > 0 then
144: oe_debug_pub.add('Leaving OE_ITORD_PUB.Check_required_fields');
145: End If;
146:
147: Exception
148: when others then
148: when others then
149: NULL;
150: End Check_required_fields;
151:
152: Procedure Validate_required_fields ( p_Item_Orderability_Import_REC IN OUT NOCOPY OE_ITORD_PUB.Item_Orderability_Import_REC )
153: IS
154:
155: l_exists varchar2(1);
156: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
157: begin
158:
159:
160: IF l_debug_level > 0 then
161: oe_debug_pub.add('Entering OE_ITORD_PUB.Validate_required_fields');
162: End If;
163:
164: p_Item_Orderability_Import_Rec.status := FND_API.G_RET_STS_SUCCESS;
165: p_Item_Orderability_Import_Rec.msg_data := NULL;
270: END IF;
271:
272:
273: IF l_debug_level > 0 then
274: oe_debug_pub.add('Leaving OE_ITORD_PUB.Validate_required_fields');
275: End If;
276:
277: Exception
278: when others then
282: End Validate_required_fields;
283:
284:
285:
286: Procedure Validate_conditional_fields ( p_Item_Orderability_Import_Rec IN OUT NOCOPY OE_ITORD_PUB.Item_Orderability_Import_Rec )
287: IS
288: l_exists VARCHAR2(1);
289: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
290: begin
289: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
290: begin
291:
292: IF l_debug_level > 0 then
293: oe_debug_pub.add('Entering OE_ITORD_PUB.Validate_conditional_fields');
294: End If;
295:
296: p_Item_Orderability_Import_Rec.status := FND_API.G_RET_STS_SUCCESS;
297: p_Item_Orderability_Import_Rec.msg_data := NULL;
810: p_Item_Orderability_Import_Rec.inventory_item_id := NULL;
811: END IF;
812:
813: IF l_debug_level > 0 then
814: oe_debug_pub.add('Leaving OE_ITORD_PUB.Validate_conditional_fields');
815: End If;
816:
817: Exception
818: when others then
821: p_Item_Orderability_Import_Rec.msg_count := 1;
822: End Validate_conditional_fields;
823:
824:
825: Procedure check_duplicate_rules ( p_Item_Orderability_Import_Rec IN OUT NOCOPY OE_ITORD_PUB.Item_Orderability_Import_Rec )
826: IS
827: l_exists Varchar2(1);
828: l_return_token boolean := TRUE;
829: l_rule_level_coulmn VARCHAR2(1000);
834: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
835: begin
836:
837: IF l_debug_level > 0 then
838: oe_debug_pub.add('Entering OE_ITORD_PUB.check_duplicate_rules');
839: End If;
840:
841: p_Item_Orderability_Import_Rec.status := FND_API.G_RET_STS_SUCCESS;
842: p_Item_Orderability_Import_Rec.msg_data := NULL;
868: when no_data_found then
869: NULL;
870: End;
871:
872: OE_ITORD_PUB.get_rule_coulumn_details(p_Item_Orderability_Import_Rec,l_rule_level_coulmn,l_rule_level_value,l_data_type);
873:
874: sql_stmt := ' select count(1) '
875: || ' from oe_item_orderability io_hdr , oe_item_orderability_rules io_rules '
876: || ' where io_hdr.orderability_id = io_rules.orderability_id '
931: NULL;
932: End ;
933:
934:
935: OE_ITORD_PUB.get_rule_coulumn_details(p_Item_Orderability_Import_Rec,l_rule_level_coulmn,l_rule_level_value,l_data_type);
936:
937: sql_stmt := ' select count(1) '
938: || ' from oe_item_orderability io_hdr , oe_item_orderability_rules io_rules '
939: || ' where io_hdr.orderability_id = io_rules.orderability_id '
967:
968: End If;
969:
970: IF l_debug_level > 0 then
971: oe_debug_pub.add('Leaving OE_ITORD_PUB.check_duplicate_rules');
972: End If;
973:
974: Exception
975: when others then
977: p_Item_Orderability_Import_Rec.msg_data := SQLERRM;
978: p_Item_Orderability_Import_Rec.msg_count := 1;
979: End check_duplicate_rules;
980:
981: Procedure get_rule_coulumn_details( p_Item_Orderability_Import_Rec IN OE_ITORD_PUB.Item_Orderability_Import_Rec ,
982: x_rule_level_column OUT NOCOPY VARCHAR2,
983: x_rule_level_value OUT NOCOPY VARCHAR2,
984: x_data_type OUT NOCOPY VARCHAR2
985: ) IS
1038: END IF;
1039:
1040: End;
1041:
1042: Procedure insert_rules( p_Item_Orderability_Import_Rec IN OUT NOCOPY OE_ITORD_PUB.Item_Orderability_Import_Rec ) IS
1043:
1044: l_item_orderability_rec OE_ITORD_UTIL.Item_Orderability_Rec;
1045: l_item_orderability_rules_rec OE_ITORD_UTIL.Item_Orderability_Rules_Rec;
1046: l_orderability_id NUMBER;
1050: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
1051: begin
1052:
1053: IF l_debug_level > 0 then
1054: oe_debug_pub.add('Entering OE_ITORD_PUB.insert_rules');
1055: End If;
1056:
1057: p_Item_Orderability_Import_Rec.status := FND_API.G_RET_STS_SUCCESS;
1058: p_Item_Orderability_Import_Rec.msg_data := NULL;
1154: End If;
1155:
1156:
1157: IF l_debug_level > 0 then
1158: oe_debug_pub.add('Leaving OE_ITORD_PUB.insert_rules');
1159: End If;
1160:
1161: Exception
1162: when others then
1167:
1168: End insert_rules;
1169:
1170:
1171: Procedure Validate_rules_DFF (p_Item_Orderability_Import_Rec IN OUT NOCOPY OE_ITORD_PUB.Item_Orderability_Import_Rec )
1172: IS
1173: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
1174: BEGIN
1175:
1173: l_debug_level NUMBER := oe_debug_pub.g_debug_level;
1174: BEGIN
1175:
1176: IF l_debug_level > 0 then
1177: oe_debug_pub.add('Entering OE_ITORD_PUB.Validate_rules_DFF ');
1178: End If;
1179:
1180:
1181: FND_FLEX_DESCVAL.Set_Context_Value
1262:
1263:
1264:
1265: IF l_debug_level > 0 then
1266: oe_debug_pub.add('Leaving OE_ITORD_PUB.Validate_rules_DFF ');
1267: End If;
1268:
1269: EXCEPTION
1270:
1276: END Validate_rules_DFF;
1277:
1278:
1279:
1280: END OE_ITORD_PUB;