DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_TRANSACTIONS_PUB

Source


1 PACKAGE BODY PA_TRANSACTIONS_PUB AS
2 /* $Header: PAXTTCPB.pls 120.5 2007/12/06 14:21:46 rrambati ship $ */
3 
4 	INVALID_DATA EXCEPTION;
5 ----------------------------------------------------------------------
6 -- Please refer to package spec for detailed description of the
7 -- procedure.
8 ----------------------------------------------------------------------
9 
10 PROCEDURE validate_transaction(
11 	      X_project_id               IN NUMBER
12             , X_task_id                  IN NUMBER
13             , X_ei_date  	         IN DATE
14             , X_expenditure_type         IN VARCHAR2
15             , X_non_labor_resource       IN VARCHAR2
16             , X_person_id                IN NUMBER
17             , X_quantity                 IN NUMBER   DEFAULT NULL
18             , X_denom_currency_code      IN VARCHAR2 DEFAULT NULL
19             , X_acct_currency_code       IN VARCHAR2 DEFAULT NULL
20             , X_denom_raw_cost           IN NUMBER   DEFAULT NULL
21             , X_acct_raw_cost            IN NUMBER   DEFAULT NULL
22             , X_acct_rate_type           IN VARCHAR2 DEFAULT NULL
23             , X_acct_rate_date           IN DATE     DEFAULT NULL
24             , X_acct_exchange_rate       IN NUMBER   DEFAULT NULL
25             , X_transfer_ei              IN NUMBER   DEFAULT NULL
26             , X_incurred_by_org_id       IN NUMBER   DEFAULT NULL
27             , X_nl_resource_org_id       IN NUMBER   DEFAULT NULL
28             , X_transaction_source       IN VARCHAR2 DEFAULT NULL
29             , X_calling_module           IN VARCHAR2 DEFAULT NULL
30 	    , X_vendor_id	         IN NUMBER   DEFAULT NULL
31             , X_entered_by_user_id       IN NUMBER   DEFAULT NULL
32             , X_attribute_category       IN VARCHAR2 DEFAULT NULL
33             , X_attribute1               IN VARCHAR2 DEFAULT NULL
34             , X_attribute2               IN VARCHAR2 DEFAULT NULL
35             , X_attribute3               IN VARCHAR2 DEFAULT NULL
36             , X_attribute4               IN VARCHAR2 DEFAULT NULL
37             , X_attribute5               IN VARCHAR2 DEFAULT NULL
38             , X_attribute6               IN VARCHAR2 DEFAULT NULL
39             , X_attribute7               IN VARCHAR2 DEFAULT NULL
40             , X_attribute8               IN VARCHAR2 DEFAULT NULL
41             , X_attribute9               IN VARCHAR2 DEFAULT NULL
42             , X_attribute10              IN VARCHAR2 DEFAULT NULL
43 	    , X_attribute11              IN VARCHAR2 DEFAULT NULL
44             , X_attribute12              IN VARCHAR2 DEFAULT NULL
45             , X_attribute13              IN VARCHAR2 DEFAULT NULL
46             , X_attribute14              IN VARCHAR2 DEFAULT NULL
47             , X_attribute15              IN VARCHAR2 DEFAULT NULL
48             , X_msg_application      IN OUT NOCOPY VARCHAR2
49             , X_msg_type                OUT NOCOPY VARCHAR2
50             , X_msg_token1              OUT NOCOPY VARCHAR2
51             , X_msg_token2              OUT NOCOPY VARCHAR2
52             , X_msg_token3              OUT NOCOPY VARCHAR2
53             , X_msg_count               OUT NOCOPY NUMBER
54             , X_msg_data                OUT NOCOPY VARCHAR2
55             , X_billable_flag           OUT NOCOPY VARCHAR2
56             , p_projfunc_currency_code   IN VARCHAR2 default null
57             , p_projfunc_cost_rate_type  IN VARCHAR2 default null
58             , p_projfunc_cost_rate_date  IN DATE     default null
59             , p_projfunc_cost_exchg_rate IN NUMBER   default null
60             , p_assignment_id            IN NUMBER   default null
61             , p_work_type_id             IN NUMBER   default null
62 	    , p_sys_link_function        IN VARCHAR2 default null
63 	    , P_Po_Header_Id             IN NUMBER   default null
64 	    , P_Po_Line_Id               IN NUMBER   default null
65 	    , P_Person_Type              IN VARCHAR2 default null
66 	    , P_Po_Price_Type            IN VARCHAR2 default null
67 	    , P_Document_Type            IN VARCHAR2 default null
68 	    , P_Document_Line_Type       IN VARCHAR2 default null
69 	    , P_Document_Dist_Type       IN VARCHAR2 default null
70 	    , P_pa_ref_num1              IN NUMBER   default null
71 	    , P_pa_ref_num2              IN NUMBER   default null
72 	    , P_pa_ref_num3              IN NUMBER   default null
73 	    , P_pa_ref_num4              IN NUMBER   default null
74 	    , P_pa_ref_num5              IN NUMBER   default null
75 	    , P_pa_ref_num6              IN NUMBER   default null
76 	    , P_pa_ref_num7              IN NUMBER   default null
77 	    , P_pa_ref_num8              IN NUMBER   default null
78 	    , P_pa_ref_num9              IN NUMBER   default null
79 	    , P_pa_ref_num10             IN NUMBER   default null
80 	    , P_pa_ref_var1              IN VARCHAR2 default null
81 	    , P_pa_ref_var2              IN VARCHAR2 default null
82 	    , P_pa_ref_var3              IN VARCHAR2 default null
83 	    , P_pa_ref_var4              IN VARCHAR2 default null
84 	    , P_pa_ref_var5              IN VARCHAR2 default null
85 	    , P_pa_ref_var6              IN VARCHAR2 default null
86 	    , P_pa_ref_var7              IN VARCHAR2 default null
87 	    , P_pa_ref_var8              IN VARCHAR2 default null
88 	    , P_pa_ref_var9              IN VARCHAR2 default null
89 	    , P_pa_ref_var10             IN VARCHAR2 default null) IS
90 
91 
92 	l_sys_link_function VARCHAR2(3) default NULL;	-- bug 2991182
93 
94    BEGIN
95 
96       X_msg_count := 1;
97 
98       -- set default message type to Error.
99       X_msg_type := 'E';
100 
101 
102       -- set default message application to Oracle Projects
103       X_msg_application := 'PA';
104 
105 	/* Added for bug 2991182 */
106 	If (X_calling_module in ('APXINENT','apiindib.pls','apiimptb.pls','APXIIMPT')
107 	  and X_transaction_source is NOT NULL)
108 	Then
109 		l_sys_link_function := X_transaction_source;
110          /* Added ElsIf for Bug#3155151 */
111         ElsIf (X_calling_module IN ('PSPLDTRF','PAXVSSTS')) Then  /* OIT */  -- removed PAXVOTCB from if clause bug 3406396
112                l_sys_link_function := nvl(p_sys_link_function, 'ST');  /* Added nvl() for Bug#3844346 */
113         ElsIf (X_calling_module = 'SelfService') Then  /* OIE */
114                l_sys_link_function := 'ER';
115         ElsIf (X_calling_module in ('POXPOEPO','POXPOERL','POXRQERQ','POWEBREQ','REQIMPORT','IGCCENTR')) Then /*Bug 3428967,3581050*/ /* Added IGCCENTR for 6523746 */
116                l_sys_link_function := 'VI';
117 	Else
118 		l_sys_link_function := p_sys_link_function;
119 	End If;
120 	/* bug 2991182 */
121 
122       PATC.get_status(
123 		  X_project_id 			=> X_project_id
124 		, X_task_id 			=> X_task_id
125                 , X_ei_date 			=> X_ei_date
126                 , X_expenditure_type 		=> X_expenditure_type
127                 , X_non_labor_resource 		=> X_non_labor_resource
128                 , X_person_id 			=> X_person_id
129                 , X_quantity 			=> X_quantity
130                 , X_denom_currency_code 	=> X_denom_currency_code
131                 , X_acct_currency_code 		=> X_acct_currency_code
132                 , X_denom_raw_cost 		=> X_denom_raw_cost
133                 , X_acct_raw_cost 		=> X_acct_raw_cost
134                 , X_acct_rate_type 		=> X_acct_rate_type
135                 , X_acct_rate_date 		=> X_acct_rate_date
136                 , X_acct_exchange_rate 		=> X_acct_exchange_rate
137                 , X_transfer_ei 		=> X_transfer_ei
138                 , X_incurred_by_org_id 		=> X_incurred_by_org_id
139                 , X_nl_resource_org_id 		=> X_nl_resource_org_id
140                 , X_transaction_source 		=> X_transaction_source
141                 , X_calling_module 		=> X_calling_module
142                 , X_vendor_id 			=> X_vendor_id
143                 , X_entered_by_user_id 		=> X_entered_by_user_id
144 	        , X_attribute_category 		=> X_attribute_category
145                 , X_attribute1 			=> X_attribute1
146                 , X_attribute2 			=> X_attribute2
147                 , X_attribute3 			=> X_attribute3
148                 , X_attribute4 			=> X_attribute4
149                 , X_attribute5 			=> X_attribute5
150                 , X_attribute6 			=> X_attribute6
151                 , X_attribute7 			=> X_attribute7
152                 , X_attribute8 			=> X_attribute8
153                 , X_attribute9 			=> X_attribute9
154                 , X_attribute10 		=> X_attribute10
155                 , X_attribute11 		=> X_attribute11
156                 , X_attribute12 		=> X_attribute12
157                 , X_attribute13 		=> X_attribute13
158                 , X_attribute14 		=> X_attribute14
159                 , X_attribute15 		=> X_attribute15
160                 , X_msg_application 		=> X_msg_application
161                 , X_msg_type 			=> X_msg_type
162                 , X_msg_token1 			=> X_msg_token1
163                 , X_msg_token2 			=> X_msg_token2
164                 , X_msg_token3 			=> X_msg_token3
165                 , X_msg_count 			=> X_msg_count
166                 , X_status 			=> X_msg_data
167 	        , X_billable_flag 		=> X_billable_flag
168                 , p_projfunc_currency_code      => p_projfunc_currency_code
169                 , p_projfunc_cost_rate_type     => p_projfunc_cost_rate_type
170                 , p_projfunc_cost_rate_date     => p_projfunc_cost_rate_date
171                 , p_projfunc_cost_exchg_rate    => p_projfunc_cost_exchg_rate
172                 , p_assignment_id               => p_assignment_id
173                 , p_work_type_id                => p_work_type_id
174 		, p_sys_link_function           => l_sys_link_function
175 	        , P_Po_Header_Id                => P_Po_Header_Id
176 	        , P_Po_Line_Id                  => P_Po_Line_Id
177 	        , P_Person_Type                 => P_Person_Type
178 	        , P_Po_Price_Type               => P_Po_Price_Type  -- bug 2991182
179 	        , P_Document_Type               => P_Document_Type
180 	        , P_Document_Line_Type          => P_Document_Line_Type
181 	        , P_Document_Dist_Type          => P_Document_Dist_Type
182 	        , P_pa_ref_num1                 => P_pa_ref_num1
183 	        , P_pa_ref_num2                 => P_pa_ref_num2
184 	        , P_pa_ref_num3                 => P_pa_ref_num3
185 	        , P_pa_ref_num4                 => P_pa_ref_num4
186 	        , P_pa_ref_num5                 => P_pa_ref_num5
187 	        , P_pa_ref_num6                 => P_pa_ref_num6
188 	        , P_pa_ref_num7                 => P_pa_ref_num7
189 	        , P_pa_ref_num8                 => P_pa_ref_num8
190 	        , P_pa_ref_num9                 => P_pa_ref_num9
191 	        , P_pa_ref_num10                => P_pa_ref_num10
192 	        , P_pa_ref_var1                 => P_pa_ref_var1
193 	        , P_pa_ref_var2                 => P_pa_ref_var2
194 	        , P_pa_ref_var3                 => P_pa_ref_var3
195 	        , P_pa_ref_var4                 => P_pa_ref_var4
196 	        , P_pa_ref_var5                 => P_pa_ref_var5
197 	        , P_pa_ref_var6                 => P_pa_ref_var6
198 	        , P_pa_ref_var7                 => P_pa_ref_var7
199 	        , P_pa_ref_var8                 => P_pa_ref_var8
200 	        , P_pa_ref_var9                 => P_pa_ref_var9
201 	        , P_pa_ref_var10                => P_pa_ref_var10);
202 
203    EXCEPTION WHEN OTHERS THEN
204       X_msg_data := SQLCODE;
205       X_billable_flag := null;
206    END validate_transaction;
207 
208 
209 
210 --  =====================================================================
211 --  DFF Upgrade ---------------------------------------------------------
212 
213 -- API: pop_dff_segments_enabled_table
214 -- Purpose: This procedure is called by validate_dff API to populate the
215 --          global variable G_dff_segments_enabled_table.
216 --          G_dff_segments_enabled_table is a variable which keeps track
217 --          of which context code has which segments enabled.  We are keeping
218 --          these information in a table in order to avoid calling ATG's
219 --          DFF API's extraneously.
220 
221    PROCEDURE pop_dff_segments_enabled_table IS
222   		flex              fnd_dflex.dflex_r;
223       flex_detail       fnd_dflex.dflex_dr;
224       context_detail    fnd_dflex.contexts_dr;
225       context           fnd_dflex.context_r;
226       segment_detail    fnd_dflex.segments_dr;
227       i NUMBER;
228    BEGIN
229 
230    	-- Need to get flexfield token before getting context token
231       fnd_dflex.get_flexfield('PA', 'PA_EXPENDITURE_ITEMS_DESC_FLEX', flex, flex_detail);
232 
233       -- Need to get context token before getting segment token
234       fnd_dflex.get_contexts(flex, context_detail);
235 
236       context.flexfield := flex;
237       i := 1;
238       -- After getting the information for this descriptive flexfield, we will
239       -- loop through each context codes to find out which segments are enabled
240       -- for each context code
241       WHILE i <= context_detail.ncontexts LOOP
242       	IF context_detail.is_enabled(i) THEN
243          	context.context_code := context_detail.context_code(i);
244             fnd_dflex.get_segments(context, segment_detail);
245 
246 				-- Store the context code
250             -- Store whether this context code is GLOBAL context code or not
247             G_dff_segments_enabled_table(i).context_code := context_detail.context_code(i);
248             G_dff_segments_enabled_table(i).context_name := context_detail.context_name(i);
249 
251 		      G_dff_segments_enabled_table(i).is_global    := context_detail.is_global(i);
252 
253 				-- Call populate_segments to store the enabled segments for this context code
254             populate_segments(
255                      p_segment_detail              => segment_detail,
256                      p_dff_segments_enabled_record => G_dff_segments_enabled_table(i));
257           ELSE
258               G_dff_segments_enabled_table(i).context_code := null;          -- Added for bug 1457298
259           END IF;
260           i := i + 1;
261       END LOOP;
262    END pop_dff_segments_enabled_table;
263 
264 
265 -- API: populate_segments
266 -- Purpose: This procedure is called by pop_dff_segments_enabled_table.
267 --          It is called once for each context code in the descriptive flexfield
268 --          definition.  For a particular context code, this API populate
269 --          one record of G_dff_segments_enabled_table table to store the enabled
270 --          segments of this context code
271 
272    PROCEDURE populate_segments (
273    	p_segment_detail IN fnd_dflex.segments_dr,
274 /* Start of bug#  2672653 */
275 --      p_dff_segments_enabled_record IN OUT dff_segments_enabled_record) IS
276         p_dff_segments_enabled_record IN OUT NOCOPY dff_segments_enabled_record) IS   /* added NOCOPY */
277 /* End of bug#  2672653 */
278       counter      NUMBER;
279    BEGIN
280       counter := 1;
281 
282 	   -- Loop through each segment of the context code to see what is the database
283       -- table column name of this segment.  It must be ATTRIBUTE1-10.  If yes and the
284       -- segment is enabled, it will set the attributex_enabled field of the
285       -- G_dff_segments_enabled_table record to TRUE, otherwise to FALSE
286       WHILE (counter <= p_segment_detail.nsegments) LOOP
287       	IF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE1' THEN
288          	IF p_segment_detail.is_enabled(counter) THEN
289             	p_dff_segments_enabled_record.attribute1_enabled := TRUE;
290             ELSE
291                p_dff_segments_enabled_record.attribute1_enabled := FALSE;
292             END IF;
293          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE2' THEN
294             IF p_segment_detail.is_enabled(counter) THEN
295                p_dff_segments_enabled_record.attribute2_enabled := TRUE;
296             ELSE
297                p_dff_segments_enabled_record.attribute2_enabled := FALSE;
298             END IF;
299          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE3' THEN
300             IF p_segment_detail.is_enabled(counter) THEN
301                p_dff_segments_enabled_record.attribute3_enabled := TRUE;
302             ELSE
303                p_dff_segments_enabled_record.attribute3_enabled := FALSE;
304             END IF;
305          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE4' THEN
306             IF p_segment_detail.is_enabled(counter) THEN
307                p_dff_segments_enabled_record.attribute4_enabled := TRUE;
308             ELSE
309                p_dff_segments_enabled_record.attribute4_enabled := FALSE;
310             END IF;
311          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE5' THEN
312             IF p_segment_detail.is_enabled(counter) THEN
313                p_dff_segments_enabled_record.attribute5_enabled := TRUE;
314             ELSE
315                p_dff_segments_enabled_record.attribute5_enabled := FALSE;
316             END IF;
317          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE6' THEN
318             IF p_segment_detail.is_enabled(counter) THEN
319                p_dff_segments_enabled_record.attribute6_enabled := TRUE;
320             ELSE
321                p_dff_segments_enabled_record.attribute6_enabled := FALSE;
322             END IF;
323          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE7' THEN
324             IF p_segment_detail.is_enabled(counter) THEN
325                p_dff_segments_enabled_record.attribute7_enabled := TRUE;
326             ELSE
327                p_dff_segments_enabled_record.attribute7_enabled := FALSE;
328             END IF;
329          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE8' THEN
330             IF p_segment_detail.is_enabled(counter) THEN
331                p_dff_segments_enabled_record.attribute8_enabled := TRUE;
332             ELSE
333                p_dff_segments_enabled_record.attribute8_enabled := FALSE;
334             END IF;
335          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE9' THEN
336             IF p_segment_detail.is_enabled(counter) THEN
337                p_dff_segments_enabled_record.attribute9_enabled := TRUE;
338             ELSE
339                p_dff_segments_enabled_record.attribute9_enabled := FALSE;
340             END IF;
341          ELSIF p_segment_detail.application_column_name(counter) = 'ATTRIBUTE10' THEN
342             IF p_segment_detail.is_enabled(counter) THEN
343                p_dff_segments_enabled_record.attribute10_enabled := TRUE;
344             ELSE
345                p_dff_segments_enabled_record.attribute10_enabled := FALSE;
346             END IF;
347          END IF;
348          counter := counter + 1;
349       END LOOP;
350    END populate_segments;
351 
352 
356 --          Underneath, the real validation is done by API's provided by ATG.
353 -- API: validate_dff
354 -- Purpose: This is the main API for validating DFF.  Given all ten segment fields,
355 --          this API will validate them against descriptive flexfield definition.
357 --          Once passed validation, this API also makes sure only the enabled segments
358 --          are passed back through the IN/OUT p_attributex parameters
359    PROCEDURE validate_dff (
360          p_dff_name        IN fnd_descriptive_flexs_vl.descriptive_flexfield_name%TYPE,
361          p_attribute_category IN pa_expenditure_items_all.attribute_category%TYPE,
362          p_attribute1      IN OUT NOCOPY pa_expenditure_items_all.attribute1%TYPE,
363          p_attribute2      IN OUT NOCOPY pa_expenditure_items_all.attribute2%TYPE,
364          p_attribute3      IN OUT NOCOPY pa_expenditure_items_all.attribute3%TYPE,
365          p_attribute4      IN OUT NOCOPY pa_expenditure_items_all.attribute4%TYPE,
366          p_attribute5      IN OUT NOCOPY pa_expenditure_items_all.attribute5%TYPE,
367          p_attribute6      IN OUT NOCOPY pa_expenditure_items_all.attribute6%TYPE,
368          p_attribute7      IN OUT NOCOPY pa_expenditure_items_all.attribute7%TYPE,
369          p_attribute8      IN OUT NOCOPY pa_expenditure_items_all.attribute8%TYPE,
370          p_attribute9      IN OUT NOCOPY pa_expenditure_items_all.attribute9%TYPE,
371          p_attribute10     IN OUT NOCOPY pa_expenditure_items_all.attribute10%TYPE,
372          x_status_code     OUT NOCOPY VARCHAR2,
373 		   x_error_message   OUT NOCOPY VARCHAR2)
374 
375    IS
376          v_attribute1      pa_expenditure_items_all.attribute1%TYPE;
377          v_attribute2      pa_expenditure_items_all.attribute2%TYPE;
378          v_attribute3      pa_expenditure_items_all.attribute3%TYPE;
379          v_attribute4      pa_expenditure_items_all.attribute4%TYPE;
380          v_attribute5      pa_expenditure_items_all.attribute5%TYPE;
381          v_attribute6      pa_expenditure_items_all.attribute6%TYPE;
382          v_attribute7      pa_expenditure_items_all.attribute7%TYPE;
383          v_attribute8      pa_expenditure_items_all.attribute8%TYPE;
384          v_attribute9      pa_expenditure_items_all.attribute9%TYPE;
385          v_attribute10     pa_expenditure_items_all.attribute10%TYPE;
386          v_desc_flex_context_name fnd_descriptive_flexs_vl.descriptive_flexfield_name%TYPE;
387          i                 NUMBER;
388 	/* Start of Bug 3064318 */
389 	TYPE seg_col_name is TABLE of varchar2(150)
390 	Index by binary_integer;
391 
392 	p_segment_column_name   seg_col_name;
393 	l_attribute             seg_col_name;
394         j                 	NUMBER;
395 	/* End of Bug 3064318 */
396 
397 -- API:  populate_v_attributes
398 -- Purpose: This procedure is part of the body of populate_dff.  It is called by
399 --          validate_dff to check against the global table G_dff_segments_enabled_table
400 --          to see, for the given context code, what segments are enabled.  If
401 --          a segment is enabled for this context code, it will then populate the
402 --          v_attributex variable with the IN/OUT parameter p_attributex.  If the segment
403 --          is not enabled, then v_attributex will be left as NULL.  This is the API
404 --          which filters out all the extra attributes the user has passed in for segments
405 --          which are not enabled. v_attributex variables are later used in the DFF validation
406 --          process
407 
408 			PROCEDURE populate_v_attributes IS
409 				c			NUMBER;
410 			BEGIN
411 				c := 1;
412             -- Loop through each record of the G_dff_segments_enabled_table table.
413             -- Check the attribute_category passed in as parameter against the context code
414             -- of each record.  If equals, then we have found the record we want to retrieve.
415             -- We also always retrive the 'Global Data Elements' context code because it stores
416             -- the global segments
417 				WHILE c <= G_dff_segments_enabled_table.count LOOP
418 					IF (G_dff_segments_enabled_table(c).is_global OR
419 						 G_dff_segments_enabled_table(c).context_code = p_attribute_category) THEN
420                   IF (G_dff_segments_enabled_table(c).context_code =
421                                                    p_attribute_category) THEN
422 /* Commented for Bug # 1982950 -- gjain
423                      v_desc_flex_context_name :=
424                                  G_dff_segments_enabled_table(c).context_name;
425 */
426                      v_desc_flex_context_name :=
427                                  G_dff_segments_enabled_table(c).context_code;
428                   END IF;
429 
430 						IF G_dff_segments_enabled_table(c).attribute1_enabled THEN
431 							v_attribute1 := p_attribute1;
432 						END IF;
433                   IF G_dff_segments_enabled_table(c).attribute2_enabled THEN
434                      v_attribute2 := p_attribute2;
435                   END IF;
436                   IF G_dff_segments_enabled_table(c).attribute3_enabled THEN
437                      v_attribute3 := p_attribute3;
438                   END IF;
439                   IF G_dff_segments_enabled_table(c).attribute4_enabled THEN
440                      v_attribute4 := p_attribute4;
441                   END IF;
442                   IF G_dff_segments_enabled_table(c).attribute5_enabled THEN
443                      v_attribute5 := p_attribute5;
444                   END IF;
445                   IF G_dff_segments_enabled_table(c).attribute6_enabled THEN
446                      v_attribute6 := p_attribute6;
447                   END IF;
448                   IF G_dff_segments_enabled_table(c).attribute7_enabled THEN
452                      v_attribute8 := p_attribute8;
449                      v_attribute7 := p_attribute7;
450                   END IF;
451                   IF G_dff_segments_enabled_table(c).attribute8_enabled THEN
453                   END IF;
454                   IF G_dff_segments_enabled_table(c).attribute9_enabled THEN
455                      v_attribute9 := p_attribute9;
456                   END IF;
457                   IF G_dff_segments_enabled_table(c).attribute10_enabled THEN
458                      v_attribute10 := p_attribute10;
459                   END IF;
460 					END IF;
461 					c := c + 1;
462 				END LOOP;
463 			END populate_v_attributes;
464 
465    -- Validate_dff logic begins
466    BEGIN
467 		   x_error_message := NULL;
468          x_status_code := NULL;
469          v_attribute1 := NULL;
470          v_attribute2 := NULL;
471          v_attribute3 := NULL;
472          v_attribute4 := NULL;
473          v_attribute5 := NULL;
474          v_attribute6 := NULL;
475          v_attribute7 := NULL;
476          v_attribute8 := NULL;
477          v_attribute9 := NULL;
478          v_attribute10 := NULL;
479 			i            := 1;
480 
481 			--Initialize G_dff_segments_enabled_table if it hasn't been initialized
482 			IF (G_dff_segments_enabled_table.count = 0) THEN
483 				pop_dff_segments_enabled_table();
484 			END IF;
485 
486 			-- Populate the v_attributex variables to get ready to do validation
487 			populate_v_attributes();
488 
489 			-- Validate the DFF
490          fnd_flex_descval.set_context_value(v_desc_flex_context_name);
491          fnd_flex_descval.set_column_value('ATTRIBUTE1', v_attribute1);
492          fnd_flex_descval.set_column_value('ATTRIBUTE2', v_attribute2);
493          fnd_flex_descval.set_column_value('ATTRIBUTE3', v_attribute3);
494          fnd_flex_descval.set_column_value('ATTRIBUTE4', v_attribute4);
495          fnd_flex_descval.set_column_value('ATTRIBUTE5', v_attribute5);
496          fnd_flex_descval.set_column_value('ATTRIBUTE6', v_attribute6);
497          fnd_flex_descval.set_column_value('ATTRIBUTE7', v_attribute7);
498          fnd_flex_descval.set_column_value('ATTRIBUTE8', v_attribute8);
499          fnd_flex_descval.set_column_value('ATTRIBUTE9', v_attribute9);
500          fnd_flex_descval.set_column_value('ATTRIBUTE10', v_attribute10);
501 
502                 /* Start of Bug 3064318 */
503          IF (FND_FLEX_DESCVAL.validate_desccols('PA', 'PA_EXPENDITURE_ITEMS_DESC_FLEX', 'D', sysdate)) THEN
504 
505         for j in 1 ..10 Loop
506                 p_segment_column_name(j) := ltrim(rtrim(FND_FLEX_DESCVAL.segment_column_name(j)));
507                 l_attribute(j)           := rtrim(FND_FLEX_DESCVAL.segment_id(j));  --Bug#6506638: Removed ltrim()
508 
509                 If p_segment_column_name(j) = 'ATTRIBUTE1' Then
510                         p_attribute1 := l_attribute(j);
511                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE2' Then
512                         p_attribute2 := l_attribute(j);
513                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE3' Then
514                         p_attribute3 := l_attribute(j);
515                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE4' Then
516                         p_attribute4 := l_attribute(j);
517                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE5' Then
518                         p_attribute5 := l_attribute(j);
519                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE6' Then
520                         p_attribute6 := l_attribute(j);
521                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE7' Then
522                         p_attribute7 := l_attribute(j);
523                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE8' Then
524                         p_attribute8 := l_attribute(j);
525                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE9' Then
526                         p_attribute9 := l_attribute(j);
527                 ElsIf p_segment_column_name(j) = 'ATTRIBUTE10' Then
528                         p_attribute10 := l_attribute(j);
529                 End If;
530         End Loop;
531 
532 	    /* p_attribute1 := v_attribute1;
533                p_attribute2 := v_attribute2;
534                p_attribute3 := v_attribute3;
535                p_attribute4 := v_attribute4;
536                p_attribute5 := v_attribute5;
537                p_attribute6 := v_attribute6;
538                p_attribute7 := v_attribute7;
539                p_attribute8 := v_attribute8;
540                p_attribute9 := v_attribute9;
541                p_attribute10 := v_attribute10;  Commented for Bug 3064318 */
542 	/* End of Bug 3064318 */
543 	ELSE
544 		  X_error_message := FND_FLEX_DESCVAL.error_message;
545               X_status_code := 'PA_DFF_VALIDATION_FAILED';
546               RAISE INVALID_DATA;
547          END IF;
548 
549 	EXCEPTION
550    WHEN  INVALID_DATA  THEN
551       NULL;
552    WHEN OTHERS THEN
553       raise;
554 
555    END validate_dff;
556 
557 ----------------------------------------------------------------------
558 -- Please refer to package spec for detailed description of the
559 -- procedure.
560 ----------------------------------------------------------------------
561 
562 PROCEDURE Check_Adjustment_of_Proj_Txn(
563                              x_transaction_source                   IN VARCHAR2,
564                              x_orig_transaction_reference           IN VARCHAR2,
565                              x_expenditure_type_class               IN VARCHAR2,
569                              x_employee_number                      IN VARCHAR2 DEFAULT NULL,
566                              x_expenditure_type                     IN VARCHAR2,
567                              x_expenditure_item_id                  IN NUMBER DEFAULT NULL,
568                              x_expenditure_item_date                IN DATE,
570                              x_expenditure_org_name                 IN VARCHAR2 DEFAULT NULL,
571                              x_project_number                       IN VARCHAR2,
572                              x_task_number                          IN VARCHAR2,
573                              x_non_labor_resource                   IN VARCHAR2 DEFAULT NULL,
574                              x_non_labor_resource_org_name          IN VARCHAR2 DEFAULT NULL,
575                              x_quantity                             IN NUMBER,
576                              x_raw_cost                             IN NUMBER DEFAULT NULL,
577                              x_attribute_category                   IN VARCHAR2 DEFAULT NULL,
578                              x_attribute1                           IN VARCHAR2 DEFAULT NULL,
579                              x_attribute2                           IN VARCHAR2 DEFAULT NULL,
580                              x_attribute3                           IN VARCHAR2 DEFAULT NULL,
581                              x_attribute4                           IN VARCHAR2 DEFAULT NULL,
582                              x_attribute5                           IN VARCHAR2 DEFAULT NULL,
583                              x_attribute6                           IN VARCHAR2 DEFAULT NULL,
584                              x_attribute7                           IN VARCHAR2 DEFAULT NULL,
585                              x_attribute8                           IN VARCHAR2 DEFAULT NULL,
586                              x_attribute9                           IN VARCHAR2 DEFAULT NULL,
587                              x_attribute10                          IN VARCHAR2 DEFAULT NULL,
588                              x_org_id                               IN NUMBER DEFAULT NULL,
589                              x_adjustment_status                    OUT NOCOPY VARCHAR2,
590                              x_adjustment_status_code               OUT NOCOPY VARCHAR2,
591                              x_return_status                        OUT NOCOPY VARCHAR2,
592                              x_message_data                         OUT NOCOPY VARCHAR2)
593 IS
594 
595 --The following Cursor will select the item in Projects based upon the parameters passed
596 --to the API.  It is a UNION because
597 -- 1) pa_expenditure_items_all.non_labor_resource and pa_expenditure_items_all.organization_id
598 --    (non labor resource owning organization) only exist for Usages (expenditure_type_class = 'USG')
599 -- 2) pa_expenditures_all.incurred_by_person_id may or may not exist for Usages, and
600 --    does not exist for Supplier Invoices.
601 
602 CURSOR item_in_projects IS
603 --The first part of the UNION handles all expenditure_type_classes EXCEPT
604 --Usages (USG) and Supplier Invoices (VI).
605 SELECT net_zero_adjustment_flag
606 FROM   pa_expenditure_items_all ei,
607        pa_expenditures_all exp,
608        per_all_people_f per,
609        pa_projects_all proj,
610        pa_tasks task,
611        hr_all_organization_units hr1
612 WHERE  ei.transaction_source = x_transaction_source AND
613        ei.orig_transaction_reference = x_orig_transaction_reference AND
614        ei.system_linkage_function = x_expenditure_type_class AND
615        ei.expenditure_type = x_expenditure_type AND
616        ei.expenditure_item_id = nvl(x_expenditure_item_id, ei.expenditure_item_id) AND
617        ei.expenditure_item_date = x_expenditure_item_date AND
618        NVL(per.employee_number,per.npw_number) = nvl(x_employee_number, nvl(per.employee_number,per.npw_number) ) AND /* FP.M / CWK Changes */
619        ei.expenditure_item_date BETWEEN per.effective_start_date AND per.effective_end_date AND
620        per.person_id = exp.incurred_by_person_id AND
621        exp.expenditure_id = ei.expenditure_id AND
622        hr1.name = nvl(x_expenditure_org_name,hr1.name) AND
623        hr1.organization_id = exp.incurred_by_organization_id AND
624        proj.segment1 = x_project_number AND
625        task.project_id = proj.project_id AND
626        task.task_number = x_task_number AND
627        ei.task_id = task.task_id AND
628        ei.quantity = x_quantity AND
629        nvl(ei.raw_cost,'-99') = nvl(x_raw_cost,nvl(ei.raw_cost,'-99')) AND
630        nvl(ei.attribute_category,'-99') = nvl(x_attribute_category,nvl(ei.attribute_category,'-99')) AND
631        nvl(ei.attribute1,'-99') = nvl(x_attribute1, nvl(ei.attribute1,'-99')) AND
632        nvl(ei.attribute2,'-99') = nvl(x_attribute2, nvl(ei.attribute2,'-99')) AND
633        nvl(ei.attribute3,'-99') = nvl(x_attribute3, nvl(ei.attribute3,'-99')) AND
634        nvl(ei.attribute4,'-99') = nvl(x_attribute4, nvl(ei.attribute4,'-99')) AND
635        nvl(ei.attribute5,'-99') = nvl(x_attribute5, nvl(ei.attribute5,'-99')) AND
636        nvl(ei.attribute6,'-99') = nvl(x_attribute6, nvl(ei.attribute6,'-99')) AND
637        nvl(ei.attribute7,'-99') = nvl(x_attribute7, nvl(ei.attribute7,'-99')) AND
638        nvl(ei.attribute8,'-99') = nvl(x_attribute8, nvl(ei.attribute8,'-99')) AND
639        nvl(ei.attribute9,'-99') = nvl(x_attribute9, nvl(ei.attribute9,'-99')) AND
640        nvl(ei.attribute10,'-99') = nvl(x_attribute10, nvl(ei.attribute10,'-99')) AND
641        nvl(ei.org_id,'-99') = nvl(x_org_id,nvl(ei.org_id,'-99')) AND
642        x_expenditure_type_class <> 'USG' AND
643        x_expenditure_type_class <> 'VI'
644 UNION ALL
645 --The second part of the UNION handles Usages (expenditure_type_class='USG')
649 FROM   pa_expenditure_items_all ei,
646 --when IN parameter x_employee_number is NOT NULL.  The additional join to
647 --hr_all_organization_units hr2 is required.
648 SELECT net_zero_adjustment_flag
650        pa_expenditures_all exp,
651        per_all_people_f per,
652        pa_projects_all proj,
653        pa_tasks task,
654        hr_all_organization_units hr1,
655        hr_all_organization_units hr2
656 WHERE  ei.transaction_source = x_transaction_source AND
657        ei.orig_transaction_reference = x_orig_transaction_reference AND
658        ei.system_linkage_function = x_expenditure_type_class AND
659        ei.expenditure_type = x_expenditure_type AND
660        ei.expenditure_item_id = nvl(x_expenditure_item_id, ei.expenditure_item_id) AND
661        ei.expenditure_item_date = x_expenditure_item_date AND
662        nvl(per.employee_number,per.npw_number) = x_employee_number AND /* FP.M / CWK Changes */
663        ei.expenditure_item_date BETWEEN per.effective_start_date AND per.effective_end_date AND
664        per.person_id = exp.incurred_by_person_id AND
665        exp.expenditure_id = ei.expenditure_id AND
666        hr1.name = nvl(x_expenditure_org_name,hr1.name) AND
667        hr1.organization_id = exp.incurred_by_organization_id AND
668        proj.segment1 = x_project_number AND
669        task.project_id = proj.project_id AND
670        task.task_number = x_task_number AND
671        ei.task_id = task.task_id AND
672        nvl(ei.non_labor_resource,'-99') = nvl(x_non_labor_resource,nvl(ei.non_labor_resource,'-99')) AND
673        hr2.name = nvl(x_non_labor_resource_org_name,hr2.name) AND
674        hr2.organization_id = ei.organization_id AND
675        ei.quantity = x_quantity AND
676        nvl(ei.raw_cost,'-99') = nvl(x_raw_cost,nvl(ei.raw_cost,'-99')) AND
677        nvl(ei.attribute_category,'-99') = nvl(x_attribute_category,nvl(ei.attribute_category,'-99')) AND
678        nvl(ei.attribute1,'-99') = nvl(x_attribute1, nvl(ei.attribute1,'-99')) AND
679        nvl(ei.attribute2,'-99') = nvl(x_attribute2, nvl(ei.attribute2,'-99')) AND
680        nvl(ei.attribute3,'-99') = nvl(x_attribute3, nvl(ei.attribute3,'-99')) AND
681        nvl(ei.attribute4,'-99') = nvl(x_attribute4, nvl(ei.attribute4,'-99')) AND
682        nvl(ei.attribute5,'-99') = nvl(x_attribute5, nvl(ei.attribute5,'-99')) AND
683        nvl(ei.attribute6,'-99') = nvl(x_attribute6, nvl(ei.attribute6,'-99')) AND
684        nvl(ei.attribute7,'-99') = nvl(x_attribute7, nvl(ei.attribute7,'-99')) AND
685        nvl(ei.attribute8,'-99') = nvl(x_attribute8, nvl(ei.attribute8,'-99')) AND
686        nvl(ei.attribute9,'-99') = nvl(x_attribute9, nvl(ei.attribute9,'-99')) AND
687        nvl(ei.attribute10,'-99') = nvl(x_attribute10, nvl(ei.attribute10,'-99')) AND
688        nvl(ei.org_id,'-99') = nvl(x_org_id,nvl(ei.org_id,'-99')) AND
689        x_expenditure_type_class = 'USG' AND
690        x_employee_number IS NOT NULL
691 UNION ALL
692 --The third part of the UNION handles Usages (expenditure_type_class='USG')
693 --when IN PARAMETER x_exployee_number IS NULL.  The additional join to
694 --hr_all_organization_units hr2 is required and the join to per_all_people_f is not required.
695 SELECT net_zero_adjustment_flag
696 FROM   pa_expenditure_items_all ei,
697        pa_expenditures_all exp,
698        pa_projects_all proj,
699        pa_tasks task,
700        hr_all_organization_units hr1,
701        hr_all_organization_units hr2
702 WHERE  ei.transaction_source = x_transaction_source AND
703        ei.orig_transaction_reference = x_orig_transaction_reference AND
704        ei.system_linkage_function = x_expenditure_type_class AND
705        ei.expenditure_type = x_expenditure_type AND
706        ei.expenditure_item_id = nvl(x_expenditure_item_id, ei.expenditure_item_id) AND
707        ei.expenditure_item_date = x_expenditure_item_date AND
708        exp.expenditure_id = ei.expenditure_id AND
709        hr1.name = nvl(x_expenditure_org_name,hr1.name) AND
710        hr1.organization_id = exp.incurred_by_organization_id AND
711        proj.segment1 = x_project_number AND
712        task.project_id = proj.project_id AND
713        task.task_number = x_task_number AND
714        ei.task_id = task.task_id AND
715        nvl(ei.non_labor_resource,'-99') = nvl(x_non_labor_resource,nvl(ei.non_labor_resource,'-99')) AND
716        hr2.name = nvl(x_non_labor_resource_org_name,hr2.name) AND
717        hr2.organization_id = ei.organization_id AND
718        ei.quantity = x_quantity AND
719        nvl(ei.raw_cost,'-99') = nvl(x_raw_cost,nvl(ei.raw_cost,'-99')) AND
720        nvl(ei.attribute_category,'-99') = nvl(x_attribute_category,nvl(ei.attribute_category,'-99')) AND
721        nvl(ei.attribute1,'-99') = nvl(x_attribute1, nvl(ei.attribute1,'-99')) AND
722        nvl(ei.attribute2,'-99') = nvl(x_attribute2, nvl(ei.attribute2,'-99')) AND
723        nvl(ei.attribute3,'-99') = nvl(x_attribute3, nvl(ei.attribute3,'-99')) AND
724        nvl(ei.attribute4,'-99') = nvl(x_attribute4, nvl(ei.attribute4,'-99')) AND
725        nvl(ei.attribute5,'-99') = nvl(x_attribute5, nvl(ei.attribute5,'-99')) AND
726        nvl(ei.attribute6,'-99') = nvl(x_attribute6, nvl(ei.attribute6,'-99')) AND
727        nvl(ei.attribute7,'-99') = nvl(x_attribute7, nvl(ei.attribute7,'-99')) AND
728        nvl(ei.attribute8,'-99') = nvl(x_attribute8, nvl(ei.attribute8,'-99')) AND
729        nvl(ei.attribute9,'-99') = nvl(x_attribute9, nvl(ei.attribute9,'-99')) AND
730        nvl(ei.attribute10,'-99') = nvl(x_attribute10, nvl(ei.attribute10,'-99')) AND
731        nvl(ei.org_id,'-99') = nvl(x_org_id,nvl(ei.org_id,'-99')) AND
732        x_expenditure_type_class = 'USG' AND
733        x_employee_number IS NULL
734 UNION ALL
735 --The fourth part of the UNION handles Supplier Invoices (expenditure_type_class='VI').
739 FROM   pa_expenditure_items_all ei,
736 --The join to per_all_people_f is not required as pa_expenditures_all.incurred_by_person_id
737 --is NULL for Supplier Invoices.
738 SELECT net_zero_adjustment_flag
740        pa_expenditures_all exp,
741        pa_projects_all proj,
742        pa_tasks task,
743        hr_all_organization_units hr1
744 WHERE  ei.transaction_source = x_transaction_source AND
745        ei.orig_transaction_reference = x_orig_transaction_reference AND
746        ei.system_linkage_function = x_expenditure_type_class AND
747        ei.expenditure_type = x_expenditure_type AND
748        ei.expenditure_item_id = nvl(x_expenditure_item_id, ei.expenditure_item_id) AND
749        ei.expenditure_item_date = x_expenditure_item_date AND
750        exp.expenditure_id = ei.expenditure_id AND
751        hr1.name = nvl(x_expenditure_org_name,hr1.name) AND
752        hr1.organization_id = ei.override_to_organization_id AND
753        proj.segment1 = x_project_number AND
754        task.project_id = proj.project_id AND
755        task.task_number = x_task_number AND
756        ei.task_id = task.task_id AND
757        ei.quantity = x_quantity AND
758        nvl(ei.raw_cost,'-99') = nvl(x_raw_cost,nvl(ei.raw_cost,'-99')) AND
759        nvl(ei.attribute_category,'-99') = nvl(x_attribute_category,nvl(ei.attribute_category,'-99')) AND
760        nvl(ei.attribute1,'-99') = nvl(x_attribute1, nvl(ei.attribute1,'-99')) AND
761        nvl(ei.attribute2,'-99') = nvl(x_attribute2, nvl(ei.attribute2,'-99')) AND
762        nvl(ei.attribute3,'-99') = nvl(x_attribute3, nvl(ei.attribute3,'-99')) AND
763        nvl(ei.attribute4,'-99') = nvl(x_attribute4, nvl(ei.attribute4,'-99')) AND
764        nvl(ei.attribute5,'-99') = nvl(x_attribute5, nvl(ei.attribute5,'-99')) AND
765        nvl(ei.attribute6,'-99') = nvl(x_attribute6, nvl(ei.attribute6,'-99')) AND
766        nvl(ei.attribute7,'-99') = nvl(x_attribute7, nvl(ei.attribute7,'-99')) AND
767        nvl(ei.attribute8,'-99') = nvl(x_attribute8, nvl(ei.attribute8,'-99')) AND
768        nvl(ei.attribute9,'-99') = nvl(x_attribute9, nvl(ei.attribute9,'-99')) AND
769        nvl(ei.attribute10,'-99') = nvl(x_attribute10, nvl(ei.attribute10,'-99')) AND
770        nvl(ei.org_id,'-99') = nvl(x_org_id,nvl(ei.org_id,'-99')) AND
771        x_expenditure_type_class = 'VI';
772 
773 --The following Cursor selects the meaning for the adjustment_status_code
774 --from pa_lookups.
775 
776 CURSOR adjustment_status_meaning IS
777 SELECT meaning
778 FROM   pa_lookups
779 WHERE  lookup_type = 'PA_ADJUSTMENT_STATUS'
780 AND    lookup_code = x_adjustment_status_code;
781 
782 l_net_zero_adjustment_flag     pa_expenditure_items_all.net_zero_adjustment_flag%TYPE;
783 e_no_unique_transaction        exception;
784 
785 
786 BEGIN
787 
788 OPEN item_in_projects;
789 
790 LOOP
791 
792      FETCH item_in_projects INTO l_net_zero_adjustment_flag;
793 
794      --If no rows are selected by the cursor then the item cannot be found in Projects.
795 
796      IF item_in_projects%ROWCOUNT = 0 THEN
797 
798           x_adjustment_status_code := 'NF';
799 
800           x_return_status := 'S';
801 
802           OPEN adjustment_status_meaning;
803 
804           FETCH adjustment_status_meaning INTO x_adjustment_status;
805 
806           CLOSE adjustment_status_meaning;
807 
808           RETURN;
809 
810       END IF;
811 
812       --Exit the loop when there are no more records in the cursor.
813 
814       EXIT WHEN item_in_projects%NOTFOUND;
815 
816       --If more than one record in the cursor then the transaction was not
817       --uniquely identified in Projects based on the parameters passed to the API.
818 
819       IF item_in_projects%ROWCOUNT > 1 THEN
820 
821            RAISE e_no_unique_transaction;
822 
823       END IF;
824 
825       --If the net_zero_adjustment_flag of the item in Projects = 'Y' then
826       --the item has been adjusted in Projects.
827 
828       IF (l_net_zero_adjustment_flag = 'Y') THEN
829 
830            x_adjustment_status_code := 'A';
831 
832            x_return_status := 'S';
833 
834            OPEN adjustment_status_meaning;
835 
836            FETCH adjustment_status_meaning INTO x_adjustment_status;
837 
838            CLOSE adjustment_status_meaning;
839 
840       END IF;
841 
842       --If the net_zero_adjustment_flag of the item in Projects = 'N' or NULL then
843       --the item has not been adjusted in Projects.
844 
845       IF (nvl(l_net_zero_adjustment_flag,'N') = 'N') THEN
846 
847            x_adjustment_status_code := 'NA';
848 
849            x_return_status := 'S';
850 
851            OPEN adjustment_status_meaning;
852 
853            FETCH adjustment_status_meaning INTO x_adjustment_status;
854 
855            CLOSE adjustment_status_meaning;
856 
857       END IF;
858 
859 END LOOP;
860 
861 EXCEPTION
862 
863      WHEN e_no_unique_transaction THEN
864 
865           x_adjustment_status := NULL;
866 
867           x_adjustment_status_code := NULL;
868 
869           x_return_status := 'E';
870 
871           FND_MSG_PUB.initialize;
872 
873           FND_MESSAGE.SET_NAME('PA','PA_NO_UNIQUE_TRANSACTION');
874 
875           x_message_data := FND_MESSAGE.GET;
876 
877      WHEN others THEN
878 
882 
879           x_adjustment_status := NULL;
880 
881           x_adjustment_status_code := NULL;
883           x_return_status := 'U';
884 
885           x_message_data := substrb(SQLERRM,1,2000);
886 
887 END Check_Adjustment_of_Proj_Txn;
888 
889 
890 PROCEDURE Allow_Adjustment_Extn(
891                              p_transaction_source                   IN  VARCHAR2,
892                              p_allow_adjustment_flag                IN  VARCHAR2,
893                              p_orig_transaction_reference           IN  VARCHAR2,
894                              p_expenditure_type_class               IN  VARCHAR2,
895                              p_expenditure_type                     IN  VARCHAR2,
896                              p_expenditure_item_id                  IN  NUMBER,
897                              p_expenditure_item_date                IN  DATE,
898                              p_employee_number                      IN  VARCHAR2,
899                              p_expenditure_org_name                 IN  VARCHAR2,
900                              p_project_number                       IN  VARCHAR2,
901                              p_task_number                          IN  VARCHAR2,
902                              p_non_labor_resource                   IN  VARCHAR2,
903                              p_non_labor_resource_org_name          IN  VARCHAR2,
904                              p_quantity                             IN  NUMBER,
905                              p_raw_cost                             IN  NUMBER,
906                              p_attribute_category                   IN  VARCHAR2,
907                              p_attribute1                           IN  VARCHAR2,
908                              p_attribute2                           IN  VARCHAR2,
909                              p_attribute3                           IN  VARCHAR2,
910                              p_attribute4                           IN  VARCHAR2,
911                              p_attribute5                           IN  VARCHAR2,
912                              p_attribute6                           IN  VARCHAR2,
913                              p_attribute7                           IN  VARCHAR2,
914                              p_attribute8                           IN  VARCHAR2,
915                              p_attribute9                           IN  VARCHAR2,
916                              p_attribute10                          IN  VARCHAR2,
917                              p_org_id                               IN  NUMBER,
918                              x_allow_adjustment_code                OUT NOCOPY VARCHAR2,
919                              x_return_status                        OUT NOCOPY VARCHAR2,
920                              x_application_code                     OUT NOCOPY VARCHAR2,
921                              x_message_code                         OUT NOCOPY VARCHAR2,
922                              x_token_name1                          OUT NOCOPY VARCHAR2,
923                              x_token_val1                           OUT NOCOPY VARCHAR2,
924                              x_token_name2                          OUT NOCOPY VARCHAR2,
925                              x_token_val2                           OUT NOCOPY VARCHAR2,
926                              x_token_name3                          OUT NOCOPY VARCHAR2,
927                              x_token_val3                           OUT NOCOPY VARCHAR2)
928 
929 IS
930 
931 BEGIN
932 
933 --The default logic of this client extension will return the
934 --pa_transaction_sources.allow_adjustment_flag for p_transaction_source.
935 
936 x_allow_adjustment_code := p_allow_adjustment_flag;
937 
938 x_return_status := 'S';
939 
940 
941 EXCEPTION
942 
943      WHEN others THEN
944 
945           x_return_status := 'U';
946 
947           x_message_code := to_char(SQLCODE);
948 
949 END Allow_Adjustment_Extn;
950 
951 
952 
953 END  PA_TRANSACTIONS_PUB;