DBA Data[Home] [Help]

APPS.ARP_XLA_EVENTS SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 16

     bld_dml_flag        DBMS_SQL.VARCHAR2_TABLE,--insert,update,delete
     bld_temp_event_id   DBMS_SQL.VARCHAR2_TABLE
);
Line: 39

   PROCEDURE define_arrays( p_select_c   IN INTEGER,
                            p_xla_ev_rec IN xla_events_type,
                            p_ev_rec     IN ev_rec_type,
                            p_call_point IN NUMBER);
Line: 44

   PROCEDURE get_column_values(p_select_c   IN  INTEGER,
                               p_xla_ev_rec IN xla_events_type,
                               p_call_point IN NUMBER,
                               p_ev_rec     OUT NOCOPY ev_rec_type);
Line: 82

   FUNCTION  Get_Select_Cursor(p_xla_ev_rec IN xla_events_type,
                               p_call_point IN NUMBER)
      RETURN INTEGER;
Line: 150

'SELECT ae.event_id,
        ae.event_date,
        ae.event_status_code,
        ae.event_type_code
  FROM '||xla_user||'.xla_events ae
 WHERE ae.event_id = :dist_event_id
 AND ae.application_id = 222';
Line: 203

' select ae.event_id         ,
         ae.event_date       ,
         ae.event_status_code,
         ae.event_type_code
  from xla_events     ae,
       xla_transaction_entities_upg xt
 where xt.source_id_int_1 = :trx_id
 and xt.entity_id = ae.entity_id
 and nvl(ae.event_date,
     to_date(''01-01-1900'',''DD-MM-YYYY'')) = :dist_gl_date
 and ae.event_status_code <> ''P''
 and ae.event_type_code = :override_event
 and ae.application_id = 222
 and xt.application_id = 222';
Line: 513

 |      Get_Select_Cursor
 |
 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
 |
 | PARAMETERS p_ev_rec IN  Event input parameter record
 |            p_stmt   OUT Build dynamic SQL statement buffer
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 | 07-OCT-2002           Herve             Add the bind_variable b_xla_mode.
 |
 |           Need to differentiate the SQL statement by execution mode.
 |
 |           For example in Upgrade mode or in OLTP, for a postable document,
 |             distribution stamped with a event_id,
 |             trx_status complete,
 |             no status for the event
 |             exist_dist_gl_date null is abnormal.
 |
 |           * In OLTP, the OLTP sql will populate the event status.
 |           * In Upgrade mode the distribution stamped with a event_id is impossible.
 |           * But in Batch mode this situation can happen, when a receipt is created
 |             RECP_CREATE, then submit autoreceipt process in batch mode to create the
 |             the RECEIPT REMITTANCE record with the RECP_REMIT event.
 |             The previous RECP_CREATE event causes the situation described happen.
 |               - distribution is stamped True.
 |               - trx_complete
 |               - no status event and exist gl date is null because OLTP sql not executed.
 |             So by adding the clause based on :b_xla_mode, avoidance to retrieve the existing
 |             RECP_CREATE is accomplished so that the same situation of Upgrade happens.
 |
 *=======================================================================*/
PROCEDURE Build_Stmt(p_xla_ev_rec IN  xla_events_type,
                     p_call_point IN  NUMBER,
                     p_stmt       OUT NOCOPY VARCHAR2) IS

l_select_clause          VARCHAR2(10000);
Line: 625

      l_select_clause :=
      ' select
        tty.post_to_gl                                POSTTOGL       ,
        tty.type                                      TRX_TYPE       ,
        decode(ct.complete_flag,
               ''Y'',''C'',
               ''I'')                                 COMP_FLAG      ,
        ctlgd.customer_trx_id                         TRX_ID         ,
        ct.trx_number                                 TRX_NUMBER     ,
        ct.org_id                                     ORG_ID         ,
        decode(nvl(ctlgd.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
               nvl(ctlgd1.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                  decode(ctlgd.posting_control_id,
                         ctlgd1.posting_control_id,  tty.type || ''_CREATE'',
                         tty.type || ''_UPDATE''),
               tty.type || ''_UPDATE'')               OVERRIDE_EVENT ,
        ctlgd.posting_control_id                      PSTID          ,
        nvl(ctlgd.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')) GL_DATE,
        ctlgd.event_id                                EXIST_EVENT    ,
        ''''                                          EVENT_ID       ,
        to_date(''01-01-1900'',''DD-MM-YYYY'')        ACCOUNTING_DATE,
        ''''                                          EVENT_TYPE     ,
        ''X''                                         EVENT_STATUS   ,
        ct.trx_date                            TRANSACTION_DATE,
        ct.legal_entity_id                            LEGAL_ENTITY_ID ' || CRLF;
Line: 710

                        tty.type || ''_UPDATE''),
              tty.type || ''_UPDATE'') ,
       ctlgd.posting_control_id,
       nvl(ctlgd.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
       ctlgd.event_id ,
       ct.trx_date,
       ct.legal_entity_id'|| CRLF;
Line: 730

        l_select_clause :=
     --BUG#5415512
      ' SELECT /*+ leading(ctlgd,evn,ev1) use_nl(evn,ev1) */
               ctlgd.rowid,
               ev1.event_id ';
Line: 766

      END IF; --create or update mode
Line: 806

      l_select_clause :=
      ' select
        decode(tty.post_to_gl,''Y'',tty.post_to_gl,nvl(tty.adj_post_to_gl,''N''))  POSTTOGL       ,
        ''ADJ''                                       TRX_TYPE       ,
        decode(adj.status,
               ''A'',''C'',
               ''I'')                                 COMP_FLAG      ,
        adj.adjustment_id                             TRX_ID         ,
        adj.adjustment_number                         TRX_NUMBER     ,
        adj.org_id                                    ORG_ID,
        ''ADJ_CREATE''                                OVERRIDE_EVENT ,
        adj.posting_control_id                        PSTID          ,
        nvl(adj.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')) GL_DATE,
        adj.event_id                                  EXIST_EVENT    ,
        ''''                                          EVENT_ID       ,
        to_date(''01-01-1900'',''DD-MM-YYYY'')        ACCOUNTING_DATE,
        ''''                                          EVENT_TYPE     ,
        ''X''                                         EVENT_STATUS   ,
        ct.trx_date                          TRANSACTION_DATE,
        ct.legal_entity_id                           LEGAL_ENTITY_ID' || CRLF;
Line: 873

        l_select_clause :=
      ' SELECT adj.rowid,
               ev1.event_id ';
Line: 960

      l_select_clause :=
      ' select
        crh.postable_flag                             POSTTOGL       ,
        ''RECP''                                      TRX_TYPE       ,
        decode(crh.status,
               ''APPROVED'', ''I'',
               ''C'')                                 COMP_FLAG      ,
        crh.cash_receipt_id                           TRX_ID         ,
        cr.receipt_number                             TRX_NUMBER     ,
        cr.org_id                                     ORG_ID,
        decode(cr.type,
               ''MISC'',''MISC_'',
               '''') ||
        decode(crh.created_from,
               ''RATE ADJUSTMENT TRIGGER'', ''RECP_RATE_ADJUST'',
               decode(crh.status,
                      ''REVERSED'',''RECP_REVERSE'',
                      decode(crh1.first_posted_record_flag,
                             '''', ''RECP_CREATE'',
                             decode(decode(crh.postable_flag,
                                           ''N'', to_date(''01-01-1900'',''DD-MM-YYYY''),
                                           nvl(crh.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY''))),
                                    nvl(crh1.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                                    decode(crh.posting_control_id,
                                           crh1.posting_control_id, ''RECP_CREATE'',
                                           ''RECP_UPDATE''),
                                    ''RECP_UPDATE'')))) OVERRIDE_EVENT,
        crh.posting_control_id                        PSTID          ,
        decode(crh.postable_flag,
               ''N'', to_date(''01-01-1900'',''DD-MM-YYYY''),
               nvl(crh.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY''))) GL_DATE,
        crh.event_id                                  EXIST_EVENT,
        ''''                                          EVENT_ID       ,
        to_date(''01-01-1900'',''DD-MM-YYYY'')        ACCOUNTING_DATE,
        ''''                                          EVENT_TYPE     ,
        ''X''                                         EVENT_STATUS   ,
        cr.receipt_date                               TRANSACTION_DATE,
        cr.legal_entity_id                             LEGAL_ENTITY_ID   ' || CRLF;
