DBA Data[Home] [Help]

PACKAGE BODY: APPS.JMF_SHIKYU_RCV_PVT

Source


1 PACKAGE BODY JMF_SHIKYU_RCV_PVT AS
2 --$Header: JMFVSKVB.pls 120.5 2010/08/05 12:32:06 skolluku ship $
3 --+===========================================================================+
4 --|                    Copyright (c) 2005 Oracle Corporation                  |
5 --|                       Redwood Shores, California, USA                     |
6 --|                            All rights reserved.                           |
7 --+===========================================================================+
8 --|                                                                           |
9 --|  FILENAME :           JMFVSKVB.pls                                        |
10 --|                                                                           |
11 --|  DESCRIPTION:         Body file of the Process Receiving Transactions     |
12 --|                       package.                                            |
13 --|                                                                           |
14 --|  FUNCTION/PROCEDURE:  process_rcv_header                                  |
15 --|                       process_rcv_trx                                     |
16 --|                                                                           |
17 --|  HISTORY:                                                                 |
18 --|    10-JUN-2005        jizheng   Created.                                  |
19 --|    15-JUN-2005        THE2      Add locator_id process logic              |
20 --|    27-JUN-2005        THE2      Add project_id process logic              |
21 --|    27-JUN-2005        VMUTYALA  Add from_subinventory and from_locator_id |
22 --|                                 process logic                             |
23 --|    27-JUN-2005        THE2      Add replenish_order_line_id process logic |
24 --|                                                                           |
25 --|    11/10/2006         vmutyala  Bug 5592230 adding parameter              |
26 --|                                 p_vendor_site_id to the procedure         |
27 --|                                 process_rcv_header                        |
28 --+===========================================================================+
29 
30 --========================================================================
31 -- PROCEDURE : process_rcv_header           PUBLIC
32 -- PARAMETERS: p_vendor_id          IN            NUMBER
33 --             p_ship_to_org_id     IN            NUMBER
34 --             x_rcv_header_id      OUT NOCOPY    NUMBER
35 --             x_group_id           OUT NOCOPY    NUMBER
36 
37 -- COMMENT   : This procedure inserts records in rev_header_interface for auto_receive
38 --========================================================================
39 PROCEDURE  Process_Rcv_Header
40 ( p_vendor_id         IN         NUMBER
41 , p_vendor_site_id    IN         NUMBER
42 , p_ship_to_org_id    IN         NUMBER
43 , x_rcv_header_id     OUT NOCOPY NUMBER
44 , x_group_id          OUT NOCOPY NUMBER
45 )
46 IS
47 l_api_name             VARCHAR2(50) := 'process_rcv_header';
48 
49 l_rcv_header_id        rcv_headers_interface.header_interface_id%TYPE;
50 l_group_id             rcv_headers_interface.group_id%TYPE;
51 
52 BEGIN
53   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
54   THEN
55     fnd_log.STRING(fnd_log.LEVEL_PROCEDURE
56                   , G_MODULE_PREFIX || l_api_name || '.begin'
57                   ,'procedure begin');
58   END IF;
59 
60   SELECT
61     rcv_headers_interface_s.NEXTVAL
62     , rcv_interface_groups_s.NEXTVAL
63   INTO
64     l_rcv_header_id
65     , l_group_id
66   FROM
67     dual;
68 
69    INSERT INTO RCV_HEADERS_INTERFACE
70   ( header_interface_id
71    , group_id
72    , processing_status_code
73    , receipt_source_code
74    , transaction_type
75    , last_update_date
76    , last_updated_by
77    , creation_date
78    , created_by
79    , vendor_id
80    , VENDOR_SITE_ID
81    , validation_flag
82    , Ship_To_Organization_id
83    , expected_receipt_date
84    )
85   VALUES(
86     l_rcv_header_id
87     , l_group_id
88     , 'PENDING'
89     , 'VENDOR'
90     , 'NEW'
91     , SYSDATE
92     , fnd_global.LOGIN_ID
93     , SYSDATE
94     , fnd_global.CONC_LOGIN_ID
95     , p_vendor_id
96     , p_vendor_site_id
97     , 'Y'
98     , p_ship_to_org_id
99     , SYSDATE);
100   COMMIT;
101 
102   x_rcv_header_id := l_rcv_header_id;
103   x_group_id      := l_group_id;
104 
105   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
106   THEN
107     fnd_log.STRING(fnd_log.LEVEL_PROCEDURE
108                      , G_MODULE_PREFIX || l_api_name || '.end'
109                      ,'END procedure. ');
110   END IF;
111 
112 EXCEPTION
113 
114   WHEN OTHERS THEN
115     IF(FND_LOG.LEVEL_UNEXPECTED >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
116     THEN
117       FND_LOG.string( FND_LOG.LEVEL_UNEXPECTED
118                     , G_MODULE_PREFIX || l_api_name || '. OTHER_EXCEPTION '
119                     , 'Unknown error'||SQLCODE||SQLERRM);
120     END IF;
121     RAISE;
122 
123 END process_rcv_header;
124 
125 --========================================================================
126 -- PROCEDURE : process_rcv_trx              PUBLIC
127 -- PARAMETERS: p_rcv_header_id              IN    NUMBER
128 --             p_group_id                   IN    NUMBER
129 --             p_quantity                   IN    NUMBER
130 --             p_unit_of_measure            IN    VARCHAR2
131 --             p_po_header_id               IN    NUMBER
132 --             p_po_line_id                 IN    NUMBER
133 --             p_po_line_location_id        IN    NUMBER
134 --             p_po_distribution_id         IN    NUMBER
135 --             p_subinventory               IN    VARCHAR2
136 --             p_transaction_type           IN    VARCHAR2
137 --             p_auto_transact_code         IN    VARCHAR2
138 --             p_parent_transaction_id      IN    NUMBER
139 --             p_vendor_id                  IN    NUMBER
140 
141 -- COMMENT   : This procedure inserts records in rev_transactions_interface for auto_receive
142 --========================================================================
143 PROCEDURE Process_Rcv_Trx
144 ( p_rcv_header_id            IN NUMBER
145 , p_group_id                 IN NUMBER
146 , p_quantity                 IN NUMBER
147 , p_unit_of_measure          IN VARCHAR2
148 , p_po_header_id             IN NUMBER
149 , p_po_line_id               IN NUMBER
150 , p_subinventory             IN VARCHAR2 DEFAULT NULL
151 , p_transaction_type         IN VARCHAR2
152 , p_auto_transact_code       IN VARCHAR2 DEFAULT NULL
153 , p_parent_transaction_id    IN NUMBER
154 , p_po_line_location_id      IN NUMBER
155 , p_locator_id               IN NUMBER DEFAULT NULL
156 , p_project_id               IN NUMBER DEFAULT NULL
157 , p_from_subinventory        IN VARCHAR2 DEFAULT NULL
158 , p_from_locator_id          IN NUMBER DEFAULT NULL
159 , p_replenish_order_line_id  IN NUMBER DEFAULT NULL
160 , p_vendor_id                IN NUMBER DEFAULT NULL -- Bug 9883090. New parameter for RMA.
161 )
162 IS
163 l_api_name                     VARCHAR2(30) := 'process_rcv_trx';
164 
165 BEGIN
166 
167   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
168   THEN
169     fnd_log.STRING(fnd_log.LEVEL_PROCEDURE
170                      , G_MODULE_PREFIX || l_api_name || '.begin'
171                      ,'procedure begin');
172   END IF;
173 
174   INSERT INTO RCV_TRANSACTIONS_INTERFACE
175   ( interface_transaction_id
176   , header_interface_id
177   , group_id
178   , last_update_date
179   , last_updated_by
180   , creation_date
181   , created_by
182   , transaction_type
183   , transaction_date
184   , processing_status_code
185   , processing_mode_code
186   , transaction_status_code
187   , quantity                        --quantity
188   , unit_of_measure                 --uom
189   , auto_transact_code
190   , receipt_source_code
191   , source_document_code
192   , po_header_id
193   , po_line_id
194   , validation_flag
195   , subinventory
196   , parent_transaction_id
197   , po_line_location_id
198   , locator_id
199   , project_id
200   , from_subinventory
201   , from_locator_id
202   , replenish_order_line_id
203   , vendor_id    -- Bug 9883090
204   )
205   SELECT
206     RCV_TRANSACTIONS_INTERFACE_S.NEXTVAL
207     , p_rcv_header_id
208     , p_group_id
209     , SYSDATE
210     , fnd_global.LOGIN_ID
211     , SYSDATE
212     , fnd_global.LOGIN_ID
213     , p_transaction_type -- 'RECEIVE' --  'SHIP',
214     , SYSDATE
215     , 'PENDING'
216     , 'BATCH'
217     , 'PENDING'
218     , p_quantity
219     , p_unit_of_measure
220     , p_auto_transact_code -- 'RECEIVE',  --'DELIVER'
221     , 'VENDOR'
222     , 'PO'
223     , p_po_header_id
224     , p_po_line_id
225     , 'Y'
226     , p_subinventory
227     , p_parent_transaction_id
228     , p_po_line_location_id
229     , p_locator_id
230     , p_project_id
231     , p_from_subinventory
232     , p_from_locator_id
233     , p_replenish_order_line_id
234     , p_vendor_id  -- Bug 9883090
235   FROM DUAL;
236   COMMIT;
237 
238 
239   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
240   THEN
241     fnd_log.STRING(fnd_log.LEVEL_PROCEDURE
242                      , G_MODULE_PREFIX || l_api_name || '.end'
243                      ,'END procedure. '
244                    );
245   END IF;
246 EXCEPTION
247   WHEN OTHERS THEN
248     IF(FND_LOG.LEVEL_UNEXPECTED >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
249     THEN
250       FND_LOG.string( FND_LOG.LEVEL_UNEXPECTED
251                     , G_MODULE_PREFIX || l_api_name || '. OTHER_EXCEPTION '
252                     , 'Unknown error'||SQLCODE||SQLERRM);
253     END IF;
254     RAISE;
255 
256 END process_rcv_trx;
257 
258 END JMF_SHIKYU_RCV_PVT;