DBA Data[Home] [Help]

APPS.AR_INVOICE_API_PUB SQL Statements

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

Line: 35

  ar_trx_global_process_header.insert_row(
    p_trx_header_tbl   => p_trx_header_tbl,
    p_batch_source_rec => p_batch_source_rec,
    x_errmsg           => x_errmsg,
    x_return_status    => x_return_status);
Line: 45

   /* 5921925 - Removed defaulting UPDATE statement and integrated it
       into ar_trx_global_process_header.insert_row */

   IF pg_debug = 'Y' THEN
     ar_invoice_utils.debug ('AR_INVOICE_API_PUB.populate_header(-)' );
Line: 69

    SELECT customer_trx_line_id, link_to_trx_line_id, trx_line_id,
	   link_to_cust_trx_line_id
    FROM   ar_trx_lines_gt
    WHERE  link_to_trx_line_id IS NOT NULL
    AND    line_type in ( 'TAX', 'FREIGHT');
Line: 76

    SELECT customer_trx_line_id
    FROM   ar_trx_lines_gt
    WHERE  trx_line_id = p_link_line_id;
Line: 88

    AR_TRX_GLOBAL_PROCESS_LINES.INSERT_ROW(
            p_trx_lines_tbl     => p_trx_lines_tbl,
            x_errmsg            => x_errmsg,
            x_return_status    => x_return_status);
Line: 104

       in the GT inserts. */

    FOR clinkRec IN clink
    LOOP
        OPEN line(clinkRec.link_to_trx_line_id);
Line: 121

        UPDATE ar_trx_lines_gt gt
            set link_to_cust_trx_line_id = l_customer_trx_line_id
        WHERE  customer_trx_line_id = clinkRec.customer_trx_line_id;
Line: 127

    UPDATE ar_trx_lines_gt lgt
    SET (customer_trx_id, trx_date, org_id, set_of_books_id,currency_code) =
      ( SELECT hgt.customer_trx_id, hgt.trx_date, hgt.org_id,
               hgt.set_of_books_id, trx_currency
        FROM ar_trx_header_gt hgt
        WHERE lgt.trx_header_id = trx_header_id),
        request_id   =  AR_INVOICE_TABLE_HANDLER.g_request_id;
Line: 171

  ar_trx_global_process_dist.insert_row(
    p_trx_dist_tbl      =>  p_trx_dist_tbl,
    x_errmsg            =>  x_errmsg,
    x_return_status     =>  x_return_status);
Line: 181

     the internals of ar_trx_global_process_dist.insert_row */
  UPDATE ar_trx_dist_gt dist
  SET set_of_books_id = nvl(set_of_books_id,
        p_trx_system_param_rec.set_of_books_id),
        request_id   =  AR_INVOICE_TABLE_HANDLER.g_request_id,
        /* gl_date = nvl(gl_date, nvl(p_batch_source_rec.default_date,
        sysdate)),
        Bug 3361235*/
     (customer_trx_id, customer_trx_line_id, trx_header_id, gl_date) =
     (
       SELECT line.customer_trx_id,
              line.customer_trx_line_id,
              line.trx_header_id,
              h.gl_date
       FROM   ar_trx_lines_gt line,
              ar_trx_header_gt h
       WHERE  line.trx_line_id = dist.trx_line_id
       AND    line.trx_header_id = h.trx_header_id
       UNION
       SELECT h.customer_trx_id, null_column, h.trx_header_id, h.gl_date
       FROM   ar_trx_header_gt h
       WHERE  h.trx_header_id = dist.trx_header_id
       AND    dist.account_class = 'REC');
Line: 233

    AR_TRX_GLOBAL_PROCESS_SALESCR.INSERT_ROW(
            p_trx_salescredits_tbl      =>  p_trx_salescredits_tbl,
            x_errmsg                    =>  x_errmsg,
            x_return_status             =>  x_return_status
            );
