zoukankan      html  css  js  c++  java
  • 使用ar_receipt_api_pub.apply失误

    使用ar_receipt_api_pub.apply这个API进行核销时候,因为是以最少的参数进行核销:

    代码
     1           ar_receipt_api_pub.apply( -- Standard API parameters.
     2                                    p_api_version      => 1.0,
     3                                    p_init_msg_list    => fnd_api.g_true,
     4                                    p_commit           => fnd_api.g_true,
     5                                    p_validation_level => fnd_api.g_valid_level_full,
     6                                    x_return_status    => l_return_status,
     7                                    x_msg_count        => l_msg_count,
     8                                    x_msg_data         => l_msg_data,
     9 
    10 
    11                                    p_cash_receipt_id => rec_reciept.cash_receipt_id, --收款ID
    12                                    p_customer_trx_id => rec_invoice.customer_trx_id, --事务处理ID
    14                                    );
    15 

    造成的失误:

    如果以最少的参数进行核销,默认情况下,

    假如有4张发票A/B/C/D,发票金额分别为1500,3500,2000,3000,收款8000

    1. 标准功能核销时候,A核销1500,B核销3500,C核销2000,D核销1000,即最后仅剩下D还有未核销的情况。

    2. 新开发的功能中,客户可能是想A核销1000,B核销3000,C核销1500,D核销2500,即每张发票都有余额。

    我使用上面以最少参数进行核销的API,核销的结果是1的结果,而不是2的结果。

    原因是因为没有将核销金额导入API。

    代码
     1           ar_receipt_api_pub.apply( -- Standard API parameters.
     2                                    p_api_version      => 1.0,
     3                                    p_init_msg_list    => fnd_api.g_true,
     4                                    p_commit           => fnd_api.g_true,
     5                                    p_validation_level => fnd_api.g_valid_level_full,
     6                                    x_return_status    => l_return_status,
     7                                    x_msg_count        => l_msg_count,
     8                                    x_msg_data         => l_msg_data,
     9                                    --Receipt application parameters.
    10                                    p_cash_receipt_id => rec_reciept.cash_receipt_id, --收款ID
    11                                    p_customer_trx_id => rec_invoice.customer_trx_id, --事务处理ID
    12                                    p_amount_applied_from => rec_invoice.apply_account --核销金额
    13                                    );

    原本以为OK了,后来提交请求出现错误:

    +---------------------------------------------------------------------------+
    FND_FILE 中日志消息开始
    +---------------------------------------------------------------------------+
    -------------------------------------------------------------
    收款编号:++gzb2010042001
    ----------------------------------
    税票号:++gzb2010042001
    -----------------
    发票号:++1270335
    返回状态 :E
    此发票核销失败:E+本位币收款的已分配收款额与核销额必须相同。收款编号:gzb2010042001发票号:1270335
    error:ORA-0000: normal, successful completion
    +---------------------------------------------------------------------------+
    FND_FILE 中日志消息结束
    +---------------------------------------------------------------------------+


    解决办法:

    还是我的失误,翻看Oracle User Guide查看API,在APPLY的与金额相关的三个参数说明:

    Amount Applied
     The amount applied cannot be null. The error message raised for an invalid value is AR_RAPI_APPLIED_AMT_NULL.
     The amount applied must not be greater than the line amount for the given customer_trx_line ID (if specified). The error message raised for an invalid value is AR_RW_APPLIED_GREATER_LINE.
     Depending on the creation sign, natural application flag, allow overapplication flag, and the amount due remaining of the specified transaction installment, the amount applied is validated to check for overapplication and natural application. The error messages raised for invalid values are AR_CKAP_OVERAPP, AR_CKAP_NATURALAPP, and AR_CKAP_CT_SIGN. For details of the messages, refer to Messages on page 7-131.
    Note: This transaction can be in a currency that is different from the receipt currency.

    For a cross currency application, the following equation sheould always be valid:

    amount applied * trans to receipt rate = amount applied from
    The error message raised is AR_RAPI_INVALID_CC_AMTS.


    Amount Applied From
     The amount applied from cannot be null. The error message raised for an invalid value is AR_RAPI_AMT_APP_FROM_NULL.
     The amount applied from cannot be greater than the unapplied amount available on the receipt. The error message raised for invalid values is AR_RW_APP_NEG_UNAPP.
     If the transaction currency and the receipt currency are the same, then the amount applied from must always be equal to the amount applied. The error message raised for an invalid value is AR_RAPI_AMT_APP_FROM_INVALID.
     As mentioned previously for a cross currency application, the following equation must always be valid:
    amount applied * trans to receipt rate = amount applied from


    Trans to Receipt Rate
     For a cross currency application, the trans to receipt rate should have a positive value. The error message raised for an invalid value is AR_RW_CC_RATE_POSITIVE.
     If the transaction currency and the receipt currency are the same, then the rate should not have any value specified. The error message raised for an invalid value is AR_RAPI_INVALID_CC_RATE.
     For a cross currency application, the following equation should always be valid:  
    amount applied * trans to receipt rate = amount applied from
    If this condition is violated, then the error raised is AR_RAPI_CC_RATE_AMTS_INVALID.

    发现我的参数搞错了,导入API时候,可能会对核销金额做验证,正确的Code:

    代码
     1           ar_receipt_api_pub.apply( -- Standard API parameters.
     2                                    p_api_version      => 1.0,
     3                                    p_init_msg_list    => fnd_api.g_true,
     4                                    p_commit           => fnd_api.g_true,
     5                                    p_validation_level => fnd_api.g_valid_level_full,
     6                                    x_return_status    => l_return_status,
     7                                    x_msg_count        => l_msg_count,
     8                                    x_msg_data         => l_msg_data,
     9                                    --Receipt application parameters.
    10                                    p_cash_receipt_id => rec_reciept.cash_receipt_id, --收款ID
    11                                    p_customer_trx_id => rec_invoice.customer_trx_id, --事务处理ID
    12                                    p_amount_applied      => rec_invoice.apply_account--, --核销金额
    13                                    );
  • 相关阅读:
    线程
    链表
    String 练习
    23种设计模式
    静态方法
    ASCII码及UTF-8概义
    java语法基础
    二进制、八进制、十进制、十六进制之间转换
    数组概意
    java程序安装 配置环境变量
  • 原文地址:https://www.cnblogs.com/benio/p/1715882.html
Copyright © 2011-2022 走看看