DBA Data[Home] [Help]

PACKAGE BODY: APPS.GME_GANTT_TABLE_HANDLER_PKG

Source


1 PACKAGE BODY gme_gantt_table_handler_pkg AS
2 /* $Header: GMEGNTTB.pls 120.2 2006/04/06 06:48:29 svgonugu noship $  */
3 
4    g_debug               VARCHAR2 (5)
5                                := NVL (fnd_profile.VALUE ('AFLOG_LEVEL'), 99);
6    g_pkg_name   CONSTANT VARCHAR2 (30) := 'GME_GANTT_TABLE_HANDLER_PKG';
7 
8    /***********************************************************/
9    /* Oracle Process Manufacturing Process Execution APIs     */
10    /*                                                         */
11    /* File Name: GMEGNTTB.pls                                 */
12    /* Contents:  Table handler for gme_gantt_document_filter  */
13    /* HISTORY                                                 */
14    /* SivakumarG 05-APR-2006 Bug#4867640                      */
15    /*  Added To Document No in all procedures                 */
16    /***********************************************************/
17    /**
18     * Insert a row into the Document Filter table.
19     */
20    PROCEDURE insert_row (
21       p_user_id             IN              NUMBER
22      ,p_organization_id     IN              NUMBER
23      ,p_from_date           IN              DATE
24      ,p_to_date             IN              DATE
25      ,p_resource            IN              VARCHAR2
26      ,p_prim_resource_ind   IN              NUMBER
27      ,p_document_no         IN              VARCHAR2
28      ,p_to_document_no      IN              VARCHAR2  --Bug#4867640
29      ,p_document_type       IN              NUMBER
30      ,p_product_code        IN              VARCHAR2
31      ,p_ingredient_code     IN              VARCHAR2
32      ,p_batch_status        IN              NUMBER
33      ,x_return_code         OUT NOCOPY      VARCHAR2
34      ,x_error_msg           OUT NOCOPY      VARCHAR2)
35    IS
36    BEGIN
37       x_return_code := 'S';
38 
39       INSERT INTO gme_gantt_document_filter
40                   (user_id, organization_id, from_date, TO_DATE
41                   ,resource_consumed, resource_ind, document_no, to_doc_no --Bug#4867640
42                   ,document_type, product_yielded, ingredient_consumed
43                   ,batch_status)
44            VALUES (p_user_id, p_organization_id, p_from_date, p_to_date
45                   ,p_resource, p_prim_resource_ind, p_document_no, p_to_document_no --Bug#4867640
46                   ,p_document_type, p_product_code, p_ingredient_code
47                   ,p_batch_status);
48 
49       COMMIT;
50    EXCEPTION
51       WHEN OTHERS THEN
52          fnd_message.set_name ('GME', 'GME_UNEXPECTED_ERROR');
53          fnd_message.set_token ('ERROR', SQLERRM);
54          x_return_code := 'F';
55          x_error_msg := fnd_message.get;
56    END insert_row;
57 
58    /**
59     * Update a row into the Document Filter table.
60     */
61    PROCEDURE update_row (
62       p_user_id             IN              NUMBER
63      ,p_organization_id     IN              NUMBER
64      ,p_from_date           IN              DATE
65      ,p_to_date             IN              DATE
66      ,p_resource            IN              VARCHAR2
67      ,p_prim_resource_ind   IN              NUMBER
68      ,p_document_no         IN              VARCHAR2
69      ,p_to_document_no      IN              VARCHAR2 --Bug#4867640
70      ,p_document_type       IN              NUMBER
71      ,p_product_code        IN              VARCHAR2
72      ,p_ingredient_code     IN              VARCHAR2
73      ,p_batch_status        IN              NUMBER
74      ,x_return_code         OUT NOCOPY      VARCHAR2
75      ,x_error_msg           OUT NOCOPY      VARCHAR)
76    IS
77    BEGIN
78       x_return_code := 'S';
79 
80       UPDATE gme_gantt_document_filter
81          SET from_date = p_from_date
82             ,TO_DATE = p_to_date
83             ,resource_consumed = p_resource
84             ,resource_ind = p_prim_resource_ind
85             ,document_no = p_document_no
86 	    ,to_doc_no = p_to_document_no --Bug#4867640
87             ,document_type = p_document_type
88             ,product_yielded = p_product_code
89             ,ingredient_consumed = p_ingredient_code
90             ,batch_status = p_batch_status
91        WHERE user_id = p_user_id AND organization_id = p_organization_id;
92 
93       IF (SQL%NOTFOUND) THEN
94          insert_row (p_user_id
95                     ,p_organization_id
96                     ,p_from_date
97                     ,p_to_date
98                     ,p_resource
99                     ,p_prim_resource_ind
100                     ,p_document_no
101 		    ,p_to_document_no --Bug#4867640
102                     ,p_document_type
103                     ,p_product_code
104                     ,p_ingredient_code
105                     ,p_batch_status
106                     ,x_return_code
107                     ,x_error_msg);
108       END IF;
109 
110       COMMIT WORK;
111    EXCEPTION
112       WHEN OTHERS THEN
113          fnd_message.set_name ('GME', 'GME_UNEXPECTED_ERROR');
114          fnd_message.set_token ('ERROR', SQLERRM);
115          x_return_code := 'F';
116          x_error_msg := fnd_message.get;
117    END update_row;
118 
119    /**
120     * Select a row from the Document Filter table.
121     */
122    PROCEDURE select_row (
123       p_user_id            IN              NUMBER
124      ,p_organization_id    IN              NUMBER
125      ,x_return_code        OUT NOCOPY      VARCHAR2
126      ,x_error_msg          OUT NOCOPY      VARCHAR2
127      ,x_filter_table_rec   OUT NOCOPY      gme_gantt_document_filter%ROWTYPE)
128    IS
129       CURSOR c_doc_filter
130       IS
131          SELECT *
132            FROM gme_gantt_document_filter
133           WHERE user_id = p_user_id AND organization_id = p_organization_id;
134    BEGIN
135       x_return_code := 'S';
136 
137       OPEN c_doc_filter;
138 
139       FETCH c_doc_filter
140        INTO x_filter_table_rec;
141 
142       CLOSE c_doc_filter;
143    EXCEPTION
144       WHEN NO_DATA_FOUND THEN
145          NULL;
146       WHEN OTHERS THEN
147          fnd_message.set_name ('GME', 'GME_UNEXPECTED_ERROR');
148          fnd_message.set_token ('ERROR', SQLERRM);
149          x_return_code := 'F';
150          x_error_msg := fnd_message.get;
151    END select_row;
152 END;