Line: 245

        ar_trx_global_process_salescr.insert_row */
    UPDATE ar_trx_salescredits_gt sc
        SET org_id = nvl(org_id, p_trx_system_param_rec.org_id),
            request_id   =  AR_INVOICE_TABLE_HANDLER.g_request_id,
            (customer_trx_id, customer_trx_line_id, trx_header_id) =  (
                    SELECT line.customer_trx_id, line.customer_trx_line_id,
                           trx_header_id
                    FROM  ar_trx_lines_gt line
                    WHERE line.trx_line_id = sc.trx_line_id
                    AND rownum = 1);
Line: 287

  ar_trx_global_process_cont.insert_row
  (
    p_trx_contingencies_tbl =>  p_trx_contingencies_tbl,
    x_errmsg               =>  x_errmsg,
    x_return_status        =>  x_return_status
  );
Line: 299

     ar_trx_global_process_cont.insert_row */
  UPDATE ar_trx_contingencies_gt tcg
  SET    org_id       = nvl(org_id, p_trx_system_param_rec.org_id),
         request_id   = ar_invoice_table_handler.g_request_id,
         trx_header_id = (SELECT trx_header_id
                          FROM  ar_trx_lines_gt tlg
                          WHERE tlg.trx_line_id = tcg.trx_line_id
                          AND   rownum = 1);
Line: 323

	delete from ar_trx_header_gt;
Line: 324

	delete from ar_trx_lines_gt;
Line: 325

	delete from ar_trx_dist_gt;
Line: 326

	delete from ar_trx_salescredits_gt;
Line: 327

	--delete from ar_trx_errors_gt;
Line: 328

	DELETE FROM ZX_TRX_HEADERS_GT;
Line: 329

	DELETE FROM ZX_TRANSACTION_LINES_GT;
Line: 330

	DELETE FROM ZX_IMPORT_TAX_LINES_GT;
Line: 336

	delete from ar_trx_header_tmp_gt;
Line: 337

	delete from ar_trx_lines_tmp_gt;
Line: 338

	delete from ar_trx_dist_tmp_gt;
Line: 339

	delete from ar_trx_salescredits_tmp_gt;
Line: 340

	--delete from ar_trx_errors_gt;
Line: 367

     select org_id
     from ar_trx_header_tmp_gt
     group by org_id;
Line: 411

AR_TRX_GLOBAL_PROCESS_TMP.INSERT_ROWS (
    p_trx_header_tbl    =>p_trx_header_tbl,
    p_trx_lines_tbl     =>p_trx_lines_tbl,
    p_trx_dist_tbl      =>p_trx_dist_tbl,
    p_trx_salescredits_tbl  =>p_trx_salescredits_tbl,
    x_errmsg     =>x_errmsg,
    x_return_status  =>x_return_status);
Line: 521

       SELECT ra_batches_s.nextval * -1
       INTO   ar_invoice_table_handler.g_request_id
       FROM   dual;
Line: 790

         ar_invoice_utils.debug ('Calling Table Handler ar_invoice_table_handler.insert_row (+) ');
Line: 793

    AR_INVOICE_TABLE_HANDLER.insert_row(
            p_trx_system_parameters_rec =>  l_trx_system_parameters_rec,
            p_trx_profile_rec           =>  l_trx_profile_rec,
            p_batch_source_rec          =>  p_batch_source_rec,
            x_errmsg                    =>  x_errmsg,
            x_return_status             =>  x_return_status)  ;
Line: 832

         ar_invoice_utils.debug ('Calling Table Handler ar_invoice_table_handler.insert_row (-) ');
Line: 1061

                          SELECT *
                          INTO   Type_Cache_Tbl( p_cust_trx_type_id )
                          FROM   ra_cust_trx_types
                          WHERE  cust_trx_type_id =  p_cust_trx_type_id;
Line: 1112

 |   it can be updated.                                                      |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |                   p_context_rec                                           |
 |              OUT:                                                         |
 |                   p_dm_reversal 					     |
 |                   p_cb 						     |
 |          IN/ OUT:                                                         |
 |                   p_trx_rec 						     |
 |                   p_type_rec 					     |
 |                   p_posted_flag 					     |
 |                   p_activity_flag 					     |
 |                   p_printed_flag 					     |
 |                   p_rev_recog_run_flag 				     |
 |                                                                           |
 | RETURNS    : None			                                     |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |  mpsingh   20-jun-2008 Created
 |                                                                           |
 +===========================================================================*/

