1 PACKAGE BODY PO_CORE_S3 AS
2 /* $Header: POXCOC3B.pls 120.0 2005/06/01 16:31:13 appldev noship $*/
3 /*===========================================================================
4
5 PROCEDURE NAME: get_window_org_sob()
6
7 ===========================================================================*/
8 PROCEDURE get_window_org_sob(x_multi_org_form_flag IN OUT NOCOPY BOOLEAN,
9 x_org_sob_id IN OUT NOCOPY NUMBER,
10 x_org_sob_name IN OUT NOCOPY VARCHAR2) is
11
12 progress varchar2(3) := NULL;
13 org_char varchar2(60) := NULL;
14
15 /* Add this variable to get multi-org information on
16 ** the current product installation.
17 ** (Bug 750973, zxzhang 98/11/11)
18 */
19 l_multi_org VARCHAR2(1);
20
21
22 BEGIN
23 /*
24 **
25 ** Get multi-org information on the current product
26 ** installation.
27 ** (Bug 750973, zxzhang 98/11/11)
28 */
29 SELECT nvl(multi_org_flag, 'N')
30 INTO l_multi_org
31 FROM fnd_product_groups;
32 IF (l_multi_org = 'N') THEN
33 x_multi_org_form_flag := FALSE;
34 ELSE
35 x_multi_org_form_flag := TRUE;
36 END IF;
37
38 /* Note: this will fail on a 10.5 or earlier install
39 ** because the org_id column in po_system_parameters
40 ** does not exist.
41 */
42
43 /* If the form uses the org picker when it opens, then
44 ** check the developer profile option to get that
45 ** MFG org id. Otherwise, the form is not a true
46 ** multiorg form, and we disregard this profile
47 ** option.
48 */
49
50 if (x_multi_org_form_flag = TRUE) then
51
52 x_org_sob_id := PO_MOAC_UTILS_PVT.get_current_org_id ; -- <R12 MOAC>
53
54 progress := '010';
55
56 BEGIN
57 /* Bug 750973: Display all the chars */
58 /* SELECT substr(hou.name,1,20) */
59 /* Bug 943602: Display 30 chars to be consistent with client side code */
60 /*SELECT substr(hou.name,1,64)*/
61 /* Bug 1040332, zxzhang, substr is dependent on character set */
62 /*SELECT substr(hou.name,1,30)*/
63 SELECT substrb(hou.name,1,30)
64 INTO x_org_sob_name
65 FROM hr_organization_units hou
66 WHERE hou.organization_id = x_org_sob_id;
67 EXCEPTION
68 WHEN NO_DATA_FOUND THEN
69 null;
70 END;
71
72 else
73
74 /* If the org_id in purchasing system parameters is not
75 ** null (customer is using the view-based multiorg
76 ** solution introduced in R10.6) , then use this org's truncated
77 ** name for the title. Otherwise use the set of books short name.
78 */
79
80 progress := '020';
81 x_org_sob_id := NULL;
82
83 BEGIN
84
85 SELECT org_id
86 INTO x_org_sob_id
87 FROM po_system_parameters;
88
89 EXCEPTION
90 WHEN NO_DATA_FOUND THEN
91
92 -- Get org_sob_id from financials_system_parameters
93 -- We need to handle this exception because the Define
94 -- Purchasing Options form calls this procedure, and prior
95 -- to setup it will not have a record.
96
97
98 null;
99 END;
100
101 if (x_org_sob_id is not null) then
102
103 progress := '030';
104
105 /* Since there might not be a 3-char code for fin-only
106 ** operating units, we must use the org name. The trunc
107 ** to 20 chars makes this the same length as the sob short
108 ** name (we cannot display a 60 character organization name
109 ** in the window titles).
110 */
111
112 /* Bug 750973: Display all the chars */
113 /* SELECT substr(hou.name,1,20) */
114 /* Bug 943602: Display 30 chars to be consistent with client side code */
115 /*SELECT substr(hou.name,1,64)*/
116 /* Bug 1040332, zxzhang, substr is dependent on character set */
117 /*SELECT substr(hou.name,1,30)*/
118 SELECT substrb(hou.name,1,30)
119 INTO x_org_sob_name
120 FROM hr_organization_units hou
121 WHERE hou.organization_id = x_org_sob_id;
122
123 else
124
125 progress := '040';
126
127 SELECT fsp.set_of_books_id,
128 gsb.short_name
129 INTO x_org_sob_id,
130 x_org_sob_name
131 FROM financials_system_parameters fsp,
132 gl_sets_of_books gsb
133 WHERE fsp.set_of_books_id = gsb.set_of_books_id;
134
135 end if;
136 end if;
137
138 EXCEPTION
139
140 when others then
141 po_message_s.sql_error('get_window_org_sob', progress, sqlcode);
142 raise;
143
144 end get_window_org_sob;
145
146 END PO_CORE_S3;