DBA Data[Home] [Help]

PACKAGE: APPS.WSH_DOCUMENT_PVT

Source


1 PACKAGE WSH_Document_PVT AUTHID CURRENT_USER AS
2 -- $Header: WSHVPACS.pls 120.1 2005/10/11 02:54:40 sgumaste noship $
3 
4 --------------------
5 -- TYPE DECLARATIONS
6 --------------------
7 
8 ------------
9 -- CONSTANTS
10 ------------
11 
12 -------------------
13 -- PUBLIC VARIABLES
14 -------------------
15 
16 ---------------------------
17 -- PROCEDURES AND FUNCTIONS
18 ---------------------------
19 
20 ------------------------------------------------------------------------------
21 --  PROCEDURE  : Create_Document        PUBLIC
22 --  VERSION    : 1.0
23 --  COMMENT    : Creates a document (packing slip, bill of lading) for a
24 --               delivery and assigns(or validates) a sequence number
25 --               as per pre-defined document category definitions
26 --
27 --  PARAMETER LIST :
28 --
29 --     IN
30 --
31 --     p_api_version          known API version
32 --     p_init_msg_list        should API reset message stack (default: false)
33 --     p_commit               should API do a commit (default: false)
34 --     p_validation_level     extent of validation done in the API (not used)
35 --     p_entity_name          Entity for which the document is being created
36 --                            examples: WSH_NEW_DELIVERIES, WSH_DELIVERY_LEGS
37 --     p_entity_id            Entity id that the document belongs to
38 --                            example: delivery_id, delivery_leg_id, etc
39 --     p_application_id       Application which is creating the document (
40 --                            should be same as the one that owns the
41 --			      document category )
42 --     p_location_id          Location id which the document is being created
43 --     p_document_type        type codes (PACK_TYPE, BOL, ASN, etc.)
44 --     p_document_sub_type    for packing slips (SALES_ORDER, etc) and
45 --                            for Bills of Lading the ship method codes
46 --     p_pod_flag             pod_flag for the document
47 --     p_pod_by               pod_by for the document
48 --     p_pod_date             pod_date for the document
49 --     p_reason_of_transport  reason of transport that describes the delivery
50 --     p_description          external aspect of the delivery
51 --     p_cod_amount           cod_amount of the document
52 --     p_cod_currency_code    cod_currency_code of the document
53 --     p_cod_remit_to         cod_remit_to of the document
54 --     p_cod_charge_paid_by   cod_charge_paid_by of the document
55 --     p_problem_contact_reference   problem_contact_referene of the document
56 --     p_bill_freight_to      bill_freight_to of the document
57 --     p_carried_by           carried_by of the document
58 --     p_port_of_loading      port_of_loading of the docucent
59 --     p_port_of_discharge    port_of_discharge of the document
60 --     p_booking_office       booking_office of the document
61 --     p_booking_number       booking_number of the document
62 --     p_service_contract     service_contract of the document
63 --     p_shipper_export_ref   shipper_export_ref of the document
64 --     p_carrier_export_ref   carrier_export_ref of the document
65 --     p_bol_notify_party     bol_notify_party of the document
66 --     p_supplier_code        supplier_code of the document
67 --     p_aetc_number          aetc_number of the document
68 --     p_shipper_signed_by    shipper_signed_by of the document
69 --     p_shipper_date         shipper_date of the document
70 --     p_carrier_signed_by    carrier_signed_by of the document
71 --     p_carrier_date         carrier_date of the document
72 --     p_bol_issue_office     bol_issue_office of the document
73 --     p_bol_issued_by        bol_issued_by of the document
74 --     p_bol_date_issued      bol_date_issued of the document
75 --     p_shipper_hm_by        shipper_bm_by of the document
76 --     p_shipper_hm_date      shipper_hm_date of the document
77 --     p_carrier_hm_by        carrier_hm_by of the document
78 --     p_carrier_hm_date      carrier_hm_date of the document
79 --     p_ledger_id            Ledger id attached to the calling program (
80 --                            should be same as ledger used to setup the
81 --                            document category/assignment )
82 --     p_consolidate_option   calling program's choice to create document(s)
83 --                            for this parent delivery only ('CONSOLIDATE')
84 --                            or for child dels of this delivery ('SEPARATE')
85 --                            or both parent and child deliveries ('BOTH')
86 --     p_manual_sequence_number  user defined sequence number ( used only
87 --                            if the document falls in a category  that has
88 --                            manual type suquence assigned to it (else null)
89 --
90 --     OUT
91 --
92 --     x_msg_count            number of messages in stack
93 --     x_msg_data             message if there is only one message in stack
94 --     x_document_number      the document number (generated/manual sequence
95 --                            with concatenated prefix and suffix).
96 --     x_return_status        API return status ('S', 'E', 'U')
97 --
98 --     PRE-CONDITIONS  :  The delivery should be existing in the Database
99 --     POST-CONDITIONS :  None
100 --     EXCEPTIONS      :  None
101 ------------------------------------------------------------------------------
102 
103 PROCEDURE Create_Document
104 ( p_api_version               IN  NUMBER
105 , p_init_msg_list             IN  VARCHAR2 DEFAULT FND_API.g_false
106 , p_commit                    IN  VARCHAR2 DEFAULT FND_API.g_false
107 , p_validation_level          IN  NUMBER   DEFAULT FND_API.g_valid_level_full
108 , x_return_status             OUT NOCOPY  VARCHAR2
109 , x_msg_count                 OUT NOCOPY  NUMBER
110 , x_msg_data                  OUT NOCOPY  VARCHAR2
111 , p_entity_name               IN  VARCHAR2 DEFAULT NULL
112 , p_entity_id                 IN  NUMBER
113 , p_application_id            IN  NUMBER
114 , p_location_id               IN  NUMBER
115 , p_document_type             IN  VARCHAR2
116 , p_document_sub_type         IN  VARCHAR2
117 /*Commented for Shipping Data model Changes - Bug#1918342*/
118 /*, p_pod_flag                  IN  VARCHAR2
119 , p_pod_by                    IN  VARCHAR2
120 , p_pod_date                  IN  DATE
121 , p_reason_of_transport       IN  VARCHAR2
122 , p_description               IN  VARCHAR2
123 , p_cod_amount                IN  NUMBER
124 , p_cod_currency_code         IN  VARCHAR2
125 , p_cod_remit_to              IN  VARCHAR2
126 , p_cod_charge_paid_by        IN  VARCHAR2
127 , p_problem_contact_reference IN  VARCHAR2
128 , p_bill_freight_to           IN  VARCHAR2
129 , p_carried_by                IN  VARCHAR2
130 , p_port_of_loading           IN  VARCHAR2
131 , p_port_of_discharge         IN  VARCHAR2
132 , p_booking_office            IN  VARCHAR2
133 , p_booking_number            IN  VARCHAR2
134 , p_service_contract          IN  VARCHAR2
135 , p_shipper_export_ref        IN  VARCHAR2
136 , p_carrier_export_ref        IN  VARCHAR2
137 , p_bol_notify_party          IN  VARCHAR2
138 , p_supplier_code             IN  VARCHAR2
139 , p_aetc_number               IN  VARCHAR2
140 , p_shipper_signed_by         IN  VARCHAR2
141 , p_shipper_date              IN  DATE
142 , p_carrier_signed_by         IN  VARCHAR2
143 , p_carrier_date              IN  DATE
144 , p_bol_issue_office          IN  VARCHAR2
145 , p_bol_issued_by             IN  VARCHAR2
146 , p_bol_date_issued           IN  DATE
147 , p_shipper_hm_by             IN  VARCHAR2
148 , p_shipper_hm_date           IN  DATE
149 , p_carrier_hm_by             IN  VARCHAR2
150 , p_carrier_hm_date           IN  DATE*/
151 , p_ledger_id                 IN  NUMBER    -- LE Uptake
152 , p_consolidate_option        IN  VARCHAR2 DEFAULT 'BOTH'
153 , p_manual_sequence_number    IN  NUMBER   DEFAULT NULL
154 , x_document_number           OUT NOCOPY  VARCHAR2
155 );
156 
157 
158 ------------------------------------------------------------------------------
159 --  PROCEDURE  : Update_Document        PUBLIC
160 --  VERSION    : 1.0
161 --  COMMENT    : Updates a document (pack slip, bill of lading) for a delivery
162 --
163 --  PARAMETER LIST :
164 --
165 --     IN
166 --
167 --     p_api_version          known API version
168 --     p_init_msg_list        should API reset message stack (default: false)
169 --     p_commit               should API do a commit (default: false)
170 --     p_validation_level     extent of validation done in the API (not used)
171 --     p_entity_name          Entity for which the document is being updated
172 --                            examples: WSH_NEW_DELIVERIES, WSH_DELIVERY_LEGS
173 --     p_entity_id            Entity id that the document belongs to
174 --                            example: delivery_id, delivery_leg_id, etc
175 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
176 --     p_pod_flag             pod_flag for the document
177 --     p_pod_by               pod_by for the document
178 --     p_pod_date             pod_date for the document
179 --     p_reason_of_transport  reason of transport that describes the delivery
180 --     p_description          external aspect of the delivery
181 --     p_cod_amount           cod_amount of the document
182 --     p_cod_currency_code    cod_currency_code of the document
183 --     p_cod_remit_to         cod_remit_to of the document
184 --     p_cod_charge_paid_by   cod_charge_paid_by of the document
185 --     p_problem_contact_reference   problem_contact_referene of the document
186 --     p_bill_freight_to      bill_freight_to of the document
187 --     p_carried_by           carried_by of the document
188 --     p_port_of_loading      port_of_loading of the docucent
189 --     p_port_of_discharge    port_of_discharge of the document
190 --     p_booking_office       booking_office of the document
191 --     p_booking_number       booking_number of the document
192 --     p_service_contract     service_contract of the document
193 --     p_shipper_export_ref   shipper_export_ref of the document
194 --     p_carrier_export_ref   carrier_export_ref of the document
195 --     p_bol_notify_party     bol_notify_party of the document
196 --     p_supplier_code        supplier_code of the document
197 --     p_aetc_number          aetc_number of the document
198 --     p_shipper_signed_by    shipper_signed_by of the document
199 --     p_shipper_date         shipper_date of the document
200 --     p_carrier_signed_by    carrier_signed_by of the document
201 --     p_carrier_date         carrier_date of the document
202 --     p_bol_issue_office     bol_issue_office of the document
203 --     p_bol_issued_by        bol_issued_by of the document
204 --     p_bol_date_issued      bol_date_issued of the document
205 --     p_shipper_hm_by        shipper_bm_by of the document
206 --     p_shipper_hm_date      shipper_hm_date of the document
207 --     p_carrier_hm_by        carrier_hm_by of the document
208 --     p_carrier_hm_date      carrier_hm_date of the document
209 --     p_ledger_id            Ledger id attached to the calling program (
210 --                            should be same as ledger used to setup the
211 --                            document category/assignment )
212 --     p_consolidate_option   calling program's choice to update document(s)
213 --                            for this parent delivery only ('CONSOLIDATE')
214 --                            or for child dels of this delivery ('SEPARATE')
215 --                            or both parent and child deliveries ('BOTH')
216 --
217 --     OUT
218 --
219 --     x_msg_count            number of messages in stack
220 --     x_msg_data             message if there is only one message in stack
221 --     x_return_status        API return status ('S', 'E', 'U')
222 --
223 --     PRE-CONDITIONS  :  None
224 --     POST-CONDITIONS :  None
225 --     EXCEPTIONS      :  None
226 ------------------------------------------------------------------------------
227 
228 
229 PROCEDURE Update_Document
230 ( p_api_version               IN  NUMBER
231 , p_init_msg_list             IN  VARCHAR2 DEFAULT FND_API.g_false
232 , p_commit                    IN  VARCHAR2 DEFAULT FND_API.g_false
233 , p_validation_level          IN  NUMBER   DEFAULT FND_API.g_valid_level_full
234 , x_return_status             OUT NOCOPY  VARCHAR2
235 , x_msg_count                 OUT NOCOPY  NUMBER
236 , x_msg_data                  OUT NOCOPY  VARCHAR2
237 , p_entity_name               IN  VARCHAR2 DEFAULT NULL
238 , p_entity_id                 IN  NUMBER
239 , p_document_type             IN  VARCHAR2
240 /* Commented for Shipping Data Model Changes Bug#1918342*/
241 /*, p_pod_flag                  IN  VARCHAR2 DEFAULT FND_API.g_miss_char
242 , p_pod_by                    IN  VARCHAR2 DEFAULT FND_API.g_miss_char
243 , p_pod_date                  IN  DATE     DEFAULT FND_API.g_miss_date
244 , p_reason_of_transport       IN  VARCHAR2 DEFAULT FND_API.g_miss_char
245 , p_description               IN  VARCHAR2 DEFAULT FND_API.g_miss_char
246 , p_cod_amount                IN  NUMBER   DEFAULT FND_API.g_miss_num
247 , p_cod_currency_code         IN  VARCHAR2 DEFAULT FND_API.g_miss_char
248 , p_cod_remit_to              IN  VARCHAR2 DEFAULT FND_API.g_miss_char
249 , p_cod_charge_paid_by        IN  VARCHAR2 DEFAULT FND_API.g_miss_char
250 , p_problem_contact_reference IN  VARCHAR2 DEFAULT FND_API.g_miss_char
251 , p_bill_freight_to           IN  VARCHAR2 DEFAULT FND_API.g_miss_char
252 , p_carried_by                IN  VARCHAR2 DEFAULT FND_API.g_miss_char
253 , p_port_of_loading           IN  VARCHAR2 DEFAULT FND_API.g_miss_char
254 , p_port_of_discharge         IN  VARCHAR2 DEFAULT FND_API.g_miss_char
255 , p_booking_office            IN  VARCHAR2 DEFAULT FND_API.g_miss_char
256 , p_booking_number            IN  VARCHAR2 DEFAULT FND_API.g_miss_char
257 , p_service_contract          IN  VARCHAR2 DEFAULT FND_API.g_miss_char
258 , p_shipper_export_ref        IN  VARCHAR2 DEFAULT FND_API.g_miss_char
259 , p_carrier_export_ref        IN  VARCHAR2 DEFAULT FND_API.g_miss_char
260 , p_bol_notify_party          IN  VARCHAR2 DEFAULT FND_API.g_miss_char
261 , p_supplier_code             IN  VARCHAR2 DEFAULT FND_API.g_miss_char
262 , p_aetc_number               IN  VARCHAR2 DEFAULT FND_API.g_miss_char
263 , p_shipper_signed_by         IN  VARCHAR2 DEFAULT FND_API.g_miss_char
264 , p_shipper_date              IN  DATE     DEFAULT FND_API.g_miss_date
265 , p_carrier_signed_by         IN  VARCHAR2 DEFAULT FND_API.g_miss_char
266 , p_carrier_date              IN  DATE     DEFAULT FND_API.g_miss_date
267 , p_bol_issue_office          IN  VARCHAR2 DEFAULT FND_API.g_miss_char
268 , p_bol_issued_by             IN  VARCHAR2 DEFAULT FND_API.g_miss_char
269 , p_bol_date_issued           IN  DATE     DEFAULT FND_API.g_miss_date
270 , p_shipper_hm_by             IN  VARCHAR2 DEFAULT FND_API.g_miss_char
271 , p_shipper_hm_date           IN  DATE     DEFAULT FND_API.g_miss_date
272 , p_carrier_hm_by             IN  VARCHAR2 DEFAULT FND_API.g_miss_char
276 );
273 , p_carrier_hm_date           IN  DATE     DEFAULT FND_API.g_miss_date*/
274 , p_ledger_id                 IN  NUMBER   -- LE Uptake
275 , p_consolidate_option        IN  VARCHAR2 DEFAULT 'BOTH'
277 
278 
279 ------------------------------------------------------------------------------
280 --  PROCEDURE  : Cancel_Document       PUBLIC
281 --  VERSION    : 1.0
282 --  COMMENT    : Updates the status of a document to 'CANCELLED'
283 --
284 --  PARAMETER LIST :
285 --
286 --     IN
287 --
288 --     p_api_version          known API version
289 --     p_init_msg_list        should API reset message stack (default: false)
290 --     p_commit               should API do a commit (default: false)
291 --     p_validation_level     extent of validation done in the API (not used)
292 --     p_entity_name          Entity for which the document is being cancelled
293 --                            examples: WSH_NEW_DELIVERIES, WSH_DELIVERY_LEGS
294 --     p_entity_id            Entity id that the document belongs to
295 --                            example: delivery_id, delivery_leg_id, etc
296 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
297 --     p_consolidate_option   calling program's choice to cancel document(s)
298 --                            for this parent delivery only ('CONSOLIDATE')
299 --                            or for child dels of this delivery ('SEPARATE')
300 --                            or both parent and child deliveries ('BOTH')
301 --
302 --     OUT
303 --
304 --     x_msg_count            number of messages in stack
305 --     x_msg_data             message if there is only one message in stack
306 --     x_return_status        API return status ('S', 'E', 'U')
307 --
308 --     PRE-CONDITIONS  :  None
309 --     POST-CONDITIONS :  None
310 --     EXCEPTIONS      :  None
311 ------------------------------------------------------------------------------
312 
313 PROCEDURE Cancel_Document
314 ( p_api_version        IN  NUMBER
315 , p_init_msg_list      IN  VARCHAR2 DEFAULT FND_API.g_false
316 , p_commit             IN  VARCHAR2 DEFAULT FND_API.g_false
317 , p_validation_level   IN  NUMBER   DEFAULT FND_API.g_valid_level_full
318 , x_return_status      OUT NOCOPY  VARCHAR2
319 , x_msg_count          OUT NOCOPY  NUMBER
320 , x_msg_data           OUT NOCOPY  VARCHAR2
321 , p_entity_name        IN  VARCHAR2 DEFAULT NULL
322 , p_entity_id          IN  NUMBER
323 , p_document_type      IN  VARCHAR2
324 , p_consolidate_option IN  VARCHAR2 DEFAULT 'BOTH'
325 );
326 
327 ------------------------------------------------------------------------------
328 --  PROCEDURE  : Open_Document       PUBLIC
329 --  VERSION    : 1.0
330 --  COMMENT    : Updates the status of a document to 'OPEN'
331 --
332 --  PARAMETER LIST :
333 --
334 --     IN
335 --
336 --     p_api_version          known API version
337 --     p_init_msg_list        should API reset message stack (default: false)
338 --     p_commit               should API do a commit (default: false)
339 --     p_validation_level     extent of validation done in the API (not used)
340 --     p_entity_name          Entity for which the document is being opened
341 --                            examples: WSH_NEW_DELIVERIES, WSH_DELIVERY_LEGS
342 --     p_entity_id            Entity id that the document belongs to
343 --                            example: delivery_id, delivery_leg_id, etc
344 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
345 --     p_consolidate_option   calling program's choice to open document(s)
346 --                            for this parent delivery only ('CONSOLIDATE')
347 --                            or for child dels of this delivery ('SEPARATE')
348 --                            or both parent and child deliveries ('BOTH')
349 --
350 --     OUT
351 --
352 --     x_msg_count            number of messages in stack
353 --     x_msg_data             message if there is only one message in stack
354 --     x_return_status        API return status ('S', 'E', 'U')
355 --
356 --     PRE-CONDITIONS  :  None
357 --     POST-CONDITIONS :  None
358 --     EXCEPTIONS      :  None
359 ------------------------------------------------------------------------------
360 
361 PROCEDURE Open_Document
362 ( p_api_version        IN  NUMBER
363 , p_init_msg_list      IN  VARCHAR2 DEFAULT FND_API.g_false
364 , p_commit             IN  VARCHAR2 DEFAULT FND_API.g_false
365 , p_validation_level   IN  NUMBER   DEFAULT FND_API.g_valid_level_full
366 , x_return_status      OUT NOCOPY  VARCHAR2
367 , x_msg_count          OUT NOCOPY  NUMBER
368 , x_msg_data           OUT NOCOPY  VARCHAR2
369 , p_entity_name        IN  VARCHAR2 DEFAULT NULL
370 , p_entity_id          IN  NUMBER
371 , p_document_type      IN  VARCHAR2
372 , p_consolidate_option IN  VARCHAR2 DEFAULT 'BOTH'
373 );
374 
375 ------------------------------------------------------------------------------
376 --  PROCEDURE  : Complete_Document       PUBLIC
377 --  VERSION    : 1.0
378 --  COMMENT    : Updates the status of a document to 'COMPLETE'
379 --
380 --  PARAMETER LIST :
381 --
382 --     IN
383 --
384 --     p_api_version          known API version
385 --     p_init_msg_list        should API reset message stack (default: false)
386 --     p_commit               should API do a commit (default: false)
387 --     p_validation_level     extent of validation done in the API (not used)
388 --     p_entity_name          Entity for which the document is being completed
392 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
389 --                            examples: WSH_NEW_DELIVERIES, WSH_DELIVERY_LEGS
390 --     p_entity_id            Entity id that the document belongs to
391 --                            example: delivery_id, delivery_leg_id, etc
393 --     p_consolidate_option   calling program's choice to complete document(s)
394 --                            for this parent delivery only ('CONSOLIDATE')
395 --                            or for child dels of this delivery ('SEPARATE')
396 --                            or both parent and child deliveries ('BOTH')
397 --
398 --     OUT
399 --
400 --     x_msg_count            number of messages in stack
401 --     x_msg_data             message if there is only one message in stack
402 --     x_return_status        API return status ('S', 'E', 'U')
403 --
404 --     PRE-CONDITIONS  :  None
405 --     POST-CONDITIONS :  None
406 --     EXCEPTIONS      :  None
407 ------------------------------------------------------------------------------
408 
409 PROCEDURE Complete_Document
410 ( p_api_version        IN  NUMBER
411 , p_init_msg_list      IN  VARCHAR2 DEFAULT FND_API.g_false
412 , p_commit             IN  VARCHAR2 DEFAULT FND_API.g_false
413 , p_validation_level   IN  NUMBER   DEFAULT FND_API.g_valid_level_full
414 , x_return_status      OUT NOCOPY  VARCHAR2
415 , x_msg_count          OUT NOCOPY  NUMBER
416 , x_msg_data           OUT NOCOPY  VARCHAR2
417 , p_entity_name        IN  VARCHAR2 DEFAULT NULL
418 , p_entity_id          IN  NUMBER
419 , p_document_type      IN  VARCHAR2
420 , p_consolidate_option IN  VARCHAR2 DEFAULT 'BOTH'
421 );
422 ------------------------------------------------------------------------------
423 --  FUNCTION   : Get_Sequence_Type        PUBLIC
424 --  VERSION    : 1.0
425 --  COMMENT    : Checks and returns the type of a sequence assigned
426 --               to a specific document category
427 --
428 --  PARAMETER LIST :
429 --
430 --     IN
431 --
432 --     p_api_version          known API version
433 --     p_init_msg_list        should API reset message stack (default: false)
434 --     p_commit               should API do a commit (default: false)
435 --     p_validation_level     extent of validation done in the API (not used)
436 --     p_application_id       appl id of the calling program. Should be same
437 --                            as the application that owns the doc category
438 --     p_ledger_id            Ledger id of the calling program. Should be as the
439 --                            ledger used to setup the doc category/assignment
440 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
441 --     p_document_code        For pack slips this means document sub types (
442 --                            'SALES_ORDER') and for BOL ship method codes
443 --     p_location_id          Ship Location of the current delivery.
444 --
445 --     OUT
446 --
447 --     x_msg_count            number of messages in stack
448 --     x_msg_data             message if there is only one message in stack
449 --     x_return_status        API return status ('S', 'E', 'U')
450 --     x_document_valid       status of the document ('OPEN','CANCEL')
451 --
452 --     PRE-CONDITIONS  :  None
453 --     POST-CONDITIONS :  None
454 --     EXCEPTIONS      :  None
455 ------------------------------------------------------------------------------
456 
457 FUNCTION Get_Sequence_Type
458 ( p_api_version               IN  NUMBER
459 , p_init_msg_list             IN  VARCHAR2 DEFAULT FND_API.g_false
460 , p_commit                    IN  VARCHAR2 DEFAULT FND_API.g_false
461 , p_validation_level          IN  NUMBER   DEFAULT FND_API.g_valid_level_full
462 , x_return_status             OUT NOCOPY  VARCHAR2
463 , x_msg_count                 OUT NOCOPY  NUMBER
464 , x_msg_data                  OUT NOCOPY  VARCHAR2
465 , p_application_id            IN  NUMBER
466 , p_ledger_id                 IN  NUMBER    -- LE Uptake
467 , p_document_type             IN  VARCHAR2
468 , p_document_code             IN  VARCHAR2
469 , p_location_id               IN  NUMBER
470 )
471 RETURN VARCHAR2;
472 
473 ------------------------------------------------------------------------------
474 --  FUNCTION   : Is_Final        PUBLIC
475 --  VERSION    : 1.0
476 --  COMMENT    : Checks the status of all documents for the delivery
477 --               including its children.  If any such document is final,
478 --               returns true.  Else return false.  This is used by
479 --               print document routine and packing slip report to bail
480 --               out if any of the document has final_print_date set.
481 --
482 --  PARAMETER LIST :
483 --
484 --     IN
485 --
486 --     p_api_version          known API version
487 --     p_init_msg_list        should API reset message stack (default: false)
488 --     p_commit               should API do a commit (default: false)
489 --     p_validation_level     extent of validation done in the API (not used)
490 --     p_delivery_id          delivery_id of the delivery to check
491 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
492 --
493 --     OUT
494 --
495 --     x_msg_count            number of messages in stack
496 --     x_msg_data             message if there is only one message in stack
497 --     x_return_status        API return status ('S', 'E', 'U')
498 --
499 --     RETURN                 VARCHAR2, value 'T' or 'F'
500 --
501 --     PRE-CONDITIONS  :  None
505 
502 --     POST-CONDITIONS :  None
503 --     EXCEPTIONS      :  None
504 ------------------------------------------------------------------------------
506 FUNCTION Is_Final
507 ( p_api_version               IN  NUMBER
508 , p_init_msg_list             IN  VARCHAR2 DEFAULT FND_API.g_false
509 , p_commit                    IN  VARCHAR2 DEFAULT FND_API.g_false
510 , p_validation_level          IN  NUMBER   DEFAULT FND_API.g_valid_level_full
511 , x_return_status             OUT NOCOPY  VARCHAR2
512 , x_msg_count                 OUT NOCOPY  NUMBER
513 , x_msg_data                  OUT NOCOPY  VARCHAR2
514 , p_delivery_id               IN  NUMBER
515 , p_document_type             IN  VARCHAR2
516 )
517 RETURN VARCHAR2;
518 
519 ------------------------------------------------------------------------------
520 --  PROCEDURE  : Set_Final_Print_Date        PUBLIC
521 --  VERSION    : 1.0
522 --  COMMENT    : Set the FINAL_PRINT_DATE column of all document instances
523 --               of the delivery and/or its child delivery to SYSDATE.
524 --               This procedure is called when user chooses print option
525 --               as FINAL.  This means later the same document instances
526 --               cannot be printed as they fail the Is_Final check.
527 --
528 --  PARAMETER LIST :
529 --
530 --     IN
531 --
532 --     p_api_version          known API version
533 --     p_init_msg_list        should API reset message stack (default: false)
534 --     p_commit               should API do a commit (default: false)
535 --     p_validation_level     extent of validation done in the API (not used)
536 --     p_delivery_id          delivery_id of the delivery to check
537 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
538 --     p_final_print_date     the final_print_date to be set
539 --
540 --     OUT
541 --
542 --     x_msg_count            number of messages in stack
543 --     x_msg_data             message if there is only one message in stack
544 --     x_return_status        API return status ('S', 'E', 'U')
545 --
546 --
547 --     PRE-CONDITIONS  :  FINAL_PRINT_DATE column of WSH_DOCUMENT_INSTANCES
548 --                        rows of related deliveries have NULL value
549 --     POST-CONDITIONS :  such FINAL_PRINT_DATE columns have SYSDATE value
550 --     EXCEPTIONS      :  None
551 ------------------------------------------------------------------------------
552 
553 PROCEDURE Set_Final_Print_Date
554 ( p_api_version               IN  NUMBER
555 , p_init_msg_list             IN  VARCHAR2 DEFAULT FND_API.g_false
556 , p_commit                    IN  VARCHAR2 DEFAULT FND_API.g_false
557 , p_validation_level          IN  NUMBER   DEFAULT FND_API.g_valid_level_full
558 , x_return_status             OUT NOCOPY  VARCHAR2
559 , x_msg_count                 OUT NOCOPY  NUMBER
560 , x_msg_data                  OUT NOCOPY  VARCHAR2
561 , p_delivery_id               IN  NUMBER
562 , p_document_type             IN  VARCHAR2
563 , p_final_print_date          IN  DATE
564 );
565 
566 ------------------------------------------------------------------------------
567 --  PROCEDURE  : Print_Document       PUBLIC
568 --  VERSION    : 1.0
569 --  COMMENT    : Submit the report WSHRDPAK.rdf to print the packing slip.
570 --
571 --  PARAMETER LIST :
572 --
573 --     IN
574 --
575 --     p_api_version          known API version
576 --     p_init_msg_list        should API reset message stack (default: false)
577 --     p_commit               should API do a commit (default: false)
578 --     p_validation_level     extent of validation done in the API (not used)
579 --     p_delivery_id          delivery id for which document is being printed
580 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
581 --     p_departure_date_lo    delivery date (low)
582 --     p_departure_date_hi    delivery date (high)
583 --     p_item_display         display FLEX, DESC or BOTH (default BOTH)
584 --     p_print_cust_item      print customer item information or not (default
585 --                            NO)
586 --     p_print_mode           print FINAL or DRAFT (default DRAFT)
587 --     p_print_all            calling program's choice to cancel document(s)
588 --                            for this parent delivery only ('CONSOLIDATE')
589 --                            or for child dels of this delivery ('SEPARATE')
590 --                            or both parent and child deliveries ('BOTH')
591 --     p_sort                 sort the report by customer item or inventory
592 --                            item (INV or CUST, default INV)
593 --     p_freight_carrier      carrier_id of the freight carrier
594 --     p_warehouse_id         current organization_id
595 --
596 --     OUT
597 --
598 --     x_msg_count            number of messages in stack
599 --     x_msg_data             message if there is only one message in stack
600 --     x_return_status        API return status ('S', 'E', 'U')
601 --
602 --     PRE-CONDITIONS  :  None
603 --     POST-CONDITIONS :  None
604 --     EXCEPTIONS      :  None
605 ------------------------------------------------------------------------------
606 
607 PROCEDURE Print_Document
608 ( p_api_version        IN  NUMBER
609 , p_init_msg_list      IN  VARCHAR2 DEFAULT FND_API.g_false
610 , p_commit             IN  VARCHAR2 DEFAULT FND_API.g_false
611 , p_validation_level   IN  NUMBER   DEFAULT FND_API.g_valid_level_full
612 , x_return_status      OUT NOCOPY  VARCHAR2
613 , x_msg_count          OUT NOCOPY  NUMBER
617 , p_departure_date_lo  IN  DATE     DEFAULT NULL
614 , x_msg_data           OUT NOCOPY  VARCHAR2
615 , p_delivery_id        IN  NUMBER
616 , p_document_type      IN  VARCHAR2
618 , p_departure_date_hi  IN  DATE     DEFAULT NULL
619 , p_item_display       IN  VARCHAR2 DEFAULT 'D'
620 , p_print_cust_item    IN  VARCHAR2 DEFAULT 'N'
621 , p_print_mode         IN  VARCHAR2 DEFAULT 'DRAFT'
622 , p_print_all          IN  VARCHAR2 DEFAULT 'BOTH'
623 , p_sort               IN  VARCHAR2 DEFAULT 'INV'
624 , p_freight_carrier    IN  VARCHAR2 DEFAULT NULL
625 , p_warehouse_id       IN  NUMBER
626 , x_conc_request_id    OUT NOCOPY  NUMBER
627 );
628 
629 ------------------------------------------------------------------------------
630 --  FUNCTION   : Get_CumQty        PUBLIC
631 --  VERSION    : 1.0
632 --  COMMENT    : Obtain cummulative quantity value based on the inputs
633 --               by calling Automotive's CUM Management API.  Return such
634 --               value.
635 --
636 --  PARAMETER LIST :
637 --
638 --     IN
639 --
640 --     p_api_version          known API version
641 --     p_init_msg_list        should API reset message stack (default: false)
642 --     p_commit               should API do a commit (default: false)
643 --     p_validation_level     extent of validation done in the API (not used)
644 --     p_customer_id          from delivery details
645 --     p_oe_order_line_id     from delivery details for getting line level
646 --                            information to be passed to cal_cum api
647 --
648 --     OUT
649 --
650 --     x_msg_count            number of messages in stack
651 --     x_msg_data             message if there is only one message in stack
652 --     x_return_status        API return status ('S', 'E', 'U')
653 --
654 --     RETURN                 NUMBER, cum quantity value
655 --
656 --     PRE-CONDITIONS  :  None
657 --     POST-CONDITIONS :  None
658 --     EXCEPTIONS      :  None
659 ------------------------------------------------------------------------------
660 
661 FUNCTION Get_CumQty
662 ( p_api_version               IN  NUMBER
663 , p_init_msg_list             IN  VARCHAR2 DEFAULT FND_API.g_false
664 , p_commit                    IN  VARCHAR2 DEFAULT FND_API.g_false
665 , p_validation_level          IN  NUMBER   DEFAULT FND_API.g_valid_level_full
666 , x_return_status             OUT NOCOPY  VARCHAR2
667 , x_msg_count                 OUT NOCOPY  NUMBER
668 , x_msg_data                  OUT NOCOPY  VARCHAR2
669 , p_customer_id               IN  NUMBER
670 , p_oe_order_line_id          IN  NUMBER
671 )
672 RETURN NUMBER;
673 
674 ------------------------------------------------------------------------------
675 --  PROCEDURE  : Cancel_All_Documents       PUBLIC
676 --  VERSION    : 1.0
677 --  COMMENT    : Updates status of all documents of all types that
678 --               belong to a specific entity
679 --               to 'CANCELLED'
680 --
681 --  PARAMETER LIST :
682 --
683 --     IN
684 --
685 --     p_api_version          known API version
686 --     p_init_msg_list        should API reset message stack (default: false)
687 --     p_commit               should API do a commit (default: false)
688 --     p_validation_level     extent of validation done in the API (not used)
689 --     p_entity_name          Entity for which the document is being cancelled
690 --                            examples: WSH_NEW_DELIVERIES, WSH_DELIVERY_LEGS
691 --     p_entity_id            Entity id that the document belongs to
692 --                            example: delivery_id, delivery_leg_id, etc
693 --
694 --     OUT
695 --
696 --     x_msg_count            number of messages in stack
697 --     x_msg_data             message if there is only one message in stack
698 --     x_return_status        API return status ('S', 'E', 'U')
699 --
700 --     PRE-CONDITIONS  :  None
701 --     POST-CONDITIONS :  None
702 --     EXCEPTIONS      :  None
703 --     NOTES           :     In consolidation situation, the child documents
704 --                           are not cancelled. Call this routine recursively
705 --                           for all entities where cancellation is reqd.
706 ------------------------------------------------------------------------------
707 
708 PROCEDURE Cancel_All_Documents
709 ( p_api_version        IN  NUMBER
710 , p_init_msg_list      IN  VARCHAR2 DEFAULT FND_API.g_false
711 , p_commit             IN  VARCHAR2 DEFAULT FND_API.g_false
712 , p_validation_level   IN  NUMBER   DEFAULT FND_API.g_valid_level_full
713 , x_return_status      OUT NOCOPY  VARCHAR2
714 , x_msg_count          OUT NOCOPY  NUMBER
715 , x_msg_data           OUT NOCOPY  VARCHAR2
716 , p_entity_name        IN  VARCHAR2
717 , p_entity_id          IN  NUMBER
718 );
719 
720 ------------------------------------------------------------------------------
721 --  PROCEDURE  : Get_All_Documents        PUBLIC
722 --  VERSION    : 1.0
723 --  COMMENT    : Returns as an out-param a table of records of all documents
724 --               (packing slip, bill of lading, etc.) that belong to a
725 --               specific entity (delivery, delivery_leg, etc.)
726 --
727 --  PARAMETER LIST :
728 --
729 --     IN
730 --
731 --     p_api_version          known API version
732 --     p_init_msg_list        should API reset message stack (default: false)
733 --     p_commit               should API do a commit (default: false)
734 --     p_validation_level     extent of validation done in the API (not used)
738 --                            example: delivery_id, delivery_leg_id, etc
735 --     p_entity_name          Entity for which the document is being cancelled
736 --                            examples: WSH_NEW_DELIVERIES, WSH_DELIVERY_LEGS
737 --     p_entity_id            Entity id that the document belongs to
739 
740 --     OUT
741 --
742 --     x_msg_count            number of messages in stack
743 --     x_msg_data             message if there is only one message in stack
744 --     x_return_status        API return status ('S', 'E', 'U')
745 --     x_document_tab         table that contains all documents of the entity
746 --
747 --     PRE-CONDITIONS      :  None
748 --     POST-CONDITIONS     :  None
749 --     EXCEPTIONS          :  None
750 ------------------------------------------------------------------------------
751 
752 PROCEDURE Get_All_Documents
753 ( p_api_version               IN  NUMBER
754 , p_init_msg_list             IN  VARCHAR2 DEFAULT FND_API.g_false
755 , p_commit                    IN  VARCHAR2 DEFAULT FND_API.g_false
756 , p_validation_level          IN  NUMBER   DEFAULT FND_API.g_valid_level_full
757 , x_return_status             OUT NOCOPY  VARCHAR2
758 , x_msg_count                 OUT NOCOPY  NUMBER
759 , x_msg_data                  OUT NOCOPY  VARCHAR2
760 , p_entity_name               IN  VARCHAR2
761 , p_entity_id                 IN  NUMBER
762 , x_document_tab              OUT NOCOPY  wsh_document_pub.document_tabtype
763 );
764 
765 ------------------------------------------------------------------------------
766 --  PROCEDURE  : Lock_Document        PUBLIC
767 --  VERSION    : 1.0
768 --  COMMENT    : Locks a document row
769 --
770 --  PARAMETER LIST :
771 --
772 --     IN
773 --
774 --     p_rowid                Rowid of wsh_document_instances table
775 --     p_document_instance_id document instance id
776 --     p_document_type        document type codes (PACK_TYPE, BOL, ASN etc.)
777 --     p_sequence_number      sequence number of the document
778 --     p_status               status of the document
779 --     p_final_print_date     final print date
780 --     p_entity_name          Entity for which the document is being updated
781 --                            examples: WSH_NEW_DELIVERIES, WSH_DELIVERY_LEGS
782 --     p_entity_id            Entity id that the document belongs to
783 --                            example: delivery_id, delivery_leg_id, etc
784 --     p_doc_sequence_cateogory_id   document sequence category id
785 --     p_pod_flag             pod_flag for the document
786 --     p_pod_by               pod_by for the document
787 --     p_pod_date             pod_date for the document
788 --     p_reason_of_transport  reason of transport that describes the delivery
789 --     p_description          external aspect of the delivery
790 --     p_cod_amount           cod_amount of the document
791 --     p_cod_currency_code    cod_currency_code of the document
792 --     p_cod_remit_to         cod_remit_to of the document
793 --     p_cod_charge_paid_by   cod_charge_paid_by of the document
794 --     p_problem_contact_reference   problem_contact_referene of the document
795 --     p_bill_freight_to      bill_freight_to of the document
796 --     p_carried_by           carried_by of the document
797 --     p_port_of_loading      port_of_loading of the docucent
798 --     p_port_of_discharge    port_of_discharge of the document
799 --     p_booking_office       booking_office of the document
800 --     p_booking_number       booking_number of the document
801 --     p_service_contract     service_contract of the document
802 --     p_shipper_export_ref   shipper_export_ref of the document
803 --     p_carrier_export_ref   carrier_export_ref of the document
804 --     p_bol_notify_party     bol_notify_party of the document
805 --     p_supplier_code        supplier_code of the document
806 --     p_aetc_number          aetc_number of the document
807 --     p_shipper_signed_by    shipper_signed_by of the document
808 --     p_shipper_date         shipper_date of the document
809 --     p_carrier_signed_by    carrier_signed_by of the document
810 --     p_carrier_date         carrier_date of the document
811 --     p_bol_issue_office     bol_issue_office of the document
812 --     p_bol_issued_by        bol_issued_by of the document
813 --     p_bol_date_issued      bol_date_issued of the document
814 --     p_shipper_hm_by        shipper_bm_by of the document
815 --     p_shipper_hm_date      shipper_hm_date of the document
816 --     p_carrier_hm_by        carrier_hm_by of the document
817 --     p_carrier_hm_date      carrier_hm_date of the document
818 --     p_created_by           standard who column
819 --     p_creation_date        standard who column
820 --     p_last_updated_by      standard who column
821 --     p_last_update_date     standard who column
822 --     p_last_update_login    standard who column
823 --     p_program_application_id   standard who column
824 --     p_program_id           standard who column
825 --     p_program_update_date  standard who column
826 --     p_request_id           standard who column
827 --     p_attribute_category   Descriptive Flex field context
828 --     p_attribute1           Descriptive Flex field
829 --     p_attribute2           Descriptive Flex field
830 --     p_attribute3           Descriptive Flex field
831 --     p_attribute4           Descriptive Flex field
832 --     p_attribute5           Descriptive Flex field
833 --     p_attribute6           Descriptive Flex field
834 --     p_attribute7           Descriptive Flex field
835 --     p_attribute8           Descriptive Flex field
839 --     p_attribute12          Descriptive Flex field
836 --     p_attribute9           Descriptive Flex field
837 --     p_attribute10          Descriptive Flex field
838 --     p_attribute11          Descriptive Flex field
840 --     p_attribute13          Descriptive Flex field
841 --     p_attribute14          Descriptive Flex field
842 --     p_attribute15          Descriptive Flex field
843 --
844 --     OUT
845 --
846 --     x_return_status        API return status ('S', 'E', 'U')
847 --
848 --     PRE-CONDITIONS  :  None
849 --     POST-CONDITIONS :  None
850 --     EXCEPTIONS      :  None
851 --
852 --     NOTES           :  1. Called from Shipping trx form only. Not an API.
853 --					    Does not conform to API standards.
854 --
855 --					 2. In a consolidation situation, this routine looks
856 --					    for a lock only on the parent document only.
857 --
858 ------------------------------------------------------------------------------
859 
860 
861 PROCEDURE Lock_Document
862 ( p_rowid                     IN  VARCHAR2
863 , p_document_instance_id      IN  NUMBER
864 , p_document_type             IN  VARCHAR2
865 , p_sequence_number           IN  VARCHAR2
866 , p_status                    IN  VARCHAR2
867 , p_final_print_date          IN  DATE
868 , p_entity_name               IN  VARCHAR2
869 , p_entity_id                 IN  NUMBER
870 , p_doc_sequence_category_id  IN  NUMBER
871 /* Commented for Shipping Data Model Changes Bug#1918342 */
872 /*, p_pod_flag                  IN  VARCHAR2
873 , p_pod_by                    IN  VARCHAR2
874 , p_pod_date                  IN  DATE
875 , p_reason_of_transport       IN  VARCHAR2
876 , p_description               IN  VARCHAR2
877 , p_cod_amount                IN  NUMBER
878 , p_cod_currency_code         IN  VARCHAR2
879 , p_cod_remit_to              IN  VARCHAR2
880 , p_cod_charge_paid_by        IN  VARCHAR2
881 , p_problem_contact_reference IN  VARCHAR2
882 , p_bill_freight_to           IN  VARCHAR2
883 , p_carried_by                IN  VARCHAR2
884 , p_port_of_loading           IN  VARCHAR2
885 , p_port_of_discharge         IN  VARCHAR2
886 , p_booking_office            IN  VARCHAR2
887 , p_booking_number            IN  VARCHAR2
888 , p_service_contract          IN  VARCHAR2
889 , p_shipper_export_ref        IN  VARCHAR2
890 , p_carrier_export_ref        IN  VARCHAR2
891 , p_bol_notify_party          IN  VARCHAR2
892 , p_supplier_code             IN  VARCHAR2
893 , p_aetc_number               IN  VARCHAR2
894 , p_shipper_signed_by         IN  VARCHAR2
895 , p_shipper_date              IN  DATE
896 , p_carrier_signed_by         IN  VARCHAR2
897 , p_carrier_date              IN  DATE
898 , p_bol_issue_office          IN  VARCHAR2
899 , p_bol_issued_by             IN  VARCHAR2
900 , p_bol_date_issued           IN  DATE
901 , p_shipper_hm_by             IN  VARCHAR2
902 , p_shipper_hm_date           IN  DATE
903 , p_carrier_hm_by             IN  VARCHAR2
904 , p_carrier_hm_date           IN  DATE     */
905 , p_created_by                IN  NUMBER
906 , p_creation_date             IN  DATE
907 , p_last_updated_by           IN  NUMBER
908 , p_last_update_date          IN  DATE
909 , p_last_update_login         IN  NUMBER
910 , p_program_application_id    IN  NUMBER
911 , p_program_id                IN  NUMBER
912 , p_program_update_date       IN  DATE
913 , p_request_id                IN  NUMBER
914 , p_attribute_category        IN  VARCHAR2
915 , p_attribute1                IN  VARCHAR2
916 , p_attribute2                IN  VARCHAR2
917 , p_attribute3                IN  VARCHAR2
918 , p_attribute4                IN  VARCHAR2
919 , p_attribute5                IN  VARCHAR2
920 , p_attribute6                IN  VARCHAR2
921 , p_attribute7                IN  VARCHAR2
922 , p_attribute8                IN  VARCHAR2
923 , p_attribute9                IN  VARCHAR2
924 , p_attribute10               IN  VARCHAR2
925 , p_attribute11               IN  VARCHAR2
926 , p_attribute12               IN  VARCHAR2
927 , p_attribute13               IN  VARCHAR2
928 , p_attribute14               IN  VARCHAR2
929 , p_attribute15               IN  VARCHAR2
930 , x_return_status             OUT NOCOPY  VARCHAR2
931 );
932 
933 
934 ------------------------------------------------------------------------------
935 --  PROCEDURE   : set_template        PUBLIC
936 --  VERSION    : 1.0
937 --  COMMENT    : This procedure is called before calling fnd_request.submit to
938 --               set the layout template so that pdf output is generated.
939 --		 Template is obtained from shipping parameters based on the
940 --               organization_id.
941 --  PARAMETER LIST :
942 --
943 --     IN
944 --
945 --     p_organization_id          Organization Id
946 --     p_report                   'BOL'/'MBL'/'PAK'
947 --     p_template_name             BOL_TEMPLATE/MBOL_TEMPLATE/PACKSLIP_TEMPLATE
948 --
949 --     OUT
950 --
951 --     x_conc_prog_name       'WSHRDBOL'/'WSHRDBOLX'/'WSHRDMBL'/'WSHRDMBLX'/'WSHRDPAK'/'WSHRDPAKX'
952 --     x_return_status        API return status ('S', 'E', 'U')
953 --
954 --
955 --     PRE-CONDITIONS  :  None
956 --     POST-CONDITIONS :  None
957 --     EXCEPTIONS      :  None
958 ------------------------------------------------------------------------------
959 
960 PROCEDURE set_template ( p_organization_id	NUMBER,
961 			 p_report		VARCHAR2,
962 			 p_template_name        VARCHAR2,
963 			 x_conc_prog_name	OUT NOCOPY VARCHAR2,
964 			 x_return_status        OUT NOCOPY VARCHAR2	);
965 
966 END WSH_Document_PVT;