DBA Data[Home] [Help]

APPS.FUN_RECIPIENT_WF SQL Statements

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

Line: 26

 * PRIVATE PROCEDURE delete_trx_batch
 * ----------------------------------------------------
 * Lock and delete a transaction. And if that is
 * the last transaction in the batch, then delete the
 * batch too.
 * ---------------------------------------------------*/

PROCEDURE delete_trx_batch (
    p_batch_id    IN number,
    p_trx_id      IN number)
IS
    l_n_trx     number;
Line: 40

    SELECT batch_id INTO l_n_trx
    FROM fun_trx_batches
    WHERE batch_id = p_batch_id
    FOR UPDATE;
Line: 45

    SELECT COUNT(h.trx_id) INTO l_n_trx
    FROM fun_trx_batches b,
         fun_trx_headers h
    WHERE h.batch_id = b.batch_id AND
          b.batch_id = p_batch_id;
Line: 51

    DELETE FROM fun_dist_lines
    WHERE line_id IN
        ( SELECT line_id
          FROM fun_trx_lines
          WHERE trx_id = p_trx_id );
Line: 57

    DELETE FROM fun_trx_lines
    WHERE trx_id = p_trx_id;
Line: 60

    DELETE FROM fun_trx_headers
    WHERE trx_id = p_trx_id;
Line: 65

        DELETE FROM fun_trx_batches
        WHERE batch_id = p_batch_id;
Line: 69

END delete_trx_batch;
Line: 83

    SELECT batch_id, batch_number, initiator_id,
           from_le_id, from_ledger_id, control_total,
           currency_code, exchange_rate_type, status,
           description, trx_type_id, trx_type_code,
           gl_date, batch_date, reject_allow_flag,
           from_recurring_batch_id
    INTO l_rec.batch_id, l_rec.batch_number, l_rec.initiator_id,
         l_rec.from_le_id, l_rec.from_ledger_id, l_rec.control_total,
         l_rec.currency_code, l_rec.exchange_rate_type, l_rec.status,
         l_rec.description, l_rec.trx_type_id, l_rec.trx_type_code,
         l_rec.gl_date, l_rec.batch_date, l_rec.reject_allowed,
         l_rec.from_recurring_batch
    FROM fun_trx_batches
    WHERE batch_id = p_batch_id;
Line: 114

    SELECT trx_id, initiator_id, recipient_id,
           to_le_id, to_ledger_id, batch_id,
           status, init_amount_cr, init_amount_dr,
           reci_amount_cr, reci_amount_dr, ar_invoice_number,
           invoice_flag, approver_id, approval_date,
           original_trx_id, reversed_trx_id, from_recurring_trx_id,
           initiator_instance_flag, recipient_instance_flag
    INTO l_rec.trx_id, l_rec.initiator_id, l_rec.recipient_id,
         l_rec.to_le_id, l_rec.to_ledger_id, l_rec.batch_id,
         l_rec.status, l_rec.init_amount_cr, l_rec.init_amount_dr,
         l_rec.reci_amount_cr, l_rec.reci_amount_dr, l_rec.ar_invoice_number,
         l_rec.invoicing_rule, l_rec.approver_id, l_rec.approval_date,
         l_rec.original_trx_id, l_rec.reversed_trx_id, l_rec.from_recurring_trx_id,
         l_rec.initiator_instance, l_rec.recipient_instance
    FROM fun_trx_headers
    WHERE trx_id = p_trx_id;
Line: 147

        SELECT d.dist_id, d.line_id, d.party_id,
               d.party_type_flag, d.dist_type_flag, d.batch_dist_id,
               d.amount_cr, d.amount_dr, d.ccid
        FROM fun_dist_lines d, fun_trx_lines l
        WHERE party_type_flag = 'R' AND
              d.line_id = l.line_id AND
              l.trx_id = p_trx_id;
Line: 218

        SELECT
         b.batch_number,
         ltrim(to_char(decode(nvl(b.running_total_cr,0),
               0, b.running_total_dr,
               b.running_total_cr),'999999999.99'))||' '||b.currency_code,
         h.party_name
        INTO l_batch_num, l_trx_amt, l_initiator_name
        FROM fun_trx_batches b, hz_parties h
        WHERE batch_id = l_batch_id
        AND b.initiator_id = h.party_id;
Line: 231

   select b.batch_number,ltrim(to_char(decode(nvl(h.reci_amount_cr,0),
                0,h.reci_amount_dr,
                h.reci_amount_cr),'999999999.99'))||' '||b.currency_code
         into  l_batch_num, l_trx_amt
         from fun_trx_headers h, fun_trx_batches b
         where b.batch_id = l_batch_id
         and h.trx_id = l_trx_id;
Line: 241

 SELECT init.party_name
        INTO l_initiator_name
        FROM fun_trx_headers,
             hz_parties init
        WHERE trx_id = l_trx_id
        AND    initiator_id = init.party_id;
