DBA Data[Home] [Help]

PACKAGE: APPS.PA_TRANSACTIONS_PUB

Source


1 PACKAGE PA_TRANSACTIONS_PUB AS
2 /* $Header: PAXTTCPS.pls 120.2 2005/08/17 12:57:48 ramurthy noship $ */
3 
4 --------------------------------------------------------------------------------
5 --
6 -- Start of comments
7 --
8 -- API Name     : pa_transactions_pub.validate_transaction
9 --
10 -- Type         : Public
11 --
12 -- Pre-reqs     : None
13 --
14 -- Function     : This procedure performs basic transaction validation(project
15 --		  status is not closed, task is chargeable, transaction date
16 --		  between project/task start and end dates), it then performs
17 --		  validation against any existing transaction controls. If the
18 -- 	  transaction passes the validation, it calls the transaction
19 --		  control client extension(PACTX.tc_extension).
20 --
21 -- Parameters   :
22 --              X_project_id             IN NUMBER
23 --              X_task_id                IN NUMBER
24 --              X_ei_date  		IN DATE
25 --              X_expenditure_type       IN VARCHAR2
26 --              X_non_labor_resource     IN VARCHAR2
27 --              X_person_id              IN NUMBER
28 --              X_quantity               IN NUMBER
29 --              X_denom_currency_code    IN VARCHAR2
30 --              X_acct_currency_code     IN VARCHAR2
31 --              X_denom_raw_cost         IN NUMBER
32 --              X_acct_raw_cost          IN NUMBER
33 --              X_acct_rate_type         IN VARCHAR2
34 --              X_acct_rate_date         IN DATE
35 --              X_acct_exchange_rate     IN NUMBER
36 --              X_transfer_ei       	IN NUMBER
37 --              X_incurred_by_org_id     IN NUMBER
38 --              X_nl_resource_org_id     IN NUMBER
39 --              X_transaction_source     IN VARCHAR2
40 --              X_calling_module         IN VARCHAR2
41 --	        X_vendor_id		IN NUMBER
42 --              X_entered_by_user_id     IN NUMBER
43 --              X_attribute_category     IN VARCHAR2
44 --              X_attribute1             IN VARCHAR2
45 --              X_attribute2             IN VARCHAR2
46 --              X_attribute3             IN VARCHAR2
47 --              X_attribute4             IN VARCHAR2
48 --              X_attribute5             IN VARCHAR2
49 --              X_attribute6             IN VARCHAR2
50 --              X_attribute7             IN VARCHAR2
51 --              X_attribute8             IN VARCHAR2
52 --              X_attribute9             IN VARCHAR2
53 --              X_attribute10            IN VARCHAR2
54 --	        X_attribute11            IN VARCHAR2
55 --              X_attribute12            IN VARCHAR2
56 --              X_attribute13            IN VARCHAR2
57 --              X_attribute14            IN VARCHAR2
58 --              X_attribute15            IN VARCHAR2
59 --              X_msg_application        IN OUT VARCHAR2
60 --              X_msg_type               OUT VARCHAR2
61 --              X_msg_token1             OUT VARCHAR2
62 --              X_msg_token2             OUT VARCHAR2
63 --              X_msg_token3             OUT VARCHAR2
64 --              X_msg_count              OUT NUMBER
65 --              X_msg_data               OUT VARCHAR2
66 --              X_billable_flag          OUT VARCHAR2
67 --
68 -- Version      : Initial version 	11.1
69 /*----------------------------------------------------------------------------
70 The processing flow of the Transaction Controls package follows the description
71 in the "Using Transaction Controls" essay in the Release 11 Oracle Projects
72 Reference Manual.
73 
74 If the transaction passes all of the basic validation checks ( project status
75 is not closed, task is chargeable, transaction date between project/task start
76 and end dates), then the transaction is checked against any existing
77 transaction controls.
78 
79 The transaction is first validated against any task-level transaction controls.
80 Task-level transaction controls always override any project-level transaction
81 controls.  If an applicable transaction control is found at the task level, and
82 the item passes this control, then the item is valid.  Likewise, if it fails,
83 then the item is invalid.
84 
85 If no applicable transaction control is found at the task level, then one of
86 the following occurs:
87   - if the limit to transaction controls flag for the task is set to 'Yes',
88     then the item is invalid and is rejected
89   - if the flag is set to 'No', then the item is validated against any
90     applicable project-level transaction controls.
91 
92 There may be several transaction controls that are applicable for a given item.
93 However, transactions are evaluated ONLY against the applicable transaction
94 control with the highest level of precedence.  The order of precedence is as
95 follows:
96 
97 1. Person - Expenditure Category - Expenditure Type - [Non-Labor Resource]
98 2. Person - Expenditure Category*
99 3. Expenditure Category - Expenditure Type - [Non-Labor Resource]
100 4. Expenditure Category
101 
102 *If a transaction control specifies that a person CAN charge, but does not
103  specify an expenditure category, then the procedure looks for any applicable
104  transaction controls (the most granular control matching the transaction's
105  expenditure category) that do not specify a particular person and then takes
106  the intersection of these two transaction controls.  This is illustrated below
107  in Example #2 below.
108 
109 
110 
111 Example 1
112 ---------
113 
114 Transaction controls defined:
115 
116      Employee    Expend Cat  Expend Type NLR         Chargeable?
117      ----------- ----------- ----------- ----------- -----------
118          --      Expense         --	     --      Yes
119          --      Assets          --          --      Yes
120      Robinson    Expense     Meals           --      Yes
121      Robinson        --          --          --      No
122          --      Labor       Clerical        --      Yes
123          --      Expense     Meals           --      No
124 
125 If the transaction being entered is a 'Meals' item for Robinson, then the
126 following transaction controls are all applicable:
127 
128      Employee    Expend Cat  Expend Type NLR         Chargeable?
129      ----------- ----------- ----------- ----------- -----------
130      Robinson    Expense     Meals           --      Yes
131          --      Expense         --          --      Yes
132      Robinson        --          --          --      No
133          --      Expense     Meals           --      No
134 
135 But given the precedence above, only one control is used to validate the item:
136 
137 Employee       Expend Cat     Expend Type    NLR            Chargeable?
138 -------------  -------------  -------------  -------------  -------------
139 Robinson       Expense        Meals               --        Yes
140 
141 Outcome:  The transaction is valid.
142 
143 
144 If the transaction being entered is an 'Air Travel' item for Robinson, then the
145 following transaction controls are both applicable:
146 
147      Employee    Expend Cat  Expend Type NLR         Chargeable?
148      ----------- ----------- ----------- ----------- -----------
149      Robinson        --          --          --      No
150          --      Expense         --          --      Yes
151 
152 But given the precedence above, only one control is used to validate the item:
153 
154      Employee    Expend Cat  Expend Type NLR         Chargeable?
155      ----------- ----------- ----------- ----------- -----------
156      Robinson        --          --          --      No
157 
158 Outcome:  The item is invalid.
159 
160 NOTE: An intersection of the two applicable transaction controls is not used in
161       this case because Robinson is not chargeable.
162 
163 
164 Example 2
165 ---------
166 
167 Transaction Controls defined:
168 
169      Employee    Expend Cat  Expend Type NLR         Chargeable?
170      ----------- ----------- ----------- ----------- -----------
171      Robinson        --          --          --      Yes
172          --      Expense         --          --      No
173          --      Expense     Meals           --      Yes
174 
175 Again, if the transaction being entered is a 'Meals' item for Robinson, then
176 all of the transaction controls are applicable.  Transaction controls involving
177 a person take precedence over others, so the transaction is validated against
178 the following control:
179 
180      Employee    Expend Cat  Expend Type NLR         Chargeable?
181      ----------- ----------- ----------- ----------- -----------
182      Robinson        --          --          --      Yes
183 
184 But, since the person is chargeable, but an expenditure category is not
185 specified in this transaction control, then the procedure will check for any
186 existing transaction controls that match the expenditure category for 'Meals'
187 and take the INTERSECTION of the two transaction controls.  The following are
188 applicable:
189 
190      Employee    Expend Cat  Expend Type NLR         Chargeable?
191      ----------- ----------- ----------- ----------- -----------
192          --      Expense         --          --      No
193          --      Expense     Meals           --      Yes
194 
195 Since the most granular transaction control is the only control used to
196 validate the item, the following control is used in the intersection with
197 the 'person' control:
198 
199      Employee    Expend Cat  Expend Type NLR         Chargeable?
200      ----------- ----------- ----------- ----------- -----------
201          --      Expense     Meals           --      Yes
202 
203 Outcome:  The item is valid.
204 
205 
206 If the item being entered is an 'Air Travel' item for Robinson, then the
207 following transaction controls are all applicable:
208 
209      Employee    Expend Cat  Expend Type NLR         Chargeable?
210      ----------- ----------- ----------- ----------- -----------
211      Robinson        --          --          --      Yes
212          --      Expense         --          --      No
213 
214 Again an INTERSECTION is necessary.  In this case, however, the item is invalid.
215 
216 ------------------------------------------------------------------------------
217 
218   Parameter              Description
219   ---------------------- ---------------------------------------------
220   X_project_id		 The identifier of the project
221 
222   X_task_id              The identifier of the task
223 
224   X_ei_date  		 The date of expenditure item
225 
226   X_expenditure_type     The type of expenditure
227 
228   X_non_labor_resource   The non-labor resource, for usage items only
229 
230   X_person_id            Identifier of the person incurring the
231 			 transaction
232 
233   X_quantity             The quantity of the transaction
234 
235   X_denom_currency_code  The transaction currency code of the transaction
236 
237   X_acct_currency_code   The functional currency code of the transaction
238 
239   X_denom_raw_cost       The transaction currency raw cost
240 
241   X_acct_raw_cost        The functional currency raw cost. The value of this
242 			 parameter will not be available for transactions
243 			 that are uncosted or unaccounted. If autorate
244 			 functionality is enabled in Oracle Payables then
245 			 X_acct_raw_cost may not be available.
246 
247   X_acct_rate_type       The conversion rate type used to convert the
248 			 transaction raw cost to functional raw cost.
249 
250   X_acct_rate_date       The conversion rate date used to convert the
251 			 transaction raw cost to functional raw cost.
252 
253   X_acct_exchange_rate   Exchange rate used to convert the transaction
254 			 raw cost to functional raw cost.  The value of this
255 			 parameter will not be available for transactions
256 			 that are uncosted or unaccounted. If autorate
257 			 functionality is enabled in Oracle Payables then
258 			 X_acct_exchange_rate may not be available.
259 
260   X_transfer_ei          The idenitifier of the original expenditure item
261 			 from which this transaction originated.
262 
263   X_incurred_by_org_id   The organization incurring the transaction.
264 
265   X_nl_resource_org_id   The identifier of the non-labor resource organization
266 			 For usageges only.
267 
268   X_transaction_source   The transaction source of the items imported using
269 			 transaction import.
270 
271   X_calling_module       The module calling the API. List of possible values
272 			 for X_calling_modules are:
273 
274 			 APXINENT (Invoice Work bench form)
275 			 CreateRelatedItem ( Procedure )
276 			 PAVVIT ( Interface supplier invoices from payables)
277 			 PAXTREPE (Pre-Approved Expenditures form)
278 			 PAXTRTRX ( Transaction import)
279 			 PAXEXCOP ( Copy Pre-Approved timecards )
280 			 PAXTEXCB ( Copy Expenditures )
281 			 PAXPRRPE (Adjust Project Expenditures )
282 			 POXPOEPO ( Purchase Orders form)
283 			 POXRQERQ ( Requisitions Form in Oracle Purchasing)
284 			 POXPOERL ( Release form in Oracle Purchasing)
285 			 POXPOPRE ( Preferences form in Oracle Purchasing)
286 			 SelfService ( Web Wxpenses SelfService Application)
287 
288 			 All values for X_calling_module are case sensitive.
289 
290   X_vendor_id		 Identifier of the vendor.
291 
292   X_entered_by_user_id   Identifier of the user that entered the transaction
293 
294   X_attribute_category   Expenditure item descriptive flexfield context
295 			 for transactions created in Orcale projects.
296 			 Invoice distributions descriptive flexfield context
297 			 for supplier invoices.
298 			 For project related requisitions and purchase orders
299 			 this will be equal to requisition/purchase order
300 			 distributions descriptive flexfield context
301 
302   X_attribute[1-15]	 Expenditure item descriptive flexfield segments
303 			 ( attribute1-10) for transactions created in Oracle
304 			 Projects.
305 			 Invoice distributions descriptive flexfields for
306 			 supplier invoices.
307 			 For project related requisitions and purchase orders
308 			 this will be equal to requisition/purchase order
309 			 distributions descriptive flexfields.
310 			 Attributes[11-15] are available for modules outside
311 			 Oracle Projects like AP,PO.
312 
313   X_msg_application      The application short name of the message owning
314 			 application
315 
316   X_msg_type             The outcome type of the procedure.
317 			 Valid Values: W for Warning, E for Errors
318 
319   X_msg_token[1-3]       Additional outcome tokens of the procedure. Used to
320 			 provide more descriptive error messages
321 
322   X_msg_count            Future Use.  This is introduced to support multiple
323 			 messages in future.  In current release we support
324 			 only 1 message
325 
326   X_msg_data             The outcome of the procedure.  The value of this
327 			 parameter will be equal to the message name.
328 
329   X_billable_flag        determine weather or not a transaction is billable
330 			 or capitalizable
331 
332   p_projfunc_currency_code  Project Functional currency code
333 
334   p_projfunc_cost_rate_type Project functional rate type is used to derive the project
335                             functional raw and burden cost
336 
337   p_projfunc_cost_rate_date Project functional rate date is used to derive the project
338                             functional raw and burden cost
339 
340   p_projfunc_cost_exchg_rate Project functional exchange rate is used to derive the project
341                             functional raw and burden cost
342 
343   p_assignment_id        identifier of the Assignment
344 
345   p_work_type_id         identifier of the work type
346 ---------------------------------------------------------------------------- */
347 -- Warning Processing in calling programs:
348 --
349 -- The following examples describe the usage of API and how to process warning
350 -- codes returned by the API in calling programs.
351 --
352 -- Example:
353 --
354 -- Usage in calling module:
355 --
356 --    pa_transactions_pub.validate_transaction( X_project_id => 121222
357 --                      , X_task_id => 1038
358 --                      , X_ei_date => '12-JAN-97'
359 --                      , X_expenditure_type => 'Supplies'
360 --                      , X_non_labor_resource => ''
361 --                      , X_person_id => 1211
362 --                      , X_quantity => 120
363 --		      	, X_denom_currency_code => 'INR'
364 --		      	, X_acct_currency_code => 'USD'
365 --		      	, X_denom_raw_cost => 120
366 --		      	, X_acct_raw_cost => 3
367 --		      	, X_acct_rate_type => 'Corporate'
368 --		      	, X_acct_rate_date => '12-FEB-97'
369 --		      	, X_acct_exchange_rate => .025
370 --                      , X_transfer_ei => ''
371 --                      , X_incurred_by_org_id => 129
372 --                      , X_nl_resource_org_id => ''
373 --                      , X_transaction_source => 'AP EXPENSE'
374 --                      , X_calling_module => 'PAXTRTRX'
375 --		      	, X_vendor_id => 11222
376 --                      , X_entered_by_user_id => 29
377 --                      , X_attribute_category => ''
378 --                      , X_attribute1 => ''
379 --                      , X_attribute2 => ''
380 --                      , X_attribute3 => ''
381 --                      , X_attribute4 => ''
382 --                      , X_attribute5 => ''
383 --                      , X_attribute6 => ''
384 --                      , X_attribute7 => ''
385 --                      , X_attribute8 => ''
386 --                      , X_attribute9 => ''
387 --                      , X_attribute10 => ''
388 --		      	, X_attribute11 => ''
389 --		      	, X_attribute12 => ''
390 --		      	, X_attribute13 => ''
391 --		      	, X_attribute14 => ''
392 --	              	, X_attribute15 => ''
393 --		      	, X_msg_application => X_msg_application
394 --	              	, X_msg_type => X_msg_type
395 --		      	, X_msg_token1 => X_msg_token1
396 --		      	, X_msg_token2 => X_msg_token2
397 --		      	, X_msg_token3 => X_msg_token3
398 --		      	, X_msg_count => X_msg_count
399 --                      , X_msg_data =>  X_msg_data
400 --                      , X_billable_flag => X_billable_flag);
401 --
402 --  After the call to the API, handle any Errors/Warnings returned
403 --  by the API. Lets assume that the API has returned with the following
404 --  values in the OUT parameters.
405 --
406 --    --------------------------------------------------------------------
407 --    X_msg_type = 'W'
408 --    X_msg_data = 'TK_TRANS_CURR_IS_NULL'
409 --    X_msg_application = 'TK'
410 --    where TK is application short name for custom application
411 --    X_msg_token1 = 1038 --Task id
412 --    X_msg_token2 = 100  -- Functional raw cost
413 --    X_msg_token3 = 80   -- Transaction Raw cost
414 --    ----------------------------------------------------------------------
415 --  The following section shows how to handle Warnings in calling programs
416 --
417 --    If X_msg_type = 'W' and X_msg_data is Not NULL then
418 --
419 --       if X_msg_application != 'PA' then
420 --
421 --	   Please do not customize messages owned by Oracle Projects. If
422 -- 	   you want to customize a message, create a new message in your
423 --	   custom application.
424 --
425 --
426 --	   FND_MESSAGE.SET_NAME(X_msg_application,X_msg_data);
427 --	   FND_MESSAGE.SET_TOKEN( patc_msg_token1,X_msg_token1)
428 --	   FND_MESSAGE.SET_TOKEN(patc_msg_token2,X_msg_token2)
429 --	   FND_MESSAGE.SET_TOKEN(patc_msg_token3,X_msg_token3)
430 --
431 -- 	 else -- for seeded messages, i.e messages owned by PA
432 --
433 --	   Tokens are not supported in Seeded messages
434 --
435 --	   FND_MESSAGE.set_name(X_msg_application,X_msg_data)
436 --
437 --	 end if;
438 --
439 --	 Display the Question Alert. Ask if the user wants to continue or
440 --	 abort the processing.  If the user chooses to continue, ignore
441 --	 the warning and continue, otherwise stop processing.
442 --
443 --    End if;
444 --
445 --       Note: Since warning's involves user interaction which is not possible
446 --	       in batch programs, hence batch programs will ignore warnings
447 --	       For Example: In Transaction Import, if validatte_transaction
448 --		            API returned a Warning, Transaction import would
449 --			    ignore the warning and continue as if the API
450 --			    completed successfully.
451 ------------------------------------------------------------------------------
452 -- Error processing in calling programs:
453 --
454 -- The following examples describe how to process error codes returned by
455 -- validate_transaction procedure in calling programs.
456 --
457 -- Example:
458 --    pa_transactions_pub.validate_transaction( X_project_id => 121222
459 --                      , X_task_id => 1038
460 --                      , X_ei_date => '12-JAN-97'
461 --                      , X_expenditure_type => 'Supplies'
462 --                      , X_non_labor_resource => ''
463 --                      , X_person_id => 1211
464 --                      , X_quantity => 120
465 --		      	, X_denom_currency_code => 'INR'
466 --		      	, X_acct_currency_code => 'USD'
467 --		      	, X_denom_raw_cost => 120
468 --		      	, X_acct_raw_cost => 3
469 --		      	, X_acct_rate_type => 'Corporate'
470 --		      	, X_acct_rate_date => '12-FEB-97'
471 --		      	, X_acct_exchange_rate => .025
472 --                      , X_transfer_ei => ''
473 --                      , X_incurred_by_org_id => 129
474 --                      , X_nl_resource_org_id => ''
475 --                      , X_transaction_source => 'AP EXPENSE'
476 --                      , X_calling_module => 'PAXTRTRX'
477 --		      	, X_vendor_id => 11222
478 --                      , X_entered_by_user_id => 29
479 --                      , X_attribute_category => ''
480 --                      , X_attribute1 => ''
481 --                      , X_attribute2 => ''
482 --                      , X_attribute3 => ''
483 --                      , X_attribute4 => ''
484 --                      , X_attribute5 => ''
485 --                      , X_attribute6 => ''
486 --                      , X_attribute7 => ''
487 --                      , X_attribute8 => ''
488 --                      , X_attribute9 => ''
489 --                      , X_attribute10 => ''
490 --		      	, X_attribute11 => ''
491 --		      	, X_attribute12 => ''
492 --		      	, X_attribute13 => ''
493 --		      	, X_attribute14 => ''
494 --	              	, X_attribute15 => ''
495 --		      	, X_msg_application => X_msg_application
496 --	              	, X_msg_type => X_msg_type
497 --		      	, X_msg_token1 => X_msg_token1
498 --		      	, X_msg_token2 => X_msg_token2
499 --		      	, X_msg_token3 => X_msg_token3
500 --		      	, X_msg_count => X_msg_count
501 --                      , X_msg_data =>  X_msg_data
502 --                      , X_billable_flag => X_billable_flag);
503 --
504 --  After the call to the API, handle the any Errors/Warnings returned
505 --  by the API. Lets assume that the API has returned with the following
506 --  values in the OUT parameters.
507 --
508 --   -------------------------------------------------------------------
509 --   X_msg_type = 'E'
510 --   X_msg_data = 'TK_QTY_IS_NULL'
511 --   X_msg_application = 'TK'
512 --   where TK is application short name for custom application that
513 --   owns the message
514 --   X_msg_token1 = 110034   -- Project Id
515 --   X_msg_token2 =1038      -- Task Id
516 --   X_msg_token3 = Supplies -- Expenditure Type
517 --   --------------------------------------------------------------------
518 --  The following section shows how to handle Warnings in calling programs
519 --
520 --   If X_msg_type = 'E' and X_msg_data is not null then
521 --
522 --      if X_msg_application !='PA' then
523 --
524 --         FND_MESSAGE.SET_NAME(X_msg_application,X_msg_data);
525 --	   FND_MESSAGE.SET_TOKEN(patc_msg_token1,X_msg_token1);
526 --	   FND_MESSAGE.SET_TOKEN(patc_msg_token2,X_msg_token2);
527 --	   FND_MESSAGE.SET_TOKEN(patc_msg_token3,X_msg_token3);
528 --      else
529 --	   FND_MESSAGE.set_name(X_msg_application,X_msg_data);
530 --	end if;
531 --
532 --	Display Error Alert.( Similar to release 11 error handling).
533 --	Abort the processing.
534 --   End if;
535 --
536 -------------------------------------------------------------------------------
537 -- Custom Error/Warning Messages:
538 --
539 -- Prior to release 11.1 users were allowed to store customized error messages
540 -- for transaction control extension in Oracle Projects, However with release
541 -- 11.1 customized messages for transaction control extension will not be
542 -- upgraded.  Users should move all customized messages to a different custom
543 -- application.  All custom messages should follow the following standards.
544 --
545 -- Transaction control custom messages should always have 3 tokens defined in
546 -- the message text( Even if you do not intend to use the tokens).
547 --
548 -- Names of the tokens should be patc_msg_token1, patc_msg_token2 and
549 -- patc_msg_token3.
550 --
551 -- Examples of messages in release 11.0 and prior versions:
552 -- -------------------------------------------------------
553 -- Application Name: Oracle Projects
554 -- Message Name: PATXC_QTY_IS_NULL
555 -- Message text:  Quantity is null
556 --
557 -- Examples of Error messages in release 11.1
558 -- ------------------------------------------
559 -- Application Name: <Custom Application>
560 -- Message Name: TK_QTY_IS_NULL
561 -- Message text: Quantity is null.
562 --	         Project id is <patc_msg_token1>
563 --	         Task_id is <patc_msg_token2>
564 --	         Expenditure Type is <patc_msg_token3>
565 --
566 -- Examples of Warning Messages in release 11.1
567 -- --------------------------------------------
568 -- Application Name: <Custom Application>
569 -- Message Name: TK_TRANS_CURR_IS_NULL
570 -- Message text: Transaction Currency is null.  Do you want to continue?.
571 --	         Task Id is <patc_msg_token1>
572 --	         Functional currency raw cost is <patc_msg_token2>
573 --	         Transaction currency raw cost is <patc_msg_token3>
574 
575 -------------------------------------------------------------------------------
576   PROCEDURE  validate_transaction(
577               X_project_id             IN NUMBER
578             , X_task_id                IN NUMBER
579             , X_ei_date  		IN DATE
580             , X_expenditure_type       IN VARCHAR2
581             , X_non_labor_resource     IN VARCHAR2
582             , X_person_id              IN NUMBER
583             , X_quantity               IN NUMBER DEFAULT NULL
584             , X_denom_currency_code    IN VARCHAR2 DEFAULT NULL
585             , X_acct_currency_code     IN VARCHAR2 DEFAULT NULL
586             , X_denom_raw_cost         IN NUMBER DEFAULT NULL
587             , X_acct_raw_cost          IN NUMBER DEFAULT NULL
588             , X_acct_rate_type         IN VARCHAR2 DEFAULT NULL
589             , X_acct_rate_date         IN DATE DEFAULT NULL
590             , X_acct_exchange_rate     IN NUMBER DEFAULT NULL
591             , X_transfer_ei       	IN NUMBER DEFAULT NULL
592             , X_incurred_by_org_id     IN NUMBER DEFAULT NULL
593             , X_nl_resource_org_id     IN NUMBER DEFAULT NULL
594             , X_transaction_source     IN VARCHAR2 DEFAULT NULL
595             , X_calling_module         IN VARCHAR2 DEFAULT NULL
596 	    , X_vendor_id		IN NUMBER DEFAULT NULL
597             , X_entered_by_user_id     IN NUMBER DEFAULT NULL
598             , X_attribute_category     IN VARCHAR2 DEFAULT NULL
599             , X_attribute1             IN VARCHAR2 DEFAULT NULL
600             , X_attribute2             IN VARCHAR2 DEFAULT NULL
601             , X_attribute3             IN VARCHAR2 DEFAULT NULL
602             , X_attribute4             IN VARCHAR2 DEFAULT NULL
603             , X_attribute5             IN VARCHAR2 DEFAULT NULL
604             , X_attribute6             IN VARCHAR2 DEFAULT NULL
605             , X_attribute7             IN VARCHAR2 DEFAULT NULL
606             , X_attribute8             IN VARCHAR2 DEFAULT NULL
607             , X_attribute9             IN VARCHAR2 DEFAULT NULL
608             , X_attribute10            IN VARCHAR2 DEFAULT NULL
609 	    , X_attribute11            IN VARCHAR2 DEFAULT NULL
610             , X_attribute12            IN VARCHAR2 DEFAULT NULL
611             , X_attribute13            IN VARCHAR2 DEFAULT NULL
612             , X_attribute14            IN VARCHAR2 DEFAULT NULL
613             , X_attribute15            IN VARCHAR2 DEFAULT NULL
614             , X_msg_application        IN OUT NOCOPY VARCHAR2
615             , X_msg_type               OUT NOCOPY VARCHAR2
616             , X_msg_token1             OUT NOCOPY VARCHAR2
617             , X_msg_token2             OUT NOCOPY VARCHAR2
618             , X_msg_token3             OUT NOCOPY VARCHAR2
619             , X_msg_count              OUT NOCOPY NUMBER
620             , X_msg_data               OUT NOCOPY VARCHAR2
621             , X_billable_flag          OUT NOCOPY VARCHAR2
622             , P_ProjFunc_Currency_Code  IN VARCHAR2    default null
623             , P_ProjFunc_Cost_rate_Type IN VARCHAR2    default null
624             , P_ProjFunc_Cost_rate_Date IN DATE        default null
625             , P_ProjFunc_Cost_Exchg_Rate IN NUMBER     default null
626             , P_Assignment_Id           IN  NUMBER     default null
627             , P_Work_type_Id            IN  NUMBER     default null
628 	    , P_Sys_Link_Function       IN  VARCHAR2   default null
629 	    , P_Po_Header_Id            IN  NUMBER     default null
630 	    , P_Po_Line_Id              IN  NUMBER     default null
631 	    , P_Person_Type             IN  VARCHAR2   default null
632 	    , P_Po_Price_Type           IN  VARCHAR2   default null
633 	    , P_Document_Type           IN  VARCHAR2   default null
634 	    , P_Document_Line_Type      IN  VARCHAR2   default null
635 	    , P_Document_Dist_Type      IN  VARCHAR2   default null
636 	    , P_pa_ref_num1             IN  NUMBER     default null
637 	    , P_pa_ref_num2             IN  NUMBER     default null
638 	    , P_pa_ref_num3             IN  NUMBER     default null
639 	    , P_pa_ref_num4             IN  NUMBER     default null
640 	    , P_pa_ref_num5             IN  NUMBER     default null
641 	    , P_pa_ref_num6             IN  NUMBER     default null
642 	    , P_pa_ref_num7             IN  NUMBER     default null
643 	    , P_pa_ref_num8             IN  NUMBER     default null
644 	    , P_pa_ref_num9             IN  NUMBER     default null
645 	    , P_pa_ref_num10            IN  NUMBER     default null
646 	    , P_pa_ref_var1             IN  VARCHAR2   default null
647 	    , P_pa_ref_var2             IN  VARCHAR2   default null
648 	    , P_pa_ref_var3             IN  VARCHAR2   default null
649 	    , P_pa_ref_var4             IN  VARCHAR2   default null
650 	    , P_pa_ref_var5             IN  VARCHAR2   default null
651 	    , P_pa_ref_var6             IN  VARCHAR2   default null
652 	    , P_pa_ref_var7             IN  VARCHAR2   default null
653 	    , P_pa_ref_var8             IN  VARCHAR2   default null
654 	    , P_pa_ref_var9             IN  VARCHAR2   default null
655 	    , P_pa_ref_var10            IN  VARCHAR2   default null);
656 
657 
658 -- DFF Upgrade -----------------------------------------------------------
659 
660 -- The following record type is used to record for each context code,
661 -- which segment is enabled.
662 
663 TYPE dff_segments_enabled_record IS RECORD (
664    context_code fnd_descr_flex_contexts.descriptive_flex_context_code%TYPE,
665    context_name fnd_descr_flex_contexts_vl.descriptive_flex_context_name%TYPE,
666    is_global           boolean,
667    attribute1_enabled  boolean,
668    attribute2_enabled  boolean,
669    attribute3_enabled  boolean,
670    attribute4_enabled  boolean,
671    attribute5_enabled  boolean,
672    attribute6_enabled  boolean,
673    attribute7_enabled  boolean,
674    attribute8_enabled  boolean,
675    attribute9_enabled  boolean,
676    attribute10_enabled  boolean
677 );
678 
679 ----------------------------------------------------------------------------
680 
681 -- This table type is used to record, for a descriptive flex field, which
682 -- context code has which enabled segments.
683 
684 TYPE dff_segments_enabled_table IS TABLE OF dff_segments_enabled_record
685    INDEX BY BINARY_INTEGER;
686 
687 ----------------------------------------------------------------------------
688 
689 -- This Global Variable is used mainly by validate_dff API to keep track of,
690 -- for a descriptive flexfield, which context code has which enabled segments.
691 -- We want to record all these information for performance purpose.  By storing
692 -- these information in a table, we do not need to call ATG API each time if
693 -- we want to find out which segments are enabled for a particular context code.
694 
695 G_dff_segments_enabled_table dff_segments_enabled_table;
696 
697 
698 ------------------------------------------------------------------------------
699 -- Start of Comments
700 -- API Name      : pop_dff_segments_enabled_table
701 -- Type          : Public
702 -- Pre-Reqs      : None
703 -- Type          : Procedure
704 -- Function      : Initialize the global variable G_dff_segments_enabled_table
705 -- Parameters    : None
706 
707 /*----------------------------------------------------------------------------*/
708 
709 PROCEDURE pop_dff_segments_enabled_table;
710 
711 
712 /*----------------------------------------------------------------------------*/
713 -- Start of Comments
714 -- API Name      : populate_segments
715 -- Type          : Public
716 -- Pre-Reqs      : None
717 -- Type          : Procedure
718 -- Function      : This API is called by pop_dff_segments_enabled_table.  It is
719 --                 called in a loop by the number of context codes for a
720 --                 descriptive flexfield.  By giving the segment detail info of
721 --                 a context code, this API initialize one record of
722 --                 G_dff_segments_enabled_table with the enabled segments of that
723 --                 context code.
724 -- Parameters    :
725 -- IN
726 --           p_segment_detail              fnd_dflex.segments_dr
727 -- IN/OUT
728 --           p_dff_segments_enabled_record dff_segments_enabled_record
729 
730 /*----------------------------------------------------------------------------*/
731 
732 PROCEDURE populate_segments (
733       p_segment_detail IN fnd_dflex.segments_dr,
734 /* Start of bug# 2672653 */
735 /*    p_dff_segments_enabled_record IN OUT dff_segments_enabled_record); */
736       p_dff_segments_enabled_record IN OUT NOCOPY dff_segments_enabled_record);
737 /* End of  bug# 2672653 */
738 
739 
740 
741 --------------------------------------------------------------------------------
742 --
743 -- Start of comments
744 --
745 -- API Name     : pa_transactions_pub.validate_dff
746 --
747 -- Type         : Public
748 --
749 -- Pre-reqs     : None
750 --
751 -- Function     : This procedure performs the following two tasks:
752 --                1. Call pop_dff_segments_enabled_table to initialize
753 --                   G_dff_segments_enabled_table if it hasn't been initialized
754 --                2. Validate DFF segments
755 --                3. Pass out enabled segment values in p_attribute_x parameters
756 --                   segments which are not enabled are pass out as NULL in p_attribute_x
757 --                   parameters
758 -- Parameters:
759 -- IN
760 --            p_dff_name              fnd_descriptive_flexs_vl.descriptive_flexfield_name%TYPE
761 --            p_attribute_category    pa_expenditure_items_all.attribute_category%TYPE
762 --
763 -- IN/OUT
764 --            p_attribute1            IN OUT pa_expenditure_items_all.attribute1%TYPE
765 --            p_attribute2            IN OUT pa_expenditure_items_all.attribute2%TYPE
766 --            p_attribute3            IN OUT pa_expenditure_items_all.attribute3%TYPE
767 --            p_attribute4            IN OUT pa_expenditure_items_all.attribute4%TYPE
768 --            p_attribute5            IN OUT pa_expenditure_items_all.attribute5%TYPE
769 --            p_attribute6            IN OUT pa_expenditure_items_all.attribute6%TYPE
770 --            p_attribute7            IN OUT pa_expenditure_items_all.attribute7%TYPE
771 --            p_attribute8            IN OUT pa_expenditure_items_all.attribute8%TYPE
772 --            p_attribute9            IN OUT pa_expenditure_items_all.attribute9%TYPE
773 --            p_attribute10           IN OUT pa_expenditure_items_all.attribute10%TYPE
774 --
775 -- OUT
776 --            x_status_code           OUT VARCHAR2
777 --            x_error_message         OUT VARCHAR2
778 --
779 PROCEDURE validate_dff (
780 				p_dff_name              IN fnd_descriptive_flexs_vl.descriptive_flexfield_name%TYPE,
781             p_attribute_category    IN pa_expenditure_items_all.attribute_category%TYPE,
782             p_attribute1            IN OUT NOCOPY pa_expenditure_items_all.attribute1%TYPE,
783             p_attribute2            IN OUT NOCOPY pa_expenditure_items_all.attribute2%TYPE,
784             p_attribute3            IN OUT NOCOPY pa_expenditure_items_all.attribute3%TYPE,
785             p_attribute4            IN OUT NOCOPY pa_expenditure_items_all.attribute4%TYPE,
786             p_attribute5            IN OUT NOCOPY pa_expenditure_items_all.attribute5%TYPE,
787             p_attribute6            IN OUT NOCOPY pa_expenditure_items_all.attribute6%TYPE,
788             p_attribute7            IN OUT NOCOPY pa_expenditure_items_all.attribute7%TYPE,
789             p_attribute8            IN OUT NOCOPY pa_expenditure_items_all.attribute8%TYPE,
790             p_attribute9            IN OUT NOCOPY pa_expenditure_items_all.attribute9%TYPE,
791             p_attribute10           IN OUT NOCOPY pa_expenditure_items_all.attribute10%TYPE,
792             x_status_code           OUT NOCOPY VARCHAR2,
793 			   x_error_message         OUT NOCOPY VARCHAR2);
794 
795 /*--------------------------------------------------------------------------------
796 --
797 -- Start of comments
798 --
799 -- API Name     : check_adjustment_of_proj_transactions
800 --
801 -- Type         : Public
802 --
803 -- Pre-reqs     : None
804 --
805 -- Function     : This procedure can be called from an external system
806 --                to check if an item imported to Projects from an external
807 --                system through Transaction Import has been adjusted in Projects.
808 --
809 --                The API will check the pa_expenditure_items_all.net_zero_adjustment_flag for
810 --                the item in Projects.
811 --
812 --                If the net_zero_adjustment_flag = 'Y'then the item has been adjusted
813 --                in Projects and the API will return x_adjustment_status = 'Adjusted'.
814 --
815 --                If the net_zero_adjustment_flag <> 'Y' then item has NOT been adjusted in
816 --                Projects and the API will return x_adjustment_status = 'Not Adjusted'.
817 
818 --                If the item cannot be found in Projects based upon the parameters
819 --                passed into the API then the API will return
820 --                x_adjustment_status = 'Not Found'.
821 --
822 --                This API is NOT customizable.
823 --
824 -- Parameters:
825 --
826 -- IN
827 --                             x_transaction_source                   IN VARCHAR2
828 --                             x_orig_transaction_reference           IN VARCHAR2
829 --                             x_expenditure_type_class               IN VARCHAR2
830 --                             x_expenditure_type                     IN VARCHAR2
831 --                             x_expenditure_item_id                  IN NUMBER DEFAULT NULL
832 --                             x_expenditure_item_date                IN DATE
833 --                             x_employee_number                      IN VARCHAR2 DEFAULT NULL
834 --                             x_expenditure_organization_name        IN VARCHAR2 DEFAULT NULL
835 --                             x_project_number                       IN VARCHAR2
836 --                             x_task_number                          IN VARCHAR2
837 --                             x_non_labor_resource                   IN VARCHAR2 DEFAULT NULL
838 --                             x_non_labor_resource_org_name          IN VARCHAR2 DEFAULT NULL
839 --                             x_quantity                             IN NUMBER
840 --                             x_raw_cost                             IN NUMBER DEFAULT NULL
841 --                             x_attribute_category                   IN VARCHAR2 DEFAULT NULL
842 --                             x_attribute1                           IN VARCHAR2 DEFAULT NULL
843 --                             x_attribute2                           IN VARCHAR2 DEFAULT NULL
844 --                             x_attribute3                           IN VARCHAR2 DEFAULT NULL
845 --                             x_attribute4                           IN VARCHAR2 DEFAULT NULL
846 --                             x_attribute5                           IN VARCHAR2 DEFAULT NULL
847 --                             x_attribute6                           IN VARCHAR2 DEFAULT NULL
848 --                             x_attribute7                           IN VARCHAR2 DEFAULT NULL
849 --                             x_attribute8                           IN VARCHAR2 DEFAULT NULL
850 --                             x_attribute9                           IN VARCHAR2 DEFAULT NULL
851 --                             x_attribute10                          IN VARCHAR2 DEFAULT NULL
852 --                             x_org_id                               IN NUMBER DEFAULT NULL
853 --OUT
854 --                             x_adjustment_status                    OUT VARCHAR2
855 --                             x_adjustment_status_code               OUT VARCHAR2
856 --                             x_return_status                        OUT VARCHAR2
857 --                             x_message_data                         OUT VARCHAR2
858 --
859 --
860 
861 ------------------------------------------------------------------------------
862 
863   Parameter                            Description
864   ----------------------               ---------------------------------------------
865   X_transaction_source                 Identifies the external system from which the item
866                                        imported by Transaction Import originated.
867 
868   X_orig_transaction_reference         Value used to identify the transaction in the external system from
869                                        which the imported item originated.
870 
871   X_expenditure_type_class             System Linkage function of the expenditure item.
872 
873   X_expenditure_type                   The type of expenditure.
874 
875   X_expenditure_item_id                Unique identifier of the item in Projects.
876 
877   X_expenditure_item_date              Date of the expenditure item.
878 
879   X_employee_number                    The employee number of the person who incurred
880                                        the expenditure.
881 
882   X_expenditure_org_name               The name of the organization that incurred the
883                                        expenditure.
884 
885   X_project_number                     Number identifying the project to which the
886                                        transaction is charged.
887 
888   X_task_number                        Number identifying the task to which the
889                                        transaction is charged.
890 
891   X_non_labor_resource                 The non-labor resource.  For usage items only.
892 
893   X_non_labor_resource_org_name        The name of the organization that owns the non-labor
894                                        resource utilized.  For usage items only.
895 
896   X_quantity                           Number of units for the transaction.
897 
898   X_raw_cost                           The total raw cost for the transaction as calculated by the
899                                        original, external system.
900 
901   X_attribute_category                 Expenditure item descriptive flexfield context
902 			               for transactions created in Orcale projects.
903 			               Invoice distributions descriptive flexfield context
904 			               for supplier invoices.
905 			               For project related requisitions and purchase orders
906 			               this will be equal to requisition/purchase order
907 			               distributions descriptive flexfield context
908 
909   X_attribute[1-10]	               Expenditure item descriptive flexfield segments
910 			               (attribute1-10).
911 
912   X_adjustment_status                  Indicates if the item has been adjusted in Projects.
913                                        'Adjusted' - Adjusted in Projects
914                                        'Not Adjusted' - Not Adjusted in Projects
915                                        'Not Found' - Not Found in Projects based upon the
916                                                      parameters passed to the API.
917 
918   X_adjustment_status_code             Code indicating if the item has been adjusted in
919                                        Projects.  Possible values are:
920                                        'A' - Adjusted in Projects
921                                        'NA' - Not Adjusted in Projects
922                                        'NF' - Not Found in Projects based upon the
923                                               parameters passed to the API.
924 
925   X_return_status                      Indicates the status of the procedure.  Possible values
926                                        are:
927 
928                                        'S' - Success
929                                        'E' - Expected Error
930                                        'U' - Unexpected Error
931 
932                                        If the parameters passed to the API do not uniquely identify
933                                        the transaction in Projects then the API will return
934                                        X_return_status = 'E' (Expected Error).
935 
936   X_msg_data                           Will contain the error message if x_return_status = 'E' or 'U'.
937                                        Will be NULL if x_return_status = 'S'.
938 
939 
940   Please note that this API is NOT customizable.
941 
942   The following IN paramters are required:
943 
944        x_transaction_source
945        x_orig_transaction_reference
946        x_expenditure_type_class
947        x_expenditure_type
948        x_expenditure_item_date
949        x_project_number
950        x_task_number
951        x_quantity
952 
953   The required parameters, along with any other parameters needed to uniquely identify
954   the transaction in Projects, should be passed to the API.
955 
956 
957 ---------------------------------------------------------------------------- */
958 
959 PROCEDURE check_adjustment_of_proj_txn(
960                              x_transaction_source                   IN VARCHAR2,
961                              x_orig_transaction_reference           IN VARCHAR2,
962                              x_expenditure_type_class               IN VARCHAR2,
963                              x_expenditure_type                     IN VARCHAR2,
964                              x_expenditure_item_id                  IN NUMBER DEFAULT NULL,
965                              x_expenditure_item_date                IN DATE,
966                              x_employee_number                      IN VARCHAR2 DEFAULT NULL,
967                              x_expenditure_org_name                 IN VARCHAR2 DEFAULT NULL,
968                              x_project_number                       IN VARCHAR2,
969                              x_task_number                          IN VARCHAR2,
970                              x_non_labor_resource                   IN VARCHAR2 DEFAULT NULL,
971                              x_non_labor_resource_org_name          IN VARCHAR2 DEFAULT NULL,
972                              x_quantity                             IN NUMBER,
973                              x_raw_cost                             IN NUMBER DEFAULT NULL,
974                              x_attribute_category                   IN VARCHAR2 DEFAULT NULL,
975                              x_attribute1                           IN VARCHAR2 DEFAULT NULL,
976                              x_attribute2                           IN VARCHAR2 DEFAULT NULL,
977                              x_attribute3                           IN VARCHAR2 DEFAULT NULL,
978                              x_attribute4                           IN VARCHAR2 DEFAULT NULL,
979                              x_attribute5                           IN VARCHAR2 DEFAULT NULL,
980                              x_attribute6                           IN VARCHAR2 DEFAULT NULL,
981                              x_attribute7                           IN VARCHAR2 DEFAULT NULL,
982                              x_attribute8                           IN VARCHAR2 DEFAULT NULL,
983                              x_attribute9                           IN VARCHAR2 DEFAULT NULL,
984                              x_attribute10                          IN VARCHAR2 DEFAULT NULL,
985                              x_org_id                               IN NUMBER DEFAULT NULL,
986                              x_adjustment_status                    OUT NOCOPY VARCHAR2,
987                              x_adjustment_status_code               OUT NOCOPY VARCHAR2,
988                              x_return_status                        OUT NOCOPY VARCHAR2,
989                              x_message_data                         OUT NOCOPY VARCHAR2);
990 
991 
992 /*--------------------------------------------------------------------------------
993 --
994 -- Start of comments
995 --
996 -- API Name     : allow_adjustment_extn
997 --
998 -- Type         : Public
999 --
1000 -- Pre-reqs     : None
1001 --
1002 -- Function     : This client extension will be called when a user attempts to make an adjustment
1003 --                in Projects to an item which was imported from an external system through Transaction Import.
1004 --                The extension can be used by customers to determine if adjustments in Projects
1005 --                should be allowed on those items.
1006 --
1007 --                For example, if the item has been adjusted in the external system then you may
1008 --                not want to allow adjustments to that item in Projects.
1009 --
1010 --                By default, the extension will return pa_transaction_sources.allow_adjustment_flag for
1011 --                p_transaction source.
1012 --
1013 --                If the client extension returns x_allow_adjustment_code = 'Y' (Yes) then the adjustment
1014 --                in Projects will be allowed.
1015 --
1016 --                If the client extension returns x_allow_adjustment_code = 'N' (No) then the adjustment
1017 --                in Projects will NOT be allowed.
1018 --
1019 -- Parameters:
1020 --
1021 -- IN
1022 --                             p_transaction_source                   IN VARCHAR2
1023 --                             p_allow_adjustment_flag                IN VARCHAR2
1024 --                             p_orig_transaction_reference           IN VARCHAR2
1025 --                             p_expenditure_type_class               IN VARCHAR2
1026 --                             p_expenditure_type                     IN VARCHAR2
1027 --                             p_expenditure_item_id                  IN NUMBER
1028 --                             p_expenditure_item_date                IN DATE
1029 --                             p_employee_number                      IN VARCHAR2
1030 --                             p_expenditure_org_name                 IN VARCHAR2
1031 --                             p_project_number                       IN VARCHAR2
1032 --                             p_task_number                          IN VARCHAR2
1033 --                             p_non_labor_resource                   IN VARCHAR2
1034 --                             p_non_labor_resource_org_name          IN VARCHAR2
1035 --                             p_quantity                             IN NUMBER
1036 --                             p_raw_cost                             IN NUMBER
1037 --                             p_attribute_category                   IN VARCHAR2
1038 --                             p_attribute1                           IN VARCHAR2
1039 --                             p_attribute2                           IN VARCHAR2
1040 --                             p_attribute3                           IN VARCHAR2
1041 --                             p_attribute4                           IN VARCHAR2
1042 --                             p_attribute5                           IN VARCHAR2
1043 --                             p_attribute6                           IN VARCHAR2
1044 --                             p_attribute7                           IN VARCHAR2
1045 --                             p_attribute8                           IN VARCHAR2
1046 --                             p_attribute9                           IN VARCHAR2
1047 --                             p_attribute10                          IN VARCHAR2
1048 --                             p_org_id                               IN NUMBER
1049 --OUT
1050 --                             x_allow_adjustment_code                OUT VARCHAR2
1051 --                             x_return_status                        OUT VARCHAR2
1052 --                             x_application_code                     OUT VARCHAR2,
1053 --                             x_message_code                         OUT VARCHAR2,
1054 --                             x_token_name1                          OUT VARCHAR2,
1055 --                             x_token_val1                           OUT VARCHAR2,
1056 --                             x_token_name2                          OUT VARCHAR2,
1057 --                             x_token_val2                           OUT VARCHAR2,
1058 --                             x_token_name3                          OUT VARCHAR2,
1059 --                             x_token_val3                           OUT VARCHAR2);
1060 --
1061 --
1062 
1063   Parameter                            Description
1064   ----------------------               ---------------------------------------------
1065   p_transaction_source                 Identifies the external system from which the item
1066                                        imported by Transaction Import originated.
1067 
1068   p_orig_transaction_reference         Value used to identify the transaction in the external system from
1069                                        which the imported item originated.
1070 
1071   p_expenditure_type_class             System Linkage function of the expenditure item.
1072 
1073   p_expenditure_type                   The type of expenditure.
1074 
1075   p_expenditure_item_id                Unique identifier of the item in Projects.
1076 
1077   p_expenditure_item_date              Date of the expenditure item.
1078 
1079   p_employee_number                    The employee number of the person who incurred
1080                                        the expenditure.
1081 
1082   p_expenditure_org_name               The name of the organization that incurred the
1083                                        expenditure.
1084 
1085   p_project_number                     Number identifying the project to which the
1086                                        transaction is charged.
1087 
1088   p_task_number                        Number identifying the task to which the
1089                                        transaction is charged.
1090 
1091   p_non_labor_resource                 The non-labor resource.  For usage items only.
1092 
1093   p_non_labor_resource_org_name        The name of the organization that owns the non-labor
1094                                        resource utilized.  For usage items only.
1095 
1096   p_quantity                           Number of units for the transaction.
1097 
1098   p_raw_cost                           The total raw cost for the transaction as calculated by the
1099                                        original, external system.
1100 
1101   p_attribute_category                 Expenditure item descriptive flexfield context
1102 			               for transactions created in Orcale projects.
1103 			               Invoice distributions descriptive flexfield context
1104 			               for supplier invoices.
1105 			               For project related requisitions and purchase orders
1106 			               this will be equal to requisition/purchase order
1107 			               distributions descriptive flexfield context
1108 
1109   p_attribute[1-10]	               Expenditure item descriptive flexfield segments
1110 			               (attribute1-10).
1111 
1112   p_org_id                             Operating unit identifier for multi-organization
1113                                        installations.
1114 
1115   x_allow_adjustment_code              Code indicating if the item may been adjusted in
1116                                        Projects.  Possible values are:
1117                                        'Y' -  Yes (Adjustment is allowed)
1118                                        'N' -  No  (Adjustment not allowed)
1119 
1120   X_return_status                      Indicates the status of the procedure.  Possible values
1121                                        are:
1122 
1123                                        'S' - Success
1124                                        'W' - Warning
1125                                        'E' - Error
1126 
1127   X_application_code                   The application short name of the message owning
1128 			               application.
1129 
1130   X_message_code                       The message name.
1131 
1132   X_token_name[1-3]                    Name of the tokens in the message.
1133 
1134   X_token_val[1-3]                     Value of the tokens in the message.
1135 
1136 --------------------------------------------------------------------------------------
1137 
1138 --The following examples describe the usage of API and how to process error/warning
1139 --codes returned by the API in calling programs.
1140 
1141 --Example:
1142 
1143 --allow_adjustment_extn is called from pa_adjustments.allow_adjustment
1144 
1145 --PA_TRANSACTIONS_PUB.Allow_Adjustment_Extn(
1146 --                             p_transaction_source => 'customer transaction source',
1147 --                             p_allow_adjustment_flag => 'Y',
1148 --                             p_orig_transaction_reference => 'Timecard-123',
1149 --                             p_expenditure_type_class => 'ST',
1150 --                             p_expenditure_type => 'Professional',
1151 --                             p_expenditure_item_id => '',
1152 --                             p_expenditure_item_date => '01-JAN-99',
1153 --                             p_employee_number => '',
1154 --                             p_expenditure_org_name => 'Consulting',
1155 --                             p_project_number => '123',
1156 --                             p_task_number => '456',
1157 --                             p_non_labor_resource => '',
1158 --                             p_non_labor_resource_org_name => '',
1159 --                             p_quantity => 8,
1160 --                             p_raw_cost => '',
1161 --                             p_attribute_category => '',
1162 --                             p_attribute1 => '',
1163 --                             p_attribute2 => '',
1164 --                             p_attribute3 => '',
1165 --                             p_attribute4 => '',
1166 --                             p_attribute5 => '',
1167 --                             p_attribute6 => '',
1168 --                             p_attribute7 => '',
1169 --                             p_attribute8 => '',
1170 --                             p_attribute9 => '',
1171 --                             p_attribute10 => '',
1172 --                             p_org_id => '',
1173 --                             x_allow_adjustment_code => x_allow_adjustment_code,
1174 --                             x_return_status => x_return_status,
1175 --                             x_application_code => x_application_code,
1176 --                             x_message_code => x_message_code,
1177 --                             x_token_name1 => x_token_name1,
1178 --                             x_token_val1 => x_token_val1,
1179 --                             x_token_name2 => x_token_name2,
1180 --                             x_token_val2 => x_token_val2,
1181 --                             x_token_name3 => x_token_name3,
1182 --                             x_token_val3 => x_token_val3);
1183 --
1184 --
1185 --
1186 --
1187 --
1188 --ERROR HANDLING
1189 --
1190 --After the call to the client extension, handle any Errors
1191 --returned by the extension.  Assume the OUT parameters have the
1192 --following values:
1193 --
1194 --X_return_status = 'E'
1195 --X_application_code = 'AB' (AB is not application short name for the customer application)
1196 --X_message_code = 'AB_ITEM_NOT_FOUND'
1197 --X_token_name1 = 'TRANSACTION_SOURCE'
1198 --X_token_val1 = 'Customer Transaction Source'
1199 --X_token_name2 = 'EXTERNAL_ID'
1200 --X_token_val2 = 'Timecard-123'
1201 --X_Token_name3 = ''
1202 --X_Token_val3 = ''
1203 --
1204 --The calling program will handle errors in the following way.
1205 --
1206 --    If X_return_status = 'E' and X_msg_data is NOT NULL THEN
1207 --
1208 --       if X_msg_application != 'PA' THEN
1209 --
1210 --	   Please do not customize messages owned by Oracle Projects. If
1211 -- 	   you want to customize a message, create a new message in your
1212 --	   custom application.
1213 --
1214 --
1215 --	   FND_MESSAGE.SET_NAME(X_application_code,X_message_code);
1216 --	   FND_MESSAGE.SET_TOKEN(X_token_name1,X_token_val1)
1217 --	   FND_MESSAGE.SET_TOKEN(X_token_name2,X_token_val2)
1218 --	   FND_MESSAGE.SET_TOKEN(X_token_name3,X_token_val3)
1219 --
1220 -- 	 ELSE -- for seeded messages, i.e messages owned by PA
1221 --
1222 --	   Tokens are not supported in Seeded messages
1223 --
1224 --	   FND_MESSAGE.set_name(X_msg_application,X_msg_data)
1225 --
1226 --	 end if;
1227 --
1228 --    End if;
1229 --
1230 --    Assume that the message_text for 'AB_ITEM_NOT_FOUND' is
1231 --
1232 --         'Unable to find <EXTERNAL_ID> in <TRANSACTION_SOURCE>'
1233 --
1234 --    The error message will then be displayed as follows, and the adjustment will be aborted.
1235 --
1236 --         'Unable to find Timecard-123 in Customer Transaction Source'
1237 --
1238 --
1239 --WARNING HANDLING
1240 --
1241 --After the call to the client extension, handle any Warnings
1242 --returned by the extension.  Assume the OUT parameters have the
1243 --following values:
1244 --
1245 --X_return_status = 'W'
1246 --X_application_code = 'AB' (AB is not application short name for the customer application)
1247 --X_message_code = 'AB_ITEM_ALREADY_BILLED'
1248 --X_token_name1 = 'TRANSACTION_SOURCE'
1249 --X_token_val1 = 'Customer Transaction Source'
1250 --X_token_name2 = 'EXTERNAL_ID'
1251 --X_token_val2 = 'Timecard-123'
1252 --X_Token_name3 = ''
1253 --X_Token_val3 = ''
1254 --
1255 --Assume that the message_text for 'AB_ITEM_ALREADY_BILLED' is
1256 --
1257 --     '<EXTERNAL_ID> from <TRANSACTION_SOURCE> has already been billed.  Are you sure
1258 --      you want to adjust this item?'
1259 --
1260 --
1261 --The calling program will handle warnings in the following way.
1262 --
1263 --    If X_return_status = 'W' and X_msg_data is NOT NULL THEN
1264 --
1265 --       if X_msg_application != 'PA' THEN
1266 --
1267 --	   Please do not customize messages owned by Oracle Projects. If
1268 -- 	   you want to customize a message, create a new message in your
1269 --	   custom application.
1270 --
1271 --
1272 --	   FND_MESSAGE.SET_NAME(X_application_code,X_message_code);
1273 --	   FND_MESSAGE.SET_TOKEN(X_token_name1,X_token_val1)
1274 --	   FND_MESSAGE.SET_TOKEN(X_token_name2,X_token_val2)
1275 --	   FND_MESSAGE.SET_TOKEN(X_token_name3,X_token_val3)
1276 --
1277 -- 	 ELSE -- for seeded messages, i.e messages owned by PA
1278 --
1279 --	   Tokens are not supported in Seeded messages
1280 --
1281 --	   FND_MESSAGE.set_name(X_msg_application,X_msg_data)
1282 --
1283 --	 end if;
1284 --
1285 --    End if;
1286 --
1287 --  Assume that the message_text for 'AB_ITEM_ALREADY_BILLED' is
1288 --
1289 --         '<EXTERNAL_ID> from <TRANSACTION_SOURCE> has already been billed.  Are you sure
1290 --          you want to adjust this item?'
1291 --
1292 --  The warning message will then be displayed as follows:
1293 --
1294 --         'Timecard-123 from Customer Transaction Source has already been billed.
1295 --          Are you sure you want to adjust this item?'
1296 --
1297 --  The user will have be able to continue with the adjustment or abort the adjustment.
1298 
1299 ----------------------------------------------------------------------------------------*/
1300 
1301 
1302 
1303 PROCEDURE allow_adjustment_extn(
1304                              p_transaction_source                   IN VARCHAR2,
1305                              p_allow_adjustment_flag                IN  VARCHAR2,
1306                              p_orig_transaction_reference           IN VARCHAR2,
1307                              p_expenditure_type_class               IN VARCHAR2,
1308                              p_expenditure_type                     IN VARCHAR2,
1309                              p_expenditure_item_id                  IN NUMBER,
1310                              p_expenditure_item_date                IN DATE,
1311                              p_employee_number                      IN VARCHAR2,
1312                              p_expenditure_org_name                 IN VARCHAR2,
1313                              p_project_number                       IN VARCHAR2,
1314                              p_task_number                          IN VARCHAR2,
1315                              p_non_labor_resource                   IN VARCHAR2,
1316                              p_non_labor_resource_org_name          IN VARCHAR2,
1317                              p_quantity                             IN NUMBER,
1318                              p_raw_cost                             IN NUMBER ,
1319                              p_attribute_category                   IN VARCHAR2 ,
1320                              p_attribute1                           IN VARCHAR2 ,
1321                              p_attribute2                           IN VARCHAR2 ,
1322                              p_attribute3                           IN VARCHAR2 ,
1323                              p_attribute4                           IN VARCHAR2 ,
1324                              p_attribute5                           IN VARCHAR2 ,
1325                              p_attribute6                           IN VARCHAR2 ,
1326                              p_attribute7                           IN VARCHAR2 ,
1327                              p_attribute8                           IN VARCHAR2 ,
1328                              p_attribute9                           IN VARCHAR2 ,
1329                              p_attribute10                          IN VARCHAR2 ,
1330                              p_org_id                               IN NUMBER ,
1331                              x_allow_adjustment_code                OUT NOCOPY VARCHAR2,
1332                              x_return_status                        OUT NOCOPY VARCHAR2,
1333                              x_application_code                     OUT NOCOPY VARCHAR2,
1334                              x_message_code                         OUT NOCOPY VARCHAR2,
1335                              x_token_name1                          OUT NOCOPY VARCHAR2,
1336                              x_token_val1                           OUT NOCOPY VARCHAR2,
1337                              x_token_name2                          OUT NOCOPY VARCHAR2,
1338                              x_token_val2                           OUT NOCOPY VARCHAR2,
1339                              x_token_name3                          OUT NOCOPY VARCHAR2,
1340                              x_token_val3                           OUT NOCOPY VARCHAR2);
1341 
1342 
1343 
1344 END  PA_TRANSACTIONS_PUB;