3 Replies Latest reply on Mar 26, 2018 7:11 AM by Bharat -Oracle

    Create Accounting is not called after XLA_JOURNAL_ENTRIES_PUB_PKG.COMPLETE_JOURNAL_ENTRY

    _JC_

      Hi Guru's

       

      I am creating Sub-Ledger Journal entry from OAF Page(Cost Management - SLA->Sub Ledger Journal Accounting). I provide header details, line details and submit as 'Final and Post'. Once i click submit button, I am given with request Id and I see that Create Accounting program has started and the record has been posted to GL as well.

      However,

      When i do this from back-end by calling api, "create accounting" program is not submitted. (Issue-1)

      I am create Sub-Ledger Journal entries using XLA_JOURNAL_ENTRIES_PUB_PKG api.

      Initially, I am calling

      1. create_journal_entry_header

             This return status 'S', and AE_HEADER_ID

      2. create_journal_entry_line

             To this I am passing AE_HEADER_ID and it return status code as 'S' and Line number

      3. complete_journal_entry

             To this I am passing AE_HEADER_ID and it return status code as 'S'. To this i pass Completion option as 'P' (complete, transfer, and post final accounting).

       

      since, "Create Accounting program" was not submitted from API, I run it from front-end. I am passing correct Ledger, GL End Date, GL Post Flag as Yes and Mode as 'Final'.

      Program get completed successfully.

       

      Yet the GL_TRANSFER_STATUS_CODE is 'N' for the above created Journal(Issue-2).

       

      Can you please help me here.

       

      Thanks

        • 1. Re: Create Accounting is not called after XLA_JOURNAL_ENTRIES_PUB_PKG.COMPLETE_JOURNAL_ENTRY
          Bharat -Oracle

          Hi

           

          Can you check log and out file of Jounal Import program which is spawned when you ran Create Accounting.

          This program will post data to GL and change flag GL_TRANSFER_STATUS_CODE to Y.

          So log and out will give you hints if something is erroring/failing .

           

          Best Regards

          Bharat

          • 2. Re: Create Accounting is not called after XLA_JOURNAL_ENTRIES_PUB_PKG.COMPLETE_JOURNAL_ENTRY
            _JC_

            Ok, So Its my mistake

            Here are solution for both the issue.

            Issue 1: COMMIT was missing after calling complete_journal_entry api.

            Lesson learnt: 1. Initialize apps correctly: fnd_global.apps_initialize 2. Use Commit at the end of complete_journal_entry_api.

            After including commit the api was able to call the Create Accounting program/Journal GL Import Program.

             

            Issue 2: mo_global.set_policy_context was set for wrong org_id and therefore Create accounting program was not able to pick it up.

            Lesson learnt: 1. Double check org id for which u r sett Mo and running Accounting program.

            Use xla_datafixes_pub.g_msg_mode := 'X'; to see the error messages from api.

             

            Pasting code below which worked for me:

            ----------------------------------------------------------------------------

            /* Formatted on 3/26/2018 12:26:09 PM (QP5 v5.277) */

            DECLARE

              --header

              x_api_version                NUMBER := 1.0;

              x_init_msg_list              VARCHAR2 (100) := fnd_api.g_true;

              x_application_id            INTEGER := 707;

              x_ledger_id                  INTEGER := 2022;

              x_gl_date                    DATE := SYSDATE;

              x_description                VARCHAR2 (100) := 'Gain/Loss on sale';

              x_je_category_name          VARCHAR2 (100) := 'Other';

              x_balance_type_code          VARCHAR2 (100) := 'A';

              xx_return_status            VARCHAR2 (100);

              xx_msg_count                NUMBER;

              xx_msg_data                  VARCHAR2 (2000);

              xx_ae_header_id              INTEGER;

              xx_event_id                  INTEGER;

             

             

              --line

              x_ae_header_id              INTEGER;

              x_displayed_line_number_1    INTEGER := 1;

              x_displayed_line_number_2    INTEGER := 2;

              x_code_combination_id_1      INTEGER := 7276364;

              x_code_combination_id_2      INTEGER := 7276374;

              x_gl_transfer_mode          VARCHAR2 (100) := 'S';

              x_accounting_class_code_rev  VARCHAR2 (100) := 'COST_OF_GOODS_SOLD';

              x_accounting_class_code_gain VARCHAR2 (100) := 'GAIN';

              x_entered_dr                NUMBER := 699;

              x_entered_cr                NUMBER := 699;

              xx_ae_line_num              INTEGER;

             

             

              x_completion_option          VARCHAR2 (100) := 'P';

              xx_completion_retcode        VARCHAR2 (100);

            BEGIN

              fnd_global.apps_initialize (43551

                                        , 50263

                                        , 707

                                        );

              fnd_msg_pub.initialize;

              mo_global.set_policy_context ('S'

                                          , 277

                                          );

              DBMS_OUTPUT.put_line ('Staring to create header:');

              xla_journal_entries_pub_pkg.create_journal_entry_header (p_api_version            => x_api_version

                                                                    , p_init_msg_list          => x_init_msg_list

                                                                    , p_application_id        => x_application_id

                                                                    , p_ledger_id              => x_ledger_id

                                                                    , p_legal_entity_id        => NULL

                                                                    , p_gl_date                => x_gl_date

                                                                    , p_description            => x_description

                                                                    , p_je_category_name      => x_je_category_name

                                                                    , p_balance_type_code      => x_balance_type_code

                                                                    , p_budget_version_id      => NULL

                                                                    , p_reference_date        => NULL

                                                                    , p_budgetary_control_flag => NULL

                                                                    , p_attribute_category    => NULL

                                                                    , p_attribute1            => NULL

                                                                    , p_attribute2            => NULL

                                                                    , p_attribute3            => NULL

                                                                    , p_attribute4            => NULL

                                                                    , p_attribute5            => NULL

                                                                    , p_attribute6            => NULL

                                                                    , p_attribute7            => NULL

                                                                    , p_attribute8            => NULL

                                                                    , p_attribute9            => NULL

                                                                    , p_attribute10            => NULL

                                                                    , p_attribute11            => NULL

                                                                    , p_attribute12            => NULL

                                                                    , p_attribute13            => NULL

                                                                    , p_attribute14            => NULL

                                                                    , p_attribute15            => NULL

                                                                    , x_return_status          => xx_return_status

                                                                    , x_msg_count              => xx_msg_count

                                                                    , x_msg_data              => xx_msg_data

                                                                    , x_ae_header_id          => xx_ae_header_id

                                                                    , x_event_id              => xx_event_id

                                                                      );

             

             

              DBMS_OUTPUT.put_line (  'xx_return_status:'

                                    || xx_return_status

                                  );

              DBMS_OUTPUT.put_line (  'xx_msg_count:'

                                    || xx_msg_count

                                  );

              --dbms_output.put_line('xx_msg_data:'||xx_msg_data);

              DBMS_OUTPUT.put_line (  'xx_ae_header_id:'

                                    || xx_ae_header_id

                                  );

              DBMS_OUTPUT.put_line (  'xx_event_id:'

                                    || xx_event_id

                                  );

             

             

              x_ae_header_id              := xx_ae_header_id;

             

             

              IF xx_msg_count >= 1

              THEN

                FOR i IN 1 .. xx_msg_count

                LOOP

                  DBMS_OUTPUT.put_line (fnd_msg_pub.get (i

                                                      , p_encoded => fnd_api.g_false

                                                        )

                                      );

                END LOOP;

              END IF;

             

             

              xla_journal_entries_pub_pkg.create_journal_entry_line (p_api_version          => x_api_version

                                                                  , p_init_msg_list        => x_init_msg_list

                                                                  , p_application_id        => x_application_id

                                                                  , p_ae_header_id          => x_ae_header_id

                                                                  , p_displayed_line_number => x_displayed_line_number_1

                                                                  , p_code_combination_id  => x_code_combination_id_1

                                                                  , p_gl_transfer_mode      => x_gl_transfer_mode

                                                                  , p_accounting_class_code => x_accounting_class_code_rev

                                                                  , p_currency_code        => NULL

                                                                  , p_entered_dr            => x_entered_dr

                                                                  , p_entered_cr            => NULL

                                                                  , p_accounted_dr          => NULL

                                                                  , p_accounted_cr          => NULL

                                                                  , p_conversion_type      => NULL

                                                                  , p_conversion_date      => NULL

                                                                  , p_conversion_rate      => NULL

                                                                  , p_party_type_code      => NULL

                                                                  , p_party_id              => NULL

                                                                  , p_party_site_id        => NULL

                                                                  , p_description          => NULL

                                                                  , p_statistical_amount    => NULL

                                                                  , p_jgzz_recon_ref        => NULL

                                                                  , p_attribute_category    => NULL

                                                                  , p_encumbrance_type_id  => NULL

                                                                  , p_attribute1            => NULL

                                                                  , p_attribute2            => NULL

                                                                  , p_attribute3            => NULL

                                                                  , p_attribute4            => NULL

                                                                  , p_attribute5            => NULL

                                                                  , p_attribute6            => NULL

                                                                  , p_attribute7            => NULL

                                                                  , p_attribute8            => NULL

                                                                  , p_attribute9            => NULL

                                                                  , p_attribute10          => NULL

                                                                  , p_attribute11          => NULL

                                                                  , p_attribute12          => NULL

                                                                  , p_attribute13          => NULL

                                                                  , p_attribute14          => NULL

                                                                  , p_attribute15          => NULL

                                                                  , x_return_status        => xx_return_status

                                                                  , x_msg_count            => xx_msg_count

                                                                  , x_msg_data              => xx_msg_data

                                                                  , x_ae_line_num          => xx_ae_line_num

                                                                    );

             

             

              DBMS_OUTPUT.put_line (  'xx_return_status:'

                                    || xx_return_status

                                  );

              DBMS_OUTPUT.put_line (  'xx_msg_count:'

                                    || xx_msg_count

                                  );

              DBMS_OUTPUT.put_line (  'xx_ae_line_num:'

                                    || xx_ae_line_num

                                  );

             

             

              IF xx_msg_count >= 1

              THEN

                FOR i IN 1 .. xx_msg_count

                LOOP

                  DBMS_OUTPUT.put_line (fnd_msg_pub.get (i

                                                      , p_encoded => fnd_api.g_false

                                                        )

                                      );

                END LOOP;

              END IF;

             

             

              xla_journal_entries_pub_pkg.create_journal_entry_line (p_api_version          => x_api_version

                                                                  , p_init_msg_list        => x_init_msg_list

                                                                  , p_application_id        => x_application_id

                                                                  , p_ae_header_id          => x_ae_header_id

                                                                  , p_displayed_line_number => x_displayed_line_number_2

                                                                  , p_code_combination_id  => x_code_combination_id_2

                                                                  , p_gl_transfer_mode      => x_gl_transfer_mode

                                                                  , p_accounting_class_code => x_accounting_class_code_gain

                                                                  , p_currency_code        => NULL

                                                                  , p_entered_dr            => NULL

                                                                  , p_entered_cr            => x_entered_cr

                                                                  , p_accounted_dr          => NULL

                                                                  , p_accounted_cr          => NULL

                                                                  , p_conversion_type      => NULL

                                                                  , p_conversion_date      => NULL

                                                                  , p_conversion_rate      => NULL

                                                                  , p_party_type_code      => NULL

                                                                  , p_party_id              => NULL

                                                                  , p_party_site_id        => NULL

                                                                  , p_description          => NULL

                                                                  , p_statistical_amount    => NULL

                                                                  , p_jgzz_recon_ref        => NULL

                                                                  , p_attribute_category    => NULL

                                                                  , p_encumbrance_type_id  => NULL

                                                                  , p_attribute1            => NULL

                                                                  , p_attribute2            => NULL

                                                                  , p_attribute3            => NULL

                                                                  , p_attribute4            => NULL

                                                                  , p_attribute5            => NULL

                                                                  , p_attribute6            => NULL

                                                                  , p_attribute7            => NULL

                                                                  , p_attribute8            => NULL

                                                                  , p_attribute9            => NULL

                                                                  , p_attribute10          => NULL

                                                                  , p_attribute11          => NULL

                                                                  , p_attribute12          => NULL

                                                                  , p_attribute13          => NULL

                                                                  , p_attribute14          => NULL

                                                                  , p_attribute15          => NULL

                                                                  , x_return_status        => xx_return_status

                                                                  , x_msg_count            => xx_msg_count

                                                                  , x_msg_data              => xx_msg_data

                                                                  , x_ae_line_num          => xx_ae_line_num

                                                                    );

             

             

              DBMS_OUTPUT.put_line (  'xx_return_status:'

                                    || xx_return_status

                                  );

              DBMS_OUTPUT.put_line (  'xx_msg_count:'

                                    || xx_msg_count

                                  );

              DBMS_OUTPUT.put_line (  'xx_ae_line_num:'

                                    || xx_ae_line_num

                                  );

             

             

              IF xx_msg_count >= 1

              THEN

                FOR i IN 1 .. xx_msg_count

                LOOP

                  DBMS_OUTPUT.put_line (fnd_msg_pub.get (i

                                                      , p_encoded => fnd_api.g_false

                                                        )

                                      );

                END LOOP;

              END IF;

             

             

              xla_datafixes_pub.g_msg_mode := 'X';

              xla_journal_entries_pub_pkg.complete_journal_entry (p_api_version        => x_api_version

                                                                , p_init_msg_list      => x_init_msg_list

                                                                , p_application_id    => x_application_id

                                                                , p_ae_header_id      => x_ae_header_id

                                                                , p_completion_option  => x_completion_option

                                                                , x_return_status      => xx_return_status

                                                                , x_msg_count          => xx_msg_count

                                                                , x_msg_data          => xx_msg_data

                                                                , x_completion_retcode => xx_completion_retcode

                                                                );

              DBMS_OUTPUT.put_line (  'xx_return_status:'

                                    || xx_return_status

                                  );

              DBMS_OUTPUT.put_line (  'xx_msg_count:'

                                    || xx_msg_count

                                  );

              DBMS_OUTPUT.put_line (  'xx_completion_retcode:'

                                    || xx_completion_retcode

                                  );

             

             

              COMMIT;

             

             

              IF xx_msg_count >= 1

              THEN

                FOR i IN 1 .. xx_msg_count

                LOOP

                  DBMS_OUTPUT.put_line (fnd_msg_pub.get (i

                                                      , p_encoded => fnd_api.g_false

                                                        )

                                      );

                END LOOP;

              END IF;

            END;

            • 3. Re: Create Accounting is not called after XLA_JOURNAL_ENTRIES_PUB_PKG.COMPLETE_JOURNAL_ENTRY
              Bharat -Oracle

              Thanks for sharing.

              I am sure that you code will help other members