Line: 250

        SELECT trx_number ,
               rec.party_name

        INTO l_trx_num, l_recipient_name
        FROM fun_trx_headers,
             hz_parties rec
        WHERE trx_id = l_trx_id
        AND    recipient_id = rec.party_id;
Line: 259

        UPDATE fun_trx_headers
        SET reci_wf_key = itemkey
        WHERE trx_id = l_trx_id;
Line: 376

 * PROCEDURE delete_trx
 * ----------------------------------------------------
 * Delete the transaction from the recipient's DB.
 * ---------------------------------------------------*/

PROCEDURE delete_trx (
    itemtype    IN varchar2,
    itemkey     IN varchar2,
    actid       IN number,
    funcmode    IN varchar2,
    resultout   IN OUT NOCOPY varchar2)
IS
    l_trx_id        number;
Line: 401

        delete_trx_batch(l_batch_id, l_trx_id);
Line: 412

END delete_trx;
Line: 476

        SELECT invoice_flag INTO l_result
        FROM fun_trx_headers
        WHERE trx_id = l_trx_id;
Line: 520

        SELECT status INTO l_status
        FROM fun_trx_headers
        WHERE trx_id = l_trx_id;
Line: 578

        SELECT t.manual_approve_flag INTO l_result
        FROM fun_trx_batches b, fun_trx_types_b t
        WHERE b.batch_id = l_batch_id AND
              b.trx_type_id = t.trx_type_id;
Line: 598

            wf_core.context('FUN_RECIPIENT_WF', 'UPDATE_STATUS_APPROVED',
                            itemtype, itemkey, TO_CHAR(actid), funcmode);
Line: 683

        SELECT initiator_instance_flag  INTO l_result
        FROM fun_trx_headers
        WHERE trx_id = l_trx_id;
Line: 730

        SELECT recipient_id INTO l_party_id
        FROM fun_trx_headers
        WHERE trx_id = l_trx_id;
Line: 778

        SELECT reject_allow_flag INTO l_result
        FROM fun_trx_batches
        WHERE batch_id = l_batch_id;
Line: 836

        SELECT  usr.user_id
        FROM    fnd_user usr
        WHERE   usr.user_name = p_user_name;
Line: 874

            ame_api2.updateApprovalStatus(
                        applicationIdIn     => 435,
                        transactionTypeIn   => 'FUN_IC_RECI_TRX',
                        transactionIdIn     => l_trx_id,
                        approverIn          => l_approver_record);
Line: 883

           UPDATE fun_trx_headers
           SET    approver_id = l_user_id,
	          approval_date = SYSDATE
           WHERE  trx_id = l_trx_id;
Line: 893

            fun_trx_pvt.update_trx_status
                        (p_api_version => 1.0,
                         x_return_status => l_status,
                         x_msg_count => l_msg_count,
                         x_msg_data => l_msg_data,
                         p_trx_id => l_trx_id,
                         p_update_status_to => 'REJECTED');
Line: 901

            UPDATE fun_trx_headers
            SET reject_reason = l_reason
            WHERE trx_id = l_trx_id;
Line: 908

            ame_api2.updateApprovalStatus(
                      applicationIdIn     => 435,
                      transactionTypeIn   => 'FUN_IC_RECI_TRX',
                      transactionIdIn     => l_trx_id,
                      approverIn          => l_approver_record);
Line: 956

            ame_api2.updateApprovalStatus(
                        applicationIdIn     => 435,
                        transactionTypeIn   => 'FUN_IC_RECI_TRX',
                        transactionIdIn     => l_trx_id,
                        approverIn          => l_approver_record,
                        forwardeeIn         => l_forwardee_record);
Line: 1022

        SELECT b.from_le_id, b.gl_date, h.to_le_id, h.to_ledger_id,
               fun_tca_pkg.get_ou_id(h.initiator_id),
               fun_tca_pkg.get_ou_id(h.recipient_id),
               b.batch_date, b.initiator_id, h.recipient_id
        INTO l_from_le_id, l_gl_date, l_to_le_id, l_to_ledger_id,
             l_from_org_id, l_to_org_id, l_trx_date,
             l_initiator_id,
             l_recipient_id
        FROM fun_trx_batches b,
             fun_trx_headers h
        WHERE b.batch_id = l_batch_id AND
              h.trx_id = l_trx_id AND
              h.batch_id = b.batch_id;
Line: 1082

         select ltrim(to_char(decode(nvl(h.reci_amount_cr,0),
                0,h.reci_amount_dr,
                h.reci_amount_cr),'999999999.99'))||' '||b.currency_code
         into  l_trx_amt
         from fun_trx_headers h, fun_trx_batches b
         where b.batch_id = l_batch_id
         and h.trx_id = l_trx_id;
Line: 1097

        SELECT init.party_name
        INTO l_initiator_name
        FROM fun_trx_headers,
             hz_parties init
        WHERE trx_id = l_trx_id
        AND    initiator_id = init.party_id;
