DBA Data[Home] [Help]

APPS.AR_INVOICE_TABLE_HANDLER SQL Statements

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

Line: 23

        SELECT COUNT(*)
        INTO   l_cnt
        FROM   ar_trx_salescredits_gt
        WHERE  trx_line_id = (
                SELECT trx_line_id
                FROM   ar_trx_lines_gt
                WHERE  customer_trx_line_id = p_cust_trx_line_id);
Line: 37

                                'N', -- p_delete_scredits_first_flag
                                'N', -- p_run_autoaccounting_flag
                                l_status1 );
Line: 57

PROCEDURE INSERT_TRX_HEADER (
    ar_trx_header_rec          IN           ar_trx_header_gt%rowtype,
    p_batch_id                 IN           NUMBER DEFAULT NULL,
    x_errmsg                    OUT NOCOPY  VARCHAR2,
    x_return_status             OUT NOCOPY  VARCHAR2)
 IS
    l_ct_reference              ra_customer_trx.ct_reference%type;
Line: 72

        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_HEADER(+)' );
Line: 82

        ar_invoice_utils.debug ('Before calling AR_TRX_BULK_PROCESS_HEADER.insert_row (+)' );
Line: 85

    AR_TRX_BULK_PROCESS_HEADER.insert_row(
            p_trx_header_id  => ar_trx_header_rec.trx_header_id,
            x_errmsg            =>  x_errmsg,
            x_return_status     =>  x_return_status);
Line: 99

        ar_invoice_utils.debug ('Before calling AR_TRX_BULK_PROCESS_HEADER.insert_row (-)' );
Line: 100

        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_HEADER(-)' );
Line: 104

                x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.INSERT_TRX_HEADER '||sqlerrm;
Line: 109

PROCEDURE INSERT_TRX_LINES (
        ar_trx_lines_rec                IN  ar_trx_lines_gt%rowtype,
        p_cust_trx_id                   IN  NUMBER,
        p_batch_id                      NUMBER DEFAULT NULL,
        x_errmsg                    OUT NOCOPY  VARCHAR2,
        x_return_status             OUT NOCOPY  VARCHAR2) IS

BEGIN
    IF pg_debug = 'Y'
    THEN
        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_LINES(+)' );
Line: 125

    AR_TRX_BULK_PROCESS_LINES.insert_row(
            p_trx_header_id => ar_trx_lines_rec.trx_header_id,
            p_trx_line_id   => ar_trx_lines_rec.trx_line_id,
            x_errmsg            =>  x_errmsg,
            x_return_status     =>  x_return_status );
Line: 136

        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_LINES(-)' );
Line: 140

                x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.INSERT_TRX_LINES '||sqlerrm;
Line: 146

PROCEDURE INSERT_TRX_DIST (
    p_trx_dist_id           IN      NUMBER  DEFAULT NULL,
    p_batch_id              IN      NUMBER  DEFAULT NULL,
    x_errmsg                OUT NOCOPY  VARCHAR2,
    x_return_status         OUT NOCOPY  VARCHAR2)  IS

BEGIN
    IF pg_debug = 'Y'
    THEN
        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_DIST(+)' );
Line: 159

    AR_TRX_BULK_PROCESS_DIST.INSERT_ROW (
            p_trx_dist_id => p_trx_dist_id,
            x_errmsg            =>  x_errmsg,
            x_return_status     =>  x_return_status );
Line: 170

        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_TRX_DIST(-)' );
Line: 175

                x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.INSERT_TRX_DIST '||sqlerrm;
Line: 179

END INSERT_TRX_DIST;
Line: 181

PROCEDURE INSERT_TRX_SALESCR (
    p_trx_salescredit_id    IN      NUMBER  DEFAULT NULL,
    p_batch_id              IN      NUMBER  DEFAULT NULL,
    x_errmsg                OUT NOCOPY  VARCHAR2,
    x_return_status         OUT NOCOPY  VARCHAR2)  IS

BEGIN
    IF pg_debug = 'Y'
    THEN
        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_SALESCR(+)' );
Line: 195

    UPDATE ar_trx_salescredits_gt
        SET request_id = -(p_batch_id);
Line: 198

    AR_TRX_BULK_PROCESS_SALESCR.INSERT_ROW (
            p_trx_salescredit_id => p_trx_salescredit_id,
            x_errmsg            =>  x_errmsg,
            x_return_status     =>  x_return_status );
Line: 209

        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.INSERT_SALESCR(-)' );