PROCEDURE Get_Flags(
                             p_context_rec   IN  Context_Rec_Type,
                             p_trx_rec       IN OUT NOCOPY  ra_customer_trx%rowtype,
                             p_type_rec      IN OUT NOCOPY  ra_cust_trx_types%rowtype,
                             p_posted_flag   IN OUT NOCOPY  VARCHAR2,
                             p_activity_flag IN OUT NOCOPY  VARCHAR2,
                             p_printed_flag  IN OUT NOCOPY  VARCHAR2,
                             p_rev_recog_run_flag  IN OUT NOCOPY VARCHAR2,
                             p_dm_reversal      OUT NOCOPY VARCHAR2,
                             p_cb               OUT NOCOPY VARCHAR2
                              ) IS

        l_index  BINARY_INTEGER;
Line: 1234

 | PROCEDURE     Validate_Delete_Transaction                                 |
 |                                                                           |
 | DESCRIPTION                                                               |
 |		 Validates that the information provided for a transaction   |
 |		 deletion does not violate any of the validation rules.      |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |                   p_customer_trx_id                                       |
 |                   p_trx_rec                                               |
 |                   p_type_rec                                              |
 |              OUT:                                                         |
 |		     p_return_status					     |
 |          IN/ OUT:                                                         |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |    mpsingh   20-Jun-08  Created                                   |
 |                                                                           |
 +===========================================================================*/

PROCEDURE Validate_Delete_Transaction(
               p_customer_trx_id  IN      ra_customer_trx.customer_trx_id%type,
               p_trx_rec          IN OUT NOCOPY  ra_customer_trx%rowtype,
               p_type_rec         IN OUT NOCOPY  ra_cust_trx_types%rowtype,
               p_return_status    OUT NOCOPY     VARCHAR2
                                     ) IS

  l_context_rec          Context_Rec_Type;
Line: 1279

        ar_invoice_utils.debug('Validate_Delete_Transaction()+');
Line: 1284

        |  Get the header record for the transaction to be deleted.  |
	+------------------------------------------------------------*/

        BEGIN
                arp_ct_pkg.fetch_p(
                                      p_trx_rec,
                                      p_customer_trx_id
                                   );
Line: 1314

        | The invoice_deletion_flag must be Y for transactions to be deleted |
	+--------------------------------------------------------------------*/

        ar_invoice_utils.debug('.  invoice_deletion_flag = ' ||
                                 arp_global.sysparam.invoice_deletion_flag);
Line: 1332

                          p_message_name      => 'AR_CANT_DELETE_IF_COMPLETE');
Line: 1347

              |  before it can be deleted.                                   |
              |                                                              |
              |  A transaction can only be made incomplete if:               |
              |    o It is not a chargeback           and                    |
              |    o It is not a debit memo reversal  and                    |
              |    o It has not been posted to GL     and                    |
              |    o There is no activity against it.                        |
              +--------------------------------------------------------------*/

              ar_invoice_utils.debug('.  complete_flag         = ' ||
                                       p_trx_rec.complete_flag);
Line: 1386

                                                 'AR_TAPI_CANT_DELETE_DM_REV');
Line: 1401

                              p_message_name      => 'AR_TAPI_CANT_DELETE_CB');
Line: 1417

                                                 'AR_ALL_CANT_DELETE_IF_POSTED');
Line: 1433

                                               'AR_TAPI_CANT_DELETE_ACTIVITY');
Line: 1442

       ar_invoice_utils.debug('Validate_Delete_Transaction()-');
Line: 1446

        ar_invoice_utils.debug('EXCEPTION:  Validate_Delete_Transaction()');
Line: 1452