Line: 1182

        SELECT batch_date, gl_date, currency_code,
               exchange_rate_type,
               fun_tca_pkg.get_ou_id(initiator_id) from_org_id
        INTO   l_batch_date, l_gl_date, l_currency,
               l_exchange_rate_type,
               l_from_org_id
        FROM fun_trx_batches
        WHERE batch_id = l_batch_id;
Line: 1191

        SELECT ar_invoice_number INTO l_invoice_Num
        FROM fun_trx_headers
        WHERE trx_id = l_trx_id;
Line: 1204

            SELECT status INTO l_status
            FROM fun_trx_headers
            WHERE trx_id = l_trx_id;
Line: 1271

        l_params.delete();
Line: 1354

        l_params.delete();
Line: 1412

        l_params.delete();
Line: 1469

        l_params.delete();
Line: 1515

        SELECT recipient_id INTO l_party_id
        FROM fun_trx_headers
        WHERE trx_id = l_trx_id;
Line: 1534

        l_params.delete();
Line: 1551

 * PROCEDURE update_status_error
 * ----------------------------------------------------
 * Update status to error.
 * ---------------------------------------------------

PROCEDURE update_status_error (
    itemtype    IN varchar2,
    itemkey     IN varchar2,
    actid       IN number,
    funcmode    IN varchar2,
    resultout   IN OUT NOCOPY varchar2)
IS
    l_trx_id        number;
Line: 1574

        fun_trx_pvt.update_trx_status
                        (p_api_version => 1.0,
                         x_return_status => l_status,
                         x_msg_count => l_msg_count,
                         x_msg_data => l_msg_data,
                         p_trx_id => l_trx_id,
                         p_update_status_to => 'ERROR');
Line: 1591

            wf_core.context('FUN_RECIPIENT_WF', 'UPDATE_STATUS_ERROR',
                            itemtype, itemkey, TO_CHAR(actid), funcmode);
Line: 1594

END update_status_error;
Line: 1598

 * PROCEDURE update_status_rejected
 * ----------------------------------------------------
 * Update status to rejected.
 * ---------------------------------------------------*/

PROCEDURE update_status_rejected (
    itemtype    IN varchar2,
    itemkey     IN varchar2,
    actid       IN number,
    funcmode    IN varchar2,
    resultout   IN OUT NOCOPY varchar2)
IS
    l_trx_id        number;
Line: 1621

        fun_trx_pvt.update_trx_status
                        (p_api_version => 1.0,
                         x_return_status => l_status,
                         x_msg_count => l_msg_count,
                         x_msg_data => l_msg_data,
                         p_trx_id => l_trx_id,
                         p_update_status_to => 'REJECTED');
Line: 1638

            wf_core.context('FUN_RECIPIENT_WF', 'UPDATE_STATUS_REJECTED',
                            itemtype, itemkey, TO_CHAR(actid), funcmode);
Line: 1641

END update_status_rejected;
Line: 1645

 * PROCEDURE update_status_approved
 * ----------------------------------------------------
 * Update status to approved.
 * ---------------------------------------------------*/

PROCEDURE update_status_approved (
    itemtype    IN varchar2,
    itemkey     IN varchar2,
    actid       IN number,
    funcmode    IN varchar2,
    resultout   IN OUT NOCOPY varchar2)
IS
    l_trx_id        number;
Line: 1669

        fun_trx_pvt.update_trx_status
                        (p_api_version => 1.0,
                         x_return_status => l_status,
                         x_msg_count => l_msg_count,
                         x_msg_data => l_msg_data,
                         p_trx_id => l_trx_id,
                         p_update_status_to => 'APPROVED');
Line: 1692

            wf_core.context('FUN_RECIPIENT_WF', 'UPDATE_STATUS_APPROVED',
                            itemtype, itemkey, TO_CHAR(actid), funcmode);
Line: 1697

            wf_core.context('FUN_RECIPIENT_WF', 'UPDATE_STATUS_APPROVED',
                            itemtype, itemkey, TO_CHAR(actid), funcmode);
Line: 1701

END update_status_approved;
Line: 1745

     SELECT WPA.ACTIVITY_NAME
     INTO l_activity_name
     from WF_ITEM_ACTIVITY_STATUSES WIAS, WF_PROCESS_ACTIVITIES WPA
     where WIAS.ITEM_TYPE = 'FUNRMAIN'
     and WIAS.ITEM_KEY = p_eventkey
     and WIAS.ACTIVITY_STATUS = wf_engine.eng_notified
     and WIAS.PROCESS_ACTIVITY = WPA.INSTANCE_ID
     and ((WPA.PROCESS_NAME = 'RECIPIENT_APPROVAL'
     AND WPA.ACTIVITY_NAME IN ('FIX_ACCT_DIST_NTF',
                               'FIX_ACCT_DIST_NTF_NO_REJ')) OR
     (WPA.PROCESS_NAME = 'SEND_APPROVAL_NOTIFICATION'
     AND WPA.ACTIVITY_NAME IN ('APPROVAL_NTF', 'APPROVAL_ONLY_NTF')));