Line: 214

                x_errmsg := 'Error in AR_INVOICE_TABLE_HANDLER.INSERT_TRX_SALESCR '||sqlerrm;
Line: 217

END INSERT_TRX_SALESCR;
Line: 237

    INSERT INTO RA_BATCHES
    (
            CREATED_BY,
            CREATION_DATE,
            LAST_UPDATED_BY,
            LAST_UPDATE_DATE,
            LAST_UPDATE_LOGIN,
            PROGRAM_APPLICATION_ID,
            PROGRAM_ID,
            PROGRAM_UPDATE_DATE,
            BATCH_ID,
            request_id,
            NAME,
            BATCH_DATE,
            GL_DATE,
            TYPE,
            BATCH_SOURCE_ID,
            SET_OF_BOOKS_ID
            ,org_id
        )
        values (
            fnd_global.user_id,
            sysdate,
            fnd_global.user_id,
            sysdate,
            fnd_global.login_id,
            fnd_global.prog_appl_id,
            null,
            sysdate,
            RA_BATCHES_S.NEXTVAL,
            -(RA_BATCHES_S.currval),
            'AR_INVOICE_API'||'_'||RA_BATCHES_S.currval,
            sysdate,
            trunc(nvl(p_batch_source_rec.default_date,trunc(sysdate))),
            'INV',
            nvl(p_batch_source_rec.batch_source_id, p_trx_profile_rec.ar_ra_batch_source),
            p_trx_system_parameters_rec.set_of_books_id
            ,arp_standard.sysparm.org_id)
        returning batch_id INTO p_batch_id;
Line: 349

    INSERT INTO ar_trx_errors_gt (
                    trx_header_id,
                    trx_line_id,
                    trx_dist_id,
                    trx_salescredit_id,
                    error_message,
                    invalid_value)
     VALUES
                    ( p_trx_header_id,
                      p_trx_line_id,
                      p_trx_dist_id,
                      p_trx_salescredit_id,
                      p_error_message,
                      p_invalid_value);
Line: 374

        delete from ra_customer_trx where customer_trx_id = p_customer_trx_id;
Line: 375

        delete from ra_customer_trx_lines where customer_trx_id = p_customer_trx_id;
Line: 376

        delete from ra_cust_trx_line_gl_dist where customer_trx_id = p_customer_trx_id;
Line: 377

        delete from ar_payment_schedules where customer_trx_id = p_customer_trx_id;
Line: 378

        delete from RA_CUST_TRX_LINE_SALESREPS where customer_trx_id = p_customer_trx_id;
Line: 386

           SELECT ct.customer_trx_id
           FROM   ra_customer_trx      ct
           WHERE
               EXISTS (SELECT 'error'
                       FROM   ar_trx_errors_gt err,
                              ar_trx_header_gt head
                       WHERE  err.trx_header_id = head.trx_header_id
                       AND    head.customer_trx_id = ct.customer_trx_id);
Line: 401

     /* Delete everything else */
        delete from ra_customer_trx
        where customer_trx_id in (
          select distinct th.customer_trx_id
          from   ar_trx_errors_gt err,
                 ar_trx_header_gt th
          where  err.trx_header_id = th.trx_header_id);
Line: 409

        delete from ra_customer_trx_lines
        where customer_trx_id in (
          select distinct th.customer_trx_id
          from   ar_trx_errors_gt err,
                 ar_trx_header_gt th
          where  err.trx_header_id = th.trx_header_id);
Line: 416

        delete from ra_cust_trx_line_gl_dist
        where customer_trx_id in (
          select distinct th.customer_trx_id
          from   ar_trx_errors_gt err,
                 ar_trx_header_gt th
          where  err.trx_header_id = th.trx_header_id);
Line: 423

        delete from ar_payment_schedules
        where customer_trx_id in (
          select distinct th.customer_trx_id
          from   ar_trx_errors_gt err,
                 ar_trx_header_gt th
          where  err.trx_header_id = th.trx_header_id);
Line: 430

        delete from RA_CUST_TRX_LINE_SALESREPS
        where customer_trx_id in (
          select distinct th.customer_trx_id
          from   ar_trx_errors_gt err,
                 ar_trx_header_gt th
          where  err.trx_header_id = th.trx_header_id);
Line: 440

PROCEDURE INSERT_ROW(
        p_trx_system_parameters_rec     IN      AR_INVOICE_DEFAULT_PVT.trx_system_parameters_rec_type,
        p_trx_profile_rec               IN      AR_INVOICE_DEFAULT_PVT.trx_profile_rec_type,
        p_batch_source_rec              IN      AR_INVOICE_API_PUB.batch_source_rec_type,
        x_errmsg                        OUT NOCOPY  VARCHAR2,
        x_return_status                 OUT NOCOPY  VARCHAR2)   AS