Line: 1046

                                             ''RECP_UPDATE''),
                                      ''RECP_UPDATE'')))),
                decode(crh.postable_flag,
                       ''N'', to_date(''01-01-1900'',''DD-MM-YYYY''),
                       nvl(crh.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY''))),
                crh.event_id,
                cr.receipt_date,
                cr.legal_entity_id' || CRLF;
Line: 1056

    |The where clause below is appended to the Select which pulls data    |
    |from the inline query. Hence it appears odd that order by should have|
    |a where but nevertheless it is required                              |
    +---------------------------------------------------------------------*/
      /** BUG 6660834
      We can directly use the field OVERRIDE_EVENT in order by clause, s the value
      itself will maintain the order we are expecting in all the cases except in case
      where we have both RECP_UPDATE and RECP_REVERSE in the same call,this
      is only possible in case of an upgrade and this is not used for upgrade*/
      /*l_order_by_clause := l_order_by_clause ||
      'ORDER BY TRX_ID,
                decode(OVERRIDE_EVENT,
                       ''RECP_CREATE''             ,1,
                       ''RECP_UPDATE''             ,2,
                       ''RECP_RATE_ADJUST''        ,3,
                       ''RECP_REVERSE''            ,6,
                       ''MISC_RECP_CREATE''        ,1,
                       ''MISC_RECP_UPDATE''        ,2,
                       ''MISC_RECP_RATE_ADJUST''   ,3,
                       ''MISC_RECP_REVERSE'',       6,
                       7),
                GL_DATE,
                PSTID desc ' || CRLF;*/
Line: 1082

      log('l_select_clause   = ' || l_select_clause);
Line: 1092

        l_select_clause :=
      ' SELECT crh.rowid,
               ev1.event_id ';
Line: 1134

      END IF; --create or update mode
Line: 1188

           l_select_clause := l_select_clause         || l_from_clause     || l_where_clause ||
                              l_where_parm_clause_crh || l_group_by_clause || l_union || CRLF;
Line: 1193

      l_select_clause := l_select_clause ||
      ' select
        ''Y''                                         POSTTOGL       ,
        ''RECP''                                      TRX_TYPE       ,
        ''C''                                         COMP_FLAG      ,
        mcd.cash_receipt_id                           TRX_ID         ,
        cr.receipt_number                             TRX_NUMBER     ,
        cr.org_id                                     ORG_ID,
        decode(mcd.created_from,
               ''RATE ADJUSTMENT TRIGGER'', ''MISC_RECP_RATE_ADJUST'',
               decode(SUBSTRB(mcd.created_from,1,19),
                      ''ARP_REVERSE_RECEIPT'',''MISC_RECP_REVERSE'',
                      decode(nvl(crh.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                             nvl(mcd.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                             decode(crh.posting_control_id,
                                    mcd.posting_control_id, ''MISC_RECP_CREATE'',
                                    ''MISC_RECP_UPDATE''),
                             ''MISC_RECP_UPDATE'')))  OVERRIDE_EVENT,
        mcd.posting_control_id                        PSTID         ,
        nvl(mcd.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')) GL_DATE,
        mcd.event_id                                  EXIST_EVENT,
        ''''                                          EVENT_ID       ,
        to_date(''01-01-1900'',''DD-MM-YYYY'')        ACCOUNTING_DATE,
        ''''                                          EVENT_TYPE     ,
        ''X''                                         EVENT_STATUS,
        cr.receipt_date                               TRANSACTION_DATE,
        cr.legal_entity_id                            LEGAL_ENTITY_ID  ' || CRLF;
Line: 1221

        log('l_select_clause ' || l_select_clause);
Line: 1248

                                    ''MISC_RECP_UPDATE''),
                             ''MISC_RECP_UPDATE''))),
                nvl(mcd.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                mcd.event_id ,
                cr.receipt_date,
                cr.legal_entity_id ' || CRLF;
Line: 1261

                          ''MISC_RECP_UPDATE''     ,2,
                          ''MISC_RECP_RATE_ADJUST'',3,
                          ''MISC_RECP_REVERSE''    ,6,
                          7),
                   GL_DATE,
                   PSTID desc ';
Line: 1269

      log('l_select_clause   = ' || l_select_clause);
Line: 1285

        l_select_clause :=
      ' SELECT mcd.rowid,
               ev1.event_id ';
Line: 1322

      END IF; --create or update mode
Line: 1402

           l_select_clause := l_select_clause         || l_from_clause     || l_where_clause ||
                              l_where_parm_clause_crh || l_group_by_clause || l_union || CRLF;