Line: 1764

         ame_api2.updateApprovalStatus(
                        applicationIdIn     => 435,
                        transactionTypeIn   => 'FUN_IC_RECI_TRX',
                        transactionIdIn     => p_trx_id,
                        approverIn          => l_approver_record);
Line: 1773

          UPDATE fun_trx_headers
          SET    approver_id = FND_GLOBAL.USER_ID,
          approval_date = SYSDATE
          WHERE  trx_id = p_trx_id;
Line: 1805

     UPDATE fun_trx_headers
     SET status = 'RECEIVED'
     WHERE trx_id = p_trx_id;
Line: 1851

        SELECT reject_allow_flag INTO l_result
        FROM fun_trx_batches
        WHERE batch_id = p_batch_id;
Line: 1859

           SELECT WPA.ACTIVITY_NAME
           INTO l_activity_name
           from WF_ITEM_ACTIVITY_STATUSES WIAS, WF_PROCESS_ACTIVITIES WPA
           where WIAS.ITEM_TYPE = 'FUNRMAIN'
           and WIAS.ITEM_KEY = p_eventkey
           and WIAS.ACTIVITY_STATUS = wf_engine.eng_notified
           and WIAS.PROCESS_ACTIVITY = WPA.INSTANCE_ID
           and ((WPA.PROCESS_NAME = 'RECIPIENT_APPROVAL'
           AND WPA.ACTIVITY_NAME IN ('FIX_ACCT_DIST_NTF')) OR
           (WPA.PROCESS_NAME = 'SEND_APPROVAL_NOTIFICATION'
           AND WPA.ACTIVITY_NAME IN ('APPROVAL_NTF', 'APPROVAL_ONLY_NTF')));
Line: 1873

               fun_trx_pvt.update_trx_status
                        (p_api_version => 1.0,
                         x_return_status => l_status,
                         x_msg_count => l_msg_count,
                         x_msg_data => l_msg_data,
                         p_trx_id => p_trx_id,
                         p_update_status_to => 'REJECTED');
Line: 1885

                ame_api2.updateApprovalStatus(
                      applicationIdIn     => 435,
                      transactionTypeIn   => 'FUN_IC_RECI_TRX',
                      transactionIdIn     => p_trx_id,
                      approverIn          => l_approver_record);
Line: 1915

     UPDATE fun_trx_headers
     SET status = 'RECEIVED'
     WHERE trx_id = p_trx_id;
Line: 1924

 * Insert a default intercompany account for recipient
 * accounting to fun_dist_lines
 * ---------------------------------------------------*/

procedure recipient_interco_acct (
    itemtype    in varchar2,
    itemkey     in varchar2,
    actid       in number,
    funcmode    in varchar2,
    resultout   in OUT NOCOPY varchar2)
IS
    l_trx_id        number;
Line: 1964

        SELECT COUNT(*)
        INTO   l_dist_exist
        FROM   fun_dist_lines d
        WHERE  d.trx_id = l_trx_id
        AND    d.dist_type_flag = 'L'
        AND    d.party_type_flag = 'R';
Line: 1986

        SELECT b.from_le_id, h.to_le_id, h.reci_amount_cr, h.reci_amount_dr
        INTO l_from_le_id, l_to_le_id, l_reci_amount_cr, l_reci_amount_dr
        FROM FUN_TRX_BATCHES b, FUN_TRX_HEADERS h
        WHERE b.batch_id = l_batch_id
        AND b.batch_id = h.batch_id
        AND h.trx_id = l_trx_id;
Line: 2019

    FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_recipient_wf.recipient_interco_acct', 'Inserting distribution rows');
Line: 2022

           FOR crec in (SELECT
                      dl.LINE_ID,
                      --dl.PARTY_ID,
		      h.RECIPIENT_ID,
                      dl.amount_dr,
                      dl.amount_cr
                      --FUN_TRX_ENTRY_UTIL.GET_DEFAULT_CCID(l_to_le_id, l_from_le_id, 'P') CCID
                     FROM fun_dist_lines dl, fun_trx_lines l, fun_trx_headers h
                     WHERE l.trx_id = l_trx_id
		     AND dl.trx_id = h.trx_id
                     AND dl.line_id = l.line_id
                     AND dl.party_type_flag = 'I'
                     AND dl.dist_type_flag = 'L')
           LOOP



            SELECT FUN_DIST_LINES_S.nextval INTO l_dist_id FROM dual;
Line: 2042

    FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_recipient_wf.recipient_interco_acct', 'Inserting distribution ' || l_dist_id);
