DBA Data[Home] [Help]

PACKAGE BODY: APPS.GML_MOBILE_MOVE_ORDER

Source


1 PACKAGE BODY GML_MOBILE_MOVE_ORDER AS
2   /* $Header: GMLMOMBB.pls 120.0 2005/05/25 16:18:40 appldev noship $ */
3 
4 
5 
6 g_gtin_cross_ref_type VARCHAR2(25) := fnd_profile.value('INV:GTIN_CROSS_REFERENCE_TYPE');
7 g_gtin_code_length NUMBER := 14;
8 
9 PROCEDURE Get_Allocation_Parameters(p_alloc_class IN VARCHAR2,
10                                     p_org_id IN NUMBER,
11                                     p_cust_id IN NUMBER,
12                                     p_ship_to_org_id IN NUMBER,
13                                     x_grade OUT NOCOPY VARCHAR2,
14                                     x_return_status OUT NOCOPY VARCHAR2) IS
15 l_msg_count          NUMBER  := 0;
16 l_msg_data           VARCHAR2(2000);
17 l_return_status      VARCHAR2(1);
18 l_op_alot_prm_rec    op_alot_prm%ROWTYPE;
19 
20 BEGIN
21 
22   GMI_ALLOCATION_RULES_PVT.GET_ALLOCATION_PARMS
23                            ( p_alloc_class   => p_alloc_class,
24                              p_org_id        => p_org_id,
25                              p_of_cust_id    => p_cust_id,
26                              p_ship_to_org_id=> p_ship_to_org_id,
27                              x_return_status => x_return_status,
28                              x_op_alot_prm   => l_op_alot_prm_rec,
29                              x_msg_count     => l_msg_count,
30                              x_msg_data      => l_msg_data
31                             );
32 
33   x_grade := ' ';
34 
35   IF (l_return_status = FND_API.G_RET_STS_SUCCESS)
36   THEN
37 
38     x_grade := l_op_alot_prm_rec.PREFQC_GRADE;
39 
40   END IF;
41 
42 END Get_Allocation_Parameters;
43 
44 PROCEDURE Save_Allocation(p_transaction_id   IN NUMBER,
45                           p_lot_id           IN NUMBER,
46                           p_location         IN VARCHAR2,
47                           p_allocated_qty    IN NUMBER,
48                           p_allocated_qty2   IN NUMBER,
49                           p_grade            IN VARCHAR2,
50                           p_lot_no           IN VARCHAR2,
51                           p_lot_status       IN VARCHAR2,
52                           p_transaction_date IN DATE,
53                           p_reason_code      IN VARCHAR2,
54                           p_item_id          IN NUMBER,
55                           p_line_id          IN NUMBER,
56                           p_warehouse_code   IN VARCHAR2,
57                           p_line_detail_id   IN NUMBER,
58                           p_transaction_um   IN VARCHAR2,
59                           p_transaction_um2  IN VARCHAR2,
60                           p_mo_line_id       IN NUMBER,
61                           x_return_status    OUT NOCOPY VARCHAR2,
62                           x_error_msg        OUT NOCOPY VARCHAR2) IS
63 
64   l_msg_count          NUMBER  := 0;
65   l_msg_data           VARCHAR2(2000);
66   l_return_status      VARCHAR2(1);
67   l_ictran_rec         GMI_TRANS_ENGINE_PUB.ictran_rec;
68   l_dummy              NUMBER;
69 
70 
71   BEGIN
72 
73     l_ictran_rec.trans_id 	:= p_transaction_id;
74     l_ictran_rec.lot_id 	:= p_lot_id;
75     l_ictran_rec.location 	:= p_location;
76     l_ictran_rec.trans_qty 	:= p_allocated_qty;
77     l_ictran_rec.trans_qty2 	:= p_allocated_qty2;
78     l_ictran_rec.qc_grade 	:= p_grade;
79     l_ictran_rec.lot_no 	:= p_lot_no;
80     l_ictran_rec.lot_status 	:= p_lot_status;
81     l_ictran_rec.trans_date 	:= p_transaction_date;
82     l_ictran_rec.reason_code    := p_reason_code;
83     l_ictran_rec.item_id	:= p_item_id;
84     l_ictran_rec.line_id 	:= p_line_id;
85     l_ictran_rec.co_code 	:= NULL;
86     l_ictran_rec.orgn_code	:= NULL;
87     l_ictran_rec.whse_code 	:= p_warehouse_code;
88     l_ictran_rec.doc_id 	:= NULL;
89     l_ictran_rec.doc_type 	:= 'OMSO';
90     l_ictran_rec.doc_line 	:= NULL;
91     l_ictran_rec.line_detail_id := p_line_detail_id;
92     l_ictran_rec.line_type	:= 0;
93     l_ictran_rec.trans_stat 	:= NULL;
94     l_ictran_rec.trans_um 	:= p_transaction_um;
95     l_ictran_rec.trans_um2 	:= p_transaction_um2;
96     l_ictran_rec.staged_ind 	:= 0;
97     l_ictran_rec.event_id 	:= 0;
98     l_ictran_rec.text_code 	:= 0;
99     l_ictran_rec.user_id 	:= NULL;
100     l_ictran_rec.create_lot_index := NULL;
101 
102     GMI_RESERVATION_UTIL.Set_Pick_Lots (
103 	     	p_ic_tran_rec    => l_ictran_rec
104       	      , p_mo_line_id     => p_mo_line_id
105               , p_commit	 => FND_API.G_FALSE
106    	      , x_return_status  => x_return_status
107    	      , x_msg_count      => l_msg_count
108    	      , x_msg_data 	 => l_msg_data );
109 
110    IF (x_return_status <> FND_API.G_RET_STS_SUCCESS)
111    THEN
112      FND_MSG_PUB.GET( p_msg_index     => 1,
113                       p_data          => x_error_msg,
114                       p_encoded       => 'F',
115                       p_msg_index_out => l_dummy);
116    END IF;
117 
118 
119 END Save_Allocation;
120 
121 
122 PROCEDURE Auto_Allocate(p_allow_delete  IN NUMBER,
123                           p_mo_line_id    IN NUMBER,
124                           p_transaction_header_id IN NUMBER,
125                           p_move_order_type    IN NUMBER,
126                           x_number_of_rows     OUT NOCOPY NUMBER,
127                           x_qc_grade           OUT NOCOPY VARCHAR2,
128                           x_detailed_qty       OUT NOCOPY NUMBER,
129                           x_qty_UM             OUT NOCOPY VARCHAR2,
130                           x_detailed_qty2      OUT NOCOPY NUMBER,
131                           x_qty_UM2            OUT NOCOPY VARCHAR2,
132                           x_return_status      OUT NOCOPY VARCHAR2,
133                           x_error_msg          OUT NOCOPY VARCHAR2) IS
134 
135     l_return_status        VARCHAR2(10);
136     l_count                NUMBER;
137     l_dummy                NUMBER;
138     l_msg                  VARCHAR2(2000);
139     l_p_allow_delete	   VARCHAR2(3);
140 
141  BEGIN
142 
143   DBMS_TRANSACTION.SAVEPOINT('AUTO_DETAIL_SAVE');
144 
145   IF (p_allow_delete = 1) THEN
146     l_p_allow_delete := 'YES';
147   ELSE
148     l_p_allow_delete := 'NO';
149   END IF;
150 
151 
152   GMI_Move_Order_Line_Util.Line_Auto_Detail
153     (
154 	    p_mo_line_id              => p_mo_line_id
155           , p_init_msg_list           => 1
156        	  , p_transaction_header_id   => NULL
157     	  , p_transaction_mode        => NULL
158           , p_move_order_type         => p_move_order_type
159 	  , p_allow_delete	      => l_p_allow_delete
160           , x_number_of_rows          => x_number_of_rows
161           , x_qc_grade                => x_qc_grade
162           , x_detailed_qty            => x_detailed_qty
163           , x_qty_UM                  => x_qty_UM
164           , x_detailed_qty2           => x_detailed_qty2
165           , x_qty_UM2                 => x_qty_UM
166           , x_return_status           => x_return_status
167           , x_msg_count               => l_count
168           , x_msg_data                => l_msg
169     );
170 
171 
172   IF (x_return_status <> 'S')
173   THEN
174      FND_MSG_PUB.GET( p_msg_index     => 1,
175                       p_data          => x_error_msg,
176                       p_encoded       => 'F',
177                       p_msg_index_out => l_dummy);
178      DBMS_TRANSACTION.ROLLBACK_SAVEPOINT('AUTO_DETAIL_SAVE');
179      x_return_status := 'E';
180   END IF;
181 
182 EXCEPTION
183       WHEN others THEN
184         x_return_status := 'E';
185         DBMS_TRANSACTION.ROLLBACK_SAVEPOINT('AUTO_DETAIL_SAVE');
186         FND_Message.Set_Name('INV','UNEXP_ERROR_AUTO_DETAIL');
187         x_error_msg := FND_MESSAGE.GET;
188 
189 END Auto_Allocate;
190 
191 
192 
193 
194 PROCEDURE Get_Sales_Order_LoV( x_so_mo_lov OUT NOCOPY t_genref,
195                          p_org_id IN NUMBER,
196                          p_so_no  IN VARCHAR2) IS
197 BEGIN
198 
199   OPEN x_so_mo_lov FOR
200     SELECT
201     oeh.order_number,
202     oeh.header_id,
203     moh.request_number mo_number
204   FROM
205     ic_txn_request_headers moh,
206     ic_txn_request_lines mol,
207     oe_order_lines_all oel,
208     oe_order_headers_all oeh
209    WHERE oeh.header_id = oel.header_id
210      AND oeh.order_number LIKE (p_so_no)
211      AND   oel.line_id = mol.txn_source_line_id
212      AND   moh.header_id = mol.header_id
213      AND   mol.organization_id = p_org_id
214      AND   mol.line_status in (3,7)
215      GROUP BY oeh.order_number, oeh.header_id, moh.request_number
216    ORDER BY oeh.order_number;
217 
218 --  OPEN x_so_mo_lov FOR
219 --    SELECT
220 --    /*+ ORDERED
221 --    INDEX(moh ic_txn_request_headers_pk)
222 --    INDEX(oel oe_order_lines_u1)
223 --    INDEX(oeh oe_order_headers_u1)
224 --    */
225 --    oeh.order_number,
226 --    oeh.header_id,
227 --    moh.request_number mo_number
228 --   FROM
229 --    (SELECT /*+ INDEX(itr ic_txn_request_lines_n1) */
230 --             DISTINCT header_id, txn_source_line_id
231 --     FROM  ic_txn_request_lines itr
232 --     WHERE organization_id = p_org_id
233 --     AND   line_status in (3,7)
234 --     ) mol,
235 --    ic_txn_request_headers moh,
236 --    oe_order_lines_all oel,
237 --    oe_order_headers_all oeh
238 --   WHERE oeh.header_id = oel.header_id
239 --     AND oeh.order_number LIKE (p_so_no)
240 --     AND   oel.line_id = mol.txn_source_line_id
241 --     AND   oel.flow_status_code NOT IN ('CLOSED','CANCELLED')
242 --     AND   moh.header_id = mol.header_id
243 --     GROUP BY oeh.order_number, oeh.header_id, moh.request_number
244 --   ORDER BY oeh.order_number;
245 
246 END Get_Sales_Order_LoV;
247 
248 PROCEDURE Get_Item_LoV( x_mo_item_lov OUT NOCOPY t_genref,
249                         p_org_id IN NUMBER,
250                         p_item_no IN VARCHAR2) IS
251 
252  l_cross_ref VARCHAR2(204);
253 
254 BEGIN
255 
256 
257  l_cross_ref := lpad(Rtrim(p_item_no, '%'), g_gtin_code_length, '00000000000000');
258 
259 
260   OPEN x_mo_item_lov FOR
261 
262        SELECT DISTINCT opi.item_no, opi.item_desc1, opi.item_id, mti.inventory_item_id
263        FROM    mtl_system_items mti,
264                ic_item_mst opi,
265                ic_txn_request_lines l
266        WHERE opi.item_no = mti.segment1
267              and opi.item_no LIKE (p_item_no)
268              and mti.organization_id = p_org_id
269              and mti.inventory_item_flag = 'Y'
270              and mti.inventory_item_id = l.inventory_item_id
271 
272        UNION
273 
274        SELECT DISTINCT opi.item_no, opi.item_desc1, opi.item_id, mti.inventory_item_id
275        FROM    mtl_system_items mti,
276                ic_item_mst opi,
277                mtl_cross_references mcr
278        WHERE
279              mti.organization_id = p_org_id
280              AND opi.item_no = mti.segment1
281              AND mti.inventory_item_id = mcr.inventory_item_id
282              AND    mcr.cross_reference_type = g_gtin_cross_ref_type
283              AND    mcr.cross_reference      LIKE l_cross_ref
284              AND    (mcr.organization_id = mti.organization_id
285              OR
286              mcr.org_independent_flag = 'Y');
287 
288 END Get_Item_LoV;
289 
290 PROCEDURE Get_Location_Lov( x_location_lov OUT NOCOPY t_genref,
291                             p_location IN VARCHAR2,
292                             p_item_id IN NUMBER,
293                             p_whse_code IN VARCHAR2,
294                             p_lot_id IN NUMBER,
295                             p_neg_inv_allowed IN INTEGER) IS
296   CURSOR Get_Loct_Ctl IS
297     SELECT
298       loct_ctl
299     FROM
300       ic_item_mst
301     WHERE
302       item_id = p_item_id;
303 
304   l_loct_ctl NUMBER(1);
305   l_lot_id   NUMBER(20);
306 
307 BEGIN
308 
309   OPEN Get_Loct_Ctl;
310   FETCH Get_Loct_Ctl INTO l_loct_ctl;
311   CLOSE Get_Loct_Ctl;
312 
313   IF p_lot_id <= 0 THEN
314    l_lot_id := NULL;
315   ELSE
316    l_lot_id := p_lot_id;
317   END IF;
318 
319   IF p_neg_inv_allowed  = 0 THEN
320 
321     IF l_loct_ctl <> 2 THEN
322 
323       OPEN x_location_lov FOR
324        select distinct inv.location, NVL(loc.loct_desc, inv.location)
325        from ic_loct_inv inv, ic_loct_mst loc
326        where inv.whse_code = p_whse_code and inv.delete_mark = 0 and
327            inv.location like (p_location)
328            and inv.lot_id = nvl(l_lot_id,inv.lot_id)
329            and inv.loct_onhand > 0
330            and inv.item_id = p_item_id
331            and loc.location = inv.location;
332     ELSE
333 
334       OPEN x_location_lov FOR
335        select distinct inv.location, NVL(loc.loct_desc, inv.location)
336        from ic_loct_inv inv, ic_loct_mst loc
337        where inv.whse_code = p_whse_code and inv.delete_mark = 0 and
338            inv.location like (p_location)
339            and inv.lot_id = nvl(l_lot_id,inv.lot_id)
340            and inv.loct_onhand > 0
341            and inv.item_id = p_item_id
342            and loc.location(+) = inv.location;
343     END IF;
344 
345    ELSE
346 
347     IF l_loct_ctl <> 2 THEN
348 
349       OPEN x_location_lov FOR
350        select distinct inv.location, NVL(loc.loct_desc, inv.location)
351        from ic_loct_inv inv, ic_loct_mst loc
352         where inv.whse_code = p_whse_code and inv.delete_mark = 0 and
353            inv.location like (p_location)
354            and inv.lot_id = nvl(l_lot_id,inv.lot_id)
355            and inv.item_id = p_item_id
356            and loc.location = inv.location;
357     ELSE
358 
359       OPEN x_location_lov FOR
360        select distinct inv.location, NVL(loc.loct_desc, inv.location)
361        from ic_loct_inv inv, ic_loct_mst loc
362         where inv.whse_code = p_whse_code and inv.delete_mark = 0 and
363            inv.location like (p_location)
364            and inv.lot_id = nvl(l_lot_id,inv.lot_id)
365            and inv.item_id = p_item_id
366            and loc.location(+) = inv.location;
367     END IF;
368 
369    END IF;
370 
371 END Get_Location_Lov;
372 
373 PROCEDURE Get_Lot_LoV( x_lot_lov         OUT NOCOPY t_genref,
374                        p_lot_no          IN VARCHAR2,
375                        p_item_id         IN NUMBER,
376                        p_whse_code       IN VARCHAR2,
377                        p_location        IN VARCHAR2,
378                        p_pref_grade      IN VARCHAR2,
379                        p_neg_inv_allowed IN INTEGER) IS
380   l_location   VARCHAR2(4);
381   l_pref_grade VARCHAR2(4);
382 
383 BEGIN
384 
385   IF p_location IS NULL OR p_location = ' ' THEN
386     l_location := NULL;
387   ELSE
388     l_location := p_location;
389   END IF;
390 
391   IF p_pref_grade IS NULL OR p_pref_grade = ' ' THEN
392     l_pref_grade := NULL;
393   ELSE
394     l_pref_grade := p_pref_grade;
395   END IF;
396 
397   IF p_neg_inv_allowed  = 0 THEN
398 
399     IF l_pref_grade IS NULL THEN
400 
401 
402       OPEN x_lot_lov FOR
403          select distinct lot_no,sublot_no, a.lot_id,a.qc_grade, b.lot_status
404          from ic_lots_mst a, ic_loct_inv b
405          where a.lot_no like (p_lot_no) and a.lot_id <> 0 and a.lot_id =b.lot_id  and a.item_id = b.item_id and
406              a.delete_mark = 0 and b.delete_mark = 0 and a.item_id = p_item_id and
407              b.whse_code = p_whse_code and b.location = nvl(l_location,b.location)
408               and b.loct_onhand > 0 and a.expire_date >= sysdate
409          order by lot_no;
410 
411     ELSE
412 
413       OPEN x_lot_lov FOR
414          select distinct lot_no,sublot_no, a.lot_id,a.qc_grade, b.lot_status
415          from ic_lots_mst a, ic_loct_inv b
416          where  a.lot_no like (p_lot_no) and a.lot_id <> 0 and a.lot_id =b.lot_id and a.item_id = b.item_id and
417              a.delete_mark = 0 and b.delete_mark = 0 and a.item_id = p_item_id and
418              b.whse_code = p_whse_code and b.location = nvl(l_location,b.location)
419              and a.qc_grade = l_pref_grade
420               and b.loct_onhand > 0 and a.expire_date >= sysdate
421          order by lot_no;
422 
423     END IF;
424 
425   ELSE
426 
427     IF l_pref_grade IS NULL THEN
428 
429       OPEN x_lot_lov FOR
430          select distinct lot_no,sublot_no, a.lot_id,a.qc_grade,b.lot_status
431          from ic_lots_mst a, ic_loct_inv b
432          where a.lot_no like (p_lot_no) and a.lot_id <> 0 and a.lot_id =b.lot_id
433  and a.item_id = b.item_id and
434              a.delete_mark = 0 and b.delete_mark = 0 and a.item_id = p_item_id and
435              b.whse_code = p_whse_code and b.location = nvl(l_location,b.location)
436               and a.expire_date >= sysdate
437          order by lot_no;
438 
439     ELSE
440 
441 
442       OPEN x_lot_lov FOR
443          select distinct lot_no,sublot_no, a.lot_id,a.qc_grade,b.lot_status
444          from ic_lots_mst a, ic_loct_inv b
445          where a.lot_no like (p_lot_no) and a.lot_id <> 0 and a.lot_id =b.lot_id
446  and a.item_id = b.item_id and
447              a.delete_mark = 0 and b.delete_mark = 0 and a.item_id = p_item_id and
448              b.whse_code = p_whse_code and b.location = nvl(l_location,b.location)
449              and a.qc_grade = l_pref_grade
450               and a.expire_date >= sysdate
451          order by lot_no;
452 
453     END IF;
454 
455   END IF;
456 
457 END Get_Lot_LoV;
458 
459 PROCEDURE Get_Sub_Lot_LoV( x_sub_lot_lov     OUT NOCOPY t_genref,
460                                        p_item_id         IN NUMBER,
461                                        p_whse_code       IN VARCHAR2,
462                                        p_location        IN VARCHAR2,
463                                        p_lot_no          IN VARCHAR2,
464                                        p_sublot_no       IN VARCHAR2,
465                                        p_neg_inv_allowed IN INTEGER) IS
466   l_location VARCHAR2(4);
467 
468 BEGIN
469 
470 
471   IF p_location IS NULL OR p_location = ' ' THEN
472     l_location := NULL;
473   ELSE
474     l_location := p_location;
475   END IF;
476 
477   IF p_neg_inv_allowed  = 0 THEN
478 
479     OPEN x_sub_lot_lov FOR
480       select distinct sublot_no, a.qc_grade, b.lot_status, a.lot_id
481       from ic_lots_mst a, ic_loct_inv b
482       where a.lot_id <> 0 and a.lot_id = b.lot_id and a.item_id = b.item_id and
483 a.delete_mark = 0 and
484 
485             b.delete_mark = 0 and b.whse_code = p_whse_code and a.lot_no = p_lot_no and b.loct_onhand > 0
486             and b.location = nvl(l_location, b.location) and a.expire_date >= sysdate and
487             a.sublot_no LIKE (p_sublot_no) and a.item_id = p_item_id order by sublot_no;
488 
489    ELSE
490 
491     OPEN x_sub_lot_lov FOR
492       select distinct sublot_no, a.qc_grade, b.lot_status, a.lot_id
493       from ic_lots_mst a, ic_loct_inv b
494       where a.lot_id <> 0 and a.lot_id = b.lot_id and a.item_id = b.item_id and
495 a.delete_mark = 0 and
496 
497             b.delete_mark = 0 and b.whse_code = p_whse_code and a.lot_no = p_lot_no
498             and b.location = nvl(l_location, b.location) and a.expire_date >= sysdate and
499             a.sublot_no LIKE (p_sublot_no) and a.item_id = p_item_id order by sublot_no;
500 
501    END IF;
502 
503 END Get_Sub_Lot_LoV;
504 
505 
506   PROCEDURE Get_Move_Order_LoV(x_pwmo_lov OUT NOCOPY t_genref,
507                                p_organization_id IN NUMBER,
508                                p_mo_req_number IN VARCHAR2) IS
509   BEGIN
510     OPEN x_pwmo_lov FOR
511      SELECT   MAX(h.request_number)
512              , MAX(h.description)
513              , h.header_id
514              , MAX(h.move_order_type)
515              , DECODE(COUNT(l.line_number), 1, MAX(l.line_number), NULL)
516              , DECODE(COUNT(l.line_id), 1, MAX(l.line_id), NULL)
517           FROM ic_txn_request_headers h, ic_txn_request_lines l
518          WHERE h.organization_id = p_organization_id
519            AND h.request_number LIKE(p_mo_req_number)
520            AND h.header_status IN(3, 7)
521            AND l.organization_id = h.organization_id
522            AND l.line_status IN(3, 7)
523            AND l.header_id = h.header_id
524          GROUP BY h.header_id;
525 
526   END Get_Move_Order_LoV;
527 
528 
529 
530   PROCEDURE Get_Delivery_LoV(x_delivery OUT NOCOPY t_genref,
531                              p_organization_id IN NUMBER,
532                              p_deliv_num IN VARCHAR2) IS
533   BEGIN
534     OPEN x_delivery FOR
535       SELECT wnd.NAME, wnd.delivery_id
536         FROM wsh_new_deliveries wnd, wsh_delivery_details wdd, wsh_delivery_assignments wda,
537           ic_txn_request_lines ml
538 
539        WHERE wda.delivery_id = wnd.delivery_id
540          AND wda.delivery_detail_id = wdd.delivery_detail_id
541          AND wdd.move_order_line_id = ml.line_id
542          AND wdd.organization_id = p_organization_id
543          AND ml.quantity > NVL(ml.quantity_delivered, 0)
544          AND wnd.NAME LIKE(p_deliv_num || '%');
545   END;
546 
547 
548   PROCEDURE Get_Pickslip_LoV(x_pickslip        OUT NOCOPY t_genref,
549                              p_organization_id IN  NUMBER,
550                              p_pickslip_num    IN  VARCHAR2) IS
551   BEGIN
552 
553     OPEN x_pickslip FOR
554       SELECT UNIQUE t.pick_slip_number
555       FROM ic_tran_pnd t,
556            ic_whse_mst i
557      WHERE
558       t.whse_code = i.whse_code AND
559       i.mtl_organization_id = p_organization_id AND
560       t.pick_slip_number LIKE(p_pickslip_num)
561       AND t.delete_mark   = 0
562       AND t.completed_ind = 0
563       AND t.doc_type      = 'OMSO';
564 
565 
566   END;
567 
568 
569 PROCEDURE Get_Reason_Code_Lov(x_reasonCodeLOV OUT NOCOPY t_genref,
570                               p_reason_code   IN VARCHAR2) IS
571 BEGIN
572    OPEN x_reasonCodeLOV for
573      select
574        reason_code,reason_desc1 from sy_reas_cds
575      where
576        reason_code like (p_reason_code) and
577        delete_mark = 0
578      order by 1;
579 
580 END  Get_Reason_Code_Lov;
581 
582 PROCEDURE get_stacked_messages(x_message OUT NOCOPY VARCHAR2)
583   IS
584      l_message VARCHAR2(2000);
585      l_msg_count NUMBER;
586 BEGIN
587    fnd_msg_pub.Count_And_Get
588      (p_encoded => FND_API.g_false,
589       p_count => l_msg_count,
590       p_data => l_message
591       );
592 
593    IF l_msg_count > 1 THEN
594       FOR i IN 1..l_msg_count LOOP
595          l_message := substr((l_message || '|' || FND_MSG_PUB.GET(p_msg_index => l_msg_count - i + 1,
596                                                           p_encoded     => FND_API.g_false)),1,2000);
597       END LOOP;
598    END IF;
599 
600    fnd_msg_pub.delete_msg;
601 
602    x_message := l_message;
603 
604 EXCEPTION
605    WHEN OTHERS THEN
606       NULL;
607 
608 END get_stacked_messages;
609 
610 END GML_MOBILE_MOVE_ORDER;