DBA Data[Home] [Help]

PACKAGE: APPS.RCV_SEEDEVENTS_PVT

Source


1 PACKAGE RCV_SeedEvents_PVT AS
2 /* $Header: RCVVRUTS.pls 120.1.12010000.3 2008/11/10 14:47:45 mpuranik ship $ */
3 
4 -- Receiving Event Types. The event types are also seeded in the
5 -- RCV_ACCOUNTING_EVENT_TYPES table.
6 RECEIVE                         CONSTANT  NUMBER  := 1;
7 DELIVER                         CONSTANT  NUMBER  := 2;
8 CORRECT                         CONSTANT  NUMBER  := 3;
9 MATCH                           CONSTANT  NUMBER  := 4;
10 RETURN_TO_RECEIVING             CONSTANT  NUMBER  := 5;
11 RETURN_TO_VENDOR                CONSTANT  NUMBER  := 6;
12 ADJUST_RECEIVE                  CONSTANT  NUMBER  := 7;
13 ADJUST_DELIVER                  CONSTANT  NUMBER  := 8;
14 LOGICAL_RECEIVE                 CONSTANT  NUMBER  := 9;
15 LOGICAL_RETURN_TO_VENDOR        CONSTANT  NUMBER  := 10;
16 INTERCOMPANY_INVOICE            CONSTANT  NUMBER  := 11;
17 INTERCOMPANY_REVERSAL           CONSTANT  NUMBER  := 12;
18 ENCUMBRANCE_REVERSAL            CONSTANT  NUMBER  := 13;
19 
20 -- Record Type to Store Accounting Event information.
21 TYPE rcv_event_rec_type is RECORD
22 (
23            event_type_id                NUMBER,
24            event_source                 VARCHAR2(25),
25            rcv_transaction_id           NUMBER          := NULL,
26            direct_delivery_flag         VARCHAR2(1)     := 'N',
27            inv_distribution_id          NUMBER          := NULL,
28            transaction_date             DATE            := sysdate,
29            po_header_id                 NUMBER          := NULL,
30            po_release_id                NUMBER          := NULL,
31            po_line_id                   NUMBER          := NULL,
32            po_line_location_id          NUMBER          := NULL,
33            po_distribution_id           NUMBER          := NULL,
34            trx_flow_header_id           NUMBER          := NULL,
35 	   set_of_books_id		NUMBER		:= NULL,
36            org_id                       NUMBER          := NULL,
37            transfer_org_id              NUMBER          := NULL,
38            organization_id              NUMBER          := NULL,
39            transfer_organization_id     NUMBER          := NULL,
40            item_id                      NUMBER          := NULL,
41            unit_price                   NUMBER          := NULL,
42            unit_nr_tax                  NUMBER          := NULL,
43            unit_rec_tax                 NUMBER          := NULL,
44            prior_unit_price             NUMBER          := NULL,
45            prior_nr_tax                 NUMBER          := NULL,
46            prior_rec_tax                NUMBER          := NULL,
47            intercompany_pricing_option  NUMBER          := 1,
48            service_flag                 VARCHAR2(1)     := 'N',
49            transaction_amount           NUMBER          := NULL,
50            currency_code                VARCHAR2(15)    := NULL,
51            currency_conversion_type     VARCHAR2(30)    := NULL,
52            currency_conversion_rate     NUMBER          := 1,
53            currency_conversion_date     DATE            := sysdate,
54            intercompany_price           NUMBER          := NULL,
55 	   intercompany_curr_code	VARCHAR2(15)	:= NULL,
56            transaction_uom              VARCHAR2(25)    := NULL,
57 	   trx_uom_code			VARCHAR2(3)	:= NULL,
58            transaction_quantity         NUMBER          := NULL,
59            primary_uom                  VARCHAR2(25)    := NULL,
60            primary_quantity             NUMBER          := NULL,
61 	   source_doc_uom		VARCHAR2(25)	:= NULL,
62 	   source_doc_quantity		NUMBER		:= NULL,
63            destination_type_code        VARCHAR2(25)    := NULL,
64            cross_ou_flag                VARCHAR2(1)     := 'N',
65            procurement_org_flag         VARCHAR2(1)     := 'N',
66            ship_to_org_flag             VARCHAR2(1)     := 'N',
67            drop_ship_flag               NUMBER          := 0,
68            debit_account_id             NUMBER          := NULL,
69            credit_account_id            NUMBER          := NULL,
70            intercompany_cogs_account_id NUMBER          := NULL,
71             /* Support for Landed Cost Management */
72 	   lcm_account_id               NUMBER          := NULL,
73 	   unit_landed_cost             NUMBER          := NULL
74 );
75 
76 -- Table type to store a table of Accounting event records
77 TYPE rcv_event_tbl_type is TABLE OF rcv_event_rec_type
78 INDEX BY BINARY_INTEGER;
79 
80 
81 --      API name        : Seed_RAEEvent
82 --      Type            : Private
83 --      Function        : To seed accounting event in RCV_ACCOUNTING_EVENTS.
84 --      Pre-reqs        :
85 --      Parameters      :
86 --      IN              :       p_api_version           IN NUMBER       Required
87 --                              p_init_msg_list         IN VARCHAR2     Optional
88 --                                      Default = FND_API.G_FALSE
89 --                              p_commit                IN VARCHAR2     Optional
90 --                                      Default = FND_API.G_FALSE
91 --                              p_validation_level      IN NUMBER       Optional
92 --                                      Default = FND_API.G_VALID_LEVEL_FULL
93 --                              p_event_source          IN VARCHAR2     Required
94 --                              p_event_type_id         IN NUMBER       Required
95 --                              p_rcv_transaction_id    IN NUMBER       Optional
96 --				p_inv_distribution_id	IN NUMBER	Optional
97 --                              p_po_distribution_id    IN NUMBER       Required
98 --                              p_direct_delivery_flag  IN VARCHAR2     Optional
99 --                              p_cross_ou_flag         IN VARCHAR2	Optional
100 --					Default = 'N'
101 --                              p_procurement_org_flag  IN VARCHAR2	Optional
102 --                                      Default = 'Y'
103 --				p_drop_ship_flag	IN NUMBER	Optional
104 --                                      Default = 'Y'
105 --                              p_org_id                IN NUMBER	Required
106 --                              p_organization_id       IN NUMBER	Required
107 --                              p_transfer_org_id       IN NUMBER	Optional
108 --                              p_transfer_organization_id IN NUMBER	Optional
109 --                              p_transaction_forward_flow_rec  mtl_transaction_flow_rec_type,
110 --                              p_transaction_reverse_flow_rec  mtl_transaction_flow_rec_type,
111 --                              p_transaction_flow_rec  IN mtl_transaction_flow_rec_type
112 --                              p_unit_price            IN NUMBER	Required
113 --                              p_prior_unit_price      IN NUMBER	Optional
114 --                              p_lcm_flag              IN VARCHAR2
115 --
116 --
117 --
118 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
119 --                              x_msg_count             OUT     NUMBER
120 --                              x_msg_data              OUT     VARCHAR2(2000)
121 --                              x_rcv_event             OUT     RCV_SeedEvents_PVT.rcv_event_tbl_type;
122 --      Version :
123 --                        Initial version       1.0
124 --
125 --
126 --      Notes           : This API is used to seed events in RCV_ACCOUNTING_EVENTS table.
127 --
128 -- End of comments
129 -------------------------------------------------------------------------------
130 PROCEDURE Seed_RAEEvent(
131                 p_api_version           IN      	NUMBER,
132                 p_init_msg_list         IN      	VARCHAR2 	:= FND_API.G_FALSE,
133                 p_commit                IN      	VARCHAR2 	:= FND_API.G_FALSE,
134                 p_validation_level      IN     		NUMBER 		:= FND_API.G_VALID_LEVEL_FULL,
135                 x_return_status         OUT NOCOPY      VARCHAR2,
136                 x_msg_count             OUT NOCOPY      NUMBER,
137                 x_msg_data              OUT NOCOPY      VARCHAR2,
138 
139                 p_event_source          IN      	VARCHAR2,
140                 p_event_type_id         IN      	NUMBER,
141                 p_rcv_transaction_id    IN 		NUMBER		:= NULL,
142                 p_inv_distribution_id   IN 		NUMBER 		:= NULL,
143 		p_po_distribution_id	IN 		NUMBER,
144                 p_direct_delivery_flag  IN 		VARCHAR2	:= 'N',
145                 p_cross_ou_flag         IN 		VARCHAR2	:= 'N',
146                 p_procurement_org_flag  IN 		VARCHAR2	:= 'Y',
147 		p_ship_to_org_flag	IN 		VARCHAR2	:= 'Y',
148 		p_drop_ship_flag	IN 		NUMBER		:= 3,
149                 p_org_id                IN 		NUMBER,
150                 p_organization_id       IN 		NUMBER 		:= NULL,
151 		p_transfer_org_id	IN 		NUMBER 		:= NULL,
152 		p_transfer_organization_id	IN 	NUMBER 		:= NULL,
153                 p_trx_flow_header_id    IN 		NUMBER 		:= NULL,
154                 p_transaction_forward_flow_rec  	INV_TRANSACTION_FLOW_PUB.mtl_transaction_flow_rec_type	:= NULL,
155                 p_transaction_reverse_flow_rec  	INV_TRANSACTION_FLOW_PUB.mtl_transaction_flow_rec_type	:= NULL,
156                 p_unit_price            IN 		NUMBER,
157                 p_prior_unit_price      IN 		NUMBER		:= NULL,
158                 /* Support for Landed Cost Management */
159                 p_lcm_flag              IN 		VARCHAR2,
160                 x_rcv_event             OUT NOCOPY 	RCV_SeedEvents_PVT.rcv_event_rec_type
161 
162 );
163 
164 -- Start of comments
165 --      API name        : Get_TransactionAmount
166 --      Type            : Private
167 --      Function        : Returns the transaction amount. Used for service line types.
168 --      Pre-reqs        :
169 --      Parameters      :
170 --      IN              :       p_api_version           IN NUMBER       Required
171 --                              p_init_msg_list         IN VARCHAR2     Optional
172 --                                      Default = FND_API.G_FALSE
173 --                              p_commit                IN VARCHAR2     Optional
174 --                                      Default = FND_API.G_FALSE
175 --                              p_validation_level      IN NUMBER       Optional
176 --                                      Default = FND_API.G_VALID_LEVEL_FULL
177 --                              p_rcv_event             IN RCV_SeedEvents_PVT.rcv_event_rec_type       Required
178 --
179 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
180 --                              x_msg_count             OUT     NUMBER
181 --                              x_msg_data              OUT     VARCHAR2(2000)
182 --                              x_transaction_amount    OUT     NUMBER
183 --      Version :
184 --                        Initial version       1.0
185 --
186 --
187 --      Notes           : This API returns the transaction amount. It should only be called for service line types.
188 --
189 -- End of comments
190 PROCEDURE Get_TransactionAmount(
191                 p_api_version           IN      	NUMBER,
192                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
193                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
194                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
195                 x_return_status         OUT NOCOPY      VARCHAR2,
196                 x_msg_count             OUT NOCOPY      NUMBER,
197                 x_msg_data              OUT NOCOPY      VARCHAR2,
198 
199                 p_rcv_event             IN 		RCV_SeedEvents_PVT.rcv_event_rec_type,
200 	  	x_transaction_amount	OUT NOCOPY	NUMBER
201 );
202 
203 -- Start of comments
204 --      API name        : Get_Quantity
205 --      Type            : Private
206 --      Function        : Returns the quantity in source doc UOM. Used for encumbrance
207 --                        reversal events. We should only encumber upto quantity
208 --                        ordered. If quantity received is greater than quantity
209 --                        ordered, we should not encumber for the excess.
210 --      Pre-reqs        :
211 --      Parameters      :
212 --      IN              :       p_api_version           IN NUMBER       Required
213 --                              p_init_msg_list         IN VARCHAR2     Optional
214 --                                      Default = FND_API.G_FALSE
215 --                              p_commit                IN VARCHAR2     Optional
216 --                                      Default = FND_API.G_FALSE
217 --                              p_validation_level      IN NUMBER       Optional
218 --                                      Default = FND_API.G_VALID_LEVEL_FULL
219 --                              p_rcv_event             IN RCV_SeedEvents_PVT.rcv_event_rec_type       Required
220 --
221 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
222 --                              x_msg_count             OUT     NUMBER
223 --                              x_msg_data              OUT     VARCHAR2(2000)
224 --                              x_source_doc_quantity  OUT     NUMBER
225 --      Version :
226 --                        Initial version       1.0
227 --
228 --
229 --      Notes           : This API returns the transaction quantity. It should
230 --                        only be called for non-service line types.
231 --
232 -- End of comments
233 PROCEDURE Get_Quantity(
234                 p_api_version           IN      	NUMBER,
235                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
236                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
237                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
238                 x_return_status         OUT NOCOPY      VARCHAR2,
239                 x_msg_count             OUT NOCOPY      NUMBER,
240                 x_msg_data              OUT NOCOPY      VARCHAR2,
241 
242                 p_rcv_event             IN 		RCV_SeedEvents_PVT.rcv_event_rec_type,
243                 x_source_doc_quantity  OUT NOCOPY 	NUMBER
244 );
245 
246 -- Start of comments
247 --      API name        : Get_UnitPrice
248 --      Type            : Private
249 --      Function        : Returns the Unit Price. Used for non-service line types.
250 --      Pre-reqs        :
251 --      Parameters      :
252 --      IN              :       p_api_version           IN NUMBER       Required
253 --                              p_init_msg_list         IN VARCHAR2     Optional
254 --                                      Default = FND_API.G_FALSE
255 --                              p_commit                IN VARCHAR2     Optional
256 --                                      Default = FND_API.G_FALSE
257 --                              p_validation_level      IN NUMBER       Optional
258 --                                      Default = FND_API.G_VALID_LEVEL_FULL
259 --                              p_rcv_event             IN RCV_SeedEvents_PVT.rcv_event_rec_type       Required
260 --
261 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
262 --                              x_msg_count             OUT     NUMBER
263 --                              x_msg_data              OUT     VARCHAR2(2000)
264 --                              x_intercompany_pricing_option   OUT     NUMBER
265 --                              x_unit_price            OUT     NUMBER
266 --                              x_unit_landed_cost      out     NUMBER
267 --                              x_currency_code         OUT     VARCHAR2(3)
268 --                              x_incr_transfer_price   OUT     NUMBER
269 --                              x_incr_currency_code    OUT     VARCHAR2(15)
270 --
271 --      Version :
272 --                        Initial version       1.0
273 --
274 --
275 --      Notes           : This API returns the unit price. It should only be called for non service line types.
276 --
277 -- End of comments
278 PROCEDURE Get_UnitPrice(
279                 p_api_version           IN      	NUMBER,
280                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
281                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
282                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
283                 x_return_status         OUT NOCOPY      VARCHAR2,
284                 x_msg_count             OUT NOCOPY      NUMBER,
285                 x_msg_data              OUT NOCOPY      VARCHAR2,
286 
287                 p_rcv_event             IN 		RCV_SeedEvents_PVT.rcv_event_rec_type,
288 		p_asset_item_pricing_option   IN 	NUMBER,
289 		p_expense_item_pricing_option IN	NUMBER,
290                 /* Support for Landed Cost Management */
291 		p_lcm_flag              IN  VARCHAR2 := 'N',
292                 x_intercompany_pricing_option   OUT NOCOPY      NUMBER,
293                 x_unit_price            OUT NOCOPY      NUMBER,
294                 /* Support for Landed Cost Management */
295                 x_unit_landed_cost      OUT NOCOPY      NUMBER,
296                 x_currency_code         OUT NOCOPY      VARCHAR2,
297 		x_incr_transfer_price   OUT NOCOPY      NUMBER,
298                 x_incr_currency_code    OUT NOCOPY      VARCHAR2
299 );
300 
301 -- Start of comments
302 --      API name        : Get_UnitTax
303 --      Type            : Private
304 --      Function        : Returns the recoverable and non-recoverable tax.
305 --      Pre-reqs        :
306 --      Parameters      :
307 --      IN              :       p_api_version           IN NUMBER       Required
308 --                              p_init_msg_list         IN VARCHAR2     Optional
309 --                                      Default = FND_API.G_FALSE
310 --                              p_commit                IN VARCHAR2     Optional
311 --                                      Default = FND_API.G_FALSE
312 --                              p_validation_level      IN NUMBER       Optional
313 --                                      Default = FND_API.G_VALID_LEVEL_FULL
314 --                              p_rcv_event             IN RCV_SeedEvents_PVT.rcv_event_rec_type       Required
315 --
316 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
317 --                              x_msg_count             OUT     NUMBER
318 --                              x_msg_data              OUT     VARCHAR2(2000)
319 --                              x_unit_nr_tax           OUT     NUMBER
320 --                              x_unit_rec_tax          OUT     NUMBER
321 --                              x_prior_nr_tax          OUT     NUMBER
322 --                              x_prior_rec_tax         OUT     NUMBER
323 --      Version :
324 --                        Initial version       1.0
325 --
326 --
327 --      Notes           : This API returns the tax information.
328 --
329 -- End of comments
330 PROCEDURE Get_UnitTax(
334                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
331                 p_api_version           IN      	NUMBER,
332                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
333                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
335                 x_return_status         OUT NOCOPY      VARCHAR2,
336                 x_msg_count             OUT NOCOPY      NUMBER,
337                 x_msg_data              OUT NOCOPY      VARCHAR2,
338 
339                 p_rcv_event             IN 		RCV_SeedEvents_PVT.rcv_event_rec_type,
340                 x_unit_nr_tax           OUT NOCOPY      NUMBER,
341                 x_unit_rec_tax          OUT NOCOPY      NUMBER,
342                 x_prior_nr_tax          OUT NOCOPY      NUMBER,
343                 x_prior_rec_tax         OUT NOCOPY      NUMBER
344 );
345 
346 
347 -----------------------------------------------------------------------------
348 -- Start of comments                                                       --
349 --                                                                         --
350 -- PROCEDURE                                                               --
351 --  Convert_UOM     This function updates the record type variable         --
352 --                  that is passed to it. It inserts the UOM into the      --
353 --                  primary_uom field, then it updates the primary_        --
354 --                  quantity with the transaction_quantity converted to    --
355 --                  the new UOM and it updates the unit_price by           --
356 --                  converting it with the new UOM.                        --
357 --                                                                         --
358 --                  Because there are already other modules under PO_TOP   --
359 --                  that use the inv_convert package, we can safely use    --
360 --                  it here without introducing new dependencies on that   --
361 --                  product.                                               --
362 --                                                                         --
363 -- VERSION 1.0                                                             --
364 --                                                                         --
365 -- PARAMETERS                                                              --
366 --  P_API_VERSION      API Version # - REQUIRED: enter 1.0                 --
367 --  P_INIT_MSG_LIST    Initialize message list? True/False                 --
368 --  P_COMMIT           Should the API commit before returning? True/False  --
369 --  P_VALIDATION_LEVEL Specify the level of validation on the inputs       --
370 --  P_EVENT_REC        Record storing an RCV Accounting Event (RAE)        --
371 --  X_TRANSACTION_QTY  Transaction quantity converted from source doc qty  --
372 --  X_PRIMARY_UOM      Converted UOM                                       --
373 --  X_PRIMARY_QTY      Primary quantity converted from source doc qty      --
374 --  X_TRX_UOM_CODE     Transaction UOM                                     --
375 --  X_RETURN_STATUS    Success/Error/Unexplained error - 'S','E', or 'U'   --
376 --  X_MSG_COUNT        Message Count - # of messages placed in message list--
377 --  X_MSG_DATA         Message Text - returns msg contents if msg_count = 1--
378 --                                                                         --
379 -- HISTORY:                                                                --
380 --    06/26/03     Bryan Kuntz      Created                                --
381 -- End of comments                                                         --
382 -----------------------------------------------------------------------------
383 
384 PROCEDURE Convert_UOM (
385   P_API_VERSION        IN          NUMBER,
386   P_INIT_MSG_LIST      IN          VARCHAR2 := FND_API.G_FALSE,
387   P_COMMIT             IN          VARCHAR2 := FND_API.G_FALSE,
388   P_VALIDATION_LEVEL   IN          NUMBER   := FND_API.G_VALID_LEVEL_FULL,
389   X_RETURN_STATUS      OUT NOCOPY  VARCHAR2,
390   X_MSG_COUNT          OUT NOCOPY  NUMBER,
391   X_MSG_DATA           OUT NOCOPY  VARCHAR2,
392   P_EVENT_REC          IN          RCV_SeedEvents_PVT.rcv_event_rec_type,
393   X_TRANSACTION_QTY    OUT NOCOPY  NUMBER,
394   X_PRIMARY_UOM        OUT NOCOPY  MTL_UNITS_OF_MEASURE.UNIT_OF_MEASURE%TYPE,
395   X_PRIMARY_QTY        OUT NOCOPY  NUMBER,
396   X_TRX_UOM_CODE       OUT NOCOPY  VARCHAR2
397 );
398 
399 -----------------------------------------------------------------------------
400 -- Start of comments                                                       --
401 --                                                                         --
402 -- PROCEDURE                                                               --
403 --  Get_Currency    This procedure returns the currency_conversion         --
404 --                  parameters, conversion rate, date and type             --
405 --
406 --                  It is being coded for the purpose of providing the     --
407 --                  currency conversion parameters for Global Procurement  --
408 --                  and true drop shipment scenario, but may be used as a  --
409 --                  generic API to return currency conversion rates for    --
410 --                  Receiving transactions.                                --
411 --                                                                         --
412 --                  Logic:                                                 --
413 --                  If supplier facing org, if match to po use POD.rate    --
414 --                                          else                           --
415 --                                          rcv_transactions.curr_conv_rate--
416 --                  Else                                                   --
417 --                  Get the conversion type                                --
418 --                  Determine currency conversion rate                     --
419 --                                                                         --
420 --                                                                         --
421 --                                                                         --
422 -- VERSION 1.0                                                             --
423 --                                                                         --
424 -- PARAMETERS                                                              --
425 --  P_API_VERSION      API Version # - REQUIRED: enter 1.0                 --
426 --  P_INIT_MSG_LIST    Initialize message list? True/False                 --
427 --  P_COMMIT           Should the API commit before returning? True/False  --
428 --  P_RCV_EVENT        Record storing an RCV Accounting Event (RAE)        --
429 --  X_CURRENCY_CODE                                                        --
430 --  X_CURRENCY_CONVERSION_RATE                                             --
431 --  X_CURRENCY_CONVERSION_TYPE                                             --
432 --  X_CURRENCY_CONVERSION_TYPE                                             --
433 --  X_RETURN_STATUS    Success/Error/Unexplained error - 'S','E', or 'U'   --
434 --  X_MSG_COUNT        Message Count - # of messages placed in message list--
435 --  X_MSG_DATA         Message Text - returns msg contents if msg_count = 1--
436 --                                                                         --
437 -- HISTORY:                                                                --
438 --    08/02/03     Anju Gupta     Created                                  --
439 -- End of comments                                                         --
440 -----------------------------------------------------------------------------
441 PROCEDURE Get_Currency(
442   P_API_VERSION        		IN          NUMBER,
443   P_INIT_MSG_LIST      		IN          VARCHAR2 := FND_API.G_FALSE,
444   P_COMMIT             		IN          VARCHAR2 := FND_API.G_FALSE,
445   P_VALIDATION_LEVEL   		IN          NUMBER   := FND_API.G_VALID_LEVEL_FULL,
446   X_RETURN_STATUS               OUT NOCOPY  VARCHAR2,
447   X_MSG_COUNT                   OUT NOCOPY  NUMBER,
448   X_MSG_DATA                    OUT NOCOPY  VARCHAR2,
449 
450   P_RCV_EVENT                   IN          RCV_SeedEvents_PVT.rcv_event_rec_type,
451   X_CURRENCY_CODE               OUT NOCOPY  VARCHAR2,
452   X_CURRENCY_CONVERSION_RATE    OUT NOCOPY  NUMBER,
453   X_CURRENCY_CONVERSION_DATE    OUT NOCOPY  DATE,
454   X_CURRENCY_CONVERSION_TYPE    OUT NOCOPY  VARCHAR2
455 );
456 
457 -- Start of comments
458 --      API name        : Get_Account
459 --      Type            : Private
460 --      Function        : To get the credit and debit accounts for each event.
461 --      Pre-reqs        :
462 --      Parameters      :
463 --      IN              :       p_api_version           IN NUMBER       Required
464 --                              p_init_msg_list         IN VARCHAR2     Optional
465 --                                      Default = FND_API.G_FALSE
466 --                              p_commit                IN VARCHAR2     Optional
467 --                                      Default = FND_API.G_FALSE
468 --                              p_validation_level      IN NUMBER       Optional
469 --                                      Default = FND_API.G_VALID_LEVEL_FULL
470 --                              p_rcv_event             IN RCV_SeedEvents_PVT.rcv_event_rec_type       Required
471 --                              p_transaction_forward_flow_rec  mtl_transaction_flow_rec_type,
472 --                              p_transaction_reverse_flow_rec  mtl_transaction_flow_rec_type,
473 --
474 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
475 --                              x_msg_count             OUT     NUMBER
476 --                              x_msg_data              OUT     VARCHAR2(2000)
477 --                              x_credit_acct_id        OUT     NUMBER
478 --                              x_debit_acct_id         OUT     NUMBER
479 --                              x_ic_cogs_acct_id       OUT     NUMBER
480 --      Version :
481 --                        Initial version       1.0
482 --
483 --
484 --      Notes           : This API creates all accounting events for RETURN TO VENDOR transactions
485 --                        in RCV_ACCOUNTING_EVENTS.
486 --
487 -- End of comments
488 PROCEDURE Get_Accounts(
489                 p_api_version           IN      	NUMBER,
490                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
491                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
492                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
493                 x_return_status         OUT NOCOPY      VARCHAR2,
494                 x_msg_count             OUT NOCOPY      NUMBER,
495                 x_msg_data              OUT NOCOPY      VARCHAR2,
499                 /* Support for Landed Cost Management */
496                 p_rcv_event             IN 		RCV_SeedEvents_PVT.rcv_event_rec_type,
497                 p_transaction_forward_flow_rec  	INV_TRANSACTION_FLOW_PUB.mtl_transaction_flow_rec_type,
498                 p_transaction_reverse_flow_rec  	INV_TRANSACTION_FLOW_PUB.mtl_transaction_flow_rec_type,
500                 p_lcm_flag              IN VARCHAR2,
501                 x_credit_acct_id        OUT NOCOPY      NUMBER,
502                 x_debit_acct_id         OUT NOCOPY      NUMBER,
503                 x_ic_cogs_acct_id       OUT NOCOPY      NUMBER,
504                 x_lcm_acct_id       OUT NOCOPY      NUMBER
505 );
506 
507 
508 
509 -- Start of comments
510 --      API name        : Get_HookAccount
511 --      Type            : Private
512 --      Function        : Call account hook to  allow customer to override default account.
513 --      Pre-reqs        :
514 --      Parameters      :
515 --      IN              :       p_api_version           IN NUMBER       Required
516 --                              p_init_msg_list         IN VARCHAR2     Optional
517 --                                      Default = FND_API.G_FALSE
518 --                              p_commit                IN VARCHAR2     Optional
519 --                                      Default = FND_API.G_FALSE
520 --                              p_validation_level      IN NUMBER       Optional
521 --                                      Default = FND_API.G_VALID_LEVEL_FULL
522 --				p_rcv_transaction_id    IN NUMBER	Required
523 --				p_accounting_line_type	IN VARCHAR2	Required
524 --				p_org_id		IN NUMBER	Required
525 --
526 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
527 --                              x_msg_count             OUT     NUMBER
528 --                              x_msg_data              OUT     VARCHAR2(2000)
529 --                              x_distribution_acct_id  OUT 	NUMBER
530 --
531 --      Version :
532 --                        Initial version       1.0
533 --
534 --
535 --      Notes           : This API creates all accounting events for RETURN TO VENDOR transactions
536 --                        in RCV_ACCOUNTING_EVENTS.
537 --
538 -- End of comments
539 PROCEDURE Get_HookAccount(
540                 p_api_version           IN      	NUMBER,
541                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
542                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
543                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
544                 x_return_status         OUT NOCOPY      VARCHAR2,
545                 x_msg_count             OUT NOCOPY      NUMBER,
546                 x_msg_data              OUT NOCOPY      VARCHAR2,
547 
548 		p_rcv_transaction_id	IN		NUMBER,
549 		p_accounting_line_type	IN		VARCHAR2,
550 		p_org_id		IN		NUMBER,
551                 x_distribution_acct_id  OUT NOCOPY      NUMBER
552 );
553 
554 
555 
556 -- Start of comments
557 --      API name        : Insert_RAEEvents
558 --      Type            : Private
559 --      Function        : To insert events into the Receiving Accounting Events table.
560 --      Pre-reqs        :
561 --      Parameters      :
562 --      IN              :       p_api_version           IN NUMBER       Required
563 --                              p_init_msg_list         IN VARCHAR2     Optional
564 --                                      Default = FND_API.G_FALSE
565 --                              p_commit                IN VARCHAR2     Optional
566 --                                      Default = FND_API.G_FALSE
567 --                              p_validation_level      IN NUMBER       Optional
568 --                                      Default = FND_API.G_VALID_LEVEL_FULL
569 --                              p_rcv_events_tbl        IN RCV_SeedEvents_PVT.rcv_event_tbl_type       Required
570 --                              p_lcm_flag              IN VARCHAR2 := 'N' Optional
571 --
572 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
573 --                              x_msg_count             OUT     NUMBER
574 --                              x_msg_data              OUT     VARCHAR2(2000)
575 --      Version :
576 --                        Initial version       1.0
577 --
578 --
579 --      Notes           : This API inserts all events for a given receiving transaction
580 --                        into RCV_ACCOUNTING_EVENTS.
581 --
582 -- End of comments
583 PROCEDURE Insert_RAEEvents(
584                 p_api_version           IN      	NUMBER,
585                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
586                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
587                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
588                 x_return_status         OUT NOCOPY      VARCHAR2,
589                 x_msg_count             OUT NOCOPY      NUMBER,
590                 x_msg_data              OUT NOCOPY      VARCHAR2,
591                 p_rcv_events_tbl        IN 		RCV_SeedEvents_PVT.rcv_event_tbl_type,
592                 /* Support for Landed Cost Management */
593                 p_lcm_flag              IN VARCHAR2 := 'N');
594 
595 -- Start of comments
596 --      API name        : Check_EncumbranceFlag
597 --      Type            : Private
598 --      Function        : Checks to see if encumbrance entries need to be created.
599 --      Pre-reqs        :
600 --      Parameters      :
601 --      IN              :       p_api_version           IN NUMBER       Required
605 --                                      Default = FND_API.G_FALSE
602 --                              p_init_msg_list         IN VARCHAR2     Optional
603 --                                      Default = FND_API.G_FALSE
604 --                              p_commit                IN VARCHAR2     Optional
606 --                              p_validation_level      IN NUMBER       Optional
607 --                                      Default = FND_API.G_VALID_LEVEL_FULL
608 --                              p_rcv_sob_id            IN      NUMBER  Required
609 --
610 --                              x_encumbrance_flag      OUT     VARCHAR2(1)
611 --                              x_ussgl_option          OUT     VARCHAR2(1)
612 --
613 --
614 --      OUT             :       x_return_status         OUT     VARCHAR2(1)
615 --                              x_msg_count             OUT     NUMBER
616 --                              x_msg_data              OUT     VARCHAR2(2000)
617 --      Version :
618 --                        Initial version       1.0
619 --
620 --
621 --      Notes           : This API checks to see if encumbrance entries need to
622 --                        be created.
623 --
624 -- End of comments
625 PROCEDURE Check_EncumbranceFlag(
626                 p_api_version           IN      	NUMBER,
627                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
628                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
629                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
630                 x_return_status         OUT NOCOPY      VARCHAR2,
631                 x_msg_count             OUT NOCOPY      NUMBER,
632                 x_msg_data              OUT NOCOPY      VARCHAR2,
633 
634                 p_rcv_sob_id            IN      	NUMBER,
635 
636                 x_encumbrance_flag      OUT NOCOPY      VARCHAR2,
637 		x_ussgl_option		OUT NOCOPY      VARCHAR2
638 
639 );
640 
641 -----------------------------------------------------------------------------
642 -- Start of comments                                                       --
643 --                                                                         --
644 -- PROCEDURE                                                               --
645 --  Insert_MMTEvents  This API takes a PL/SQL table as input that has one  --
646 --                    entry for each RAE event. It loops through the table --
647 --                    and calls Create_MMTRecord to create logical MMT     --
648 --                    transactions as appropriate for each event.          --
649 --                                                                         --
650 -- VERSION 1.0                                                             --
651 --                                                                         --
652 -- PARAMETERS                                                              --
653 --  P_API_VERSION      API Version # - REQUIRED: enter 1.0                 --
654 --  P_INIT_MSG_LIST    Initialize message list? True/False                 --
655 --  P_COMMIT           Should the API commit before returning? True/False  --
656 --  P_VALIDATION_LEVEL Specify the level of validation on the inputs       --
657 --  P_RCV_EVENTS_TBL   Collection of events of type rcv_event_rec_type     --
658 --  X_RETURN_STATUS    Success/Error/Unexplained error - 'S','E', or 'U'   --
659 --  X_MSG_COUNT        Message Count - # of messages placed in message list--
660 --  X_MSG_DATA         Message Text - returns msg contents if msg_count = 1--
661 --                                                                         --
662 -- HISTORY:                                                                --
663 --    7/21/03     Bryan Kuntz      Created                                --
664 -- End of comments                                                         --
665 -----------------------------------------------------------------------------
666 
667 PROCEDURE Insert_MMTEvents (
668   P_API_VERSION        IN          NUMBER,
669   P_INIT_MSG_LIST      IN          VARCHAR2 := FND_API.G_FALSE,
670   P_COMMIT             IN          VARCHAR2 := FND_API.G_FALSE,
671   P_VALIDATION_LEVEL   IN          NUMBER   := FND_API.G_VALID_LEVEL_FULL,
672   X_RETURN_STATUS      OUT NOCOPY  VARCHAR2,
673   X_MSG_COUNT          OUT NOCOPY  NUMBER,
674   X_MSG_DATA           OUT NOCOPY  VARCHAR2,
675   P_RCV_EVENTS_TBL     IN          RCV_SeedEvents_PVT.rcv_event_tbl_type
676 );
677 
678 -----------------------------------------------------------------------------
679 -- Start of comments                                                       --
680 --                                                                         --
681 -- PROCEDURE                                                               --
682 --  Create_MMTRecord  This API takes an RAE record along with the          --
683 --                    parameters listed above and converts them into a     --
684 --                    single MMT record which will be used in a subsequent --
685 --                    function to make the physical insert into MMT        --
686 --                                                                         --
687 --                                                                         --
688 -- VERSION 1.0                                                             --
689 --                                                                         --
690 -- PARAMETERS                                                              --
691 --  P_API_VERSION      API Version # - REQUIRED: enter 1.0                 --
692 --  P_INIT_MSG_LIST    Initialize message list? True/False                 --
693 --  P_COMMIT           Should the API commit before returning? True/False  --
694 --  P_VALIDATION_LEVEL Specify the level of validation on the inputs       --
695 --  X_RETURN_STATUS    Success/Error/Unexplained error - 'S','E', or 'U'   --
696 --  X_MSG_COUNT        Message Count - # of messages placed in message list--
697 --  X_MSG_DATA         Message Text - returns msg contents if msg_count = 1--
698 --  P_RCV_EVENT        Represents a single RAE, used to build the MMT entry--
699 --  P_TXN_TYPE_ID      Txn Type ID of the new MMT row being created        --
700 --  P_INTERCOMPANY_PRICE  The calling fcn must determine how to populate   --
701 --                     this based on the txn type and on the OU's position --
702 --                     in the txn flow. It will represent the transfer     --
703 --                     price between this OU and an adjacent one.          --
704 --  P_INTERCOMPANY_CURR_CODE This parameter represents the currency code   --
705 --                     of the intercompany price.                          --
706 --  P_ACCT_ID          Used to populate MMT.distribution_account_id        --
707 --  P_SIGN             Used to set the signs (+/-) of the primary quantity --
708 --                     and the transaction quantity                        --
709 --  P_PARENT_TXN_FLAG  1 - Indicates that this is the parent transaction   --
710 --  P_TRANSFER_ORGANIZATION_ID The calling function should pass the        --
711 --                     organization from the next event.                   --
712 --  X_INV_TRX          Returns the record that will be inserted into MMT   --
713 --                                                                         --
714 -- HISTORY:                                                                --
715 --    7/21/03     Bryan Kuntz      Created                                --
716 -- End of comments                                                         --
717 -----------------------------------------------------------------------------
718 PROCEDURE Create_MMTRecord(
719                 p_api_version           IN      	NUMBER,
720                 p_init_msg_list         IN      	VARCHAR2 := FND_API.G_FALSE,
721                 p_commit                IN      	VARCHAR2 := FND_API.G_FALSE,
722                 p_validation_level      IN      	NUMBER   := FND_API.G_VALID_LEVEL_FULL,
723                 x_return_status         OUT NOCOPY      VARCHAR2,
724                 x_msg_count             OUT NOCOPY      NUMBER,
725                 x_msg_data              OUT NOCOPY      VARCHAR2,
726                 p_rcv_event             IN      	RCV_SeedEvents_PVT.rcv_event_rec_type,
727                 p_txn_type_id           IN      	NUMBER,
728                 p_intercompany_price    IN      	NUMBER,
729 		p_intercompany_curr_code IN		VARCHAR2,
730                 p_acct_id               IN      	NUMBER,
731                 p_sign                  IN      	NUMBER,
732                 p_parent_txn_flag       IN      	NUMBER,
733                 p_transfer_organization_id IN           NUMBER,
734                 x_inv_trx               OUT NOCOPY      INV_LOGICAL_TRANSACTION_GLOBAL.mtl_trx_rec_type
735 );
736 
737 
738 END RCV_SeedEvents_PVT;