Line: 2045

            INSERT into FUN_DIST_LINES(
             DIST_ID,
             LINE_ID,
             DIST_NUMBER,
             PARTY_ID,
             PARTY_TYPE_FLAG,
             DIST_TYPE_FLAG,
             AMOUNT_CR,
             AMOUNT_DR,
             CCID,
             AUTO_GENERATE_FLAG,
             CREATED_BY,
             CREATION_DATE,
             LAST_UPDATED_BY,
             LAST_UPDATE_DATE,
             LAST_UPDATE_LOGIN,
             trx_id)
            VALUES(
             l_dist_id,
             crec.line_id,
             l_dist_id,
             --crec.party_id,
	     crec.recipient_id,
             'R',
             'L',
             crec.amount_dr,
             crec.amount_cr,
             l_ccid,
             'N',
             FND_GLOBAL.USER_ID,
             sysdate,
             FND_GLOBAL.USER_ID,
             sysdate,
             FND_GLOBAL.LOGIN_ID,
             l_trx_id);
Line: 2086

    FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_recipient_wf.recipient_interco_acct', 'Done inserting');
Line: 2148

        select status into l_trx_status
        from fun_trx_headers
        where trx_id = l_trx_id;
Line: 2180

        UPDATE fun_trx_headers
        SET status = 'RECEIVED'
        WHERE trx_id = l_trx_id;
Line: 2273

    SELECT
      dist.dist_id         ,
      dist.dist_number     ,
      dist.trx_id          ,
      dist.line_id         ,
      head.initiator_id    ,
      head.recipient_id    ,
      btch.from_le_id  initiator_le_id ,
      head.to_le_id     recipient_le_id ,
      btch.gl_date         ,
      DECODE(p_party_type, 'I', btch.from_ledger_id,
                                head.to_ledger_id)  ledger_id ,
      dist.amount_cr       ,
      dist.amount_dr       ,
      dist.ccid       ,
      fun_util.get_account_segment_value (DECODE(p_party_type, 'I',
                                                   btch.from_ledger_id,
                                                   head.to_ledger_id),
                                          dist.ccid,
                                          'GL_BALANCING')  dist_bsv ,
      dist.description,
      head.init_amount_cr,
      head.init_amount_dr,
      head.reci_amount_cr,
      head.reci_amount_dr
    FROM  fun_dist_lines  dist,
          fun_trx_headers head,
          fun_trx_batches btch
    WHERE  dist.trx_id           = head.trx_id
    AND    head.batch_id         = btch.batch_id
    AND    dist.party_type_flag  = p_party_type
    AND    head.trx_id           = p_trx_id
    AND    dist.dist_type_flag   = 'L';
Line: 2367

      last_updated_by   NUMBER,
      last_update_date  DATE,
      last_update_login NUMBER,
      trx_id            NUMBER (15));
Line: 2373

   SELECT  b.batch_id,
           b.initiator_id initiator_id
          ,b.from_le_id  from_le_id
          ,b.from_ledger_id from_ledger_id
          ,b.currency_code currency_code
          ,b.attribute1  bat_attribute1
          ,b.attribute2  bat_attribute2
          ,b.attribute3  bat_attribute3
          ,b.attribute4  bat_attribute4
          ,b.attribute5  bat_attribute5
          ,b.attribute6  bat_attribute6
          ,b.attribute7  bat_attribute7
          ,b.attribute8  bat_attribute8
          ,b.attribute9  bat_attribute9
          ,b.attribute10  bat_attribute10
          ,b.attribute11  bat_attribute11
          ,b.attribute12  bat_attribute12
          ,b.attribute13  bat_attribute13
          ,b.attribute14  bat_attribute14
          ,b.attribute15  bat_attribute15
          ,b.attribute_category  bat_attribute_category
          ,t.trx_id       trx_id
          ,t.recipient_id recipient_id
          ,t.to_le_id     to_le_id
          ,t.to_ledger_id to_ledger_id
          ,t.attribute1  trx_attribute1
          ,t.attribute2  trx_attribute2
          ,t.attribute3  trx_attribute3
          ,t.attribute4  trx_attribute4
          ,t.attribute5  trx_attribute5
          ,t.attribute6  trx_attribute6
          ,t.attribute7  trx_attribute7
          ,t.attribute8  trx_attribute8
          ,t.attribute9  trx_attribute9
          ,t.attribute10  trx_attribute10
          ,t.attribute11  trx_attribute11
          ,t.attribute12  trx_attribute12
          ,t.attribute13  trx_attribute13
          ,t.attribute14  trx_attribute14
          ,t.attribute15  trx_attribute15
          ,t.attribute_category  trx_attribute_category
          ,y.trx_type_id  trx_type_id
          ,y.manual_approve_flag           manual_approve_flag
          ,y.allow_invoicing_flag          allow_invoicing_flag
          ,y.vat_taxable_flag              vat_taxable_flag
          ,y.allow_interest_accrual_flag   allow_interest_accrual_flag
          ,y.attribute1  typ_attribute1
          ,y.attribute2  typ_attribute2
          ,y.attribute3  typ_attribute3
          ,y.attribute4  typ_attribute4
          ,y.attribute5  typ_attribute5
          ,y.attribute6  typ_attribute6
          ,y.attribute7  typ_attribute7
          ,y.attribute8  typ_attribute8
          ,y.attribute9  typ_attribute9
          ,y.attribute10  typ_attribute10
          ,y.attribute11  typ_attribute11
          ,y.attribute12  typ_attribute12
          ,y.attribute13  typ_attribute13
          ,y.attribute14  typ_attribute14
          ,y.attribute15  typ_attribute15
          ,y.attribute_category  typ_attribute_category
          ,l.chart_of_accounts_id  coa_id
          ,b.batch_date
          ,b.gl_date
   FROM fun_trx_batches b,
        fun_trx_headers t,
        fun_trx_types_vl y,
        gl_ledgers       l
   WHERE b.batch_id     = t.batch_id
   AND   b.trx_type_id  = y.trx_type_id
   AND   t.to_ledger_id = l.ledger_id
   AND   t.trx_id       = p_trx_id;
