277: ,p_security_id_char_1 => p_security_id_char_1
278: ,p_security_id_char_2 => p_security_id_char_2
279: ,p_security_id_char_3 => p_security_id_char_3);
280:
281: -- Populate xla_ae_headers_gt table for processing.
282:
283: Populate_Journal_Entries;
284:
285: -- Invoke API to validate and balance journal entries by balancing segments.
624:
625:
626: --============================================================================
627: --
628: -- Private API which populates the xla_ae_headers_gt table with journal
629: -- entries to be completed and reset its status to 'Incomplete'.
630: --
631: -- The accounting entries to be completed must fullfill the following
632: -- conditions:
650: l_err_num number;
651:
652: Cursor C_SEL_HDRS is
653: Select accounting_entry_status_code
654: from xla_ae_headers
655: where ae_header_id in (Select distinct ae_header_id from xla_ae_headers_gt)
656: for update nowait;
657:
658: BEGIN
651:
652: Cursor C_SEL_HDRS is
653: Select accounting_entry_status_code
654: from xla_ae_headers
655: where ae_header_id in (Select distinct ae_header_id from xla_ae_headers_gt)
656: for update nowait;
657:
658: BEGIN
659:
705: ,p_level => C_LEVEL_STATEMENT
706: ,p_module => l_log_module);
707: End If;
708:
709: -- Insert the journal entries to be completed into xla_ae_headers_gt.
710:
711: l_stmt := 'INSERT INTO xla_ae_headers_gt
712: (ae_header_id
713: ,ledger_id
707: End If;
708:
709: -- Insert the journal entries to be completed into xla_ae_headers_gt.
710:
711: l_stmt := 'INSERT INTO xla_ae_headers_gt
712: (ae_header_id
713: ,ledger_id
714: ,entity_id
715: ,event_id
738: ,xah.doc_category_code
739: ,xah.gl_transfer_status_code
740: ,xah.accrual_reversal_flag
741: ,''F''
742: FROM xla_ae_headers xah
743: , xla_ae_headers xah2
744: , xla_ledger_relationships_v xlr
745: , xla_subledgers xs
746: , xla_event_types_b xet
739: ,xah.gl_transfer_status_code
740: ,xah.accrual_reversal_flag
741: ,''F''
742: FROM xla_ae_headers xah
743: , xla_ae_headers xah2
744: , xla_ledger_relationships_v xlr
745: , xla_subledgers xs
746: , xla_event_types_b xet
747: , xla_event_class_attrs xec
788: ,p_level => C_LEVEL_STATEMENT
789: ,p_module => l_log_module);
790: End If;
791:
792: print_logfile('- Dynamic stmt to populate xla_ae_headers_gt table built');
793:
794: EXECUTE IMMEDIATE l_stmt
795: USING g_ledger_id
796: ,g_application_id
804: p_module => l_log_module,
805: p_level => C_LEVEL_STATEMENT);
806: END IF;
807:
808: print_logfile('- xla_ae_headers_gt table populuated');
809:
810: If (l_count = 0) then
811: If (C_LEVEL_EVENT >= g_log_level) THEN
812: trace
830: --
831: -- Reset journal entry status for the journal entry to be completed
832: --
833:
834: Update xla_ae_headers
835: Set accounting_entry_status_code = 'N'
836: , request_id = g_request_id
837: , accounting_batch_id = g_accounting_batch_id
838: , last_update_date = sysdate
838: , last_update_date = sysdate
839: , last_updated_by = xla_environment_pkg.g_usr_id
840: , last_update_login = xla_environment_pkg.g_login_id
841: Where application_id = g_application_id
842: and ae_header_id in (Select ae_header_id from xla_ae_headers_gt)
843: RETURNING ae_header_id BULK COLLECT INTO g_array_ae_header_id; -- 5115223
844:
845: -- Lock rows in main headers table selected for processing.
846:
924: ,p_module => l_log_module);
925: END IF;
926:
927: FORALL i IN 1..g_array_ae_header_id.COUNT -- 5115223
928: UPDATE xla_ae_headers xah
929: SET accounting_entry_status_code = 'F'
930: ,completed_date = sysdate
931: WHERE xah.request_id = g_request_id
932: AND xah.accounting_batch_id = g_accounting_batch_id
1008: ,g_ledger_id
1009: ,h.entity_id
1010: ,t.entity_code
1011: ,h.event_id
1012: FROM xla_ae_headers_gt h,
1013: xla_transaction_entities t
1014: WHERE h.entity_id = t.entity_id
1015: AND h.ledger_id = t.ledger_id
1016: AND t.application_id = g_application_id
1061: END IF;
1062:
1063: fun_seq_batch.batch_init
1064: (p_application_id => 602
1065: ,p_table_name => 'XLA_AE_HEADERS'
1066: ,p_event_code => 'COMPLETION'
1067: ,p_context_type => 'LEDGER_AND_CURRENCY'
1068: ,p_context_value_tbl => l_seq_context_value
1069: ,p_request_id => g_request_id