Line: 1407

      l_select_clause := l_select_clause ||
      ' select
        decode(app.postable,
               ''N'',''N'',
               ''Y'')                                 POSTTOGL       ,
        ''RECP''                                      TRX_TYPE       ,
        decode(NVL(app.confirmed_flag,''Y''),
               ''Y'',''C'',
               ''N'')                                 COMP_FLAG      ,
        cr.cash_receipt_id                            TRX_ID , --BUG#3554871
        cr.receipt_number                             TRX_NUMBER     ,
        cr.org_id                                     ORG_ID         ,
        decode(crh.created_from,
               ''RATE ADJUSTMENT TRIGGER'', ''RECP_RATE_ADJUST'',
               decode(crh.status,
                      ''REVERSED'',''RECP_REVERSE'',
                      decode(crh1.first_posted_record_flag,
                             '''', ''RECP_CREATE'',
                             decode(nvl(app.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                                    nvl(crh1.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                                    decode(app.posting_control_id,
                                           crh1.posting_control_id, ''RECP_CREATE'',
                                           ''RECP_UPDATE''),
                                    ''RECP_UPDATE'')))) OVERRIDE_EVENT,
        app.posting_control_id                                  PSTID  ,
        nvl(app.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')) GL_DATE,
        app.event_id                                  EXIST_EVENT   ,
        ''''                                          EVENT_ID       ,
        to_date(''01-01-1900'',''DD-MM-YYYY'')        ACCOUNTING_DATE,
        ''''                                          EVENT_TYPE     ,
        ''X''                                         EVENT_STATUS   ,
        cr.receipt_date                               TRANSACTION_DATE,
        cr.legal_entity_id                            LEGAL_ENTITY_ID ' || CRLF;
Line: 1484

                                           ''RECP_UPDATE''),
                                    ''RECP_UPDATE'')))),
          nvl(app.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
          app.event_id ,
          cr.receipt_date,
          cr.legal_entity_id' || CRLF;
Line: 1497

                        ''RECP_UPDATE''     ,2,
                        ''RECP_RATE_ADJUST'',3,
                        ''RECP_REVERSE''    ,6,
                        7),
                 GL_DATE,
                 PSTID desc ';
Line: 1512

        l_select_clause :=
      ' SELECT app.rowid,
               ev1.event_id ';
Line: 1516

        log('l_select_clause ' || l_select_clause);
Line: 1562

      END IF; --create or update mode
Line: 1574

           l_select_clause := l_select_clause         || l_from_clause     || l_where_clause ||
                              l_where_parm_clause_crh || l_group_by_clause || l_union || CRLF;
Line: 1578

      l_select_clause := l_select_clause ||
      ' select
        decode(app.postable,
               ''N'',''N'',
               ''Y'')                                 POSTTOGL       ,
        ''CM''                                        TRX_TYPE       ,
        decode(NVL(app.confirmed_flag,''Y''),
               ''Y'',''C'',
               ''N'')                                 COMP_FLAG      ,
        ctlgd.customer_trx_id                         TRX_ID, --BUG#3554871
        ct.trx_number                                 TRX_NUMBER     ,
        app.org_id                                    ORG_ID         ,
        decode(nvl(app.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
               nvl(ctlgd.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                  decode(app.posting_control_id,
                         ctlgd.posting_control_id, ''CM_CREATE'',
                         ''CM_UPDATE''),
               ''CM_UPDATE'')                         OVERRIDE_EVENT ,
        app.posting_control_id                        PSTID          ,
        nvl(app.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')) GL_DATE,
        app.event_id                                  EXIST_EVENT   ,
        ''''                                          EVENT_ID       ,
        to_date(''01-01-1900'',''DD-MM-YYYY'')        ACCOUNTING_DATE,
        ''''                                          EVENT_TYPE     ,
        ''X''                                         EVENT_STATUS   ,
        ct.trx_date                           TRANSACTION_DATE,
        ct.legal_entity_id                            LEGAL_ENTITY_ID  ' || CRLF;
Line: 1637

                             ''CM_UPDATE''),
                      ''CM_UPDATE''),
                nvl(app.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                app.event_id,
                ct.trx_date,
                ct.legal_entity_id ' || CRLF;
Line: 1662

        l_select_clause :=
      ' SELECT app.rowid,
               ev1.event_id ';
Line: 1695

      END IF; --create or update mode
Line: 1747

      l_select_clause :=
      ' select
        tty.post_to_gl                                POSTTOGL       ,
        ''BILL''                                      TRX_TYPE       ,
        decode(trh.status,
               ''INCOMPLETE'', ''I'',
               ''PENDING_ACCEPTANCE'',''I'',
               ''C'')                                 COMP_FLAG      ,
        trh.customer_trx_id                           TRX_ID         ,
        ct.trx_number                                 TRX_NUMBER     ,
        ct.org_id                                     ORG_ID,
        decode(trh.event,
               ''INCOMPLETE''  , ''BILL_CREATE'',
               ''ACCEPTED''    , ''BILL_CREATE'',
               ''COMPLETED''   , decode(trh.status,
                                        ''PENDING_ACCEPTANCE'', ''BILL_CREATE'',
                                        ''PENDING_REMITTANCE'', ''BILL_CREATE'',
                                        ''NO_EVENT''),
               ''CANCELLED''   , ''BILL_REVERSE'',
               decode(trh1.first_posted_record_flag,
                      '''', ''BILL_CREATE'',
                      decode(nvl(trh.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                             nvl(trh1.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY'')),
                                 decode(trh.posting_control_id,
                                        trh1.posting_control_id, ''BILL_CREATE'',
                                        ''BILL_UPDATE''),
                             ''BILL_UPDATE'')))       OVERRIDE_EVENT,
        trh.posting_control_id                        PSTID          ,
        decode(tty.post_to_gl,
               ''N'', to_date(''01-01-1900'',''DD-MM-YYYY''),
               nvl(trh.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY''))) GL_DATE,
        trh.event_id                                  EXIST_EVENT   ,
        ''''                                          EVENT_ID       ,
        to_date(''01-01-1900'',''DD-MM-YYYY'')        ACCOUNTING_DATE,
        ''''                                          EVENT_TYPE     ,
        ''X''                                         EVENT_STATUS   ,
        ct.trx_date                           TRANSACTION_DATE,
        ct.legal_entity_id                            LEGAL_ENTITY_ID ';
Line: 1844

                                        ''BILL_UPDATE''),
                             ''BILL_UPDATE''))),
                decode(tty.post_to_gl,
                       ''N'', to_date(''01-01-1900'',''DD-MM-YYYY''),
                       nvl(trh.gl_date,to_date(''01-01-1900'',''DD-MM-YYYY''))),
                trh.event_id ,
                ct.trx_date,
                ct.legal_entity_id ' || CRLF;
Line: 1867

        l_select_clause :=
      ' SELECT trh.rowid,
               ev1.event_id ';
Line: 1922

      END IF; --create or update mode
Line: 1926

   p_stmt := l_select_clause     ||
             l_from_clause       ||
             l_where_clause      ||
             l_where_parm_clause ||
             l_group_by_clause   ||
             l_order_by_clause   ;
Line: 1947

 |      Define positional place holders in the select list
 |
 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
 |      Get_Select_Cursor
 |
 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
 |
 | PARAMETERS p_select_c   IN  Cursor handle
 |            p_xla_ev_rec IN  Events parameter record
 |            p_ev_rec     IN  Events record
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 *=======================================================================*/
PROCEDURE define_arrays( p_select_c   IN INTEGER,
                         p_xla_ev_rec IN xla_events_type,
                         p_ev_rec     IN ev_rec_type,
                         p_call_point IN NUMBER) IS
BEGIN
    log( 'ARP_XLA_EVENTS.define_arrays()+' );