Line: 2450

  SELECT amb_context_code,
         account_definition_code
  FROM   fun_trx_acct_definitions
  WHERE  ledger_id = p_ledger_id;
Line: 2458

SELECT vals.segment_value
FROM   gl_ledger_le_bsv_specific_v vals
WHERE  vals.legal_entity_id     = p_le_id
AND    vals.ledger_id           = p_ledger_id
AND   p_gl_date BETWEEN Nvl(vals.start_date, p_gl_date) AND Nvl(vals.end_date, p_gl_date)
AND   (SELECT COUNT(*)
       FROM   gl_ledger_le_bsv_specific_v vals1
       WHERE  vals1.legal_entity_id = p_le_id
       AND    vals1.ledger_id       = p_ledger_id
       AND   p_gl_date BETWEEN Nvl(vals1.start_date, p_gl_date) AND Nvl(vals1.end_date, p_gl_date)) = 1;
Line: 2548

			SELECT MIN(DIST_BSV)
			INTO l_init_bsv
			FROM   (SELECT   FUN_UTIL.GET_ACCOUNT_SEGMENT_VALUE(DECODE(DIST.PARTY_TYPE_FLAG,'I',BTCH.FROM_LEDGER_ID,
																						HEAD.TO_LEDGER_ID),
															DIST.CCID,'GL_BALANCING') DIST_BSV,
					DECODE(DIST.PARTY_TYPE_FLAG,'I', BTCH.FROM_LE_ID, HEAD.TO_LE_ID)
				FROM     FUN_DIST_LINES DIST,
						 FUN_TRX_HEADERS HEAD,
						 FUN_TRX_BATCHES BTCH
				WHERE    DIST.TRX_ID = HEAD.TRX_ID
						 AND HEAD.BATCH_ID = BTCH.BATCH_ID
						 AND HEAD.TRX_ID = p_trx_id
				GROUP BY FUN_UTIL.GET_ACCOUNT_SEGMENT_VALUE(DECODE(DIST.PARTY_TYPE_FLAG,'I',BTCH.FROM_LEDGER_ID,
																						HEAD.TO_LEDGER_ID),
															DIST.CCID,'GL_BALANCING'),
						DECODE(DIST.PARTY_TYPE_FLAG,'I', BTCH.FROM_LE_ID, HEAD.TO_LE_ID)
				HAVING   SUM(NVL(DIST.AMOUNT_DR,0.00)) <> SUM(NVL(DIST.AMOUNT_CR,0.00))
						 AND SUM(NVL(DIST.AMOUNT_CR,0.00)) <> 0.00);
Line: 2567

			SELECT MIN(DIST_BSV)
			INTO l_reci_bsv
			FROM   (SELECT   FUN_UTIL.GET_ACCOUNT_SEGMENT_VALUE(DECODE(DIST.PARTY_TYPE_FLAG,'I',BTCH.FROM_LEDGER_ID,
																						HEAD.TO_LEDGER_ID),
															DIST.CCID,'GL_BALANCING') DIST_BSV,
					DECODE(DIST.PARTY_TYPE_FLAG,'I', BTCH.FROM_LE_ID, HEAD.TO_LE_ID)
				FROM     FUN_DIST_LINES DIST,
						 FUN_TRX_HEADERS HEAD,
						 FUN_TRX_BATCHES BTCH
				WHERE    DIST.TRX_ID = HEAD.TRX_ID
						 AND HEAD.BATCH_ID = BTCH.BATCH_ID
						 AND HEAD.TRX_ID = p_trx_id
				GROUP BY FUN_UTIL.GET_ACCOUNT_SEGMENT_VALUE(DECODE(DIST.PARTY_TYPE_FLAG,'I',BTCH.FROM_LEDGER_ID,
																						HEAD.TO_LEDGER_ID),
															DIST.CCID,'GL_BALANCING'),
						DECODE(DIST.PARTY_TYPE_FLAG,'I', BTCH.FROM_LE_ID, HEAD.TO_LE_ID)
				HAVING   SUM(NVL(DIST.AMOUNT_DR,0.00)) <> SUM(NVL(DIST.AMOUNT_CR,0.00))
						 AND SUM(NVL(DIST.AMOUNT_DR,0.00)) <> 0.00);
