EBS 创建收款API示例

DECLARE
    x_return_status VARCHAR2(1);
    x_msg_data      VARCHAR2(240);

    l_return_status VARCHAR2(1);
    l_msg_count     NUMBER;
    l_msg_data      VARCHAR2(240);

    l_msg_index_out NUMBER;
    l_data          VARCHAR2(240);

    l_status  VARCHAR2(1);
    l_message VARCHAR2(4000);

    l_resp_appl_id    NUMBER;
    l_resp_id         NUMBER;
    l_cash_receipt_id NUMBER;

    l_attribute_rec        ar_receipt_api_pub.attribute_rec_type;
    l_global_attribute_rec ar_receipt_api_pub.global_attribute_rec_type;
BEGIN
    x_return_status := fnd_api.g_ret_sts_success;

    SELECT t.application_id
          ,t.responsibility_id
    INTO   l_resp_appl_id
          ,l_resp_id
    FROM   fnd_responsibility_vl t
    WHERE  t.responsibility_key = '15081_AR_SUPERUSER';

    fnd_global.apps_initialize(user_id      => 0
                              ,resp_id      => l_resp_id
                              ,resp_appl_id => l_resp_appl_id);
    mo_global.set_policy_context('S'
                                ,95);


    l_attribute_rec.attribute1  := ''; --认领单号
    l_attribute_rec.attribute2  := 0; --附件张数
    l_attribute_rec.attribute3  := ''; --出票人
    l_attribute_rec.attribute4  := ''; --出票银行
    l_attribute_rec.attribute5  := ''; --出票日期
    l_attribute_rec.attribute6  := ''; --收款人
    l_attribute_rec.attribute7  := ''; --贴现利息
    l_attribute_rec.attribute8  := ''; --利润中心  CUX_AR_DEPT_LOV
    l_attribute_rec.attribute9  := ''; --现金流量项  CFS_ITEM
    l_attribute_rec.attribute10 := ''; --收款说明 
    l_attribute_rec.attribute11 := ''; --备注/分户  CUX_AR_TERPARTY_LIST_ACR
    l_attribute_rec.attribute12 := ''; --出票总行
    l_attribute_rec.attribute13 := ''; --是否自动贴息

    -- Call the procedure
    ar_receipt_api_pub.create_cash(p_api_version                  => 1.0
                                  ,p_init_msg_list                => fnd_api.g_true
                                  ,p_commit                       => fnd_api.g_true
                                  ,p_validation_level             => fnd_api.g_valid_level_full
                                  ,x_return_status                => l_return_status
                                  ,x_msg_count                    => l_msg_count
                                  ,x_msg_data                     => l_msg_data
                                  ,p_usr_currency_code            => NULL
                                  ,p_currency_code                => 'CNY'
                                  ,p_usr_exchange_rate_type       => NULL
                                  ,p_exchange_rate_type           => null 
                                  ,p_exchange_rate                => NULL
                                  ,p_exchange_rate_date           => null 
                                  ,p_amount                       => 100
                                  ,p_factor_discount_amount       => NULL
                                  ,p_receipt_number               => 'test_roy_20251027'
                                  ,p_receipt_date                 => to_date('2025-09-27'
                                                                            ,'yyyy-MM-dd')
                                  ,p_gl_date                      => to_date('2025-09-27'
                                                                            ,'yyyy-MM-dd')
                                  ,p_maturity_date                => NULL --收款到期日 
                                  ,p_postmark_date                => NULL
                                  ,p_customer_id                  => 35071
                                  ,p_customer_name                => NULL
                                  ,p_customer_number              => NULL
                                  ,p_customer_bank_account_id     => NULL
                                  ,p_customer_bank_account_num    => NULL
                                  ,p_customer_bank_account_name   => NULL
                                  ,p_payment_trxn_extension_id    => NULL
                                  ,p_location                     => NULL
                                  ,p_customer_site_use_id         => 79791
                                  ,p_default_site_use             => NULL
                                  ,p_customer_receipt_reference   => NULL
                                  ,p_override_remit_account_flag  => NULL
                                  ,p_remittance_bank_account_id   => 10905
                                  ,p_remittance_bank_account_num  => NULL
                                  ,p_remittance_bank_account_name => NULL
                                  ,p_deposit_date                 => NULL
                                  ,p_receipt_method_id            => 33008
                                  ,p_receipt_method_name          => NULL
                                  ,p_doc_sequence_value           => NULL
                                  ,p_ussgl_transaction_code       => NULL
                                  ,p_anticipated_clearing_date    => NULL
                                  ,p_called_from                  => 'xxxx.cmb_transaction'
                                  ,p_attribute_rec                => l_attribute_rec
                                  ,p_global_attribute_rec         => l_global_attribute_rec
                                  ,p_comments                     => '这是一笔测试收款'
                                  ,p_issuer_name                  => NULL
                                  ,p_issue_date                   => NULL
                                  ,p_issuer_bank_branch_id        => NULL
                                  ,p_org_id                       => 95
                                  ,p_installment                  => NULL
                                  ,p_cr_id                        => l_cash_receipt_id);
    IF l_return_status = fnd_api.g_ret_sts_success THEN
        l_status := fnd_api.g_ret_sts_success;
    ELSE
        l_status := fnd_api.g_ret_sts_error;
        fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false
                                 ,p_count   => l_msg_count
                                 ,p_data    => l_message);
        IF l_msg_count > 1 THEN
            FOR i IN 1 .. l_msg_count LOOP
                fnd_msg_pub.get(p_msg_index     => i
                               ,p_encoded       => fnd_api.g_false
                               ,p_data          => l_data
                               ,p_msg_index_out => l_msg_index_out);
            
                l_message := substrb(l_message || '【' || l_msg_index_out || '】' || l_data
                                    ,1
                                    ,4000);
            END LOOP;
        END IF;
    
        IF l_message IS NULL THEN
            l_message := '创建收款出现异常错误,请联系系统管理员。';
        END IF;
    END IF;

    dbms_output.put_line('l_status = ' || l_status);
    dbms_output.put_line('l_message = ' || l_message);
    COMMIT;

EXCEPTION
    WHEN OTHERS THEN
        x_return_status := fnd_api.g_ret_sts_error;
        x_msg_data      := 'process_data' || SQLERRM || dbms_utility.format_error_backtrace;
END;

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值