1 PACKAGE BODY PO_REQ_DISTRIBUTIONS_PKG2 as
2 /* $Header: POXRID2B.pls 120.1.12000000.3 2007/05/21 23:50:08 lswamy ship $ */
3
4 PROCEDURE Lock_Row(X_Rowid VARCHAR2,
5 X_Distribution_Id NUMBER,
6 X_Requisition_Line_Id NUMBER,
7 X_Set_Of_Books_Id NUMBER,
8 X_Code_Combination_Id NUMBER,
9 X_Req_Line_Quantity NUMBER,
10 X_Req_Line_Amount NUMBER, -- <SERVICES FPJ>
11 X_Encumbered_Flag VARCHAR2,
12 X_Gl_Encumbered_Date DATE,
13 X_Gl_Encumbered_Period_Name VARCHAR2,
14 X_Gl_Cancelled_Date DATE,
15 X_Failed_Funds_Lookup_Code VARCHAR2,
16 X_Encumbered_Amount NUMBER,
17 X_Budget_Account_Id NUMBER,
18 X_Accrual_Account_Id NUMBER,
19 X_Variance_Account_Id NUMBER,
20 X_Prevent_Encumbrance_Flag VARCHAR2,
21 X_Attribute_Category VARCHAR2,
22 X_Attribute1 VARCHAR2,
23 X_Attribute2 VARCHAR2,
24 X_Attribute3 VARCHAR2,
25 X_Attribute4 VARCHAR2,
26 X_Attribute5 VARCHAR2,
27 X_Attribute6 VARCHAR2,
28 X_Attribute7 VARCHAR2,
29 X_Attribute8 VARCHAR2,
30 X_Attribute9 VARCHAR2,
31 X_Attribute10 VARCHAR2,
32 X_Attribute11 VARCHAR2,
33 X_Attribute12 VARCHAR2,
34 X_Attribute13 VARCHAR2,
35 X_Attribute14 VARCHAR2,
36 X_Attribute15 VARCHAR2,
37 X_Ussgl_Transaction_Code VARCHAR2,
38 X_Government_Context VARCHAR2,
39 X_Project_Id NUMBER,
40 X_Task_Id NUMBER,
41 X_Expenditure_Type VARCHAR2,
42 X_Project_Accounting_Context VARCHAR2,
43 X_Expenditure_Organization_Id NUMBER,
44 X_Gl_Closed_Date DATE,
45 X_Source_Req_Distribution_Id NUMBER,
46 X_Distribution_Num NUMBER,
47 X_Project_Related_Flag VARCHAR2,
48 X_Expenditure_Item_Date DATE,
49 X_End_Item_Unit_Number VARCHAR2 DEFAULT NULL,
50 X_Recovery_Rate NUMBER,
51 X_Tax_Recovery_Override_Flag VARCHAR2
52
53 ) IS
54 CURSOR C IS
55 SELECT *
56 FROM PO_REQ_DISTRIBUTIONS
57 WHERE rowid = X_Rowid
58 FOR UPDATE of Distribution_Id NOWAIT;
59 Recinfo C%ROWTYPE;
60 BEGIN
61 OPEN C;
62 FETCH C INTO Recinfo;
63 if (C%NOTFOUND) then
64 CLOSE C;
65 FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
66 APP_EXCEPTION.Raise_Exception;
67 end if;
68 CLOSE C;
69
70 IF
71 (Recinfo.distribution_id = X_Distribution_Id)
72 AND (Recinfo.requisition_line_id = X_Requisition_Line_Id)
73 AND (Recinfo.set_of_books_id = X_Set_Of_Books_Id)
74 AND (Recinfo.code_combination_id = X_Code_Combination_Id)
75
76 -- <SERVICES FPJ START>
77 AND ( ( Recinfo.req_line_quantity = X_Req_Line_Quantity )
78 OR ( ( Recinfo.req_line_quantity IS NULL )
79 AND ( X_Req_Line_Quantity IS NULL ) ) )
80 AND ( ( Recinfo.req_line_amount = X_Req_Line_Amount )
81 OR ( ( Recinfo.req_line_amount IS NULL )
82 AND ( X_Req_Line_Amount IS NULL ) ) )
83 -- <SERVICES FPJ END>
84
85 AND ( (Recinfo.encumbered_flag = X_Encumbered_Flag)
86 OR ( (Recinfo.encumbered_flag IS NULL)
87 AND (X_Encumbered_Flag IS NULL)))
88 AND ( (trunc(Recinfo.gl_encumbered_date) = trunc(X_Gl_Encumbered_Date))
89 OR ( (Recinfo.gl_encumbered_date IS NULL)
90 AND (X_Gl_Encumbered_Date IS NULL)))
91 AND ( (Recinfo.gl_encumbered_period_name = X_Gl_Encumbered_Period_Name)
92 OR ( (Recinfo.gl_encumbered_period_name IS NULL)
93 AND (X_Gl_Encumbered_Period_Name IS NULL)))
94 AND ( (trunc(Recinfo.gl_cancelled_date) = trunc(X_Gl_Cancelled_Date))
95 OR ( (Recinfo.gl_cancelled_date IS NULL)
96 AND (X_Gl_Cancelled_Date IS NULL)))
97 AND ( (Recinfo.failed_funds_lookup_code = X_Failed_Funds_Lookup_Code)
98 OR ( (Recinfo.failed_funds_lookup_code IS NULL)
99 AND (X_Failed_Funds_Lookup_Code IS NULL)))
100 AND ( (Recinfo.encumbered_amount = X_Encumbered_Amount)
101 OR ( (Recinfo.encumbered_amount IS NULL)
102 AND (X_Encumbered_Amount IS NULL)))
103 AND ( (Recinfo.budget_account_id = X_Budget_Account_Id)
104 OR ( (Recinfo.budget_account_id IS NULL)
105 AND (X_Budget_Account_Id IS NULL)))
106 AND ( (Recinfo.accrual_account_id = X_Accrual_Account_Id)
107 OR ( (Recinfo.accrual_account_id IS NULL)
108 AND (X_Accrual_Account_Id IS NULL)))
109 AND ( (Recinfo.variance_account_id = X_Variance_Account_Id)
110 OR ( (Recinfo.variance_account_id IS NULL)
111 AND (X_Variance_Account_Id IS NULL)))
112 AND ( (Recinfo.prevent_encumbrance_flag = X_Prevent_Encumbrance_Flag)
113 OR ( (Recinfo.prevent_encumbrance_flag IS NULL)
114 AND (X_Prevent_Encumbrance_Flag IS NULL))) THEN
115
116
117 IF
118 ( (Recinfo.attribute_category = X_Attribute_Category)
119 OR ( (Recinfo.attribute_category IS NULL)
120 AND (X_Attribute_Category IS NULL)))
121 AND ( (Recinfo.attribute1 = X_Attribute1)
122 OR ( (Recinfo.attribute1 IS NULL)
123 AND (X_Attribute1 IS NULL)))
124 AND ( (Recinfo.attribute2 = X_Attribute2)
125 OR ( (Recinfo.attribute2 IS NULL)
126 AND (X_Attribute2 IS NULL)))
127 AND ( (Recinfo.attribute3 = X_Attribute3)
128 OR ( (Recinfo.attribute3 IS NULL)
129 AND (X_Attribute3 IS NULL)))
130 AND ( (Recinfo.attribute4 = X_Attribute4)
131 OR ( (Recinfo.attribute4 IS NULL)
132 AND (X_Attribute4 IS NULL)))
133 AND ( (Recinfo.attribute5 = X_Attribute5)
134 OR ( (Recinfo.attribute5 IS NULL)
135 AND (X_Attribute5 IS NULL)))
136 AND ( (Recinfo.attribute6 = X_Attribute6)
137 OR ( (Recinfo.attribute6 IS NULL)
138 AND (X_Attribute6 IS NULL)))
139 AND ( (Recinfo.attribute7 = X_Attribute7)
140 OR ( (Recinfo.attribute7 IS NULL)
141 AND (X_Attribute7 IS NULL)))
142 AND ( (Recinfo.attribute8 = X_Attribute8)
143 OR ( (Recinfo.attribute8 IS NULL)
144 AND (X_Attribute8 IS NULL)))
145 AND ( (Recinfo.attribute9 = X_Attribute9)
146 OR ( (Recinfo.attribute9 IS NULL)
147 AND (X_Attribute9 IS NULL)))
148 AND ( (Recinfo.attribute10 = X_Attribute10)
149 OR ( (Recinfo.attribute10 IS NULL)
150 AND (X_Attribute10 IS NULL)))
151 AND ( (Recinfo.attribute11 = X_Attribute11)
152 OR ( (Recinfo.attribute11 IS NULL)
153 AND (X_Attribute11 IS NULL)))
154 AND ( (Recinfo.attribute12 = X_Attribute12)
155 OR ( (Recinfo.attribute12 IS NULL)
156 AND (X_Attribute12 IS NULL)))
157 AND ( (Recinfo.attribute13 = X_Attribute13)
158 OR ( (Recinfo.attribute13 IS NULL)
159 AND (X_Attribute13 IS NULL)))
160 AND ( (Recinfo.attribute14 = X_Attribute14)
161 OR ( (Recinfo.attribute14 IS NULL)
162 AND (X_Attribute14 IS NULL)))
163 AND ( (Recinfo.attribute15 = X_Attribute15)
164 OR ( (Recinfo.attribute15 IS NULL)
165 AND (X_Attribute15 IS NULL)))
166 AND ( (Recinfo.government_context = X_Government_Context)
167 OR ( (Recinfo.government_context IS NULL)
168 AND (X_Government_Context IS NULL)))
169 AND ( (Recinfo.project_id = X_Project_Id)
170 OR ( (Recinfo.project_id IS NULL)
171 AND (X_Project_Id IS NULL)))
172 AND ( (Recinfo.task_id = X_Task_Id)
173 OR ( (Recinfo.task_id IS NULL)
174 AND (X_Task_Id IS NULL)))
175 AND ( (Recinfo.end_item_unit_number = X_End_Item_Unit_Number)
176 OR ( (Recinfo.end_item_unit_number IS NULL)
177 AND (X_End_Item_Unit_Number IS NULL)))
178 AND ( (Recinfo.Recovery_Rate = X_Recovery_Rate)
179 OR ( (Recinfo.Recovery_Rate IS NULL)
180 AND (X_Recovery_Rate IS NULL)))
181 AND ( (Recinfo.tax_recovery_override_flag = X_Tax_Recovery_Override_Flag)
182 OR ( (Recinfo.tax_recovery_override_flag IS NULL)
183 AND (X_Tax_Recovery_Override_Flag IS NULL)))
184 AND ( (Recinfo.expenditure_type = X_Expenditure_Type)
185 OR ( (Recinfo.expenditure_type IS NULL)
186 AND (X_Expenditure_Type IS NULL)))
187 AND ( (Recinfo.project_accounting_context = X_Project_Accounting_Context)
188 OR ( (Recinfo.project_accounting_context IS NULL)
189 AND (X_Project_Accounting_Context IS NULL)))
190 AND ( (Recinfo.expenditure_organization_id = X_Expenditure_Organization_Id)
191 OR ( (Recinfo.expenditure_organization_id IS NULL)
192 AND (X_Expenditure_Organization_Id IS NULL)))
193 AND ( (trunc(Recinfo.gl_closed_date) = trunc(X_Gl_Closed_Date))
194 OR ( (Recinfo.gl_closed_date IS NULL)
195 AND (X_Gl_Closed_Date IS NULL)))
196 AND ( (Recinfo.source_req_distribution_id = X_Source_Req_Distribution_Id)
197 OR ( (Recinfo.source_req_distribution_id IS NULL)
198 AND (X_Source_Req_Distribution_Id IS NULL)))
199 AND (Recinfo.distribution_num = X_Distribution_Num)
200 AND ( (Recinfo.project_related_flag = X_Project_Related_Flag)
201 OR ( (Recinfo.project_related_flag IS NULL)
202 AND (X_Project_Related_Flag IS NULL)))
203 AND ( (trunc(Recinfo.expenditure_item_date) = trunc(X_Expenditure_Item_Date))
204 OR ( (Recinfo.expenditure_item_date IS NULL)
205 AND (X_Expenditure_Item_Date IS NULL))) THEN
206
207 return;
208
209 END IF;
210
211 END IF;
212
213 /*
214 ** If we get to this point then a column has been changed.
215 */
216
217 FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
218 APP_EXCEPTION.RAISE_EXCEPTION;
219
220 END Lock_Row;
221
222
223
224 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
225 BEGIN
226 DELETE FROM PO_REQ_DISTRIBUTIONS
227 WHERE rowid = X_Rowid;
228
229 if (SQL%NOTFOUND) then
230 Raise NO_DATA_FOUND;
231 end if;
232
233
234 END Delete_Row;
235
236 END PO_REQ_DISTRIBUTIONS_PKG2;