Line: 2586

			SELECT MIN(DIST_BSV)
			INTO l_reci_bsv
			FROM   (SELECT   FUN_UTIL.GET_ACCOUNT_SEGMENT_VALUE(DECODE(DIST.PARTY_TYPE_FLAG,'I',BTCH.FROM_LEDGER_ID,
																						HEAD.TO_LEDGER_ID),
															DIST.CCID,'GL_BALANCING') DIST_BSV,
					DECODE(DIST.PARTY_TYPE_FLAG,'I', BTCH.FROM_LE_ID, HEAD.TO_LE_ID)
				FROM     FUN_DIST_LINES DIST,
						 FUN_TRX_HEADERS HEAD,
						 FUN_TRX_BATCHES BTCH
				WHERE    DIST.TRX_ID = HEAD.TRX_ID
						 AND HEAD.BATCH_ID = BTCH.BATCH_ID
						 AND HEAD.TRX_ID = p_trx_id
				GROUP BY FUN_UTIL.GET_ACCOUNT_SEGMENT_VALUE(DECODE(DIST.PARTY_TYPE_FLAG,'I',BTCH.FROM_LEDGER_ID,
																						HEAD.TO_LEDGER_ID),
															DIST.CCID,'GL_BALANCING'),
						DECODE(DIST.PARTY_TYPE_FLAG,'I', BTCH.FROM_LE_ID, HEAD.TO_LE_ID)
				HAVING   SUM(NVL(DIST.AMOUNT_DR,0.00)) <> SUM(NVL(DIST.AMOUNT_CR,0.00))
						 AND SUM(NVL(DIST.AMOUNT_CR,0.00)) <> 0.00);
Line: 2605

			SELECT MIN(DIST_BSV)
			INTO l_init_bsv
			FROM   (SELECT   FUN_UTIL.GET_ACCOUNT_SEGMENT_VALUE(DECODE(DIST.PARTY_TYPE_FLAG,'I',BTCH.FROM_LEDGER_ID,
																						HEAD.TO_LEDGER_ID),
															DIST.CCID,'GL_BALANCING') DIST_BSV,
					DECODE(DIST.PARTY_TYPE_FLAG,'I', BTCH.FROM_LE_ID, HEAD.TO_LE_ID)
				FROM     FUN_DIST_LINES DIST,
						 FUN_TRX_HEADERS HEAD,
						 FUN_TRX_BATCHES BTCH
				WHERE    DIST.TRX_ID = HEAD.TRX_ID
						 AND HEAD.BATCH_ID = BTCH.BATCH_ID
						 AND HEAD.TRX_ID = p_trx_id
				GROUP BY FUN_UTIL.GET_ACCOUNT_SEGMENT_VALUE(DECODE(DIST.PARTY_TYPE_FLAG,'I',BTCH.FROM_LEDGER_ID,
																						HEAD.TO_LEDGER_ID),
															DIST.CCID,'GL_BALANCING'),
						DECODE(DIST.PARTY_TYPE_FLAG,'I', BTCH.FROM_LE_ID, HEAD.TO_LE_ID)
				HAVING   SUM(NVL(DIST.AMOUNT_DR,0.00)) <> SUM(NVL(DIST.AMOUNT_CR,0.00))
						 AND SUM(NVL(DIST.AMOUNT_DR,0.00)) <> 0.00);
Line: 2651

    SELECT l.chart_of_accounts_id
    INTO l_from_coa_id
    from gl_ledgers l
    WHERE l.ledger_id = l_trx_dtl_rec.from_ledger_id;
Line: 3014

    SELECT FUN_DIST_LINES_S.nextval
    INTO  l_new_dist_tbl(l_new_index).dist_id
    FROM dual;
Line: 3031

    l_new_dist_tbl(l_new_index).last_updated_by   :=  FND_GLOBAL.USER_ID;
Line: 3032

    l_new_dist_tbl(l_new_index).last_update_date  :=  SYSDATE;
Line: 3033

    l_new_dist_tbl(l_new_index).last_update_login :=  FND_GLOBAL.LOGIN_ID;
Line: 3043

    SELECT l.chart_of_accounts_id
    INTO l_to_coa_id
    from gl_ledgers l
    WHERE l.ledger_id = l_trx_dtl_rec.to_ledger_id;
Line: 3386

    SELECT FUN_DIST_LINES_S.nextval
    INTO  l_new_dist_tbl(l_new_index).dist_id
    FROM dual;
Line: 3403

    l_new_dist_tbl(l_new_index).last_updated_by   :=  FND_GLOBAL.USER_ID;
Line: 3404

    l_new_dist_tbl(l_new_index).last_update_date  :=  SYSDATE;
Line: 3405

    l_new_dist_tbl(l_new_index).last_update_login :=  FND_GLOBAL.LOGIN_ID;
Line: 3416

        	FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_recipient_wf.generate_interco_acct', 'If Sucessful Delete existing lines and insert.');
