Tuesday 11 April 2017

Lease Creation API in Oracle Property manager

BEGIN
            select vendor_id
            into   v_vendor_id
            from   ap_suppliers
            where vendor_name  = r_get_lease_rec.vendor_name
            ;
EXCEPTION
        WHEN NO_DATA_FOUND THEN
        v_error_msg:=v_error_msg||'Vendor'||r_get_lease_rec.vendor_name||'  is not found . Please verify!!';
            FND_FILE.PUT_LINE(FND_FILE.LOG,v_error_msg);
            v_error_flag := 'Y';
        WHEN OTHERS THEN
        v_error_msg:=v_error_msg||'Error in Validating Vendor '||r_get_lease_rec.vendor_name||', Error Message ->'||sqlerrm;
            FND_FILE.PUT_LINE(FND_FILE.LOG,v_error_msg);
            v_error_flag := 'Y';
END;

        --Validate Vendor Site
        BEGIN
            select vendor_site_id
            into   v_vendor_Site_id
            from   ap_supplier_sites_All
            where  1=1
            and    org_id           = v_circle_id
            and    vendor_id        = v_vendor_id
            and    vendor_site_code = r_get_lease_rec.vendor_site_Code;

        EXCEPTION
        WHEN NO_DATA_FOUND THEN
        v_error_msg:=v_error_msg||'Vendor Site'||r_get_lease_rec.vendor_site_Code||'  is not found . Please verify!!';
            FND_FILE.PUT_LINE(FND_FILE.LOG,v_error_msg);
            v_error_flag := 'Y';
        WHEN OTHERS THEN
        v_error_msg:=v_error_msg||'Error in Validating Vendor Site Code '||r_get_lease_rec.vendor_site_Code||', Error Message ->'||sqlerrm;
            FND_FILE.PUT_LINE(FND_FILE.LOG,v_error_msg);
            v_error_flag := 'Y';
        END;
            IF v_error_flag <> 'Y'
            THEN
            BEGIN
            FND_FILE.PUT_LINE(FND_FILE.LOG,'r_get_lease_rec.name'||r_get_lease_rec.name);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'r_get_lease_rec.lease_num'||r_get_lease_rec.lease_num);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'g_user_id'||g_user_id);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'v_circle_id'||v_circle_id);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'v_location_id'||v_location_id);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'v_frequency'||v_frequency);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'v_payment_purpose_code'||v_payment_purpose_code);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'v_payment_type'||v_payment_type);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'v_vendor_id'||v_vendor_id);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'v_vendor_site_id'||v_vendor_site_id);
            FND_FILE.PUT_LINE(FND_FILE.LOG,'v_sobid'||v_payment_type);

                pn_leases_pkg.insert_row
                                  (  x_rowid                          => v_chr_rowid1                   /*Output Parameter for Row Id*/
                                    ,x_lease_id                       => v_num_lease_id1                /*Output Parameter for lease Id*/
                                    ,x_lease_change_id                => v_num_lease_ch_id1             /*Output Parameter for lease change Id*/
                                    ,x_lease_detail_id                => v_num_detail_id1               /*Output parameter for Lease Detail id*/
                                    ,x_name                           => r_get_lease_rec.name           /*Input the Lease Name*/
                                    ,x_lease_num                      => r_get_lease_rec.lease_num      /*Input Lease number*/
                                    ,x_parent_lease_id                => NULL
                                    ,x_lease_type_code                => 'NNN'                          /*Input lease type and class code set in the above lookups*/
                                    ,x_lease_class_code               => 'DIRECT'
                                    ,x_payment_term_proration_rule    => 365                            /*Input the Proration rule Value*/
                                    ,x_abstracted_by_user             => g_user_id
                                    ,x_status                         => 'D'                            /*Input approval status as `DRAFT?. Initially lease will be created in `DRAFT? status and the Schedules and Items Program will finalize the Lease*/
                                    ,x_lease_status                   => 'ACT'                          --Active Status
                                    /*WHO Columns*/
                                    ,x_creation_date                  => sysdate
                                    ,x_created_by                     => g_user_id
                                    ,x_last_update_date               => sysdate
                                    ,x_last_updated_by                => g_user_id
                                    ,x_last_update_login              => g_user_id
                                    ,x_responsible_user               => g_user_id
                                    ,x_expense_account_id             => NULL
                                    ,x_accrual_account_id             => NULL
                                    ,x_receivable_account_id          => NULL
                                    ,x_term_template_id               => NULL
                                    /*Input Commencement, Termination and Execution Date for Lease*/
                                    ,x_lease_commencement_date        => r_get_lease_rec.lease_commencement_date
                                    ,x_lease_termination_date         => r_get_lease_rec.lease_termination_date
                                    ,x_lease_execution_date           => r_get_lease_rec.lease_execution_date
                                    /*Pass the values of any Attribute Columns*/
                                    ,x_attribute_category             => NULL
                                    ,x_attribute1                     => NULL
                                    ,x_attribute2                     => NULL
                                    ,x_attribute3                     => NULL
                                    ,x_attribute4                     => NULL
                                    ,x_attribute5                     => NULL
                                    ,x_attribute6                     => NULL
                                    ,x_attribute7                     => NULL
                                    ,x_attribute8                     => NULL
                                    ,x_attribute9                     => NULL
                                    ,x_attribute10                    => NULL
                                    ,x_attribute11                    => NULL
                                    ,x_attribute12                    => NULL
                                    ,x_attribute13                    => NULL
                                    ,x_attribute14                    => NULL
                                    ,x_attribute15                    => NULL
                                    ,x_org_id                         => v_circle_id
                                    /*Input Location Id from PN_LOCATIONS for the Profit Center (Store Number) and Customer Id for which the is to be created*/
                                    ,x_location_id                    => v_location_id
                                    ,x_customer_id                    => NULL
                                    ,x_grouping_rule_id               => NULL
                                    );
                dbms_output.put_line('v_chr_rowid'||v_chr_rowid1);
                dbms_output.put_line('v_num_lease_id'||v_num_lease_id1);
                dbms_output.put_line('v_num_lease_ch_id'||v_num_lease_ch_id1);
                dbms_output.put_line('v_num_detail_id'||v_num_detail_id1);
                FND_FILE.PUT_LINE(FND_FILE.LOG,'v_chr_rowid'||v_chr_rowid1);
                FND_FILE.PUT_LINE(FND_FILE.LOG,'v_num_lease_id'||v_num_lease_id1);
                FND_FILE.PUT_LINE(FND_FILE.LOG,'v_num_lease_ch_id'||v_num_lease_ch_id1);
                FND_FILE.PUT_LINE(FND_FILE.LOG,'v_num_detail_id'||v_num_detail_id1);
                COMMIT;
                pnt_payment_terms_pkg.insert_row (
                                                /*Output parameter for Row Id*/
                                                x_rowid                                      => v_chr_row_id6
                                                /*Output Parameter for Payment Term Id*/
                                                ,x_payment_term_id                           => v_num_payment_term_id
                                                /*Input Billing Purpose Code and the Billing term*/
                                                ,x_payment_purpose_code                      => v_payment_purpose_code--'RENT'
                                                ,x_payment_term_type_code                    => v_payment_type--'BASER'
                                                /*Input the frequency as Montly, One time, etc... */
                                                ,x_frequency_code                            => v_frequency--'MON'
                                                /*Input parameter Lease Id and lease Change Id*/
                                                ,x_lease_id                                  => v_num_lease_id1
                                                ,x_lease_change_id                           => v_num_lease_ch_id1
                                                /*Input Start and End date for the Payment Stream*/
                                                ,x_start_date                                => r_get_lease_rec.start_date--SYSDATE
                                                ,x_end_date                                  => r_get_lease_rec.end_date--SYSDATE+240
                                                ,x_vendor_id                                 => v_vendor_id
                                                ,x_vendor_site_id                            => v_vendor_site_id
                                                ,x_customer_id                               => NULL
                                                ,x_customer_site_use_id                      => NULL
                                                ,x_target_date                               => NULL
                                                /*Input the Amount for Payment Stream*/
                                                ,x_actual_amount                             => r_get_lease_rec.actual_amount
                                                ,x_estimated_amount                          => NULL
                                                /*Input Set of Books and Currency*/
                                                ,x_set_of_books_id                           => 1001--v_sob_id
                                                ,x_currency_code                             => r_get_lease_rec.currency_code
                                                ,x_rate                                      => 1
                                                /*Input Normalize flag value as `Y? if the payment stream needs to be Normalized*/
                                                ,x_normalize                                 =>'Y'
                                                ,x_location_id                               => NULL
                                                /*Input Special terms and Customer ship to Site*/
                                                ,x_schedule_day                              => r_get_lease_rec.schedule_day
                                                ,x_cust_ship_site_id                         => NULL
                                                /*Input the term Id from the table RA_TERMS and transaction Id from RA_CUST_TRX_TYPES*/
                                                ,x_ap_ar_term_id                             => NULL
                                                ,x_cust_trx_type_id                          => NULL
                                                ,x_project_id                                => NULL
                                                ,x_task_id                                   => NULL
                                                ,x_organization_id                           => NULL
                                                ,x_expenditure_type                          => NULL
                                                ,x_expenditure_item_date                     => NULL
                                                ,x_tax_group_id                              => NULL
                                                /*Input the tax Code Id from the table AR_VAT_TAX*/
                                                ,x_tax_code_id                               => NULL
                                                ,x_tax_included                              => NULL
                                                ,x_distribution_set_id                       => NULL
                                                ,x_inv_rule_id                               => NULL
                                                ,x_account_rule_id                           => NULL
                                                ,x_salesrep_id                               => NULL
                                                ,x_approved_by                               => NULL
                                                ,x_status                                    => NULL
                                                ,x_index_period_id                           => NULL
                                                ,x_index_term_indicator                      => NULL
                                                ,x_po_header_id                              => NULL
                                                ,x_cust_po_number                               => NULL
                                                ,x_receipt_method_id                            => NULL
                                                ,x_var_rent_inv_id                            => NULL
                                                ,x_var_rent_type                              => NULL
                                                ,x_period_billrec_id                            => NULL
                                                ,x_rec_agr_line_id                             => NULL
                                                ,x_amount_type                               => NULL
                                                ,x_changed_flag                              => NULL
                                                ,x_term_template_id                             => NULL
                                                ,x_attribute_category                           => NULL
                                                ,x_attribute1                                => NULL
                                                ,x_attribute2                                => NULL
                                                ,x_attribute3                                => NULL
                                                ,x_attribute4                                => NULL
                                                ,x_attribute5                                => NULL
                                                ,x_attribute6                                => NULL
                                                ,x_attribute7                                => NULL
                                                ,x_attribute8                                => NULL
                                                ,x_attribute9                                => NULL
                                                ,x_attribute10                               => NULL
                                                ,x_attribute11                                  => NULL
                                                ,x_attribute12                                  => NULL
                                                ,x_attribute13                                  => NULL
                                                ,x_attribute14                               => NULL
                                                ,x_attribute15                               => NULL
                                                ,x_project_attribute_category                 => NULL
                                                ,x_project_attribute1                         => NULL
                                                ,x_project_attribute2                         => NULL
                                                ,x_project_attribute3                         => NULL
                                                ,x_project_attribute4                         => NULL
                                                ,x_project_attribute5                         => NULL
                                                ,x_project_attribute6                         => NULL
                                                ,x_project_attribute7                         => NULL
                                                ,x_project_attribute8                         => NULL
                                                ,x_project_attribute9                         => NULL
                                                ,x_project_attribute10                       => NULL
                                                ,x_project_attribute11                       => NULL
                                                ,x_project_attribute12                       => NULL
                                                ,x_project_attribute13                       => NULL
                                                ,x_project_attribute14                       => NULL
                                                ,x_project_attribute15                       => NULL
                                                /*WHO Columns*/
                                                ,x_creation_date                             => SYSDATE
                                                ,x_created_by                                => g_user_id
                                                ,x_last_update_date                          => sysdate
                                                ,x_last_updated_by                           => g_user_id
                                                ,x_last_update_login                           => g_user_id
                                                /*Input Calling form value*/
                                                ,x_calling_form                              => 'PNTLEASE'
                                                ,x_org_id                                    => v_circle_id
                                                ,x_lease_status                              => 'ACT'  --Active Status
                                                ,x_recoverable_flag                          => NULL
                                                ,x_area_type_code                            => NULL
                                                ,x_area                                      => NULL
                                                ,x_grouping_rule_id                          => NULL
                                                );
            COMMIT;

1 comment:

  1. Really impressed! Everything is very open and very clear clarification of issues. It contains truly facts. Your website is very valuable. Thanks for sharing. חוזה שכירות סטנדרטי

    ReplyDelete

AOL SYLLABUS: PREREQUISITE SQL PL/SQL D2K GENERAL INTRODUCTION KNOW HOW OF ERP Version of Oracle Apps 11i Comparison of 10.7/11...