1 PACKAGE BODY MRP_SCATP_PVT AS
2 /* $Header: MRPVATPB.pls 115.0 99/07/16 12:41:22 porting ship $*/
3 FUNCTION get_default_ship_method (p_from_location_id IN NUMBER, p_to_location_id IN NUMBER)
4 return VARCHAR2
5 IS
6 l_ship_method VARCHAR2(204);
7 BEGIN
8
9 SELECT ship_method
10 INTO l_ship_method
11 FROM mtl_interorg_ship_methods
12 WHERE from_location_id = p_from_location_id
13 AND to_location_id = p_to_location_id
14 AND default_flag = 1
15 AND rownum = 1;
16
17 return l_ship_method;
18 EXCEPTION WHEN NO_DATA_FOUND THEN
19 return null;
20
21 END get_default_ship_method;
22
23 FUNCTION get_default_intransit_time (p_from_location_id IN NUMBER, p_to_location_id IN NUMBER)
24 return NUMBER
25 IS
26 l_intransit_time NUMBER;
27 BEGIN
28
29 SELECT intransit_time
30 INTO l_intransit_time
31 FROM mtl_interorg_ship_methods
32 WHERE from_location_id = p_from_location_id
33 AND to_location_id = p_to_location_id
34 AND default_flag = 1
35 AND rownum = 1;
36
37 return l_intransit_time;
38 EXCEPTION WHEN NO_DATA_FOUND THEN
39 return null;
40 END get_default_intransit_time;
41
42 FUNCTION get_ship_method (p_from_org_id IN NUMBER, p_to_org_id IN NUMBER,
43 p_source_ship_method IN VARCHAR2,
44 p_receipt_org_id IN NUMBER)
45 return VARCHAR2 IS
46
47 l_ship_method VARCHAR2(30);
48
49 BEGIN
50
51
52 IF (p_receipt_org_id is NOT NULL and
53 p_source_ship_method is NOT NULL) THEN
54
55 return p_source_ship_method;
56
57 END IF;
58
59 select ship_method
60 into l_ship_method
61 from mtl_interorg_ship_methods
62 where from_organization_id = p_from_org_id
63 and to_organization_id = p_to_org_id
64 and default_flag = 1
65 and rownum = 1;
66
67 return l_ship_method;
68
69 EXCEPTION WHEN NO_DATA_FOUND THEN
70 return null;
71
72 END get_ship_method;
73
74
75 FUNCTION get_intransit_time (p_from_org_id IN NUMBER, p_to_org_id IN NUMBER,
76 p_source_ship_method IN VARCHAR2,
77 p_receipt_org_id IN NUMBER)
78 return NUMBER IS
79 l_intransit_time NUMBER;
80 BEGIN
81
82
83 IF (p_receipt_org_id is NOT NULL and
84 p_source_ship_method is NOT NULL) THEN
85
86 BEGIN
87 select intransit_time
88 into l_intransit_time
89 from mtl_interorg_ship_methods
90 where from_organization_id = p_from_org_id
91 and to_organization_id = p_to_org_id
92 and ship_method = p_source_ship_method
93 and rownum = 1;
94
95 return l_intransit_time;
96
97 EXCEPTION WHEN NO_DATA_FOUND THEN
98 return null;
99
100 END;
101
102 END IF;
103
104
105 BEGIN
106 select intransit_time
107 into l_intransit_time
108 from mtl_interorg_ship_methods
109 where from_organization_id = p_from_org_id
110 and to_organization_id = p_to_org_id
111 and default_flag = 1
112 and rownum = 1;
113
114 return l_intransit_time;
115
116 EXCEPTION WHEN NO_DATA_FOUND THEN
117 return null;
118
119 END;
120 END;
121 END MRP_SCATP_PVT;