9459: sysdate
9460: BULK COLLECT INTO l_xla_distribution_links
9461: FROM xla_distribution_links
9462: where event_id IN (SELECT event_id from psa_bc_xla_events_gt)
9463: and application_id = psa_bc_xla_pvt.g_application_id;
9464:
9465:
9466:
9467: DEBUG_XLA_INSERT ( l_xla_events, l_xla_validation_lines, l_xla_ae_lines, l_xla_ae_headers , l_xla_distribution_links);
9789: 0, 'S',
9790: 1, 'A'
9791: ),
9792: COUNT (DECODE (SUBSTR (bp.result_code, 1, 1), 'F', 1)), 'F',
9793: DECODE (DECODE (psa_bc_xla_pvt.g_bc_mode,
9794: 'C', 'Y',
9795: 'M', 'N',
9796: 'P', 'Y',
9797: 'N'
9843: -- ====== FND LOG ======
9844: psa_utils.debug_other_string(g_state_level,l_full_path,
9845: ' BCTRL -> P_LEDGERID = '||p_ledgerid);
9846: psa_utils.debug_other_string(g_state_level,l_full_path,
9847: ' BCTRL -> MODE = '||PSA_BC_XLA_PVT.G_BC_MODE);
9848: psa_utils.debug_other_string(g_state_level,l_full_path,
9849: ' BCTRL -> OVERRIDE = '||PSA_BC_XLA_PVT.G_OVERRIDE_FLAG);
9850: psa_utils.debug_other_string(g_state_level,l_full_path,
9851: ' BCTRL -> USER_ID = '||PSA_BC_XLA_PVT.G_USER_ID);
9845: ' BCTRL -> P_LEDGERID = '||p_ledgerid);
9846: psa_utils.debug_other_string(g_state_level,l_full_path,
9847: ' BCTRL -> MODE = '||PSA_BC_XLA_PVT.G_BC_MODE);
9848: psa_utils.debug_other_string(g_state_level,l_full_path,
9849: ' BCTRL -> OVERRIDE = '||PSA_BC_XLA_PVT.G_OVERRIDE_FLAG);
9850: psa_utils.debug_other_string(g_state_level,l_full_path,
9851: ' BCTRL -> USER_ID = '||PSA_BC_XLA_PVT.G_USER_ID);
9852: psa_utils.debug_other_string(g_state_level,l_full_path,
9853: ' BCTRL -> RESP_ID = '||PSA_BC_XLA_PVT.G_USER_RESP_ID);
9847: ' BCTRL -> MODE = '||PSA_BC_XLA_PVT.G_BC_MODE);
9848: psa_utils.debug_other_string(g_state_level,l_full_path,
9849: ' BCTRL -> OVERRIDE = '||PSA_BC_XLA_PVT.G_OVERRIDE_FLAG);
9850: psa_utils.debug_other_string(g_state_level,l_full_path,
9851: ' BCTRL -> USER_ID = '||PSA_BC_XLA_PVT.G_USER_ID);
9852: psa_utils.debug_other_string(g_state_level,l_full_path,
9853: ' BCTRL -> RESP_ID = '||PSA_BC_XLA_PVT.G_USER_RESP_ID);
9854: -- ====== FND LOG ======
9855:
9849: ' BCTRL -> OVERRIDE = '||PSA_BC_XLA_PVT.G_OVERRIDE_FLAG);
9850: psa_utils.debug_other_string(g_state_level,l_full_path,
9851: ' BCTRL -> USER_ID = '||PSA_BC_XLA_PVT.G_USER_ID);
9852: psa_utils.debug_other_string(g_state_level,l_full_path,
9853: ' BCTRL -> RESP_ID = '||PSA_BC_XLA_PVT.G_USER_RESP_ID);
9854: -- ====== FND LOG ======
9855:
9856: -- First invoke GLXFIN and assign values to global variables.
9857:
9860: -- ====== FND LOG ======
9861:
9862: if not glxfin (p_ledgerid => p_ledgerid,
9863: p_packetid => 0,
9864: p_mode => PSA_BC_XLA_PVT.G_BC_MODE,
9865: p_override => PSA_BC_XLA_PVT.G_OVERRIDE_FLAG,
9866: p_conc_flag => 'N',
9867: p_user_id => PSA_BC_XLA_PVT.G_USER_ID,
9868: p_user_resp_id => PSA_BC_XLA_PVT.G_USER_RESP_ID,
9861:
9862: if not glxfin (p_ledgerid => p_ledgerid,
9863: p_packetid => 0,
9864: p_mode => PSA_BC_XLA_PVT.G_BC_MODE,
9865: p_override => PSA_BC_XLA_PVT.G_OVERRIDE_FLAG,
9866: p_conc_flag => 'N',
9867: p_user_id => PSA_BC_XLA_PVT.G_USER_ID,
9868: p_user_resp_id => PSA_BC_XLA_PVT.G_USER_RESP_ID,
9869: p_calling_prog_flag => 'S') then
9863: p_packetid => 0,
9864: p_mode => PSA_BC_XLA_PVT.G_BC_MODE,
9865: p_override => PSA_BC_XLA_PVT.G_OVERRIDE_FLAG,
9866: p_conc_flag => 'N',
9867: p_user_id => PSA_BC_XLA_PVT.G_USER_ID,
9868: p_user_resp_id => PSA_BC_XLA_PVT.G_USER_RESP_ID,
9869: p_calling_prog_flag => 'S') then
9870:
9871: -- ====== FND LOG ======
9864: p_mode => PSA_BC_XLA_PVT.G_BC_MODE,
9865: p_override => PSA_BC_XLA_PVT.G_OVERRIDE_FLAG,
9866: p_conc_flag => 'N',
9867: p_user_id => PSA_BC_XLA_PVT.G_USER_ID,
9868: p_user_resp_id => PSA_BC_XLA_PVT.G_USER_RESP_ID,
9869: p_calling_prog_flag => 'S') then
9870:
9871: -- ====== FND LOG ======
9872: psa_utils.debug_other_string(g_error_level,l_full_path, ' BCTRL -> glxfin failed ');
9961: -- ====== FND LOG ======
9962: psa_utils.debug_other_string(g_state_level,l_full_path, ' BCTRL -> Get Je_Source_name ');
9963: -- ====== FND LOG ======
9964:
9965: open get_je_source_name(PSA_BC_XLA_PVT.G_APPLICATION_ID);
9966: fetch get_je_source_name into l_je_source_name;
9967: if get_je_source_name%notfound then
9968: raise invalid_je_source_name;
9969: end if;
10144: ps.period_year,
10145: ps.period_num,
10146: ps.quarter_num,
10147: xv.entered_currency_code,
10148: -- decode(psa_bc_xla_pvt.g_bc_mode, 'C', 'C', 'P'), Bug 6452856.
10149: decode(psa_bc_xla_pvt.g_bc_mode, 'C', 'C','M', 'C', 'P'),
10150: sysdate,
10151: g_user_id,
10152: xv.budget_version_id, -- BUDGET_VERSION_ID
10145: ps.period_num,
10146: ps.quarter_num,
10147: xv.entered_currency_code,
10148: -- decode(psa_bc_xla_pvt.g_bc_mode, 'C', 'C', 'P'), Bug 6452856.
10149: decode(psa_bc_xla_pvt.g_bc_mode, 'C', 'C','M', 'C', 'P'),
10150: sysdate,
10151: g_user_id,
10152: xv.budget_version_id, -- BUDGET_VERSION_ID
10153: xv.encumbrance_type_id,
10220: xv.source_distribution_id_num_4,
10221: xv.source_distribution_id_num_5,
10222: l_session_id,
10223: l_serial_id,
10224: psa_bc_xla_pvt.g_application_id,
10225: xv.entity_id,
10226: NULL -- GROUP_ID
10227: BULK COLLECT INTO l_bc_pkts
10228: FROM xla_psa_bc_lines_v xv,
10251: CLOSE get_ledger_category;
10252:
10253: -- ====== FND LOG ======
10254: psa_utils.debug_other_string(g_state_level,l_full_path, ' BCTRL -> Ledger Category: '||l_ledger_category);
10255: psa_utils.debug_other_string(g_state_level,l_full_path, ' BCTRL -> Application Id: '||psa_bc_xla_pvt.g_application_id);
10256: -- ====== FND LOG ======
10257:
10258: IF (l_ledger_category = 'PRIMARY') OR (psa_bc_xla_pvt.g_application_id = 602) THEN
10259: -- ==================== FND LOG ===========================
10254: psa_utils.debug_other_string(g_state_level,l_full_path, ' BCTRL -> Ledger Category: '||l_ledger_category);
10255: psa_utils.debug_other_string(g_state_level,l_full_path, ' BCTRL -> Application Id: '||psa_bc_xla_pvt.g_application_id);
10256: -- ====== FND LOG ======
10257:
10258: IF (l_ledger_category = 'PRIMARY') OR (psa_bc_xla_pvt.g_application_id = 602) THEN
10259: -- ==================== FND LOG ===========================
10260: psa_utils.debug_other_string(g_state_level,l_full_path, ' l_ledger_category = PRIMARY OR (psa_bc_xla_pvt.g_application_id = 602 --> raise gl_bc_packets_empty');
10261: -- ==================== FND LOG ===========================
10262:
10256: -- ====== FND LOG ======
10257:
10258: IF (l_ledger_category = 'PRIMARY') OR (psa_bc_xla_pvt.g_application_id = 602) THEN
10259: -- ==================== FND LOG ===========================
10260: psa_utils.debug_other_string(g_state_level,l_full_path, ' l_ledger_category = PRIMARY OR (psa_bc_xla_pvt.g_application_id = 602 --> raise gl_bc_packets_empty');
10261: -- ==================== FND LOG ===========================
10262:
10263: raise gl_bc_packets_empty;
10264: ELSE
10340: -- ====== FND LOG ======
10341:
10342: IF NOT glxfck( p_ledgerid ,
10343: l_packets(i) ,
10344: PSA_BC_XLA_PVT.G_BC_MODE ,
10345: PSA_BC_XLA_PVT.G_OVERRIDE_FLAG ,
10346: 'N' ,
10347: PSA_BC_XLA_PVT.G_USER_ID ,
10348: PSA_BC_XLA_PVT.G_USER_RESP_ID ,
10341:
10342: IF NOT glxfck( p_ledgerid ,
10343: l_packets(i) ,
10344: PSA_BC_XLA_PVT.G_BC_MODE ,
10345: PSA_BC_XLA_PVT.G_OVERRIDE_FLAG ,
10346: 'N' ,
10347: PSA_BC_XLA_PVT.G_USER_ID ,
10348: PSA_BC_XLA_PVT.G_USER_RESP_ID ,
10349: 'S' ,
10343: l_packets(i) ,
10344: PSA_BC_XLA_PVT.G_BC_MODE ,
10345: PSA_BC_XLA_PVT.G_OVERRIDE_FLAG ,
10346: 'N' ,
10347: PSA_BC_XLA_PVT.G_USER_ID ,
10348: PSA_BC_XLA_PVT.G_USER_RESP_ID ,
10349: 'S' ,
10350: l_ret_code ) THEN
10351:
10344: PSA_BC_XLA_PVT.G_BC_MODE ,
10345: PSA_BC_XLA_PVT.G_OVERRIDE_FLAG ,
10346: 'N' ,
10347: PSA_BC_XLA_PVT.G_USER_ID ,
10348: PSA_BC_XLA_PVT.G_USER_RESP_ID ,
10349: 'S' ,
10350: l_ret_code ) THEN
10351:
10352: -- ====== FND LOG ======
10366: psa_utils.debug_other_string(g_state_level, l_full_path, ' BCTRL -> Update funds_status_code '||
10367: 'of xla_ae_headers_gt ');
10368: -- ====== FND LOG ======
10369:
10370: IF (PSA_BC_XLA_PVT.G_BC_MODE = 'P') AND (l_ret_code <> 'T') THEN
10371: FOR y IN get_status_per_header(l_packets(i))
10372: LOOP
10373: -- ====== FND LOG ======
10374: psa_utils.debug_other_string(g_state_level,l_full_path, ' BCTRL -> GET_STATUS_PER_HEADER DETAILS ');
10504: -- ====== FND LOG ======
10505:
10506: -- Update global variable for packet_id to the first packet_id
10507:
10508: PSA_BC_XLA_PVT.G_PACKET_ID := l_packets(1);
10509:
10510: -- ====== FND LOG ======
10511: psa_utils.debug_other_string(g_state_level, l_full_path, ' BCTRL -> Updated '||
10512: ' PSA_BC_XLA_PVT.G_PACKET_ID to '||PSA_BC_XLA_PVT.G_PACKET_ID);
10508: PSA_BC_XLA_PVT.G_PACKET_ID := l_packets(1);
10509:
10510: -- ====== FND LOG ======
10511: psa_utils.debug_other_string(g_state_level, l_full_path, ' BCTRL -> Updated '||
10512: ' PSA_BC_XLA_PVT.G_PACKET_ID to '||PSA_BC_XLA_PVT.G_PACKET_ID);
10513: -- ====== FND LOG ======
10514:
10515: -- ====== FND LOG ======
10516: psa_utils.debug_other_string(g_state_level, l_full_path, ' BCTRL -> l_t_status_cnt = '||l_t_status_cnt);
10571: CLOSE c_chk_funds_hier;
10572: -- update the statuses of gl_bc_packets
10573: -- related rows to 'F' Failed or 'R' Rejected.
10574: UPDATE gl_bc_packets
10575: SET status_code = decode(PSA_BC_XLA_PVT.G_BC_MODE, 'C', 'F',
10576: 'M', 'F',
10577: 'R', 'R',
10578: 'P', 'R')
10579: ,result_code = 'F77'
10595: END IF;
10596: END LOOP;
10597:
10598: UPDATE xla_ae_headers_gt
10599: SET funds_status_code = decode(PSA_BC_XLA_PVT.G_BC_MODE, 'C', 'F',
10600: 'M', 'F',
10601: 'R', 'F',
10602: 'P', 'F')
10603: WHERE ae_header_id IN (SELECT ae_header_id
10814: FROM gl_bc_packets
10815: WHERE event_id IN (SELECT event_id
10816: FROM psa_bc_xla_events_gt
10817: )
10818: AND application_id = PSA_BC_XLA_PVT.g_application_id
10819: AND status_code = 'A';
10820:
10821: dummy VARCHAR2(100);
10822: l_success_evt_exist VARCHAR2(1);
10839: -- ====== FND LOG ======
10840:
10841: FORALL i IN 1..p_failed_ldgr_array.COUNT
10842: UPDATE gl_bc_packets
10843: SET status_code = decode(PSA_BC_XLA_PVT.G_BC_MODE, 'C', 'F',
10844: 'M', 'F',
10845: 'R', 'R',
10846: 'P', 'R')
10847: ,result_code = 'F81'
10845: 'R', 'R',
10846: 'P', 'R')
10847: ,result_code = 'F81'
10848: WHERE event_id = p_failed_evnt_array(i)
10849: AND application_id = PSA_BC_XLA_PVT.g_application_id
10850: AND ledger_id = p_failed_ldgr_array(i)
10851: AND status_code NOT IN ('F', 'R');
10852:
10853: l_f81_cnt := SQL%ROWCOUNT;
10859:
10860:
10861: FORALL j IN 1..p_failed_evnt_array.COUNT
10862: UPDATE gl_bc_packets
10863: SET status_code = decode(PSA_BC_XLA_PVT.G_BC_MODE, 'C', 'F',
10864: 'M', 'F',
10865: 'R', 'R',
10866: 'P', 'R')
10867: ,result_code = 'F82'
10865: 'R', 'R',
10866: 'P', 'R')
10867: ,result_code = 'F82'
10868: WHERE event_id = p_failed_evnt_array(j)
10869: AND application_id = PSA_BC_XLA_PVT.g_application_id
10870: AND status_code NOT IN ('F', 'R');
10871:
10872: l_f82_cnt := SQL%ROWCOUNT;
10873:
10915: FROM gl_bc_packets bc
10916: WHERE event_id IN ( SELECT event_id
10917: FROM psa_bc_xla_events_gt
10918: )
10919: AND application_id = PSA_BC_XLA_PVT.g_application_id
10920: AND result_code IN ('F81', 'F82')
10921: ) ;
10922:
10923: -- ====== FND LOG ======