1 PACKAGE csd_receive_util AS
2 /* $Header: csdvruts.pls 120.2 2006/03/09 11:29:45 mshirkol noship $ */
3
4 /*----------------------------------------------------*/
5 /* Record name: RCV_REC_TYPE */
6 /* description : Record used for interfacing the */
7 /* receiving API. This reocrd is used */
8 /* to pass information to the receiving */
9 /* API to populate the interface tables */
10 /*----------------------------------------------------*/
11 TYPE rcv_rec_type IS RECORD (
12 customer_id NUMBER, -- value for this can not be G_MISS_NUM should be valid
13 -- customer id or null
14 customer_site_id NUMBER, -- value for this can not be G_MISS_NUM should be valid
15 -- customer site id or null
16 employee_id NUMBER,
17 quantity NUMBER,
18 uom_code VARCHAR2 (3),
19 unit_of_measure VARCHAR2 (25),
20 inventory_item_id NUMBER,
21 item_revision VARCHAR2 (3),
22 to_organization_id NUMBER,
23 destination_type_code VARCHAR2 (25),
24 subinventory VARCHAR2 (30),
25 locator_id NUMBER,
26 deliver_to_location_id NUMBER,
27 requisition_number NUMBER,
28 requisition_line_id NUMBER,
29 order_header_id NUMBER,
30 order_line_id NUMBER,
31 order_number VARCHAR2 (30),
32 doc_number VARCHAR2 (30),
33 internal_order_flag VARCHAR2 (1),
34 from_organization_id NUMBER,
35 expected_receipt_date DATE,
36 transaction_date DATE,
37 ship_to_location_id NUMBER,
38 serial_number VARCHAR2 (30),
39 lot_number VARCHAR2 (80), -- fix for bug#4625226
40 category_id NUMBER,
41 routing_header_id NUMBER,
42 primary_unit_of_measure VARCHAR2(25),
43 lot_control_code NUMBER,
44 serial_control_code NUMBER,
45 currency_code VARCHAR2 (3),
46 -- Added for internal orders
47 shipped_date date,
48 shipment_number VARCHAR2(30),
49 shipment_header_id NUMBER,
50 shipment_line_id NUMBER
51 );
52
53 TYPE rcv_tbl_type IS TABLE OF rcv_rec_type
54 INDEX BY BINARY_INTEGER;
55
56 /*----------------------------------------------------*/
57 /* Record name : RCV_ERROR_MSG_REC */
58 /* description : Record used to capture the error */
59 /* messages for a order header and line */
60 /*----------------------------------------------------*/
61 TYPE rcv_error_msg_rec IS RECORD
62 (
63 group_id NUMBER,
64 header_interface_id NUMBER,
65 interface_transaction_id NUMBER,
66 order_header_id NUMBER,
67 order_line_id NUMBER,
68 column_name VARCHAR2(30),
69 error_message VARCHAR2(2000)
70 );
71
72 TYPE rcv_error_msg_tbl IS TABLE OF rcv_error_msg_rec
73 INDEX BY BINARY_INTEGER;
74
75 /*--------------------------------------------------------------------------------------*/
76 /* function name: is_auto_rcv_available */
77 /* description : This function will check if the item is eligible for auto receive */
78 /* */
79 /* Called from : This is called from the LOGISTICS UI and also the */
80 /* CSD_RECEIVE_PVT.RECEIVE_ITEM API. */
81 /* Input Parm : p_inventory_item_id NUMBER inventory item id */
82 /* p_inv_org_id NUMBER org id of the receiving */
83 /* sub inventory */
84 /* p_internal_ro_flag VARCHAR2 indicates if the repair */
85 /* order is internal */
86 /* p_from_inv_org_id NUMBER org id from which the */
87 /* transfer is made in the */
88 /* case if internal orders */
89 /* returns Routing header id. NUMBER */
90 /*------------------------------------------------------------------------------------*/
91
92
93 FUNCTION is_auto_rcv_available (
94 p_inventory_item_id IN NUMBER,
95 p_inv_org_id IN NUMBER,
96 p_internal_ro_flag IN VARCHAR2,
97 p_from_inv_org_id IN NUMBER
98 )
99 RETURN NUMBER;
100
101 /*-----------------------------------------------------------------------------------------------------------*/
102 /* procedure name: VALIDATE_RCV_INPUT */
103 /* description : Validates the RMA data. Checks for mandatory fields for */
104 /* Receiving Open interface API. */
105 /* Called from : CSD_RECEIVE_PVT.RECEIVE_ITEM */
106 /* Input Parm :
107 /* p_validation_level NUMBER Optional API uses this parameter to determine which */
108 /* validation steps must be done and which steps */
109 /* should be skipped. */
110 /* p_receive_rec CSD_RCV_UTIL.RCV_REC_TYPE Required */
111 /* Output Parm : x_return_status VARCHAR2 Return status after the call. The status can be*/
112 /* fnd_api.g_ret_sts_success (success) */
113 /* fnd_api.g_ret_sts_error (error) */
114 /* fnd_api.g_ret_sts_unexp_error (unexpected) */
115 /*-----------------------------------------------------------------------------------------------------------*/
116 PROCEDURE validate_rcv_input (
117 p_validation_level IN NUMBER,
118 x_return_status OUT NOCOPY VARCHAR2,
119 p_receive_rec IN csd_receive_util.rcv_rec_type
120 );
121
122 /*-----------------------------------------------------------------------------------------------------------*/
123 /* procedure name: CHECK_RCV_ERRORS */
124 /* description : Checks the PO_INTERFACE_ERRORS table to see of there are any error records created by the */
125 /* receiving transaction processor.. */
126 /* Called from : CSD_RECEIVE_PVT.RECEIVE_ITEM */
127 /* Input Parm : p_request_group_id NUMBER Required */
128 /* Output Parm : x_return_status VARCHAR2 Return status after the call. The status can be */
129 /* fnd_api.g_ret_sts_success (success) */
130 /* fnd_api.g_ret_sts_error (error) */
131 /* fnd_api.g_ret_sts_unexp_error (unexpected) */
132 /* x_rcv_error_tbl rcv_error_tbl Returns table of rcv_error messages */
133 /*-----------------------------------------------------------------------------------------------------------*/
134 PROCEDURE check_rcv_errors (
135 x_return_status OUT NOCOPY VARCHAR2,
136 x_rcv_error_msg_tbl OUT NOCOPY csd_receive_util.rcv_error_msg_tbl,
137 p_request_group_id IN NUMBER
138 );
139
140 /*-----------------------------------------------------------------------------------------------------------*/
141 /* procedure name: get_employee_id */
142 /* description : This will return the employee id for the given user id. */
143 /* */
144 /* Called from : CSD_RECEIVE_PVT.RECEIVE_ITEM */
145 /* Input Parm : p_request_group_id NUMBER Required */
146 /* Output Parm : x_return_status VARCHAR2 Return status after the call. The status can be*/
147 /* fnd_api.g_ret_sts_success (success) */
148 /* fnd_api.g_ret_sts_error (error) */
149 /* fnd_api.g_ret_sts_unexp_error (unexpected) */
150 /*-----------------------------------------------------------------------------------------------------------*/
151 PROCEDURE get_employee_id (
152 p_user_id IN NUMBER,
153 x_employee_id OUT NOCOPY NUMBER
154 );
155
156 /*-----------------------------------------------------------------------------------------------------------*/
157 /* procedure name: get_rcv_item_params */
158 /* description : This will populate some required fields in the receiving data structure */
159 /* */
160 /* Called from : CSD_RECEIVE_PVT.RECEIVE_ITEM */
161 /* Input Parm : p_receive_rec CSD_RCV_UTIL.RCV_REC_TYPE Required */
162 /* Output Parm : x_return_status VARCHAR2 Return status after the call. The status can be*/
163 /* fnd_api.g_ret_sts_success (success) */
164 /* fnd_api.g_ret_sts_error (error) */
165 /* fnd_api.g_ret_sts_unexp_error (unexpected) */
166 /*-----------------------------------------------------------------------------------------------------------*/
167 PROCEDURE get_rcv_item_params (
168 p_receive_rec IN OUT NOCOPY csd_receive_util.rcv_rec_type
169 );
170 END csd_receive_util;