DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGIPMSMD

Source


1 Package Body IGIPMSMD AS
2 -- $Header: igipmmdb.pls 115.7 2003/12/01 14:58:03 sdixit ship $
3 -- ---------
4 -- CONSTANTS
5 -- ---------
6 
7 AP_APPLICATION_ID   CONSTANT NUMBER(15)  := 200;
8 G_USER_ID           CONSTANT NUMBER(15)  := fnd_global.user_id;
9 G_DATE              CONSTANT DATE        := sysdate;
10 G_LOGIN_ID          CONSTANT NUMBER(15)  := fnd_global.login_id;
11 --bug 3199481: following variables added for fnd logging changes: sdixit
12    l_debug_level number	:=	FND_LOG.G_CURRENT_RUNTIME_LEVEL;
13    l_state_level number	:=	FND_LOG.LEVEL_STATEMENT;
14    l_proc_level number	:=	FND_LOG.LEVEL_PROCEDURE;
15    l_event_level number	:=	FND_LOG.LEVEL_EVENT;
16    l_excep_level number	:=	FND_LOG.LEVEL_EXCEPTION;
17    l_error_level number	:=	FND_LOG.LEVEL_ERROR;
18    l_unexp_level number	:=	FND_LOG.LEVEL_UNEXPECTED;
19 
20 -- ----------
21 -- CURSORS
22 -- ----------
23 
24    CURSOR  c_dist ( cp_invoice_id in number
25                   , cp_distribution_line_number in number
26                   )
27    IS
28      SELECT dist.invoice_id, dist.set_of_books_id, dist.period_name, dist.amount
29             , dist.distribution_line_number, dist.dist_code_combination_id
30             , dist.description
31      FROM   ap_invoice_distributions dist
32      WHERE  dist.distribution_line_number = cp_distribution_line_number
33      AND    dist.invoice_id               = cp_invoice_id
34      ;
35 
36    CURSOR  c_ext_dist ( cp_invoice_id in number
37                   , cp_distribution_line_number in number
38                   )
39    IS
40      SELECT ext_dist.*
41      FROM   igi_mpp_ap_invoice_dists  ext_dist
42      WHERE  ext_dist.distribution_line_number = cp_distribution_line_number
43      AND    ext_dist.invoice_id               = cp_invoice_id
44      ;
45 
46 
47     CURSOR c_rules ( cp_accounting_rule_id in number) IS
48         SELECT  rr.rule_id, rr.type
49         FROM    ra_rules rr
50         where   rr.rule_id = cp_accounting_rule_id
51         ;
52 
53     CURSOR c_rule_schedules (cp_accounting_rule_id in number) IS
54         SELECT ras.period_number, ras.percent, ras.rule_id
55         FROM   ra_rule_schedules ras
56         WHERE  ras.rule_id = cp_accounting_rule_id
57         ORDER BY period_number
58         ;
59 -- ----------------
60 -- COMMON PROCEDURES
61 -- -----------------
62 
63    PROCEDURE WriteToLog ( pp_mesg in varchar2 ) IS
64    BEGIN
65       -- FND_FILE.put_line( FND_FILE.log, pp_mesg );
66       -- dbms_output.put_line( pp_mesg);
67       null;
68    END;
69 
70 -- -----------------
71 -- FUNCTIONS
72 -- -----------------
73    FUNCTION GetEffPeriodNum  ( fp_period_name in varchar2
74                              , fp_sob_id      in number
75                              )
76    RETURN NUMBER
77    IS
78      CURSOR c_effnum IS
79       SELECT effective_period_num
80       FROM   gl_period_statuses
81       WHERE  application_id = AP_APPLICATION_ID
82       AND    set_of_books_id = fp_sob_id
83       AND    period_name    = fp_period_name
84       ;
85    BEGIN
86        FOR l_eff in C_effnum LOOP
87            return l_eff.effective_period_num;
88        END LOOP;
89    END GetEffPeriodNum;
90 
91    FUNCTION GetRelPeriodName ( fp_period_name in varchar2
92                              , fp_sob_id      in number
93                              , fp_relative    in number
94                              )
95    RETURN   VARCHAR2
96    IS
97      CURSOR   c_ap_periods  ( cp_eff_period_num in number) IS
98         SELECT  gps.effective_period_num, gps.period_name
99         FROM    gl_period_statuses gps
100         WHERE   gps.application_id = AP_APPLICATION_ID
101         AND     gps.set_of_books_id = fp_sob_id
102         AND     gps.adjustment_period_flag <> 'Y'
103         AND     gps.effective_period_num   >= cp_eff_period_num
104         ORDER BY gps.effective_period_num
105         ;
106      l_eff_period_num NUMBER := 0;
107      l_count NUMBER := 0;
108    BEGIN
109    --bug 3199481 fnd logging changes: sdixit: start block
110        IF (l_state_level >=  l_debug_level ) THEN
111           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.GetRelPeriodName',
112                           '>> >> Current Period '||fp_period_name );
113        END IF;
114       l_eff_period_num := GetEffPeriodNum( fp_period_name, fp_sob_id );
115        IF (l_state_level >=  l_debug_level ) THEN
116           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.GetRelPeriodName',
117                           '>> >> Current Eff Period Num '||l_eff_period_num );
118        END IF;
119 
120       l_count := 0;
121       FOR l_per IN c_ap_periods ( l_eff_period_num ) LOOP
122            IF l_count = fp_relative THEN
123        IF (l_state_level >=  l_debug_level ) THEN
124           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.GetRelPeriodName',
125                           '>> >> New Period Name '||l_per.period_name );
126        END IF;
127    --bug 3199481 fnd logging changes: sdixit: end block
128               return  l_per.period_name;
129            ELSE
130               l_count := l_count + 1;
131            END IF;
132       END LOOP;
133       return fp_period_name;
134    END GetRelPeriodName;
135 
136 
137    FUNCTION  GetInvoiceCurrency ( fp_invoice_id in number)
138    RETURN VARCHAR2
139    IS
140      CURSOR C_curr IS
141         SELECT invoice_currency_code
142         from   ap_invoices
143         where  invoice_id = fp_invoice_id
144         ;
145    BEGIN
146       FOR l_curr in C_curr LOOP
147           return l_curr.invoice_currency_code;
148       END LOOP;
149       return '-1';
150    END GetInvoiceCurrency;
151 
152 
153    PROCEDURE Create_MPP_Details
154      ( p_invoice_id in number
155      , p_distribution_line_number in number
156      , p_accounting_rule_id       in number
157      , p_start_date               in date
158      , p_duration                 in number
159      )   IS
160 
161    l_currency_code      ap_invoices_all.invoice_currency_code%TYPE := NULL;
162    l_amount             ap_invoice_distributions_all.amount%TYPE := NULL;
163    l_running_amount     ap_invoice_distributions_all.amount%TYPE := NULL;
164    l_total_amount       ap_invoice_distributions_all.amount%TYPE := NULL;
165    l_mpp_dist_line_num  igi_mpp_ap_invoice_dists_det.mpp_dist_line_number%TYPE;
166    l_period_name        igi_mpp_ap_invoice_dists_det.period_name%TYPE;
167 
168    FUNCTION isVariableDuration ( fp_accounting_rule_id in  number)
169    RETURN BOOLEAN  IS
170       CURSOR c_exist is
171         SELECT 'x'
172         FROM   ra_rules
173         WHERE  type = 'ACC_DUR'
174         AND    rule_id = fp_accounting_rule_id
175         ;
176    BEGIN
177       FOR l_exist in C_exist LOOP
178          return TRUE;
179       END LOOP;
180       return FALSE;
181    EXCEPTION WHEN OTHERS THEN
182    --bug 3199481 fnd logging changes: sdixit: start block
183       --standard way to handle when-others as per FND logging guidelines
184            IF ( l_unexp_level >= l_debug_level ) THEN
185 
186                FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
187                FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
188                FND_MESSAGE.SET_TOKEN('MSG',  SQLERRM);
189                FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.isipmsdb.igipmsmd.isVariableduration',TRUE);
190            END IF;
191    --bug 3199481 fnd logging changes: sdixit: end block
192      return FALSE;
193    END ;
194 
195    PROCEDURE InsertRecord     ( p_mpp_dist_line_num in number
196                               , p_dist              in c_dist%ROWTYPE
197                               , p_period_name       in varchar2
198                               , p_rule_id           in number
199                               , p_amount            in number
200                               )
201 
202    IS
203 
204    BEGIN
205    --bug 3199481 fnd logging changes: sdixit: start block
206        IF (l_state_level >=  l_debug_level ) THEN
207           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.InsertRecord',
208                           '>> >> ** Mpp dist line number '|| p_mpp_dist_line_num );
209        END IF;
210        IF (l_state_level >=  l_debug_level ) THEN
211           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.InsertRecord',
212                            '>> >> ** Mpp dist amount      '|| p_amount );
213        END IF;
214    --bug 3199481 fnd logging changes: sdixit: end block
215 
216          INSERT INTO  igi_mpp_ap_invoice_dists_det
217                ( mpp_dist_line_number
218                , distribution_line_number
219                , invoice_id
220                , last_updated_by
221                , code_combination_id
222                , last_update_date
223                , period_name
224                , created_by
225                , creation_date
226                , accounting_rule_id
227                , description
228                , amount
229                , last_update_login  ) values (
230                  p_mpp_dist_line_num
231                , p_dist.distribution_line_number
232                , p_dist.invoice_id
233                , g_user_id
234                , p_dist.dist_code_combination_id
235                , g_date
236                , p_period_name
237                , g_user_id
238                , g_date
239                , p_rule_id
240                , p_dist.description
241                , p_amount
242                , g_login_id  ) ;
243 
244    END;
245 
246    FUNCTION GetPeriod  ( fp_date    in date
247                             , fp_sob_id  in number
248                             )
249    RETURN   varchar2 IS
250            CURSOR c_period IS
251            SELECT  period_name
252            FROM    gl_period_statuses
253            where   application_id = AP_APPLICATION_ID
254            and     set_of_books_id = fp_sob_id
255            and     adjustment_period_flag = 'N'
256            and     fp_date between start_date and end_date
257            ;
258    BEGIN
259           FOR  l_period in c_period LOOP
260               return l_period.period_name;
261           END LOOP;
262 
263           return null;
264         EXCEPTION WHEN OTHERS THEN
265    --bug 3199481 fnd logging changes: sdixit: start block
266       --standard way to handle when-others as per FND logging guidelines
267 
268            IF ( l_unexp_level >= l_debug_level ) THEN
269 
270                FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
271                FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
272                FND_MESSAGE.SET_TOKEN('MSG',  SQLERRM);
273                FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.igipmmdb.igipmsmd.GetPeriod',TRUE);
274            END IF;
275    --bug 3199481 fnd logging changes: sdixit: end block
276           return null;
277    END GetPeriod;
278 
279    PROCEDURE CreateFixedDists ( p_dist in c_dist%ROWTYPE
280                               , p_accounting_rule_id in number
281                               , p_running_amount in out NOCOPY number
282                               , p_currency_code in varchar2
283                               , p_mpp_dist_line_num in out NOCOPY number
284                               , p_start_date in date
285                               ) IS
286         l_period_name varchar2(80);
287         l_amount  number;
288         l_first_period_name varchar2(80);
289 
290 
291 
292    BEGIN
293 
294         l_first_period_name := nvl(GetPeriod(p_start_date,
295                                          p_dist.set_of_books_id
296                                         ), p_dist.period_name) ;
297 
298         FOR l_rs IN c_rule_schedules ( p_accounting_rule_id) LOOP
299    --bug 3199481 fnd logging changes: sdixit: start block
300             IF (l_state_level >=  l_debug_level ) THEN
301                FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
302                           '>> Processing Accounting Rules ...');
303             END IF;
304    --bug 3199481 fnd logging changes: sdixit: end block
305 
306              p_mpp_dist_line_num := p_mpp_dist_line_num + 1;
307    --bug 3199481 fnd logging changes: sdixit: start block
308            IF (l_state_level >=  l_debug_level ) THEN
309               FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
310                           '>> MPP Distribution Line number '||p_mpp_dist_line_num );
311             END IF;
312    --bug 3199481 fnd logging changes: sdixit: end block
313 
314              l_amount         := (l_rs.percent/100) * p_dist.amount;
315    --bug 3199481 fnd logging changes: sdixit: start block
316            IF (l_state_level >=  l_debug_level ) THEN
317                FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
318                           '>> MPP Distribution Amount (Before Rounding) '||l_amount );
319            END IF;
320    --bug 3199481 fnd logging changes: sdixit: end block
321 
322              l_amount         := arp_util.CurrRound( l_amount, p_currency_code );
323              p_running_amount := p_running_amount - l_amount;
324    --bug 3199481 fnd logging changes: sdixit: start block
325        IF (l_state_level >=  l_debug_level ) THEN
326           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
327                           '>> MPP Distribution Amount (After Rounding) '||l_amount );
328        END IF;
329        IF (l_state_level >=  l_debug_level ) THEN
330           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
331                           '>> Balance  '||p_running_amount );
332        END IF;
333    --bug 3199481 fnd logging changes: sdixit: end block
334 
335 
336 
337              l_Period_name  := GetRelPeriodName
338                                     ( l_first_period_name
339                                     , p_dist.set_of_books_id
340                                     , p_mpp_dist_line_num -1
341                                     ) ;
342    --bug 3199481 fnd logging changes: sdixit: start block
343            IF (l_state_level >=  l_debug_level ) THEN
344               FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
345                           '>> MPP Distribution Period  '||l_period_name );
346            END IF;
347            IF (l_state_level >=  l_debug_level ) THEN
348               FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateFixedDists',
349                           '>> Inserting the record into MPP details...' );
350            END IF;
351    --bug 3199481 fnd logging changes: sdixit: end block
352 
353               InsertRecord     ( p_mpp_dist_line_num
354                          , p_dist
355                          , l_period_name
356                          , p_accounting_rule_id
357                          , l_amount
358                          ) ;
359      END LOOP;
360 
361    END CreateFixedDists;
362 
363    PROCEDURE CreateVariableDists ( p_dist in c_dist%ROWTYPE
364                                  , p_accounting_rule_id in number
365                                  , p_running_amount in out NOCOPY number
366                                  , p_currency_code in varchar2
367                                  , p_start_date    in date
368                                  , p_duration      in number
369                                  , p_mpp_dist_line_num in out NOCOPY number
370                                  ) IS
371         l_period_name varchar2(80);
372         l_first_period_name varchar2(80);
373         l_amount  number;
374         l_amount_remaining NUMBER;
375 
376 
377         FUNCTION GetPercent ( fp_rule_id in number
378                             , fp_duration_is_1 in boolean
379                             )
380         RETURN NUMBER IS
381           CURSOR c_percent is
382              SELECT  nvl(percent,0)/100  percent_value
383              FROM    ra_rule_schedules
384              WHERE   rule_id = fp_rule_id
385              AND     period_number = 1
386              ;
387         BEGIN
388           IF fp_duration_is_1 THEN
389              return 100;
390           END IF;
391 
392           FOR l_percent in C_percent LOOP
393               return l_percent.percent_value;
394           END LOOP;
395           return 0;
396         EXCEPTION WHEN OTHERS THEN
397    --bug 3199481 fnd logging changes: sdixit: start block
398       --standard way to handle when-others as per FND logging guidelines
399 
400            IF ( l_unexp_level >= l_debug_level ) THEN
401 
402                FND_MESSAGE.SET_NAME('IGI','IGI_LOGGING_UNEXP_ERROR');
403                FND_MESSAGE.SET_TOKEN('CODE',SQLCODE);
404                FND_MESSAGE.SET_TOKEN('MSG',  SQLERRM);
405                FND_LOG.MESSAGE ( l_unexp_level,'igi.plsql.igipmmdb.igipmsmd.GetPercent',TRUE);
406            END IF;
407    --bug 3199481 fnd logging changes: sdixit: end block
408           return 0;
409         END GetPercent;
410 
411    BEGIN
412         --
413         -- Create the FIRST line
414         --
415         p_mpp_dist_line_num := 1;
416         l_amount            := p_dist.amount * GetPercent( p_accounting_rule_id ,
417                                      p_duration = 1 );
418    --bug 3199481 fnd logging changes: sdixit: start block
419         IF (l_state_level >=  l_debug_level ) THEN
420            FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
421                           '>> >> First instalment '|| l_amount );
422         END IF;
423 
424         l_amount            := arp_util.CurrRound( l_amount, p_currency_code );
425         p_running_amount    := p_running_amount - l_amount;
426         l_first_period_name := GetPeriod ( p_start_date, p_dist.set_of_books_id );
427 
428 	IF (l_state_level >=  l_debug_level ) THEN
429            FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
430                           '>> >> Period Name '|| l_period_name );
431         END IF;
432    --bug 3199481 fnd logging changes: sdixit: end block
433 
434         InsertRecord     ( p_mpp_dist_line_num
435                          , p_dist
436                          , l_first_period_name
437                          , p_accounting_rule_id
438                          , l_amount
439                          ) ;
440 
441         if p_duration = 1 then
442            return;
443         end if;
444 
445         l_amount_remaining := p_dist.amount - l_amount;
446         l_amount           := l_amount_remaining / (p_duration - 1);
447    --bug 3199481 fnd logging changes: sdixit: start block
448         IF (l_state_level >=  l_debug_level ) THEN
449           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
450                           '>> MPP Distribution Amount (Before Rounding) '||l_amount );
451         END IF;
452         l_amount           := arp_util.CurrRound( l_amount, p_currency_code );
453         IF (l_state_level >=  l_debug_level ) THEN
454            FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
455                           '>> MPP Distribution Amount (After Rounding) '||l_amount );
456         END IF;
457    --bug 3199481 fnd logging changes: sdixit: end block
458 
459         FOR t_mpp_dist_line_num  IN 2 .. p_duration LOOP
460              p_mpp_dist_line_num := t_mpp_dist_line_num;
461 
462    --bug 3199481 fnd logging changes: sdixit: start block
463            IF (l_state_level >=  l_debug_level ) THEN
464               FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
465                           '>> MPP Distribution Line number '||p_mpp_dist_line_num );
466            END IF;
467 
468              p_running_amount := p_running_amount - l_amount;
469              IF (l_state_level >=  l_debug_level ) THEN
470               FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
471                           '>> Balance  '||p_running_amount );
472              END IF;
473    --bug 3199481 fnd logging changes: sdixit: end block
474 
475              l_Period_name  := GetRelPeriodName
476                                     ( l_first_period_name
477                                     , p_dist.set_of_books_id
478                                     , p_mpp_dist_line_num -1
479                                     ) ;
480    --bug 3199481 fnd logging changes: sdixit: start block
481        IF (l_state_level >=  l_debug_level ) THEN
482           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
483                           '>> MPP Distribution Period  '||l_period_name );
484        END IF;
485        IF (l_state_level >=  l_debug_level ) THEN
486           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD.CreateVariableDists',
487                           '>> Inserting the record into MPP details...' );
488        END IF;
489    --bug 3199481 fnd logging changes: sdixit: end block
490              InsertRecord     ( p_mpp_dist_line_num
491                          , p_dist
492                          , l_period_name
493                          , p_accounting_rule_id
494                          , l_amount
495                          ) ;
496      END LOOP;
497 
498    END CreateVariableDists;
499 
500    BEGIN  /** create mpp distributions **/
501 
502 
503    --bug 3199481: fnd logging changes: sdixit : start
504    IF (l_state_level >=  l_debug_level ) THEN
505        FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
506                           'Begin Creation of MPP Dist Details...');
507    END IF;
508 
509    l_currency_code := GetInvoiceCurrency ( p_invoice_id );
510    IF (l_state_level >=  l_debug_level ) THEN
511        FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
512                           '>> Invoice Currency '||l_currency_code );
513    END IF;
514    --bug 3199481 fnd logging changes: sdixit: end block
515 
516    FOR l_dist in c_dist ( p_invoice_id, p_distribution_line_number ) LOOP
517 
518      l_mpp_dist_line_num  := 0;
519      l_total_amount       := l_dist.amount;
520      l_running_amount     := l_dist.amount;
521    --bug 3199481 fnd logging changes: sdixit: start block
522        IF (l_state_level >=  l_debug_level ) THEN
523           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
524                           '>> Processing Invoice Distributions ...');
525        END IF;
526        IF (l_state_level >=  l_debug_level ) THEN
527           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
528                           '>> Distribution Amount '||l_total_amount );
529        END IF;
530    --bug 3199481 fnd logging changes: sdixit: end block
531 
532      IF IsVariableDuration ( p_accounting_rule_id ) THEN
533         CreateVariableDists      ( l_dist
534                                  , p_accounting_rule_id
535                                  , l_running_amount
536                                  , l_currency_code
537                                  , p_start_date
538                                  , p_duration
539                                  , l_mpp_dist_line_num
540                                  );
541      ELSE
542          CreateFixedDists ( l_dist
543                          , p_accounting_rule_id
544                          , l_running_amount
545                          , l_currency_code
546                          , l_mpp_dist_line_num
547                          , p_start_date
548                          );
549      END IF;
550 
551    --bug 3199481 fnd logging changes: sdixit: start block
552        IF (l_state_level >=  l_debug_level ) THEN
553           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
554                           '>> Rounding Checks... ');
555           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
556                     '>> >> Running Amount '|| l_running_amount );
557           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
558                           '>> >> Dist Line Num  '|| l_mpp_dist_line_num );
559        END IF;
560    --bug 3199481 fnd logging changes: sdixit: end block
561      IF l_running_amount <> 0 AND l_mpp_dist_line_num <> 0 THEN
562 
563         UPDATE igi_mpp_ap_invoice_dists_det
564         SET    amount = amount + l_running_amount
565         WHERE  invoice_id  = l_dist.invoice_id
566         AND    distribution_line_number = l_dist.distribution_line_number
567         AND    mpp_dist_line_number     = l_mpp_dist_line_num
568         ;
569    --bug 3199481 fnd logging changes: sdixit: start block
570        IF (l_state_level >=  l_debug_level ) THEN
571           FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
572                           '>> Rounding Performed on the last mpp distribution '||               l_mpp_dist_line_num );
573        END IF;
574    --bug 3199481 fnd logging changes: sdixit: end block
575 
576      ELSE
577    --bug 3199481 fnd logging changes: sdixit: start block
578            IF (l_state_level >=  l_debug_level ) THEN
579                 FND_LOG.STRING  (l_state_level , 'igi.pls.igipmmdb.IGIPMSMD',
580                           '>> Rounding Check okay!... ');
581            END IF;
582    --bug 3199481 fnd logging changes: sdixit: end block
583      END IF;
584 
585    END LOOP;
586 
587    END;
588 
589    PROCEDURE Update_MPP_Details
590      ( p_invoice_id in number
591      , p_distribution_line_number in number
592      , p_accounting_rule_id       in number
593      )   IS
594    BEGIN
595       NULL;
596    END;
597 
598 
599 
600    PROCEDURE Delete_MPP_details
601      ( p_invoice_id in number
602      , p_distribution_line_number in number
603      , p_accounting_rule_id       in number
604      , p_ignore_mpp_flag          in number
605      )
606    IS
607    BEGIN
608       NULL;
609    END;
610 
611 
612 END;