l_cust_trx_id       NUMBER;
Line: 511

    SELECT * FROM ar_trx_header_gt gt
    WHERE NOT EXISTS ( SELECT 'X' FROM
                       ar_trx_errors_gt err
                       WHERE err.trx_header_id = gt.trx_header_id);
Line: 517

    SELECT * FROM ar_trx_lines_gt gt
    WHERE  trx_header_id = l_trx_header_id
    order by trx_header_id, trx_line_id, line_number;
Line: 522

    SELECT * FROM ar_trx_dist_gt
       where trx_header_id = l_trx_header_id
       AND   account_class = 'REC'
       AND   process_flag = 'N';
Line: 530

        ar_invoice_utils.debug ('AR_INVOICE_TABLE_HANDLER.insert_row(+)' );
Line: 563

            ar_invoice_utils.debug ('calling insert_trx_header (+)' );
Line: 566

        insert_trx_header ( ar_trx_header_rec   => ar_trx_header_rec,
                            p_batch_id          => l_batch_id,
                            x_errmsg            =>  x_errmsg,
                            x_return_status     =>  x_return_status);
Line: 578

            ar_invoice_utils.debug ('calling insert_trx_header (-)' );
Line: 582

        /* 5921925 - Do not call insert unless there were dists rows */
        IF ar_invoice_api_pub.g_dist_exist
        THEN
           BEGIN
               FOR ar_trx_dist_rec IN ar_trx_dist_c
               LOOP
                   INSERT_TRX_DIST(
                   p_trx_dist_id     =>  ar_trx_dist_rec.trx_dist_id,
                   p_batch_id        =>  l_batch_id,
                   x_errmsg          =>  x_errmsg,
                   x_return_status   =>  x_return_status);
Line: 614

                ar_invoice_utils.debug ('Calling insert_trx_lines (+)' );
Line: 619

            insert_trx_lines(ar_trx_lines_rec   => ar_trx_lines_rec,
                             p_cust_trx_id      => l_cust_trx_id,
                             p_batch_id         => l_batch_id,
                             x_errmsg            =>  x_errmsg,
                             x_return_status     =>  x_return_status);
Line: 631

                ar_invoice_utils.debug ('Calling insert_trx_lines (-)' );
Line: 681

                 arp_process_tax.after_insert_line   */

                  IF ar_trx_lines_rec.line_type = 'FREIGHT' THEN
                    BEGIN

						/* Changes for Bug 5398561 starts. */
						DECLARE
						lv_ship_via		ar_trx_header_gt.ship_via%type;
Line: 694

							 select ship_via, ship_date_actual
							 into   lv_ship_via, lv_ship_dt_actual
							 from   ar_trx_header_gt
							 where  customer_trx_id = l_cust_trx_id;
Line: 702

							 select ship_via
							 into   lv_ship_via
							 from   ar_trx_header_gt
							 where  customer_trx_id = l_cust_trx_id;
Line: 720

                     arp_process_header.update_header_freight_cover(
                       'AR_INVOICE_API',
                       1,
                       l_cust_trx_id,
                       'INV',
                       null,
                       ar_trx_lines_rec.ship_via,
                       ar_trx_lines_rec.ship_date_actual,
                       ar_trx_lines_rec.waybill_number,
                       ar_trx_lines_rec.fob_point,
                       l_status);
Line: 736

                          'arp_process_header.update_header_freight_cover '
                             || 'raised unexpected error!';
Line: 775

       INSERT_TRX_DIST( p_trx_dist_id => null,
                        p_batch_id => l_batch_id,
                        x_errmsg            =>  x_errmsg,
                        x_return_status     =>  x_return_status );
Line: 788

       INSERT_TRX_SALESCR ( p_trx_salescredit_id => null,
                            p_batch_id => l_batch_id,
                            x_errmsg            =>  x_errmsg,
                            x_return_status     =>  x_return_status );
Line: 962

           arp_util.debug('EXCEPTION:  ar_invoice_table_handler.insert_row()');
Line: 1054

                INSERT INTO ar_trx_errors_gt (
                    trx_header_id,
                    error_message)
                    VALUES
                    ( ar_trx_header_rec.trx_header_id,
                      x_errmsg);
Line: 1067

               ar_invoice_utils.debug ('Insert_row(-)' );
Line: 1076

END INSERT_ROW;