[Home] [Help]
PACKAGE BODY: APPS.OE_ORDER_IMPORT_CONFIG_PVT
Source
1 PACKAGE BODY OE_ORDER_IMPORT_CONFIG_PVT AS
2 /* $Header: OEXVIMCB.pls 120.1 2005/09/10 20:50:38 jjmcfarl noship $ */
3
4 /* ---------------------------------------------------------------
5 -- Start of Comments
6 -- API name OE_ORDER_IMPORT_CONFIG_PVT
7 -- Type Private
8 -- Function
9 -- Pre-reqs
10 -- Parameters
11 -- Version Current version = 1.0
12 -- Initial version = 1.0
13 -- Notes
14 --
15 -- End of Comments
16 ------------------------------------------------------------------
17 */
18
19 /* -----------------------------------------------------------
20 Procedure: Pre_Process
21 -----------------------------------------------------------
22 */
23 PROCEDURE Pre_Process(
24 p_header_rec IN OE_Order_Pub.Header_Rec_Type
25 ,p_x_line_tbl IN OUT NOCOPY OE_Order_Pub.Line_Tbl_Type
26 ,p_return_status OUT NOCOPY VARCHAR2
27
28 ) IS
29
30 l_orig_sys_document_ref VARCHAR2(50);
31 l_orig_sys_line_ref VARCHAR2(50);
32 l_orig_sys_shipment_ref VARCHAR2(50);
33
34 l_organization_id NUMBER;
35 l_sequence_id NUMBER;
36 l_sort_order VARCHAR2(2000);
37 l_component_code VARCHAR2(1000);
38 l_msg_index NUMBER;
39 l_msg_data VARCHAR2(2000);
40 l_error_code NUMBER;
41 l_api_name CONSTANT VARCHAR2(30) := 'Pre_Process';
42
43 --
44 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
45 --
46 BEGIN
47 /* -----------------------------------------------------------
48 Model/Configurations Pre_Process
49 -----------------------------------------------------------
50 */
51 IF l_debug_level > 0 THEN
52 oe_debug_pub.add( 'BEFORE DOING MODEL/CONFIGURATIONS PRE_PROCESS' ) ;
53 END IF;
54
55 /* -----------------------------------------------------------
56 Get OE_Organization_Id
57 -----------------------------------------------------------
58 */
59 IF l_debug_level > 0 THEN
60 oe_debug_pub.add( 'BEFORE GETTING OE_ORGANIZATION_ID' ) ;
61 END IF;
62
63 -- This change is required since we are dropping the profile OE_ORGANIZATION -- _ID. Change made by Esha.
64 l_organization_id := OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID', p_header_rec.org_id);
65 /*FND_PROFILE.Get('OE_ORGANIZATION_ID', l_organization_id);*/
66
67 IF l_debug_level > 0 THEN
68 oe_debug_pub.add( 'OE ORGANIZATION ID: '|| TO_CHAR ( L_ORGANIZATION_ID ) ) ;
69 END IF;
70
71
72 FOR i IN 1 .. p_x_line_tbl.count
73 LOOP
74 IF l_debug_level > 0 THEN
75 oe_debug_pub.add( 'BEFORE PROCESSING LINE FOR '|| 'REF: ' || RTRIM ( P_X_LINE_TBL ( I ) .ORIG_SYS_LINE_REF ) || ' ID:' || P_X_LINE_TBL ( I ) .INVENTORY_ITEM_ID || ' TYPE: ' || RTRIM ( P_X_LINE_TBL ( I ) .ITEM_TYPE_CODE ) ) ;
76 END IF;
77
78 /* -----------------------------------------------------------
79 Set message context
80 -----------------------------------------------------------
81 */
82 IF l_debug_level > 0 THEN
83 oe_debug_pub.add( 'BEFORE SETTING MESSAGE CONTEXT' ) ;
84 END IF;
85
86 OE_MSG_PUB.set_msg_context(
87 p_entity_code => 'LINE'
88 ,p_entity_ref => null
89 ,p_entity_id => null
90 ,p_header_id => p_header_rec.header_id
91 ,p_line_id => p_x_line_tbl(i).line_id
92 -- ,p_batch_request_id => p_header_rec.request_id
93 ,p_order_source_id => p_header_rec.order_source_id
94 ,p_orig_sys_document_ref => p_header_rec.orig_sys_document_ref
95 ,p_change_sequence => p_header_rec.change_sequence
96 ,p_orig_sys_document_line_ref => p_x_line_tbl(i).orig_sys_line_ref
97 ,p_orig_sys_shipment_ref => p_x_line_tbl(i).orig_sys_shipment_ref
98 ,p_source_document_type_id => null
99 ,p_source_document_id => null
100 ,p_source_document_line_id => null
101 ,p_attribute_code => null
102 ,p_constraint_id => null
103 );
104
105
106 /* ----- Removed as this is also done as part of Config api --
107 Setting Link_To_Line_Index
108 -----------------------------------------------------------
109 -- Bug fix 1707492 -- start --
110 IF p_x_line_tbl(i).link_to_line_ref IS NOT NULL THEN
111 oe_debug_pub.add('before setting Link_To_Line_Index');
112
113 FOR j IN 1 .. p_x_line_tbl.count
114 LOOP
115 IF p_x_line_tbl(j).orig_sys_line_ref =
116 p_x_line_tbl(i).link_to_line_ref
117 THEN
118 p_x_line_tbl(i).link_to_line_index := j;
119 END IF;
120 END LOOP;
121 END IF;
122 -- Bug fix 1707492 -- end --
123
124 */
125
126 IF (nvl(p_x_line_tbl(i).item_type_code,'STANDARD') = 'MODEL') OR
127 (p_x_line_tbl(i).item_type_code = FND_API.G_MISS_CHAR AND
128 p_x_line_tbl(i).orig_sys_line_ref = p_x_line_tbl(i).top_model_line_ref)
129 THEN
130
131 /* -----------------------------------------------------------
132 Set Top_Model_Line_Index, Component_Sequence_Id, Component_Code
133 and Sort_Order for the classes and options of this model
134 -----------------------------------------------------------
135 */
136 FOR j IN 1 .. p_x_line_tbl.count
137 LOOP
138 IF p_x_line_tbl(j).top_model_line_ref = p_x_line_tbl(i).orig_sys_line_ref
139 THEN
140 /* -----------------------------------------------------------
141 Setting Top_Model_Line_Index for the options
142 -----------------------------------------------------------
143 */
144 IF l_debug_level > 0 THEN
145 oe_debug_pub.add( 'BEFORE SETTING TOP_MODEL_LINE_INDEX FOR '|| RTRIM ( P_X_LINE_TBL ( J ) .ITEM_TYPE_CODE ) || ' REF: ' || RTRIM ( P_X_LINE_TBL ( J ) .ORIG_SYS_LINE_REF ) || ' AND ITEM ID:' || ( P_X_LINE_TBL ( J ) .INVENTORY_ITEM_ID ) ) ;
146 END IF;
147 -- This is added for the bug# 1380879 both service and top model reference
148 -- can not be present together
149 If nvl(p_x_line_tbl(j).service_reference_line, FND_API.G_MISS_CHAR) =
150 FND_API.G_MISS_CHAR Then
151 p_x_line_tbl(j).top_model_line_index := i;
152 Else
153 p_return_status := FND_API.G_RET_STS_ERROR;
154 FND_MESSAGE.Set_Name('ONT', 'OE_SERV_LINE_WITH_TOP_REF');
155 FND_MESSAGE.Set_Token('ITEM', p_x_line_tbl(j).inventory_item_id);
156 oe_msg_pub.add;
157 RETURN;
158 End If;
159
160 /* -----------------------------------------------------------
161 Setting Component_Sequence_Id, Component_Code and
162 Sort_Order for the options
163 -----------------------------------------------------------
164 */
165 IF l_debug_level > 0 THEN
166 oe_debug_pub.add( 'BEFORE SETTING COMPONENT_SEQUENCE_ID FOR ' || RTRIM ( P_X_LINE_TBL ( J ) .ITEM_TYPE_CODE ) );
167 oe_debug_pub.add( ' REF: ' || RTRIM ( P_X_LINE_TBL ( J ) .ORIG_SYS_LINE_REF ) || ' AND ITEM ID:' || ( P_X_LINE_TBL ( J ) .INVENTORY_ITEM_ID ) ) ;
168 END IF;
169
170 END IF; /* IF p_x_line_tbl(j).top_model_line_ref = */
171 END LOOP; /* FOR j IN ... */
172
173 /* -----------------------------------------------------------
174 Change the item type code to CLASS in case of ATO under PTO
175 -----------------------------------------------------------
176 */
177 /* aksingh to check */
178 END IF; /* IF nvl(p_x_line_tbl(i).item_type_code,'STANDARD')='MODEL' */
179
180 END LOOP; /* FOR i IN ... */
181
182 END Pre_Process;
183
184 END OE_ORDER_IMPORT_CONFIG_PVT;