1 PACKAGE BODY PO_FV_INTEGRATION_PVT AS
2 /* $Header: POXVFVIB.pls 120.2 2005/06/29 18:49:26 shsiung noship $ */
3
4 g_pkg_name CONSTANT VARCHAR2(30) := 'PO_FV_INTEGRATION_PVT';
5 g_log_head CONSTANT VARCHAR2(50) := 'po.plsql.'|| g_pkg_name || '.';
6
7 g_debug_stmt CONSTANT BOOLEAN := PO_DEBUG.is_debug_stmt_on;
8 g_debug_unexp CONSTANT BOOLEAN := PO_DEBUG.is_debug_unexp_on;
9
10 --<JFMIP Vendor Registration FPJ Start>
11 -------------------------------------------------------------------------------
12 --Start of Comments
13 --Name: val_vendor_site_ccr_regis
14 --Pre-reqs:
15 -- None
16 --Modifies:
17 -- None
18 --Locks:
19 -- None.
20 --Function:
21 -- This function checks if a vendor site has a valid Central Contractor
22 -- Registration (CCR). It returns TRUE if the registration is valid, or if
23 -- the instanse is not a federal instance; otherwise, it returns FALSE
24 --Parameters:
25 --IN:
26 --p_vendor_id
27 -- Vendor ID
28 --p_vendor_site_id
29 -- Vendor site ID
30 --Notes:
31 -- None
32 --Testing:
33 -- None
34 --End of Comments
35 -------------------------------------------------------------------------------
36 FUNCTION val_vendor_site_ccr_regis(
37 p_vendor_id IN NUMBER,
38 p_vendor_site_id IN NUMBER
39 )
40 RETURN BOOLEAN
41 IS
42
43 l_api_name CONSTANT VARCHAR2(30) := 'VAL_VENDOR_SITE_CCR_REGIS';
44 l_progress VARCHAR2(3);
45
46 l_return_status VARCHAR2(1);
47 l_msg_count NUMBER;
48 l_msg_data VARCHAR2(2000);
49 l_ccr_status VARCHAR2(1);
50 l_error_code NUMBER;
51
52 -- If the profile option 'Enable Transaction Code' is set to Yes, then it
53 -- is a federal instance
54 l_federal_instance VARCHAR2(1) := NVL(PO_CORE_S.Check_Federal_Instance(PO_MOAC_UTILS_PVT.Get_Current_Org_Id),'N');
55
56 BEGIN
57 l_progress := '000';
58 IF g_debug_stmt THEN
59 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
60 FND_LOG.string(FND_LOG.LEVEL_STATEMENT,g_log_head || '.'||l_api_name||'.'
61 || l_progress, ' Begin');
62 END IF;
63 END IF;
64
65 IF l_federal_instance = 'N' THEN
66 l_progress := '005';
67 IF g_debug_stmt THEN
68 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
69 FND_LOG.string(FND_LOG.LEVEL_STATEMENT,g_log_head || '.'||l_api_name
70 ||'.'|| l_progress,
71 ' Not a federal instance. No need to check. Return True.');
72 END IF;
73 END IF;
74
75 RETURN TRUE;
76 END IF;
77
78 l_progress := '010';
79
80 -- Call Federal Financials' API to check the Central Contractor Registration
81 -- status of the vendor site
82 FV_CCR_GRP.fv_ccr_reg_status(
83 p_api_version => 1.0,
84 p_init_msg_list => 'F',
85 p_vendor_site_id => p_vendor_site_id,
86 x_return_status => l_return_status,
87 x_msg_count => l_msg_count,
88 x_msg_data => l_msg_data,
89 x_ccr_status => l_ccr_status,
90 x_error_code => l_error_code);
91
92 l_progress := '020';
93 IF g_debug_stmt THEN
94 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
95 FND_LOG.string(FND_LOG.LEVEL_STATEMENT,g_log_head || '.'||l_api_name||'.'
96 || l_progress, ' After calling FV_CCR_GRP.fv_ccr_reg_status');
97 END IF;
98 END IF;
99
100 -- Return FALSE if
101 -- (1) return status is error and vendor site is not exempt from CCR;
102 IF (l_return_status = FND_API.G_RET_STS_ERROR AND l_error_code <> G_SITE_NOT_CCR_SITE)
103 OR
104 -- (2) return status is success but registration status is not ACTIVE;
105 (l_return_status = FND_API.G_RET_STS_SUCCESS AND l_ccr_status <> G_SITE_REG_ACTIVE)
106 OR
107 -- (3) return status is unexpected error
108 (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
109
110 l_progress := '030';
111 IF g_debug_stmt THEN
112 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
113 FND_LOG.string(FND_LOG.LEVEL_STATEMENT,g_log_head || '.'||
114 l_api_name||'.' || l_progress,
115 ' Vendor site registration is not valid. CCR status: '|| l_ccr_status
116 ||' Error code: '|| l_error_code ||' Return status: '|| l_return_status);
117 END IF;
118 END IF;
119
120 RETURN FALSE;
121
122 ELSE -- l_return_status check
123 l_progress := '040';
124 IF g_debug_stmt THEN
125 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
126 FND_LOG.string(FND_LOG.LEVEL_STATEMENT,g_log_head || '.'||
127 l_api_name||'.' || l_progress,
128 ' Vendor site registration is valid');
129 END IF;
130 END IF;
131
132 RETURN TRUE;
133 END IF;
134
135 EXCEPTION
136 WHEN OTHERS THEN
137 IF g_debug_stmt THEN
138 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
139 FND_LOG.string(FND_LOG.LEVEL_STATEMENT,g_log_head || '.'||
140 l_api_name||'.' || l_progress, ' Exception has occured.' ||
141 ' l_msg_data: ' || l_msg_data || ' l_msg_count: ' || l_msg_count );
142 END IF;
143 END IF;
144 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
145 FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name,
146 SUBSTRB (SQLERRM , 1 , 200) || ' at location ' || l_progress);
147 END IF;
148
149 RETURN FALSE;
150 END val_vendor_site_ccr_regis;
151 --<JFMIP Vendor Registration FPJ End>
152
153 END PO_FV_INTEGRATION_PVT;