DBA Data[Home] [Help]

PACKAGE BODY: APPS.AHL_LTP_REQST_MATRL_PUB

Source


1 PACKAGE BODY AHL_LTP_REQST_MATRL_PUB AS
2 /* $Header: AHLPRMTB.pls 115.14 2003/12/17 00:36:59 ssurapan noship $ */
3 --
4 G_PKG_NAME  VARCHAR2(30)  := 'AHL_LTP_REQST_MATRL_PUB';
5 G_DEBUG     VARCHAR2(1)   := AHL_DEBUG_PUB.is_log_enabled;
6 --
7 -- PACKAGE
8 --    AHL_LTP_REQST_MATRL_PUB
9 --
10 -- PURPOSE
11 --     This Public API is used to schedule and unschedule materials requests
12 --     using Material Requirement Interface
13 --
14 -- NOTES
15 --
16 --
17 -- HISTORY
18 -- 23-Apr-2002    ssurapan      Created.
19 --
20 -- Start of Comments --
21 --  Procedure name    : Update_Planned_Materials
22 --  Type        : Private
23 --  Function    : This procedure Updates Planned materials information associated to scheduled
24 --                visit, which are defined at Route Operation and Disposition level
25 --  Pre-reqs    :
26 --  Parameters  :
27 --
28 --  Standard IN  Parameters :
29 --      p_api_version                   IN      NUMBER                Required
30 --      p_init_msg_list                 IN      VARCHAR2     Default  FND_API.G_FALSE
31 --      p_commit                        IN      VARCHAR2     Default  FND_API.G_FALSE
32 --      p_validation_level              IN      NUMBER       Default  FND_API.G_VALID_LEVEL_FULL
33 --         Based on this flag, the API will set the default attributes.
34 --      p_module_type                   In      VARCHAR2     Default  NULL
35 --         This will be null.
36 --  Standard out Parameters :
37 --      x_return_status                 OUT     VARCHAR2               Required
38 --      x_msg_count                     OUT     NUMBER                 Required
39 --      x_msg_data                      OUT     VARCHAR2               Required
40 --
41 --  Update_Planned_Materials Parameters :
42 --       p_planned_materials_tbl          IN   Planned_Materials_Tbl,Required
43 --
44 --
45 PROCEDURE Update_Planned_Materials (
46    p_api_version             IN    NUMBER,
47    p_init_msg_list           IN    VARCHAR2  := FND_API.g_false,
48    p_commit                  IN    VARCHAR2  := FND_API.g_false,
49    p_validation_level        IN    NUMBER    := FND_API.g_valid_level_full,
50    p_module_type             IN    VARCHAR2  := 'JSP',
51    p_planned_Materials_tbl   IN    Planned_Materials_Tbl,
52    x_return_status              OUT NOCOPY VARCHAR2,
53    x_msg_count                  OUT NOCOPY NUMBER,
54    x_msg_data                   OUT NOCOPY VARCHAR2)
55 
56   IS
57 
58 
59     --Standard local variables
60     l_api_name	    CONSTANT	VARCHAR2(30)	:= 'Update_Planned_Materials';
61     l_api_version	CONSTANT	NUMBER		    := 1.0;
62     l_msg_data             VARCHAR2(2000);
63     l_return_status        VARCHAR2(1);
64     l_msg_count             NUMBER;
65     --
66     l_commit     VARCHAR2(10)  := FND_API.g_false;
67 	l_planned_materials_tbl   planned_materials_tbl := p_planned_materials_tbl;
68  BEGIN
69 
70    IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level)THEN
71 		fnd_log.string
72 		(
73 			fnd_log.level_procedure,
74 			'ahl.plsql.AHL_LTP_REQST_MATRL_PUB.Update_Planned_Materials',
75 			'At the start of PLSQL procedure'
76 		);
77      END IF;
78      -- Standard start of API savepoint
79      SAVEPOINT Update_Planned_Materials;
80       -- Initialize message list if p_init_msg_list is set to TRUE
81      IF FND_API.To_Boolean( p_init_msg_list) THEN
82         FND_MSG_PUB.Initialize;
83      END IF;
84      -- Initialize API return status to success
85      x_return_status := FND_API.G_RET_STS_SUCCESS;
86      --
87      IF (fnd_log.level_statement >= fnd_log.g_current_runtime_level)THEN
88 		fnd_log.string
89 		(
90 			fnd_log.level_statement,
91             'ahl.plsql.'||g_pkg_name||'.'||l_api_name||':',
92 			'Request for Update Material Number of Records : '|| l_planned_materials_tbl.COUNT
93 		);
94 
95      END IF;
96 
97      IF l_planned_materials_tbl.COUNT > 0 THEN
98        --
99      IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
100 	      fnd_log.string
101 		  (
102 		   fnd_log.level_procedure,
103                 'ahl.plsql.'||g_pkg_name||'.'||l_api_name||':',
104     	        'Before calling ahl ltp reqst matrl pvt.Update Planned Materials'
105    		  );
106 
107      END IF;
108 
109        AHL_LTP_REQST_MATRL_PVT.Update_Planned_Materials (
110                  p_api_version            => l_api_version,
111                  p_init_msg_list          => p_init_msg_list,
112                  p_commit                 => l_commit,
113                  p_validation_level       => p_validation_level,
114                  p_planned_materials_tbl  => p_planned_materials_tbl,
115                  x_return_status          => l_return_status,
116                  x_msg_count              => l_msg_count,
117                  x_msg_data               => l_msg_data);
118      END IF;
119 
120     IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
121 	     fnd_log.string
122 		 (
123 		  fnd_log.level_procedure,
124             'ahl.plsql.'||g_pkg_name||'.'||l_api_name||': End API',
125 	        'After calling ahl ltp reqst matrl pvt.Update Planned Materials, Return Status : '|| l_return_status
126 		);
127     END IF;
128     -- Check Error Message stack.
129      IF (l_return_Status <>  FND_API.G_RET_STS_SUCCESS) THEN
130          l_msg_count := FND_MSG_PUB.count_msg;
131 	      IF l_msg_count > 0 THEN
132 	        RAISE FND_API.G_EXC_ERROR;
133 	      END IF;
134        END IF;
135 
136      -- Standard check of p_commit
137      IF FND_API.TO_BOOLEAN(p_commit) THEN
138         COMMIT WORK;
139      END IF;
140 
141      IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level)THEN
142 		fnd_log.string
143 		(
144 			fnd_log.level_procedure,
145 			'ahl.plsql.AHL_LTP_REQST_MATRL_PUB.Update Planned Materials.end',
146 			'At the end of PLSQL procedure'
147 		);
148      END IF;
149 EXCEPTION
150  WHEN FND_API.G_EXC_ERROR THEN
151    x_return_status := FND_API.G_RET_STS_ERROR;
152    ROLLBACK TO Update_Planned_Materials;
153    FND_MSG_PUB.count_and_get( p_count => x_msg_count,
154                               p_data  => x_msg_data,
155                               p_encoded => fnd_api.g_false);
156 
157 
158  WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
159    x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
160    ROLLBACK TO Update_Planned_Materials;
161    FND_MSG_PUB.count_and_get( p_count => x_msg_count,
162                               p_data  => x_msg_data,
163                               p_encoded => fnd_api.g_false);
164 
165 
166  WHEN OTHERS THEN
167     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
168     ROLLBACK TO Update_Planned_Materials;
169     IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
170        fnd_msg_pub.add_exc_msg(p_pkg_name       => G_PKG_NAME,
171                                p_procedure_name => 'Update_Planned_Materials',
172                                p_error_text     => SUBSTR(SQLERRM,1,500));
173     END IF;
174     FND_MSG_PUB.count_and_get( p_count => x_msg_count,
175                                p_data  => x_msg_data,
176                                p_encoded => fnd_api.g_false);
177 
178   END Update_Planned_Materials;
179 
180 END AHL_LTP_REQST_MATRL_PUB;