Line: 1974

       dbms_sql.define_array(p_select_c, 1 , p_ev_rec.posttogl
                                          ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1976

       dbms_sql.define_array(p_select_c, 2 , p_ev_rec.trx_type
                                          ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1978

       dbms_sql.define_array(p_select_c, 3 , p_ev_rec.trx_status
                                          ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1980

       dbms_sql.define_array(p_select_c, 4 , p_ev_rec.trx_id
                                          ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1982

       dbms_sql.define_array(p_select_c, 5 , p_ev_rec.trx_number
                                          ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1984

       dbms_sql.define_array(p_select_c, 6 , p_ev_rec.org_id
                                          ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1986

       dbms_sql.define_array(p_select_c, 7 , p_ev_rec.override_event
                                           , MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1988

       dbms_sql.define_array(p_select_c, 8 , p_ev_rec.pstid
                                          ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1990

       dbms_sql.define_array(p_select_c, 9 , p_ev_rec.dist_gl_date
                                          ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1992

       dbms_sql.define_array(p_select_c, 10, p_ev_rec.ev_match_event_id
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1994

       dbms_sql.define_array(p_select_c, 11 , p_ev_rec.dist_event_id
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1996

       dbms_sql.define_array(p_select_c, 12, p_ev_rec.ev_match_gl_date
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 1998

       dbms_sql.define_array(p_select_c, 13, p_ev_rec.ev_match_type
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 2000

       dbms_sql.define_array(p_select_c, 14, p_ev_rec.ev_match_status
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 2003

       dbms_sql.define_array(p_select_c, 15, p_ev_rec.transaction_date
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 2005

       dbms_sql.define_array(p_select_c, 16, p_ev_rec.legal_entity_id
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 2010

       dbms_sql.define_array(p_select_c, 1 , p_ev_rec.dist_row_id
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 2012

       dbms_sql.define_array(p_select_c, 2 , p_ev_rec.dist_event_id
                                           ,  MAX_ARRAY_SIZE, STARTING_INDEX );
Line: 2029

 |      Gets the values in select list and stores them in the target
 |      event record table variable
 |
 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
 |      Get_Column_Values
 |      Upd_Dist
 |
 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
 |
 | PARAMETERS p_select_c   IN  Cursor handle
 |            p_xla_ev_rec IN  Events parameter record
 |            p_ev_rec     OUT Events record
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 *=======================================================================*/
PROCEDURE get_column_values(p_select_c   IN  INTEGER,
                            p_xla_ev_rec IN xla_events_type,
                            p_call_point IN NUMBER,
                            p_ev_rec     OUT NOCOPY ev_rec_type) IS
BEGIN
    log('ARP_XLA_EVENTS.get_column_values (+)');
Line: 2057

       dbms_sql.column_value(p_select_c, 1 , p_ev_rec.posttogl);
Line: 2058

       dbms_sql.column_value(p_select_c, 2 , p_ev_rec.trx_type);
Line: 2059

       dbms_sql.column_value(p_select_c, 3 , p_ev_rec.trx_status);
Line: 2060

       dbms_sql.column_value(p_select_c, 4 , p_ev_rec.trx_id);
Line: 2061

       dbms_sql.column_value(p_select_c, 5 , p_ev_rec.trx_number);
Line: 2062

       dbms_sql.column_value(p_select_c, 6 , p_ev_rec.org_id);
Line: 2063

       dbms_sql.column_value(p_select_c, 7 , p_ev_rec.override_event);
Line: 2064

       dbms_sql.column_value(p_select_c, 8 , p_ev_rec.pstid);
Line: 2065

       dbms_sql.column_value(p_select_c, 9 , p_ev_rec.dist_gl_date);
Line: 2066

       dbms_sql.column_value(p_select_c, 10 , p_ev_rec.dist_event_id);
Line: 2067

       dbms_sql.column_value(p_select_c, 11, p_ev_rec.ev_match_event_id);
Line: 2068

       dbms_sql.column_value(p_select_c, 12, p_ev_rec.ev_match_gl_date);
Line: 2069

       dbms_sql.column_value(p_select_c, 13, p_ev_rec.ev_match_type);
Line: 2070

       dbms_sql.column_value(p_select_c, 14, p_ev_rec.ev_match_status);
Line: 2072

       dbms_sql.column_value(p_select_c, 15, p_ev_rec.transaction_date);
Line: 2073

       dbms_sql.column_value(p_select_c, 16, p_ev_rec.legal_entity_id);
Line: 2076

       dbms_sql.column_value(p_select_c, 1 , p_ev_rec.dist_row_id);
Line: 2077

       dbms_sql.column_value(p_select_c, 2 , p_ev_rec.dist_event_id);
Line: 2085

 | PUBLIC PROCEDURE Get_Select_Cursor
 |
 | DESCRIPTION
 |      Builds Select statement, opens cursor, parses it, defines place
 |      holders for select list, binds variables and returns a cursor
 |      handle.
 |
 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
 |      Upd_Dist
 |
 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
 |
 | PARAMETERS p_xla_ev_rec IN Events parameter record
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 *=======================================================================*/
FUNCTION Get_Select_Cursor(p_xla_ev_rec IN xla_events_type,
                           p_call_point IN NUMBER) RETURN INTEGER IS

l_select_c INTEGER;
Line: 2115

   log('ARP_XLA_EVENTS.Get_Select_Cursor ()+');
Line: 2123

   l_select_c := dbms_sql.open_cursor;
Line: 2125

   log('Parsing select stmt');
Line: 2127

   dbms_sql.parse(l_select_c, l_stmt, dbms_sql.v7);
Line: 2133

   define_arrays(p_select_c   => l_select_c,
                 p_xla_ev_rec => p_xla_ev_rec,
                 p_ev_rec     => l_ev_rec,
                 p_call_point => p_call_point);
Line: 2143

      dbms_sql.bind_variable(l_select_c, ':b_xla_mode', p_xla_ev_rec.xla_mode);
Line: 2148

     dbms_sql.bind_variable(l_select_c, ':b_xla_from_doc_id', p_xla_ev_rec.xla_from_doc_id);
Line: 2153

     dbms_sql.bind_variable(l_select_c, ':b_xla_to_doc_id', p_xla_ev_rec.xla_to_doc_id);
Line: 2158

     dbms_sql.bind_variable(l_select_c, ':b_xla_req_id', p_xla_ev_rec.xla_req_id);
Line: 2163

     dbms_sql.bind_variable(l_select_c, ':b_xla_dist_id', p_xla_ev_rec.xla_dist_id);
Line: 2166

   log('ARP_XLA_EVENTS.Get_Select_Cursor (-)');
Line: 2168

   return(l_select_c);
Line: 2172

     log('EXCEPTION: ARP_XLA_EVENTS.Get_Select_Cursor:'||SQLERRM);
Line: 2175

END Get_Select_Cursor;
Line: 2181

 |      Creates, updates and deletes events for the transactions
 |      INV, DM, CM, CB, GUAR, DEP
 |
 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
 |      Execute
 |
 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
 |
 | PARAMETERS
 |      p_xla_ev_rec IN xla_events_type
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 | 10-SEP-2003           Herve Yu
 |          Use the set_of_books_id for now as the ledger_id bug#3135769
 |          we might need to come back on this point later after the uptake
 |          of ledger architecture project.
 *=======================================================================*/
PROCEDURE Create_All_Events(p_xla_ev_rec IN xla_events_type) IS

/*---------------------------------------------------------------------+
 | Main cursor which gets transaction data, and event data for decision|
 | making on which events require to be created, updated or deleted.   |
 +---------------------------------------------------------------------*/
TYPE get_tran_data_type IS REF CURSOR;
Line: 2213

l_select_c BINARY_INTEGER;
Line: 2276

 SELECT 'X'
   FROM xla_events_int_gt
  WHERE entity_id IS NULL;
Line: 2306

   l_select_c := Get_Select_Cursor(p_xla_ev_rec => p_xla_ev_rec,
                                   p_call_point => 1);
Line: 2309

   l_ignore   := dbms_sql.execute( l_select_c );
Line: 2311

   log( 'Fetching select stmt');
Line: 2342

      l_rows_fetched := dbms_sql.fetch_rows(l_select_c);
Line: 2355

         get_column_values(p_select_c   => l_select_c,
                           p_xla_ev_rec => p_xla_ev_rec,
                           p_ev_rec     => ev_rec,
                           p_call_point => 1);
Line: 2364

            IF( dbms_sql.is_open( l_select_c) ) THEN
                dbms_sql.close_cursor( l_select_c );
Line: 2373

          IF( dbms_sql.is_open( l_select_c ) ) THEN
                dbms_sql.close_cursor( l_select_c );
Line: 2389

      log('Number of rows selected : '|| ev_rec.trx_id.COUNT);
Line: 2424

             select ae.event_id         ,
                    ae.event_date       ,
                    ae.event_status_code,
                    ae.event_type_code
             into   ev_rec.ev_match_event_id(i) ,
                    ev_rec.ev_match_gl_date(i)  ,
                    ev_rec.ev_match_status(i)   ,
                    ev_rec.ev_match_type(i)
             from xla_events ae
             where ev_rec.dist_event_id(i) = ae.event_id;
Line: 2465

                'INV_UPDATE','DM_UPDATE','DEP_UPDATE','CB_UPDATE','CM_UPDATE','GUAR_UPDATE')
               THEN
		  select ae2.event_id         ,
			 ae2.event_date       ,
			 ae2.event_status_code,
			 ae2.event_type_code
		  into   ev_rec.ev_match_event_id(i) ,
			 ev_rec.ev_match_gl_date(i)  ,
			 ev_rec.ev_match_status(i)   ,
			 ev_rec.ev_match_type(i)
		  from xla_events ae2
		  where ae2.application_id = 222
		  and ae2.event_id IN
                  ( select MAX( ae.event_id )
                    from xla_events                   ae,
                         xla_transaction_entities_upg xt,
                         ra_customer_trx_all          trx
                    where trx.customer_trx_id         = ev_rec.trx_id(i)
                      and NVL(xt.source_id_int_1,-99) = trx.customer_trx_id
                      and xt.entity_code              = 'TRANSACTIONS'
                      and xt.ledger_id                = trx.set_of_books_id
                      and xt.entity_id                = ae.entity_id
                      and xt.application_id           = 222
                      and ae.application_id           = 222
                      and nvl(ae.event_date,
                            to_date('01-01-1900','DD-MM-YYYY')) = ev_rec.dist_gl_date(i)
                      and ae.event_status_code <> 'P'
		      and ae.event_type_code  IN
		         ('INV_CREATE','DM_CREATE','DEP_CREATE','CB_CREATE','CM_CREATE','GUAR_CREATE',
                          'INV_UPDATE','DM_UPDATE','DEP_UPDATE','CB_UPDATE','CM_UPDATE','GUAR_UPDATE')
		   )
		  FOR UPDATE OF ae2.event_id NOWAIT;
Line: 2499

               ('BILL_CREATE','BILL_UPDATE','BILL_REVERSE')
               THEN
		  select ae2.event_id         ,
			 ae2.event_date       ,
			 ae2.event_status_code,
			 ae2.event_type_code
		  into   ev_rec.ev_match_event_id(i) ,
			 ev_rec.ev_match_gl_date(i)  ,
			 ev_rec.ev_match_status(i)   ,
			 ev_rec.ev_match_type(i)
		  from xla_events ae2
		  where ae2.application_id = 222
		  and ae2.event_id IN
                  ( select MAX( ae.event_id )
                    from xla_events                   ae,
                         xla_transaction_entities_upg xt,
                         ra_customer_trx_all          trx
                    where trx.customer_trx_id         = ev_rec.trx_id(i)
                      and NVL(xt.source_id_int_1,-99) = trx.customer_trx_id
                      and xt.entity_code              = 'BILLS_RECEIVABLE'
                      and xt.ledger_id                = trx.set_of_books_id
                      and xt.entity_id                = ae.entity_id
                      and xt.application_id           = 222
                      and ae.application_id           = 222
                      and nvl(ae.event_date,
                            to_date('01-01-1900','DD-MM-YYYY')) = ev_rec.dist_gl_date(i)
                      and ae.event_status_code <> 'P'
                      and ev_rec.override_event(i) = ae.event_type_code )
		  FOR UPDATE OF ae2.event_id NOWAIT;
Line: 2531

                   ('RECP_CREATE','RECP_RATE_ADJUST','RECP_UPDATE','RECP_REVERSE',
                    'MISC_RECP_CREATE','MISC_RECP_RATE_ADJUST','MISC_RECP_UPDATE','MISC_RECP_REVERSE')
               THEN
		  select ae2.event_id         ,
			 ae2.event_date       ,
			 ae2.event_status_code,
			 ae2.event_type_code
		  into   ev_rec.ev_match_event_id(i) ,
			 ev_rec.ev_match_gl_date(i)  ,
			 ev_rec.ev_match_status(i)   ,
			 ev_rec.ev_match_type(i)
		  from xla_events ae2
		  where ae2.application_id = 222
		  and ae2.event_id IN
                  ( select MAX( ae.event_id )
                    from xla_events                   ae,
                         xla_transaction_entities_upg xt,
                         ar_Cash_receipts_all         cr
                    where cr.cash_receipt_id          = ev_rec.trx_id(i)
                      and NVL(xt.source_id_int_1,-99) = cr.cash_receipt_id
                      and xt.entity_code              = 'RECEIPTS'
                      and xt.ledger_id                = cr.set_of_books_id
                      and xt.entity_id                = ae.entity_id
                      and xt.application_id           = 222
                      and ae.application_id           = 222
                      and nvl(ae.event_date,
                            to_date('01-01-1900','DD-MM-YYYY')) = ev_rec.dist_gl_date(i)
                      and ae.event_status_code <> 'P'
                      and DECODE(ev_rec.override_event(i),
		                  'RECP_CREATE',      ae.event_type_code,
				  'MISC_RECP_CREATE', ae.event_type_code,
                                 ev_rec.override_event(i) ) = ae.event_type_code )
		  FOR UPDATE OF ae2.event_id NOWAIT;
Line: 2566

		  select ae2.event_id         ,
			 ae2.event_date       ,
			 ae2.event_status_code,
			 ae2.event_type_code
		  into   ev_rec.ev_match_event_id(i) ,
			 ev_rec.ev_match_gl_date(i)  ,
			 ev_rec.ev_match_status(i)   ,
			 ev_rec.ev_match_type(i)
		  from xla_events ae2
		  where ae2.application_id = 222
		  and ae2.event_id IN
                  ( select MAX( ae.event_id )
                    from xla_events                   ae,
                         xla_transaction_entities_upg xt,
                         ar_adjustments_all           adj
                    where adj.adjustment_id           = ev_rec.trx_id(i)
                      and NVL(xt.source_id_int_1,-99) = adj.adjustment_id
                      and xt.entity_code              = 'ADJUSTMENTS'
                      and xt.ledger_id                = adj.set_of_books_id
                      and xt.entity_id                = ae.entity_id
                      and xt.application_id           = 222
                      and ae.application_id           = 222
                      and nvl(ae.event_date,
                            to_date('01-01-1900','DD-MM-YYYY')) = ev_rec.dist_gl_date(i)
                      and ae.event_status_code <> 'P'
                      and ev_rec.override_event(i) = ae.event_type_code )
		  FOR UPDATE OF ae2.event_id NOWAIT;
Line: 2617

		      process continue and create a new event of type UPDATE.

		      This code flow gets triggered only in cases where the concerned document already
		      has an event of type CREATE,will explictly override the event_type_code with
		      that of event type UPDATE to ensure that there exist only one event of type CREATE
		      for given document*/
		      IF SQLCODE = -54 THEN
			ev_rec.override_event(i) :=
			            CASE ev_rec.override_event(i)
					 WHEN 'INV_CREATE'       THEN 'INV_UPDATE'
					 WHEN 'DM_CREATE'        THEN 'DM_UPDATE'
					 WHEN 'DEP_CREATE'       THEN 'DEP_UPDATE'
					 WHEN 'CB_CREATE'        THEN 'CB_UPDATE'
					 WHEN 'CM_CREATE'        THEN 'CM_UPDATE'
					 WHEN 'GUAR_CREATE'      THEN 'GUAR_UPDATE'
					 WHEN 'RECP_CREATE'      THEN 'RECP_UPDATE'
					 WHEN 'MISC_RECP_CREATE' THEN 'MISC_RECP_UPDATE'
                                    END;
Line: 2663

      |need to figure out what the previous event insert did is to make  |
      |a decision as regards the construction of the event type as Create|
      |or modify.                                                        |
      +------------------------------------------------------------------*/

       l_change_matrix := Change_Matrix(
                       ev_rec.trx_status(i)             ,
                       ev_rec.dist_gl_date(i)           ,
                       ev_rec.ev_match_gl_date(i)       ,
                       ev_rec.ev_match_status(i)        ,
                       ev_rec.posttogl(i));
Line: 2703

      |After the Bulk Insert and Updates to Events table.         |
      |Latching occurs in the end.                                |
      +-----------------------------------------------------------*/
       /* IF ((NOT ev_match_flg)
           AND (l_change_matrix IN (1.01,1.03,1.07,1.09,1.13,1.14,
                                    1.16,1.17))) THEN  */
         /*------------------------------------------------+
          |Latching is implicit to ev_rec.ev_event_id for  |
          |Update or ev_rec.ev_temp_event_id for Insert    |
          |for all above change matrix values not in the   |
          |IF construct below. For others explicit latching|
          +------------------------------------------------*/
           /* IF (l_change_matrix IN (1.01, 1.09, 1.13, 1.17)) THEN
              ev_rec.dist_event_id(i) := ev_rec.ev_match_event_id(i);
Line: 2730

      | GLDate needs to be updated on that event.               |
      | Typically when a invoice with rules arrear has some     |
      | new lines entered then the transaction only has modal   |
      | REC distributions but the GLDate will be set the last   |
      | FORECASt REV_RECOGNITION date.                          |
      +---------------------------------------------------------*/
      l_revrun  := 'X';
Line: 2749

      |Update existing Event                                    |
      |Matrix  - Dist    - Description                          |
      |          Event                                          |
      |1.02    - T       - Update event gl date                 |
      |1.03    - T, F    - Update Status = Incomplete           |
      |1.04    - T       - Update gl date, Status = Incomplete  |
      |1.07    - T,F     - Update Status = Unprocessed          |
      |1.08    - T       - Update gl date, Status = Unprocessed |
      |1.10    - T       - Update gl date                       |
      |1.14    - T,F     - Status = Incomplete                  |
      |1.16    - T,F     - Status = Unprocessed                 |
      |1.08    - F       - Update gl date, Status = Unprocesse  |
      |                    if Acct_asg created for one line     |
      |1.02    - F       - Update gl date if ACT_ASG created    |
      |1.04    - F       - Update gl date if ACT_ASG created    |
      |1.10    - F       - Update gl date if ACT_ASG created    |
      |1.09    - T       - For the case of cleaning events      |
      |                    when update REV_REC event GL Dates.  |
      |1.23    -T,F      - Update of a postable trx to be       |
      |                    unpostable Bug#3320427               |
      |1.22    -T,F      - Update of a unpostable trx to be     |
      |                    postable Bug#3320427                 |
      +---------------------------------------------------------*/
      --BUG#3999572
      IF (l_change_matrix IN   ('1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.23'))
      THEN       NULL;
Line: 2793

          log('Entered Update Built event construct ');
Line: 2821

           | Typically this can happens when user update the GL_Date on a inv   |
           | with rules on which REV_RECOGNITION has run. In this case the      |
           | the xla_events table contains multiple REV_RECOGNITION events with |
           | different GLDate, when user updates the GL Date on the header      |
           | of the document, the GLDates for all the distributions related     |
           | to that document are updated to the new GLDate.                    |
           | In this case, we need :                                            |
           |  Reset the event_id of the distributions to NULL.                  |
           |  Conserve only one event of one type and a GLDate.                 |
           |  The denormalise mode should restamped the distributions with the  |
           |  correct event_id.                                                 |
           +--------------------------------------------------------------------*/
           keep_flag := TRUE;
Line: 2877

                  xla_events_pub_pkg.delete_event
                  ( p_event_source_info   => l_event_source_info,
                    p_event_id            => ev_rec.ev_match_event_id(i),
                    p_valuation_method    => NULL,
                    p_security_context    => l_security_context);
Line: 2887

                END IF; --event needs to be deleted
Line: 2893

        END IF;--if OLTP then check whether existing events need to be deleted
Line: 2933

       END IF; --Update event condition
Line: 2951

               log('Building an Event in Insert new' ||
                                  ' event construct ');
Line: 3023

               |cell needs to be populated for update, so make sure|
               |contiguous null cell is created.                   |
               +---------------------------------------------------*/
                bld_ev_ent(l_build_ctr).event_id := '';
Line: 3041

       END IF; --Insert event condition
Line: 3080

      |May be in update construct above.                   |
      +----------------------------------------------------*/

     /*---------------------------------------------------------+
      |Add an event to the events cache table for the current   |
      |transaction being processed. Get the hash index using    |
      |hash function and ascertain if the event has been cached |
      +---------------------------------------------------------*/

     /*-----------------------------------------------------------+
      |Set the previous row id of the distribution and trx id     |
      |used to reinitialize caches or skip processing duplicate   |
      |rows.                                                      |
      +-----------------------------------------------------------*/
       --prev_distid  := ev_rec.dist_id(i); same dist is not reprocessed
Line: 3102

   |Call the xla events api passing it the tables for Bulk Insert, Update|
   |On return for inserted rows, the event_id will be returned and the   |
   |distributions will be updated with this event id using the temp event|
   |id which will ascertain the mapping of internal id's to actual ids   |
   |for a distribution.To be replaced by call to xla events api commit   |
   |issued by owning product.                                            |
   +---------------------------------------------------------------------*/

  /*-------------------------------------------------------------+
   | Insert into Events table, to be replaced with XLA apis      |
   +-------------------------------------------------------------*/

    IF p_xla_ev_rec.xla_mode IN ('U','B') AND test_flag = 'N' THEN

       log('xla_events_pub_pkg.create_bulk_events xla_mode IN (U,B)');
Line: 3140

           INSERT INTO xla_events_int_gt (
               APPLICATION_ID
             , LEGAL_ENTITY_ID
             , LEDGER_ID
             , ENTITY_CODE
             , TRANSACTION_NUMBER
             , SOURCE_ID_INT_1
             , EVENT_TYPE_CODE
             , EVENT_STATUS_CODE
             , EVENT_DATE
             , SECURITY_ID_INT_1
             , TRANSACTION_DATE     )
            VALUES   (
               222
             , bld_ev_ent(m).reference_num_1         -- LEGAL_ENTITY_ID
             , arp_standard.sysparm.set_of_books_id  -- LEDGER_ID
             , l_entity_code                         -- ENTITY_CODE
             , bld_ev_ent(m).transaction_number      -- TRANSACTION_NUMBER
             , bld_ev_ent(m).source_id_int_1         -- SOURCE_ID_INT_1
             , bld_ev_ent(m).event_type_code         -- EVENT_TYPE_CODE
             , bld_ev_ent(m).event_status_code       -- EVENT_STATUS_CODE
             , bld_ev_ent(m).event_date              -- EVENT_DATE
             , bld_ev_ent(m).security_id_int_1       -- SECURITY_ID_INT_1
             , bld_ev_ent(m).transaction_date);      -- TRANSACTION_DATE
Line: 3172

   |Bulk update the distributions already existing in the Database|
   |with the modified gl date or status, if unchanged these should|
   |retain their default original values in the assignments below.|
   +--------------------------------------------------------------*/

    IF    p_xla_ev_rec.xla_mode = 'O'
	--{Work around waiting for bulk mode
--       OR p_xla_ev_rec.xla_mode = 'B'
    --}
	THEN

       IF bld_ev_ent.COUNT > 0 THEN

         FOR m IN bld_ev_ent.FIRST .. bld_ev_ent.LAST LOOP

     /*----------------------------------------------------------+
      |Set the event source details                              |
      +----------------------------------------------------------*/
        l_event_source_info.application_id       := 222;
Line: 3233

             log('XLA_EVENTS_PUB_PKG.update_event');
Line: 3241

              XLA_EVENTS_PUB_PKG.update_event(
                 p_event_source_info => l_event_source_info             ,
                 p_event_id          => bld_ev_ent(m).event_id          ,
                 p_event_type_code   => bld_ev_ent(m).event_type_code   ,
                 p_event_date        => bld_ev_ent(m).event_date        ,
                 p_event_status_code => bld_ev_ent(m).event_status_code ,
                 p_valuation_method  => ''                              ,
                 p_security_context  => l_security_context               );
Line: 3257

		SELECT a.transaction_number INTO trxn_number
		FROM   xla_transaction_entities_upg a,
		       xla_events b
		WHERE  NVL(a.source_id_int_1,-99) = bld_ev_ent(m).source_id_int_1
		AND    b.event_id  = bld_ev_ent(m).event_id
	        AND    a.entity_id = b.entity_id
		AND    a.security_id_int_1 = bld_ev_ent(m).security_id_int_1
		AND    a.application_id = 222;
Line: 3268

	     log('EXCEPTION: XLA TRANSACTION NUMBER UPDATE');
Line: 3274

	      XLA_EVENTS_PUB_PKG.UPDATE_TRANSACTION_NUMBER(
		 p_event_source_info   =>   l_event_source_info,
		 p_transaction_number  =>   bld_ev_ent(m).transaction_number,
		 p_valuation_method    =>   '',
		 p_security_context    =>   l_security_context ,
		 p_event_id            =>   bld_ev_ent(m).event_id );
Line: 3282

        END IF; --end insert or update events in OLTP mode
Line: 3291

   |Denormalize the event id which has been inserted into the |
   |database, and update the event id column in the dist table|
   |This denormalization is used by the extract process.      |
   |The internal negative id i.e. temp_event_id is used to    |
   |ascertain as to which event.                              |
   +----------------------------------------------------------*/
 --Only used for upgrade
    IF p_xla_ev_rec.xla_mode = 'U' THEN
       Commit;
Line: 3318

         DELETE from xla_events_int_gt WHERE entity_id IS NOT NULL;
Line: 3325

   |Bulk update the distributions event ids with the newly created|
   |event ids as part of the mark transaction data associated with|
   |the event.                                                    |
   +--------------------------------------------------------------*/

<>
   log('ARP_XLA_EVENTS.Create_All_Events ()-');
Line: 3380

      UPDATE ra_cust_trx_line_gl_dist
         SET event_id = NULL
       WHERE event_id = p_event_id;
Line: 3386

      UPDATE ar_cash_receipt_history
         SET event_id = NULL
       WHERE event_id = p_event_id;
Line: 3392

      UPDATE ar_adjustments
         SET event_id = NULL
       WHERE event_id = p_event_id;
Line: 3398

      UPDATE ar_receivable_applications
         SET event_id = NULL
       WHERE event_id = p_event_id;
Line: 3404

      UPDATE ar_misc_cash_distributions
         SET event_id = NULL
       WHERE event_id = p_event_id;
Line: 3410

      UPDATE ar_transaction_history
         SET event_id = NULL
       WHERE event_id = p_event_id;
Line: 3467

   SELECT 'Y'
     FROM ra_customer_trx_lines ctl
    WHERE ctl.customer_trx_id = p_invoice_id
      AND ctl.line_type = 'LINE'
      AND NVL(ctl.autorule_complete_flag,'Y') <> 'N';
Line: 3536

l_select_c   INTEGER;
Line: 3543

l_last_updated_by    NUMBER := arp_standard.profile.user_id;
Line: 3544

l_last_update_login  NUMBER := arp_standard.profile.last_update_login;
Line: 3554

   l_select_c := Get_Select_Cursor(p_xla_ev_rec => p_xla_ev_rec,
                                   p_call_point => 2);
Line: 3557

   l_ignore   := dbms_sql.execute(l_select_c);
Line: 3559

   log( 'Fetching select stmt');
Line: 3566

      l_rows_fetched := dbms_sql.fetch_rows(l_select_c);
Line: 3579

         get_column_values(p_select_c   => l_select_c,
                           p_xla_ev_rec => p_xla_ev_rec,
                           p_ev_rec     => ev_rec,
                           p_call_point => 2);
Line: 3588

            IF( dbms_sql.is_open( l_select_c) ) THEN
                dbms_sql.close_cursor( l_select_c );
Line: 3597

          IF( dbms_sql.is_open( l_select_c ) ) THEN
                dbms_sql.close_cursor( l_select_c );
Line: 3605

      log('Commence bulk update processing');
Line: 3615

	   UPDATE ra_cust_trx_line_gl_dist_all ctlgd
           SET ctlgd.event_id          = ev_rec.dist_event_id(m),
               ctlgd.last_update_date  = TRUNC(SYSDATE),
               ctlgd.last_update_login = l_last_update_login,
               ctlgd.last_updated_by   = l_last_updated_by
           WHERE ctlgd.rowid = ev_rec.dist_row_id(m);
Line: 3627

           UPDATE ar_adjustments_all           adj
           SET adj.event_id            = ev_rec.dist_event_id(m),
               adj.last_update_date    = TRUNC(SYSDATE),
               adj.last_update_login   = l_last_update_login,
               adj.last_updated_by     = l_last_updated_by
           WHERE adj.rowid = ev_rec.dist_row_id(m);
Line: 3639

	   UPDATE ar_cash_receipt_history_all  crh
           SET crh.event_id            = ev_rec.dist_event_id(m),
               crh.last_update_date    = TRUNC(SYSDATE),
               crh.last_update_login   = l_last_update_login,
               crh.last_updated_by     = l_last_updated_by
           WHERE crh.rowid = ev_rec.dist_row_id(m);
Line: 3651

	   UPDATE ar_misc_cash_distributions_all mcd
           SET mcd.event_id            = ev_rec.dist_event_id(m),
               mcd.last_update_date    = TRUNC(SYSDATE),
               mcd.last_update_login   = l_last_update_login,
               mcd.last_updated_by     = l_last_updated_by
           WHERE mcd.rowid = ev_rec.dist_row_id(m);
Line: 3665

	   UPDATE ar_receivable_applications_all app
           SET app.event_id            = ev_rec.dist_event_id(m),
               app.last_update_date    = TRUNC(SYSDATE),
               app.last_update_login   = l_last_update_login,
               app.last_updated_by     = l_last_updated_by
           WHERE app.rowid = ev_rec.dist_row_id(m);
Line: 3677

	   UPDATE ar_transaction_history_all trh
           SET trh.event_id            = ev_rec.dist_event_id(m),
               trh.last_update_date    = TRUNC(SYSDATE),
               trh.last_update_login   = l_last_update_login,
               trh.last_updated_by     = l_last_updated_by
           WHERE trh.rowid = ev_rec.dist_row_id(m);
Line: 3819

 |      Decision matix which returns a number stating whether an update,
 |      insert or latch to an event is required.
 |
 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
 |      Execute
 |
 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
 |
 | PARAMETERS
 |       trx_status        IN Transaction status
 |       dist_gl_date      IN gldate of distribution
 |       ev_match_gl_date  IN matching or existing event accountin date
 |       ev_match_status   IN event status
 |       post_to_gl        IN post to Gl
 |
 | KNOWN ISSUES
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 |
 *=======================================================================*/
FUNCTION Change_Matrix(trx_status        IN VARCHAR2                   ,
                       dist_gl_date      IN DATE                       ,
                       ev_match_gl_date  IN DATE                       ,
                       ev_match_status   IN xla_events.event_status_code%TYPE,
                       posttogl          IN VARCHAR2) RETURN VARCHAR2 IS

l_change_matrix VARCHAR2(30);
Line: 4250

 | PUBLIC FUNCTION delete_event
 |
 | DESCRIPTION
 |   This procedure is a wrapper on the top of XLA delete_event API
 |
 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
 |
 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
 |
 | PARAMETERS
 |   p_document_id         document identifier
 |   p_doc_table           CT, APP, CMAPP, CRH, CR, ADJ, TRH
 | KNOWN ISSUES
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 | Date                  Author            Description of Changes
 | 14-JAN-2003           Herve Yu          Create
 *=======================================================================*/
PROCEDURE delete_event( p_document_id  IN NUMBER,
                        p_doc_table    IN VARCHAR2)
IS
  l_event_source_info xla_events_pub_pkg.t_event_source_info;
Line: 4282

  select xe.event_id event_id from
  ra_customer_trx ct,
  xla_transaction_entities_upg xte,
  xla_events xe
  where  ct.customer_trx_id  =  p_document_id
  and    ct.invoicing_rule_id in (-2,-3)
  and    ct.set_of_books_id  = xte.ledger_id
  and    nvl(xte.source_id_int_1,-99) = ct.customer_trx_id
  and    xte.entity_code     = 'TRANSACTIONS'
  and    xte.application_id  = 222
  and    xte.entity_id       = xe.entity_id
  and    xe.application_id   = 222
  and    xe.event_status_code  = 'I' ;
Line: 4297

  SELECT event_id
    FROM ra_cust_trx_line_gl_dist
   WHERE customer_trx_id = p_document_id;
Line: 4302

  SELECT event_id
    FROM ar_receivable_applications
   WHERE receivable_application_id = p_document_id;
Line: 4307

  SELECT event_id
    FROM ar_adjustments
   WHERE adjustment_id = p_document_id;
Line: 4312

  SELECT event_id
    FROM ar_cash_receipt_history
   WHERE cash_receipt_id = p_document_id;
Line: 4317

  SELECT event_id, customer_trx_id
    FROM ar_transaction_history
   WHERE transaction_history_id = p_document_id;
Line: 4322

    log('arp_xla_events.delete_event ()+');
Line: 4330

    select invoicing_rule_id into l_invoicing_rule_id  from ra_customer_trx
    where customer_trx_id =  p_document_id;
Line: 4364

      xla_events_pub_pkg.delete_event
      ( p_event_source_info => l_event_source_info,
        p_event_id          => l_event_id,
        p_valuation_method  => NULL,
        p_security_context  => l_security);
Line: 4371

    log('arp_xla_events.delete_event ()-');
Line: 4374

  log('EXCEPTION: arp_xla_events.delete_event'||SQLERRM);
Line: 4376

END delete_event;
Line: 4380

 | PUBLIC FUNCTION delete_reverse_revrec_event
 |
 | DESCRIPTION
 |   This procedure is a wrapper on the top of XLA delete_event API.
 |   This procedure is used to delete the events from xla_events
 |   other than the REC event when a transaction with rule is incompleted.
 |
 | CALLED FROM PROCEDURES/FUNCTIONS (local to this package body)
 |
 | CALLS PROCEDURES/FUNCTIONS (local to this package body)
 |
 | PARAMETERS
 |   p_document_id         document identifier
 |   p_doc_table           CT, APP, CMAPP, CRH, CR, ADJ, TRH
 | KNOWN ISSUES
 |
 | NOTES
 |
 | MODIFICATION HISTORY
 | Date                  Author             Description of Changes
 | 07-Mar-2008           Bharani Suri        Create
 *=======================================================================*/


PROCEDURE delete_reverse_revrec_event( p_document_id  IN NUMBER,
                                       p_doc_table    IN VARCHAR2)
IS

  l_event_source_info xla_events_pub_pkg.t_event_source_info;
Line: 4414

   SELECT  distinct event_id  event_id
   FROM ra_cust_trx_line_gl_dist gld
   WHERE customer_trx_id = p_document_id
   and  account_set_flag = 'N'
   AND  event_id is not null
   and   EXISTS
         ( select 'x' FROM ra_cust_trx_line_gl_dist gldin
           WHERE customer_trx_id = p_document_id
   	    and account_class='REC'
	    and  latest_rec_flag='Y'
	    AND  event_id IS NOT NULL
	    AND  event_id <> gld.event_id
         );
Line: 4430

    log('arp_xla_events.delete_reverse_revrec_event ()+');
Line: 4442

      xla_events_pub_pkg.delete_event
      ( p_event_source_info => l_event_source_info,
        p_event_id          => l_event_id,
        p_valuation_method  => NULL,
        p_security_context  => l_security);
Line: 4450

     log('arp_xla_events.delete_reverse_revrec_event ()-');
Line: 4453

  log('EXCEPTION: arp_xla_events.delete_reverse_revrec_event'||SQLERRM);
Line: 4455

END delete_reverse_revrec_event;
Line: 4492

    INSERT INTO RA_INTERFACE_ERRORS
     ( interface_line_id,
       message_text,
       org_id )
     select l.interface_line_id,
            xgt.error_msg,
            l.org_id
     from   ra_interface_lines_gt l,
            xla_events_gt         xgt
     where  l.request_id         = p_request_id
     and    l.customer_trx_id    = xgt.source_id_int_1
     and    l.event_id           = -9999
	 and    xgt.event_class_code in ('INV_CREATE','DM_CREATE','CM_CREATE','ADJ_CREATE');
Line: 4506

    INSERT INTO RA_INTERFACE_ERRORS
     ( interface_line_id,
       message_text,
       org_id )
     select l.interface_line_id,
            xgt.error_msg,
            l.org_id
     from   ra_interface_lines_gt l,
            xla_events_gt         xgt
     where  l.request_id         = p_request_id
     and    l.customer_trx_id    = xgt.source_id_int_1
     and    l.event_id           = -9999
	 and    xgt.event_class_code in ('CM_CREATE')
	 and    l.interface_line_id NOT IN (SELECT interface_line_id FROM RA_INTERFACE_ERRORS);