DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_AP_RETROACTIVE_UPDATE_GRP

Source


1 PACKAGE BODY PO_AP_RETROACTIVE_UPDATE_GRP AS
2 /* $Header: POXAPRAB.pls 120.1 2005/07/12 03:05:57 vsanjay noship $ */
3 
4 G_PKG_NAME CONSTANT varchar2(30) := 'PO_AP_RETROACTIVE_UPDATE_GRP';
5 
6 c_log_head    CONSTANT VARCHAR2(50) := 'po.plsql.'|| G_PKG_NAME || '.';
7 
8 -- Read the profile option that enables/disables the debug log
9 g_fnd_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
10 
11 --------------------------------------------------------------------------------
12 --Start of Comments
13 --Name: Update_Invoice_Flag
14 --Pre-reqs:
15 --  None.
16 --Modifies:
17 --  Update po_distributions_all.invoice_adjument_flag.
18 --Locks:
19 --  None.
20 --Function:
21 --  This procedure updates invoice adjument flag which is used
22 --  by AP to create invoice adjument
23 --Parameters:
24 --IN:
25 --p_api_version
26 --  Version number of API that caller expects. It
27 --  should match the l_api_version defined in the
28 --  procedure (expected value : 1.0)
29 --p_dist_ids
30 --  The ids of the distributions
31 --p_flags
32 --  The invoice adjustment flags
33 --OUT:
34 --x_return_status
35 --  FND_API.G_RET_STS_SUCCESS if API succeeds
36 --  FND_API.G_RET_STS_ERROR if API fails
37 --  FND_API.G_RET_STS_UNEXP_ERROR if unexpected error occurs
38 --x_msg_data
39 --  Contains error msg in case x_return_status returned
40 --  FND_API.G_RET_STS_ERROR or FND_API.G_RET_STS_UNEXP_ERROR
41 --Testing:
42 --
43 --End of Comments
44 -------------------------------------------------------------------------------
45 PROCEDURE Update_Invoice_Flag(p_api_version     IN         NUMBER,
46 			      p_dist_ids        IN         DBMS_SQL.NUMBER_TABLE,
47 			      p_flags           IN         DBMS_SQL.VARCHAR2_TABLE,
48 			      x_return_status   OUT NOCOPY VARCHAR2,
49                               x_msg_count       OUT NOCOPY NUMBER,
50 			      x_msg_data        OUT NOCOPY VARCHAR2)
51 IS
52 
53   l_api_name	CONSTANT varchar2(30) := 'Update_Invoice_Flag';
54   l_api_version	CONSTANT NUMBER       := 1.0;
55   l_progress	VARCHAR2(3);
56   l_document_id	NUMBER;
57 
58 BEGIN
59 
60   l_progress := '000';
61   -- Standard call to check for call compatibility
62   IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name, G_PKG_NAME)
63   THEN
64     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
65   END IF;
66 
67   l_progress := '010';
68   IF g_fnd_debug = 'Y' THEN
69    IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
70      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || '.'||l_api_name||'.'
71             || l_progress,'Updating invoice adjustment flag');
72    END IF;
73  END IF;
74 
75   l_progress := '040';
76   FORALL i in 1..p_dist_ids.COUNT
77      UPDATE po_distributions_all
78      SET    invoice_adjustment_flag = p_flags(i)
79      WHERE  po_distribution_id = p_dist_ids(i);
80 
81   l_progress := '100';
82 EXCEPTION
83   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
84     x_msg_data := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST,
85                                   p_encoded => 'F');
86     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
87     x_msg_count  := 0;
88   WHEN FND_API.G_EXC_ERROR THEN
89     x_msg_data := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST,
90                                   p_encoded => 'F');
91     x_return_status := FND_API.G_RET_STS_ERROR;
92     x_msg_count  := 0;
93   WHEN OTHERS THEN
94     IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
95       FND_MSG_PUB.add_exc_msg(G_PKG_NAME, l_api_name);
96     END IF;
97 
98     IF (g_fnd_debug = 'Y') THEN
99      IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_UNEXPECTED) THEN
100       FND_LOG.string(FND_LOG.level_unexpected, c_log_head ||
101                      l_api_name || '.others_exception', 'EXCEPTION: Location is '
102                      || l_progress || ' SQL CODE is '||sqlcode);
103      END IF;
104     END IF;
105 
106     x_msg_data := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST,
107                                   p_encoded => 'F');
108     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
109     x_msg_count  := 0;
110 
111 END Update_Invoice_Flag;
112 
113 
114 END PO_AP_RETROACTIVE_UPDATE_GRP; -- Package spec