810: (message_name = 'AP_ORPHAN_EVENTS_CLEANED' AND
811: g_action = G_ACTION_SWEEP))
812: AND EXISTS
813: (SELECT 1
814: FROM xla_events xe,
815: xla_transaction_entities_upg xte,
816: ap_org_attributes_gt aagt
817: WHERE xe.application_id = 200
818: AND xte.application_id = 200
1053: return;
1054: end if;
1055:
1056: -- check transfer to GL
1057: xla_events_pub_pkg.period_close(P_API_VERSION => 1
1058: , X_RETURN_STATUS => p_validation_flag
1059: , P_APPLICATION_ID => G_AP_APPLICATION_ID
1060: , P_LEDGER_ID => g_ledger_id
1061: , P_PERIOD_NAME => g_period_name);
1059: , P_APPLICATION_ID => G_AP_APPLICATION_ID
1060: , P_LEDGER_ID => g_ledger_id
1061: , P_PERIOD_NAME => g_period_name);
1062:
1063: debug ('xla_events_pub_pkg.period_close: p_validation_flag='||p_validation_flag);
1064:
1065: if (p_validation_flag <> 'S') then
1066: set_expected_error ('AP_UNTRNF_EVENTS_IN_XLA ' ||' - Untransferred XLA events');
1067: return;
1062:
1063: debug ('xla_events_pub_pkg.period_close: p_validation_flag='||p_validation_flag);
1064:
1065: if (p_validation_flag <> 'S') then
1066: set_expected_error ('AP_UNTRNF_EVENTS_IN_XLA ' ||' - Untransferred XLA events');
1067: return;
1068: end if;
1069:
1070: -- check if unposted invoices or unposted payment exists
1294: | PRAMETERS:
1295: | p_org_id: Organization ID
1296: | p_calling_sequence: Debug information
1297: |
1298: | RETURN: XLA_EVENTS_PUB_PKG.T_SECURITY
1299: |
1300: | KNOWN ISSUES:
1301: |
1302: | NOTES:
1307: *===========================================================================*/
1308: FUNCTION get_event_security_context(
1309: p_org_id IN NUMBER,
1310: p_calling_sequence IN VARCHAR2)
1311: RETURN XLA_EVENTS_PUB_PKG.T_SECURITY
1312: IS
1313:
1314: l_event_security_context XLA_EVENTS_PUB_PKG.T_SECURITY;
1315:
1310: p_calling_sequence IN VARCHAR2)
1311: RETURN XLA_EVENTS_PUB_PKG.T_SECURITY
1312: IS
1313:
1314: l_event_security_context XLA_EVENTS_PUB_PKG.T_SECURITY;
1315:
1316: BEGIN
1317:
1318: l_event_security_context.security_id_int_1 := p_org_id;
1333: | p_ledger_id: Ledger ID
1334: | p_trans_id: Invoice ID / Check ID
1335: | p_calling_sequence: Debug information
1336: |
1337: | RETURN: XLA_EVENTS_PUB_PKG.T_EVENT_SOURCE_INFO
1338: |
1339: | KNOWN ISSUES:
1340: |
1341: | NOTES:
1352: p_inv_payment_id IN NUMBER, -- 7318763
1353: p_trans_num IN VARCHAR2,
1354: p_context IN VARCHAR2,
1355: p_calling_sequence IN VARCHAR2)
1356: RETURN XLA_EVENTS_PUB_PKG.T_EVENT_SOURCE_INFO
1357: IS
1358: /* Modified the procedure for bug 7137359, related to AWT event creation */
1359: l_invoice_num VARCHAR2(50);
1360: l_event_source_info XLA_EVENTS_PUB_PKG.T_EVENT_SOURCE_INFO;
1356: RETURN XLA_EVENTS_PUB_PKG.T_EVENT_SOURCE_INFO
1357: IS
1358: /* Modified the procedure for bug 7137359, related to AWT event creation */
1359: l_invoice_num VARCHAR2(50);
1360: l_event_source_info XLA_EVENTS_PUB_PKG.T_EVENT_SOURCE_INFO;
1361: l_count NUMBER(15);
1362: l_check_id AP_CHECKS_ALL.Check_Id%TYPE;
1363: l_check_number AP_CHECKS_ALL.Check_Number%TYPE;
1364:
1553: END;
1554:
1555:
1556: /*============================================================================
1557: | PROCEDURE - UPDATE_XLA_EVENTS
1558: |
1559: | DESCRIPTION
1560: | This procedure is used to sweep accounting events from one accounting period
1561: | to another.
1574: | Date Author Description of Change
1575: | 14-MAR-08 PRANPAUL New
1576: *===========================================================================*/
1577:
1578: PROCEDURE update_xla_events (
1579: p_calling_sequence IN VARCHAR2,
1580: p_success OUT NOCOPY BOOLEAN)
1581: IS
1582:
1597: l_org_ids t_org_ids;
1598: l_legal_entity_ids t_legal_entity_ids;
1599: --l_ledger_ids t_ledger_ids;
1600: l_sources t_source;
1601: l_event_security_context XLA_EVENTS_PUB_PKG.T_SECURITY;
1602: l_event_source_info XLA_EVENTS_PUB_PKG.T_EVENT_SOURCE_INFO;
1603: l_curr_calling_sequence VARCHAR2(200);
1604:
1605: -- Bug 7137359
1598: l_legal_entity_ids t_legal_entity_ids;
1599: --l_ledger_ids t_ledger_ids;
1600: l_sources t_source;
1601: l_event_security_context XLA_EVENTS_PUB_PKG.T_SECURITY;
1602: l_event_source_info XLA_EVENTS_PUB_PKG.T_EVENT_SOURCE_INFO;
1603: l_curr_calling_sequence VARCHAR2(200);
1604:
1605: -- Bug 7137359
1606: l_xla_event XLA_EVENTS.EVENT_ID%TYPE;
1602: l_event_source_info XLA_EVENTS_PUB_PKG.T_EVENT_SOURCE_INFO;
1603: l_curr_calling_sequence VARCHAR2(200);
1604:
1605: -- Bug 7137359
1606: l_xla_event XLA_EVENTS.EVENT_ID%TYPE;
1607: l_xla_event_status XLA_EVENTS.EVENT_STATUS_CODE%TYPE;
1608: l_call_xla_api VARCHAR2(1);
1609:
1610: CURSOR c_events IS
1603: l_curr_calling_sequence VARCHAR2(200);
1604:
1605: -- Bug 7137359
1606: l_xla_event XLA_EVENTS.EVENT_ID%TYPE;
1607: l_xla_event_status XLA_EVENTS.EVENT_STATUS_CODE%TYPE;
1608: l_call_xla_api VARCHAR2(1);
1609:
1610: CURSOR c_events IS
1611: SELECT gt.accounting_event_id accounting_event_id,
1639:
1640: begin
1641:
1642: l_curr_calling_sequence := p_calling_sequence;
1643: debug ('begin update_xla_events: Bulk fetch cursor c_events');
1644:
1645: OPEN c_events;
1646: LOOP
1647: FETCH c_events
1654: l_sources,
1655: l_inv_payment_ids -- 7318763
1656: LIMIT g_fetch_limit;
1657:
1658: debug ('update_xla_events: l_event_ids.count='||l_event_ids.count );
1659:
1660: EXIT WHEN
1661: l_event_ids.count = 0;
1662:
1666: BEGIN
1667:
1668: SELECT event_id, event_status_code
1669: INTO l_xla_event, l_xla_event_status
1670: FROM xla_events
1671: WHERE event_id = l_event_ids(i)
1672: AND application_id = 200;
1673:
1674: IF l_xla_event_status = 'P' THEN
1704: p_context => l_sources(i),
1705: p_calling_sequence => l_curr_calling_sequence
1706: );
1707:
1708: AP_XLA_EVENTS_PKG.UPDATE_EVENT
1709: ( p_event_source_info => l_event_source_info,
1710: p_event_id => l_event_ids(i),
1711: p_event_type_code => NULL,
1712: p_event_date => g_sweep_to_date,
1746:
1747: END LOOP;
1748: CLOSE c_events;
1749:
1750: debug ('end update_xla_events');
1751:
1752: p_success := TRUE;
1753:
1754: EXCEPTION
1756:
1757: IF (c_events%ISOPEN) THEN
1758: CLOSE c_events;
1759: END IF;
1760: debug ('EXCEPTION: update_xla_events: '|| sqlerrm);
1761: p_success := FALSE;
1762:
1763: END update_xla_events;
1764:
1759: END IF;
1760: debug ('EXCEPTION: update_xla_events: '|| sqlerrm);
1761: p_success := FALSE;
1762:
1763: END update_xla_events;
1764:
1765: /*============================================================================
1766: | FUNCTION - UPDATE_AP_ACCT_DATE
1767: |
2000:
2001: FUNCTION delete_orphan_events RETURN BOOLEAN IS
2002:
2003: TYPE orphan_events_tab IS
2004: TABLE OF xla_events.event_id%TYPE
2005: INDEX BY BINARY_INTEGER;
2006:
2007: TYPE orphan_headers_tab IS
2008: TABLE OF xla_ae_headers.ae_header_id%TYPE
2013:
2014: CURSOR orphan_xla_event_headers IS
2015: SELECT xe.event_id,
2016: xah.ae_header_id
2017: FROM xla_events xe,
2018: xla_transaction_entities_upg xte,
2019: xla_ae_headers xah
2020: WHERE xe.application_id = 200
2021: AND xte.application_id = 200
2094: AND l_orphan_headers_data(i) IS NOT NULL;
2095:
2096: debug('deleting the orphan events');
2097: FORALL i IN l_orphan_events_data.FIRST..l_orphan_events_data.LAST
2098: DELETE FROM xla_events
2099: WHERE application_id = 200
2100: AND event_id = l_orphan_events_data(i);
2101:
2102: debug('all deletes successful, returning true');
2149: return FALSE;
2150: end if;
2151:
2152:
2153: update_xla_events('AP_PERIOD_CLOSE_EXCP_PKG.DO_SWEEP',
2154: l_success);
2155:
2156: if (l_success <> TRUE) then
2157: print ('Failure in update_xla_events while updating XLA unaccounted events');
2153: update_xla_events('AP_PERIOD_CLOSE_EXCP_PKG.DO_SWEEP',
2154: l_success);
2155:
2156: if (l_success <> TRUE) then
2157: print ('Failure in update_xla_events while updating XLA unaccounted events');
2158: return FALSE;
2159: end if;
2160:
2161: l_success := update_ebtax_dists;