END Validate_Delete_Transaction;
Line: 1455

 |              Delete_Trxn_Extn_Details                                     |
 |                                                                           |
 | DESCRIPTION                                                               |
 |              This is the main routine that deletes the                    |
 |              PAYMENT_TRXN_EXTENSION details of transactions.              |
 |                                                                           |
 | SCOPE - PUBLIC                                                            |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |     IBY_FNDCPT_TRXN_PUB.delete_transaction_extension                      |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |                   p_trx_rec                                               |
 |              OUT:                                                         |
 |                   p_return_status                                         |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |    mpsingh   20-jun-2008  Created                                   |
 |                                                                           |
 +===========================================================================*/

PROCEDURE Delete_Trxn_Extn_Details(p_trx_rec IN ra_customer_trx%rowtype,
                                   p_return_status    OUT NOCOPY     VARCHAR2
) IS

    l_payer_rec            IBY_FNDCPT_COMMON_PUB.payercontext_rec_type;
Line: 1494

        ar_invoice_utils.debug('AR_INVOICE_API_PUB.Delete_Trxn_Extn_Details()+ ');
Line: 1516

            IBY_FNDCPT_TRXN_PUB.delete_transaction_extension(
               p_api_version           => 1.0,
               p_init_msg_list         => AR_BILLS_MAIN.GTRUE,
               p_commit                => AR_BILLS_MAIN.GFALSE,
               x_return_status         => x_return_status,
               x_msg_count             => x_msg_count,
               x_msg_data              => x_msg_data,
               p_payer                 => l_payer_rec,
               p_payer_equivalency     => 'UPWARD',
               p_entity_id             => l_payment_trxn_extn_id,
               x_response              => l_response);
Line: 1534

      ar_invoice_utils.debug('Errors Reported by IBY API:Delete Transaction Extension ');
Line: 1539

       ar_invoice_utils.debug('exception in AR_INVOICE_API_PUB.Delete_Trxn_Extn_Detail ');
Line: 1541

END Delete_Trxn_Extn_Details;
Line: 1546

 |              Delete_Transaction                                           |
 |                                                                           |
 | DESCRIPTION                                                               |
 |              This is the main routine that deletes the transactions.      |
 |              It is called once for each transaction to be deleted.        |
 |                                                                           |
 | SCOPE - PUBLIC                                                            |
 |                                                                           |
 | EXETERNAL PROCEDURES/FUNCTIONS ACCESSED                                   |
 |     ar_transaction_val2_pub.Validate_Delete_Transaction                   |
 |     arp_process_header.update_header                                      |
 |     arp_process_header_post_commit.post_commit                            |
 |     arp_trx_validate.Add_To_Error_List                                    |
 |     arp_process_header.delete_header                                      |
 |     arp_util.disable_debug                                                |
 |     arp_util.enable_debug                                                 |
 |     fnd_api.compatible_api_call                                           |
 |     fnd_api.g_exc_unexpected_error                                        |
 |     fnd_api.g_ret_sts_error                                               |
 |     fnd_api.g_ret_sts_error                                               |
 |     fnd_api.g_ret_sts_success                                             |
 |     fnd_api.to_boolean                                                    |
 |     fnd_msg_pub.check_msg_level                                           |
 |     fnd_msg_pub.count_and_get                                             |
 |     fnd_msg_pub.initialize                                                |
 |                                                                           |
 | ARGUMENTS  : IN:                                                          |
 |                   p_api_name                                              |
 |                   p_api_version                                           |
 |                   p_init_msg_list                                         |
 |                   p_commit                                                |
 |                   p_validation_level                                      |
 |                   p_customer_trx_id                                       |
 |              OUT:                                                         |
 |                   p_return_status                                         |
 |          IN/ OUT:                                                         |
 |                   p_msg_count                                             |
 |                   p_msg_data                                              |
 |                   p_errors                                                |
 |                                                                           |
 | RETURNS    : NONE                                                         |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 | MODIFICATION HISTORY                                                      |
 |    mpsingh   20-jun-2008  Created                                   |
 |                                                                           |
 +===========================================================================*/