Line: 3418

        DELETE fun_dist_lines
        WHERE  trx_id  = l_trx_id
        AND    dist_type_flag IN ('R','P');
Line: 3425

            INSERT into FUN_DIST_LINES
            VALUES l_new_dist_tbl(i);
Line: 3462

   SELECT  b.batch_id,
           b.initiator_id initiator_id
          ,b.from_le_id  from_le_id
          ,b.from_ledger_id from_ledger_id
          ,b.currency_code currency_code
          ,b.attribute1  bat_attribute1
          ,b.attribute2  bat_attribute2
          ,b.attribute3  bat_attribute3
          ,b.attribute4  bat_attribute4
          ,b.attribute5  bat_attribute5
          ,b.attribute6  bat_attribute6
          ,b.attribute7  bat_attribute7
          ,b.attribute8  bat_attribute8
          ,b.attribute9  bat_attribute9
          ,b.attribute10  bat_attribute10
          ,b.attribute11  bat_attribute11
          ,b.attribute12  bat_attribute12
          ,b.attribute13  bat_attribute13
          ,b.attribute14  bat_attribute14
          ,b.attribute15  bat_attribute15
          ,b.attribute_category  bat_attribute_category
          ,t.trx_id       trx_id
          ,t.recipient_id recipient_id
          ,t.to_le_id     to_le_id
          ,t.to_ledger_id to_ledger_id
          ,t.attribute1  trx_attribute1
          ,t.attribute2  trx_attribute2
          ,t.attribute3  trx_attribute3
          ,t.attribute4  trx_attribute4
          ,t.attribute5  trx_attribute5
          ,t.attribute6  trx_attribute6
          ,t.attribute7  trx_attribute7
          ,t.attribute8  trx_attribute8
          ,t.attribute9  trx_attribute9
          ,t.attribute10  trx_attribute10
          ,t.attribute11  trx_attribute11
          ,t.attribute12  trx_attribute12
          ,t.attribute13  trx_attribute13
          ,t.attribute14  trx_attribute14
          ,t.attribute15  trx_attribute15
          ,t.attribute_category  trx_attribute_category
          ,y.trx_type_id  trx_type_id
          ,y.manual_approve_flag           manual_approve_flag
          ,y.allow_invoicing_flag          allow_invoicing_flag
          ,y.vat_taxable_flag              vat_taxable_flag
          ,y.allow_interest_accrual_flag   allow_interest_accrual_flag
          ,y.attribute1  typ_attribute1
          ,y.attribute2  typ_attribute2
          ,y.attribute3  typ_attribute3
          ,y.attribute4  typ_attribute4
          ,y.attribute5  typ_attribute5
          ,y.attribute6  typ_attribute6
          ,y.attribute7  typ_attribute7
          ,y.attribute8  typ_attribute8
          ,y.attribute9  typ_attribute9
          ,y.attribute10  typ_attribute10
          ,y.attribute11  typ_attribute11
          ,y.attribute12  typ_attribute12
          ,y.attribute13  typ_attribute13
          ,y.attribute14  typ_attribute14
          ,y.attribute15  typ_attribute15
          ,y.attribute_category  typ_attribute_category
          ,l.chart_of_accounts_id  coa_id
          ,b.batch_date
          ,b.gl_date
   FROM fun_trx_batches b,
        fun_trx_headers t,
        fun_trx_types_vl y,
        gl_ledgers       l
   WHERE b.batch_id     = t.batch_id
   AND   b.trx_type_id  = y.trx_type_id
   AND   t.to_ledger_id = l.ledger_id
   AND   t.trx_id       = p_trx_id;
Line: 3539

  SELECT amb_context_code,
         account_definition_code
  FROM   fun_trx_acct_definitions
  WHERE  ledger_id = p_ledger_id;
Line: 3547

SELECT vals.segment_value
FROM   gl_ledger_le_bsv_specific_v vals
WHERE  vals.legal_entity_id     = p_le_id
AND    vals.ledger_id           = p_ledger_id
AND   p_gl_date BETWEEN Nvl(vals.start_date, p_gl_date) AND Nvl(vals.end_date, p_gl_date)
AND   (SELECT COUNT(*)
       FROM   gl_ledger_le_bsv_specific_v vals1
       WHERE  vals1.legal_entity_id = p_le_id
       AND    vals1.ledger_id       = p_ledger_id
       AND   p_gl_date BETWEEN Nvl(vals1.start_date, p_gl_date) AND Nvl(vals1.end_date, p_gl_date)) = 1;
Line: 3754

            fun_trx_pvt.update_trx_status
                        (p_api_version => 1.0,
                         x_return_status => l_status,
                         x_msg_count => l_msg_count,
                         x_msg_data => l_msg_data,
                         p_trx_id => l_trx_id,
                         p_update_status_to => 'ERROR');
Line: 3803

              select 'X'
        from wf_local_user_roles role
        where role.role_name = 'FUN_ADHOC_RECI_'||trx_id
        and role.user_name = FND_GLOBAL.USER_NAME;