DBA Data[Home] [Help]

PACKAGE BODY: APPS.CST_COST_TYPES_PKG

Source


1 PACKAGE BODY CST_COST_TYPES_PKG as
2 /* $Header: cstpcctb.pls 115.2 2002/11/11 23:05:48 awwang ship $ */
3 
4 PROCEDURE Insert_Row(X_Rowid                        IN OUT NOCOPY VARCHAR2,
5                      X_Cost_Type_Id                 IN OUT NOCOPY NUMBER,
6                      X_Last_Update_Date                    DATE,
7                      X_Last_Updated_By                     NUMBER,
8                      X_Creation_Date                       DATE,
9                      X_Created_By                          NUMBER,
10                      X_Last_Update_Login                   NUMBER DEFAULT NULL,
11                      X_Organization_Id                     NUMBER DEFAULT NULL,
12                      X_Cost_Type                           VARCHAR2,
13                      X_Description                         VARCHAR2 DEFAULT NULL,
14                      X_Costing_Method_Type                 NUMBER,
15                      X_Frozen_Standard_Flag                NUMBER DEFAULT NULL,
16                      X_Default_Cost_Type_Id         IN OUT NOCOPY NUMBER,
17                      X_Bom_Snapshot_Flag                   NUMBER,
18                      X_Allow_Updates_Flag                  NUMBER DEFAULT NULL,
19                      X_Pl_Element_Flag                     NUMBER,
20                      X_Pl_Resource_Flag                    NUMBER,
21                      X_Pl_Operation_Flag                   NUMBER,
22                      X_Pl_Activity_Flag                    NUMBER,
23                      X_Disable_Date                        DATE DEFAULT NULL,
24                      X_Available_To_Eng_Flag               NUMBER DEFAULT NULL,
25                      X_Component_Yield_Flag                NUMBER,
26                      X_Attribute_Category                  VARCHAR2 DEFAULT NULL,
27                      X_Attribute1                          VARCHAR2 DEFAULT NULL,
28                      X_Attribute2                          VARCHAR2 DEFAULT NULL,
29                      X_Attribute3                          VARCHAR2 DEFAULT NULL,
30                      X_Attribute4                          VARCHAR2 DEFAULT NULL,
31                      X_Attribute5                          VARCHAR2 DEFAULT NULL,
32                      X_Attribute6                          VARCHAR2 DEFAULT NULL,
33                      X_Attribute7                          VARCHAR2 DEFAULT NULL,
34                      X_Attribute8                          VARCHAR2 DEFAULT NULL,
35                      X_Attribute9                          VARCHAR2 DEFAULT NULL,
36                      X_Attribute10                         VARCHAR2 DEFAULT NULL,
37                      X_Attribute11                         VARCHAR2 DEFAULT NULL,
38                      X_Attribute12                         VARCHAR2 DEFAULT NULL,
39                      X_Attribute13                         VARCHAR2 DEFAULT NULL,
40                      X_Attribute14                         VARCHAR2 DEFAULT NULL,
41                      X_Attribute15                         VARCHAR2 DEFAULT NULL,
42                      X_Alternate_Bom_Designator            VARCHAR2 DEFAULT NULL
43  ) IS
44    CURSOR C IS SELECT rowid FROM cst_cost_types
45 
46              WHERE cost_type_id = X_Cost_Type_Id;
47 
48 
49 
50 
51 
52     CURSOR C2 IS SELECT cst_cost_types_s.nextval FROM sys.dual;
53 BEGIN
54 
55    if (X_Cost_Type_Id is NULL) then
56      OPEN C2;
57      FETCH C2 INTO X_Cost_Type_Id;
58      CLOSE C2;
59    end if;
60    if (X_Default_Cost_Type_Id is NULL) then
61      X_Default_Cost_Type_Id := X_Cost_Type_Id;
62    end if;
63   INSERT INTO cst_cost_types(
64           cost_type_id,
65           last_update_date,
66           last_updated_by,
67           creation_date,
68           created_by,
69           last_update_login,
70           organization_id,
71           cost_type,
72           description,
73           costing_method_type,
74           frozen_standard_flag,
75           default_cost_type_id,
76           bom_snapshot_flag,
77           allow_updates_flag,
78           pl_element_flag,
79           pl_resource_flag,
80           pl_operation_flag,
81           pl_activity_flag,
82           disable_date,
83           available_to_eng_flag,
84           component_yield_flag,
85           attribute_category,
86           attribute1,
87           attribute2,
88           attribute3,
89           attribute4,
90           attribute5,
91           attribute6,
92           attribute7,
93           attribute8,
94           attribute9,
95           attribute10,
96           attribute11,
97           attribute12,
98           attribute13,
99           attribute14,
100           attribute15,
101           alternate_bom_designator
102          ) VALUES (
103           X_Cost_Type_Id,
104           X_Last_Update_Date,
105           X_Last_Updated_By,
106           X_Creation_Date,
107           X_Created_By,
108           X_Last_Update_Login,
109           X_Organization_Id,
110           X_Cost_Type,
111           X_Description,
112           X_Costing_Method_Type,
113           X_Frozen_Standard_Flag,
114           nvl(X_Default_Cost_Type_Id, X_Cost_Type_Id),
115           X_Bom_Snapshot_Flag,
116           X_Allow_Updates_Flag,
117           X_Pl_Element_Flag,
118           X_Pl_Resource_Flag,
119           X_Pl_Operation_Flag,
120           X_Pl_Activity_Flag,
121           X_Disable_Date,
122           X_Available_To_Eng_Flag,
123           X_Component_Yield_Flag,
124           X_Attribute_Category,
125           X_Attribute1,
126           X_Attribute2,
127           X_Attribute3,
128           X_Attribute4,
129           X_Attribute5,
130           X_Attribute6,
131           X_Attribute7,
132           X_Attribute8,
133           X_Attribute9,
134           X_Attribute10,
135           X_Attribute11,
136           X_Attribute12,
137           X_Attribute13,
138           X_Attribute14,
139           X_Attribute15,
140           X_Alternate_Bom_Designator
141 
142   );
143 
144   OPEN C;
145   FETCH C INTO X_Rowid;
146   if (C%NOTFOUND) then
147     CLOSE C;
148     RAISE NO_DATA_FOUND;
149   end if;
150   CLOSE C;
151 END Insert_Row;
152 PROCEDURE Lock_Row(X_Rowid                                 VARCHAR2,
153                    X_Cost_Type_Id                          NUMBER,
154                    X_Organization_Id                       NUMBER DEFAULT NULL,
155                    X_Cost_Type                             VARCHAR2,
156                    X_Description                           VARCHAR2 DEFAULT NULL,
157                    X_Costing_Method_Type                   NUMBER,
158                    X_Frozen_Standard_Flag                  NUMBER DEFAULT NULL,
159                    X_Default_Cost_Type_Id                  NUMBER,
160                    X_Bom_Snapshot_Flag                     NUMBER,
161                    X_Allow_Updates_Flag                    NUMBER DEFAULT NULL,
162                    X_Pl_Element_Flag                       NUMBER,
163                    X_Pl_Resource_Flag                      NUMBER,
164                    X_Pl_Operation_Flag                     NUMBER,
165                    X_Pl_Activity_Flag                      NUMBER,
166                    X_Disable_Date                          DATE DEFAULT NULL,
167                    X_Available_To_Eng_Flag                 NUMBER DEFAULT NULL,
168                    X_Component_Yield_Flag                  NUMBER,
169                    X_Attribute_Category                    VARCHAR2 DEFAULT NULL,
170                    X_Attribute1                            VARCHAR2 DEFAULT NULL,
171                    X_Attribute2                            VARCHAR2 DEFAULT NULL,
172                    X_Attribute3                            VARCHAR2 DEFAULT NULL,
173                    X_Attribute4                            VARCHAR2 DEFAULT NULL,
174                    X_Attribute5                            VARCHAR2 DEFAULT NULL,
175                    X_Attribute6                            VARCHAR2 DEFAULT NULL,
176                    X_Attribute7                            VARCHAR2 DEFAULT NULL,
177                    X_Attribute8                            VARCHAR2 DEFAULT NULL,
178                    X_Attribute9                            VARCHAR2 DEFAULT NULL,
179                    X_Attribute10                           VARCHAR2 DEFAULT NULL,
180                    X_Attribute11                           VARCHAR2 DEFAULT NULL,
181                    X_Attribute12                           VARCHAR2 DEFAULT NULL,
182                    X_Attribute13                           VARCHAR2 DEFAULT NULL,
183                    X_Attribute14                           VARCHAR2 DEFAULT NULL,
184                    X_Attribute15                           VARCHAR2 DEFAULT NULL,
185                    X_Alternate_Bom_Designator              VARCHAR2 DEFAULT NULL
186 ) IS
187   CURSOR C IS
188       SELECT *
189       FROM   cst_cost_types
190       WHERE  rowid = X_Rowid
191       FOR UPDATE of Cost_Type_Id NOWAIT;
192   Recinfo C%ROWTYPE;
193 BEGIN
194   OPEN C;
195   FETCH C INTO Recinfo;
196   if (C%NOTFOUND) then
197     CLOSE C;
198     RAISE NO_DATA_FOUND;
199   end if;
200   CLOSE C;
201   if (
202           (   (Recinfo.cost_type_id = X_Cost_Type_Id)
203            OR (    (Recinfo.cost_type_id IS NULL)
204                AND (X_Cost_Type_Id IS NULL)))
205       AND (   (Recinfo.organization_id = X_Organization_Id)
206            OR (    (Recinfo.organization_id IS NULL)
207                AND (X_Organization_Id IS NULL)))
208       AND (   (Recinfo.cost_type = X_Cost_Type)
209            OR (    (Recinfo.cost_type IS NULL)
210                AND (X_Cost_Type IS NULL)))
211       AND (   (Recinfo.description = X_Description)
212            OR (    (Recinfo.description IS NULL)
213                AND (X_Description IS NULL)))
214       AND (   (Recinfo.costing_method_type = X_Costing_Method_Type)
215            OR (    (Recinfo.costing_method_type IS NULL)
216                AND (X_Costing_Method_Type IS NULL)))
217       AND (   (Recinfo.frozen_standard_flag = X_Frozen_Standard_Flag)
218            OR (    (Recinfo.frozen_standard_flag IS NULL)
219                AND (X_Frozen_Standard_Flag IS NULL)))
220       AND (   (Recinfo.default_cost_type_id = X_Default_Cost_Type_Id)
221            OR (    (Recinfo.default_cost_type_id IS NULL)
222                AND (X_Default_Cost_Type_Id IS NULL)))
223       AND (   (Recinfo.bom_snapshot_flag = X_Bom_Snapshot_Flag)
224            OR (    (Recinfo.bom_snapshot_flag IS NULL)
225                AND (X_Bom_Snapshot_Flag IS NULL)))
226       AND (   (Recinfo.allow_updates_flag = X_Allow_Updates_Flag)
227            OR (    (Recinfo.allow_updates_flag IS NULL)
228                AND (X_Allow_Updates_Flag IS NULL)))
229       AND (   (Recinfo.pl_element_flag = X_Pl_Element_Flag)
230            OR (    (Recinfo.pl_element_flag IS NULL)
231                AND (X_Pl_Element_Flag IS NULL)))
232       AND (   (Recinfo.pl_resource_flag = X_Pl_Resource_Flag)
233            OR (    (Recinfo.pl_resource_flag IS NULL)
234                AND (X_Pl_Resource_Flag IS NULL)))
235       AND (   (Recinfo.pl_operation_flag = X_Pl_Operation_Flag)
236            OR (    (Recinfo.pl_operation_flag IS NULL)
237                AND (X_Pl_Operation_Flag IS NULL)))
238       AND (   (Recinfo.pl_activity_flag = X_Pl_Activity_Flag)
239            OR (    (Recinfo.pl_activity_flag IS NULL)
240                AND (X_Pl_Activity_Flag IS NULL)))
241       AND (   (Recinfo.disable_date = X_Disable_Date)
242            OR (    (Recinfo.disable_date IS NULL)
243                AND (X_Disable_Date IS NULL)))
244       AND (   (Recinfo.available_to_eng_flag = X_Available_To_Eng_Flag)
245            OR (    (Recinfo.available_to_eng_flag IS NULL)
246                AND (X_Available_To_Eng_Flag IS NULL)))
247       AND (   (Recinfo.component_yield_flag = X_Component_Yield_Flag)
248            OR (    (Recinfo.component_yield_flag IS NULL)
249                AND (X_Component_Yield_Flag IS NULL)))
250       AND (   (Recinfo.attribute_category = X_Attribute_Category)
251            OR (    (Recinfo.attribute_category IS NULL)
252                AND (X_Attribute_Category IS NULL)))
253       AND (   (Recinfo.attribute1 = X_Attribute1)
254            OR (    (Recinfo.attribute1 IS NULL)
255                AND (X_Attribute1 IS NULL)))
256       AND (   (Recinfo.attribute2 = X_Attribute2)
257            OR (    (Recinfo.attribute2 IS NULL)
258                AND (X_Attribute2 IS NULL)))
259       AND (   (Recinfo.attribute3 = X_Attribute3)
260            OR (    (Recinfo.attribute3 IS NULL)
261                AND (X_Attribute3 IS NULL)))
262       AND (   (Recinfo.attribute4 = X_Attribute4)
263            OR (    (Recinfo.attribute4 IS NULL)
264                AND (X_Attribute4 IS NULL)))
265       AND (   (Recinfo.attribute5 = X_Attribute5)
266            OR (    (Recinfo.attribute5 IS NULL)
267                AND (X_Attribute5 IS NULL)))
268       AND (   (Recinfo.attribute6 = X_Attribute6)
269            OR (    (Recinfo.attribute6 IS NULL)
270                AND (X_Attribute6 IS NULL)))
271       AND (   (Recinfo.attribute7 = X_Attribute7)
272            OR (    (Recinfo.attribute7 IS NULL)
273                AND (X_Attribute7 IS NULL)))
274       AND (   (Recinfo.attribute8 = X_Attribute8)
275            OR (    (Recinfo.attribute8 IS NULL)
276                AND (X_Attribute8 IS NULL)))
277       AND (   (Recinfo.attribute9 = X_Attribute9)
278            OR (    (Recinfo.attribute9 IS NULL)
279                AND (X_Attribute9 IS NULL)))
280       AND (   (Recinfo.attribute10 = X_Attribute10)
281            OR (    (Recinfo.attribute10 IS NULL)
282                AND (X_Attribute10 IS NULL)))
283       AND (   (Recinfo.attribute11 = X_Attribute11)
284            OR (    (Recinfo.attribute11 IS NULL)
285                AND (X_Attribute11 IS NULL)))
286       AND (   (Recinfo.attribute12 = X_Attribute12)
287            OR (    (Recinfo.attribute12 IS NULL)
288                AND (X_Attribute12 IS NULL)))
289       AND (   (Recinfo.attribute13 = X_Attribute13)
290            OR (    (Recinfo.attribute13 IS NULL)
291                AND (X_Attribute13 IS NULL)))
292       AND (   (Recinfo.attribute14 = X_Attribute14)
293            OR (    (Recinfo.attribute14 IS NULL)
294                AND (X_Attribute14 IS NULL)))
295       AND (   (Recinfo.attribute15 = X_Attribute15)
296            OR (    (Recinfo.attribute15 IS NULL)
297                AND (X_Attribute15 IS NULL)))
298       AND (   (Recinfo.alternate_bom_designator = X_Alternate_Bom_Designator)
299            OR (    (Recinfo.alternate_bom_designator IS NULL)
300                AND (X_Alternate_Bom_Designator IS NULL)))
301           ) then
302     return;
303   else
304     FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
305     APP_EXCEPTION.RAISE_EXCEPTION;
306   end if;
307 END Lock_Row;
308 
309 PROCEDURE Update_Row(X_Rowid                               VARCHAR2,
310                      X_Cost_Type_Id                        NUMBER,
311                      X_Last_Update_Date                    DATE,
312                      X_Last_Updated_By                     NUMBER,
313                      X_Last_Update_Login                   NUMBER DEFAULT NULL,
314                      X_Organization_Id                     NUMBER DEFAULT NULL,
315                      X_Cost_Type                           VARCHAR2,
316                      X_Description                         VARCHAR2 DEFAULT NULL,
317                      X_Costing_Method_Type                 NUMBER,
318                      X_Frozen_Standard_Flag                NUMBER DEFAULT NULL,
319                      X_Default_Cost_Type_Id                NUMBER,
320                      X_Bom_Snapshot_Flag                   NUMBER,
321                      X_Allow_Updates_Flag                  NUMBER DEFAULT NULL,
322                      X_Pl_Element_Flag                     NUMBER,
323                      X_Pl_Resource_Flag                    NUMBER,
324                      X_Pl_Operation_Flag                   NUMBER,
325                      X_Pl_Activity_Flag                    NUMBER,
326                      X_Disable_Date                        DATE DEFAULT NULL,
327                      X_Available_To_Eng_Flag               NUMBER DEFAULT NULL,
328                      X_Component_Yield_Flag                NUMBER,
329                      X_Attribute_Category                  VARCHAR2 DEFAULT NULL,
330                      X_Attribute1                          VARCHAR2 DEFAULT NULL,
331                      X_Attribute2                          VARCHAR2 DEFAULT NULL,
332                      X_Attribute3                          VARCHAR2 DEFAULT NULL,
333                      X_Attribute4                          VARCHAR2 DEFAULT NULL,
334                      X_Attribute5                          VARCHAR2 DEFAULT NULL,
335                      X_Attribute6                          VARCHAR2 DEFAULT NULL,
336                      X_Attribute7                          VARCHAR2 DEFAULT NULL,
337                      X_Attribute8                          VARCHAR2 DEFAULT NULL,
338                      X_Attribute9                          VARCHAR2 DEFAULT NULL,
339                      X_Attribute10                         VARCHAR2 DEFAULT NULL,
340                      X_Attribute11                         VARCHAR2 DEFAULT NULL,
341                      X_Attribute12                         VARCHAR2 DEFAULT NULL,
342                      X_Attribute13                         VARCHAR2 DEFAULT NULL,
343                      X_Attribute14                         VARCHAR2 DEFAULT NULL,
344                      X_Attribute15                         VARCHAR2 DEFAULT NULL,
345                      X_Alternate_Bom_Designator            VARCHAR2 DEFAULT NULL
346 ) IS
347 BEGIN
348   UPDATE cst_cost_types
349   SET
350 
351     cost_type_id                              =    X_Cost_Type_Id,
352     last_update_date                          =    X_Last_Update_Date,
353     last_updated_by                           =    X_Last_Updated_By,
354     last_update_login                         =    X_Last_Update_Login,
355     organization_id                           =    X_Organization_Id,
356     cost_type                                 =    X_Cost_Type,
357     description                               =    X_Description,
358     costing_method_type                       =    X_Costing_Method_Type,
359     frozen_standard_flag                      =    X_Frozen_Standard_Flag,
360     default_cost_type_id                      =    X_Default_Cost_Type_Id,
361     bom_snapshot_flag                         =    X_Bom_Snapshot_Flag,
362     allow_updates_flag                        =    X_Allow_Updates_Flag,
363     pl_element_flag                           =    X_Pl_Element_Flag,
364     pl_resource_flag                          =    X_Pl_Resource_Flag,
365     pl_operation_flag                         =    X_Pl_Operation_Flag,
366     pl_activity_flag                          =    X_Pl_Activity_Flag,
367     disable_date                              =    X_Disable_Date,
368     available_to_eng_flag                     =    X_Available_To_Eng_Flag,
369     component_yield_flag                      =    X_Component_Yield_Flag,
370     attribute_category                        =    X_Attribute_Category,
371     attribute1                                =    X_Attribute1,
372     attribute2                                =    X_Attribute2,
373     attribute3                                =    X_Attribute3,
374     attribute4                                =    X_Attribute4,
375     attribute5                                =    X_Attribute5,
376     attribute6                                =    X_Attribute6,
377     attribute7                                =    X_Attribute7,
378     attribute8                                =    X_Attribute8,
379     attribute9                                =    X_Attribute9,
380     attribute10                               =    X_Attribute10,
381     attribute11                               =    X_Attribute11,
382     attribute12                               =    X_Attribute12,
383     attribute13                               =    X_Attribute13,
384     attribute14                               =    X_Attribute14,
385     attribute15                               =    X_Attribute15,
386     alternate_bom_designator                  =    X_Alternate_Bom_Designator
387   WHERE rowid = X_rowid;
388 
389   if (SQL%NOTFOUND) then
390     RAISE NO_DATA_FOUND;
391   end if;
392 
393 END Update_Row;
394 
395 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
396 BEGIN
397   DELETE FROM cst_cost_types
398   WHERE  rowid = X_Rowid;
399 
400   if (SQL%NOTFOUND) then
401     RAISE NO_DATA_FOUND;
402   end if;
403 END Delete_Row;
404 
405 END CST_COST_TYPES_PKG;