PROCEDURE Delete_Transaction(
     p_api_name                  IN  varchar2,
     p_api_version               IN  number,
     p_init_msg_list             IN  varchar2 := FND_API.G_FALSE,
     p_commit                    IN  varchar2 := FND_API.G_FALSE,
     p_validation_level          IN  varchar2 := FND_API.G_VALID_LEVEL_FULL,
     p_customer_trx_id           IN  ra_customer_trx.customer_trx_id%type,
     p_return_status            OUT NOCOPY  varchar2,
     p_msg_count             IN OUT NOCOPY  NUMBER,
     p_msg_data              IN OUT NOCOPY  varchar2,
     p_errors                IN OUT NOCOPY  arp_trx_validate.Message_Tbl_Type
                  ) IS

  l_api_name             CONSTANT VARCHAR2(20) := 'Delete_Transaction';
Line: 1618

  l_update_status        VARCHAR2(50)  := 'OK';
Line: 1619

  l_delete_status        VARCHAR2(50)  := 'OK';
Line: 1621

  l_delete_pmt_ext_status VARCHAR2(10);
Line: 1640

        SAVEPOINT Delete_Transaction_Pub;
Line: 1663

              arp_trx_validate.pg_message_tbl.DELETE;
Line: 1676

       	 ar_invoice_utils.debug('AR_INVOICE_API_PUB.Delete_Transaction(+)' );
Line: 1679

                               Validate_Delete_Transaction(
                                                            p_customer_trx_id,
                                                            l_trx_rec,
                                                            l_type_rec,
                                                            l_validation_status
                                                           );
Line: 1700

                         SELECT trunc(gl_date),
                                amount
                         INTO   l_gl_date,
                                l_amount
                         FROM   ra_cust_trx_line_gl_dist
                         WHERE  customer_trx_id = p_customer_trx_id
                         AND    account_class   = 'REC'
                         AND    latest_rec_flag = 'Y';
Line: 1721

                         arp_process_header.update_header(
                               p_api_name,
                               p_api_version,
                               l_trx_rec,
                               p_customer_trx_id,
                               l_amount,
                               l_type_rec.type,
                               l_gl_date,
                               l_trx_rec.initial_customer_trx_id,
                               l_commitment_rec,
                               l_type_rec.accounting_affect_flag,
                               'Y',
                               FALSE,
                               FALSE,
                               NULL,
                               NULL,
                               l_update_status);
Line: 1773

              |  Delete the transaction if no errors have occurred  |
              |  in the previous steps.                             |
              +-----------------------------------------------------*/

              IF pg_debug = 'Y'
	      THEN
		ar_invoice_utils.debug ('.  update_status         = ' || l_update_status);
Line: 1784

                    AND l_update_status = 'OK'
                   )
              THEN
			IF pg_debug = 'Y'
			THEN
				ar_invoice_utils.debug('Deleting the transaction');
Line: 1794

				Delete_Trxn_Extn_Details(l_trx_rec,
						       l_delete_pmt_ext_status);
Line: 1797

			   l_delete_pmt_ext_status := FND_API.G_RET_STS_SUCCESS;
Line: 1800

			IF  l_delete_pmt_ext_status = FND_API.G_RET_STS_SUCCESS THEN

			      arp_process_header.delete_header(
								p_api_name,
								p_api_version,
								p_customer_trx_id,
								l_type_rec.type,
								l_delete_status);
Line: 1862

               OR l_update_status <> 'OK'
               OR l_delete_status <> 'OK'
	       OR l_delete_pmt_ext_status <> FND_API.G_RET_STS_SUCCESS
               OR l_return_status <> FND_API.G_RET_STS_SUCCESS
             )
        THEN

             p_errors := arp_trx_validate.pg_message_tbl;
Line: 1871

             ROLLBACK TO Delete_Transaction_PUB;
Line: 1894

        	 ar_invoice_utils.debug('AR_INVOICE_API_PUB.Delete_Transaction(-)' );
Line: 1900

                ROLLBACK TO Delete_Transaction_PUB;
Line: 1913

                ROLLBACK TO Delete_Transaction_PUB;
Line: 1925

                ROLLBACK TO Delete_Transaction_PUB;
Line: 1946

                      ROLLBACK TO Delete_Transaction_PUB;
Line: 1958

                ROLLBACK TO Delete_Transaction_PUB;
Line: 1975

END Delete_Transaction;