[Home] [Help]
9819: SELECT event_id, ae_header_id, ae_line_num, entity_id, ledger_id,
9820: period_name
9821: FROM xla_psa_bc_lines_v;
9822:
9823: CURSOR debug_psa_bc_alloc_gt IS
9824: SELECT hierarchy_id, ae_header_id, ae_line_num, event_id,
9825: status_code
9826: FROM psa_bc_alloc_gt;
9827:
9822:
9823: CURSOR debug_psa_bc_alloc_gt IS
9824: SELECT hierarchy_id, ae_header_id, ae_line_num, event_id,
9825: status_code
9826: FROM psa_bc_alloc_gt;
9827:
9828: -- Check whether all the events from XLA_EVENTS_GT have come to
9829: -- XLA_AE_LINES_GT.
9830: /* If any event is missed we will treat it as
10020: CURSOR c_get_hierarchy_id
10021: IS
10022: SELECT
10023: DISTINCT(hierarchy_id)
10024: FROM psa_bc_alloc_gt;
10025:
10026: -- Check whether for a hierarchy events funds check/reserve is
10027: -- failed/rejected.
10028: CURSOR c_chk_funds_hier(p_hierarchy_id NUMBER,
10034: WHERE EXISTS
10035: (SELECT 'X' FROM GL_BC_PACKETS
10036: WHERE (ae_header_id, ae_line_num, event_id)
10037: IN (select ae_header_id, ae_line_num, event_id
10038: from psa_bc_alloc_gt
10039: where hierarchy_id = p_hierarchy_id
10040: and status_code = 'P'
10041: )
10042: AND status_code IN ('F', 'R')
10266: /* First level of validation for allocation attributes is two fold:
10267: 1) We check whether transaction lines are related with allocation attributes or not.
10268: If allocation attributes are NOT used we do the normal processing.
10269: 2) Using allocation attributes we find out the relationship amongst trx lines and
10270: store this information into PSA_BC_ALLOC_GT. Events stored in this table are sampled with
10271: events of XLA_PSA_BC_LINES_V. If any event is missing we disallow the group of related
10272: transaction rows to go in for funds operation. */
10273:
10274: -- Preliminary check for allocation attributes usage.
10333: );
10334: LOOP
10335: FETCH c_get_child_trx INTO l_child_trx;
10336: EXIT WHEN c_get_child_trx%NOTFOUND;
10337: -- now insert parent and child transactions in psa_bc_alloc_gt
10338: -- with a initial status of 'U' (Unprocessed)
10339: INSERT INTO psa_bc_alloc_gt (
10340: hierarchy_id,
10341: ae_header_id,
10335: FETCH c_get_child_trx INTO l_child_trx;
10336: EXIT WHEN c_get_child_trx%NOTFOUND;
10337: -- now insert parent and child transactions in psa_bc_alloc_gt
10338: -- with a initial status of 'U' (Unprocessed)
10339: INSERT INTO psa_bc_alloc_gt (
10340: hierarchy_id,
10341: ae_header_id,
10342: ae_line_num,
10343: event_id,
10363: LOOP
10364: SELECT
10365: COUNT(DISTINCT(event_id))
10366: INTO l_alloc_event_cnt
10367: FROM psa_bc_alloc_gt
10368: WHERE hierarchy_id = h.hierarchy_id;
10369:
10370: -- ======================== FND LOG =============================
10371: psa_utils.debug_other_string(g_state_level, l_full_path, ' l_alloc_event_cnt -> '||l_alloc_event_cnt);
10379: (
10380: (
10381: SELECT
10382: pa1.event_id
10383: FROM psa_bc_alloc_gt pa1
10384: WHERE pa1.hierarchy_id = h.hierarchy_id
10385: )
10386: MINUS
10387: (
10386: MINUS
10387: (
10388: SELECT
10389: pa2.event_id
10390: FROM psa_bc_alloc_gt pa2
10391: WHERE pa2.event_id = xv.event_id
10392: AND pa2.status_code = 'F'
10393: )
10394: );
10400: -- Compare both the counts. if they are equal
10401: -- then the hierarchy events are eligible for funds check
10402: IF (l_alloc_event_cnt = NVL(l_xla_event_cnt, 0)) THEN
10403: UPDATE
10404: psa_bc_alloc_gt
10405: SET status_code = 'P'
10406: WHERE hierarchy_id = h.hierarchy_id;
10407: -- ====== FND LOG ======
10408: psa_utils.debug_other_string(g_state_level, l_full_path, ' BCTRL -> Updated '||sql%rowcount||
10409: ' rows.');
10410: -- ====== FND LOG ======
10411: ELSE
10412: UPDATE
10413: psa_bc_alloc_gt
10414: SET status_code = 'F'
10415: WHERE hierarchy_id = h.hierarchy_id;
10416: -- ====== FND LOG ======
10417: psa_utils.debug_other_string(g_state_level, l_full_path, ' BCTRL -> Updated '||sql%rowcount||
10534: (
10535: (l_alloc_used = 'Y' and
10536: xv.event_id IN (
10537: SELECT event_id
10538: FROM psa_bc_alloc_gt
10539: WHERE status_code = 'P')
10540: )
10541: OR
10542: (l_alloc_used = 'N')
10832: UPDATE xla_ae_headers_gt
10833: SET funds_status_code = 'F'
10834: WHERE event_id IN (
10835: SELECT event_id
10836: FROM psa_bc_alloc_gt
10837: WHERE status_code <> 'P');
10838:
10839: IF(SQL%ROWCOUNT<> 0) THEN
10840: -- ====== FND LOG ======
10846: UPDATE xla_validation_lines_gt vl
10847: SET vl.funds_status_code = 'F76'
10848: WHERE event_id IN (
10849: SELECT event_id
10850: FROM psa_bc_alloc_gt
10851: WHERE status_code <> 'P');
10852:
10853: IF(SQL%ROWCOUNT<> 0) THEN
10854: -- ====== FND LOG ======
10880: 'P', 'R')
10881: ,result_code = 'F77'
10882: WHERE (ae_header_id, ae_line_num, event_id)
10883: IN (SELECT ae_header_id, ae_line_num, event_id
10884: FROM psa_bc_alloc_gt
10885: WHERE hierarchy_id = h.hierarchy_id
10886: )
10887: AND status_code NOT IN ('F', 'R')
10888: AND session_id = l_session_id
10976: -- PSA regular tables.
10977:
10978: debug_xla ( 'BUDGETARY_CONTROL_END' );
10979:
10980: psa_utils.debug_other_string(g_state_level,l_full_path,'Cleaning up psa_bc_alloc_gt Table');
10981: DELETE FROM psa_bc_alloc_gt; --For bug 7607496
10982: psa_utils.debug_other_string(g_state_level,l_full_path, ' Deleted Rows -> ' || SQL%ROWCOUNT);
10983:
10984: return TRUE;
10977:
10978: debug_xla ( 'BUDGETARY_CONTROL_END' );
10979:
10980: psa_utils.debug_other_string(g_state_level,l_full_path,'Cleaning up psa_bc_alloc_gt Table');
10981: DELETE FROM psa_bc_alloc_gt; --For bug 7607496
10982: psa_utils.debug_other_string(g_state_level,l_full_path, ' Deleted Rows -> ' || SQL%ROWCOUNT);
10983:
10984: return TRUE;
10985:
11062: -- ====== FND LOG ======
11063: END LOOP;
11064:
11065: -- ====== FND LOG ======
11066: psa_utils.debug_other_string(g_error_level,l_full_path, ' BCTRL -> PSA_BC_ALLOC_GT DUMP');
11067: psa_utils.debug_other_string(g_error_level,l_full_path,' --------------------------------------- ');
11068: -- ====== FND LOG ======
11069: FOR p in debug_psa_bc_alloc_gt
11070: LOOP
11065: -- ====== FND LOG ======
11066: psa_utils.debug_other_string(g_error_level,l_full_path, ' BCTRL -> PSA_BC_ALLOC_GT DUMP');
11067: psa_utils.debug_other_string(g_error_level,l_full_path,' --------------------------------------- ');
11068: -- ====== FND LOG ======
11069: FOR p in debug_psa_bc_alloc_gt
11070: LOOP
11071: -- ====== FND LOG ======
11072: psa_utils.debug_other_string(g_error_level,l_full_path, ' HIERARCHY_ID = '||p.hierarchy_id||' , '||
11073: ' EVENT_ID = '||p.event_id||' , '||