SAP/FICO/BAPI_ACC_DOCUMENT_POST-外币凭证金额和本位币误差问题处理

场景:通过BAPI_ACC_DOCUMENT_POST创建USD币别凭证SAP会自动带出CNY本位币金额,本位币金额是USD通过SAP配置的汇率计算出来的,有时候会有误差。
想要实现的功能:凭证金额和本位币金额都有外部系统传入设置不需要SAP自动通过汇率计算

  CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
    EXPORTING
      documentheader    = gd_documentheader
      customercpd       = gd_customercpd
      contractheader    = gd_fica_hd
    IMPORTING
      obj_key           = lv_key
    TABLES
      accountgl         = it_accountgl
      accountreceivable = it_accountreceivable
      accountpayable    = it_accountpayable
      accounttax        = it_accounttax
      currencyamount    = it_currencyamount  "通过这个传入参数设置如下
      criteria          = it_criteria
      valuefield        = it_valuefield
  •     EXTENSION1        = IT_EXTENSION
        extension2        = it_extension2
        return            = it_return
        paymentcard       = it_paymentcard
        contractitem      = it_fica_it
        realestate        = it_re.
    

"注意点:it_currencyamount 里面数量一定要按照itemno_acc curr_type 排序

CLEAR it_currencyamount.
it_currencyamount-itemno_acc = g_n.
it_currencyamount-curr_type = ‘00’."凭证币别标识
it_currencyamount-currency = gt_act-waers."凭证币别(外币如USD)
it_currencyamount-amt_doccur = gt_act-wrbtr."凭证币别对应的金额
it_currencyamount-exch_rate = gt_act-kursf."汇率(可不传输)
APPEND it_currencyamount.

IF ( gt_act-dmbtr IS NOT INITIAL OR gt_act-dmbtr <> 0 )
AND gt_act-h_waers IS NOT INITIAL.
it_currencyamount-itemno_acc = g_n."
it_currencyamount-curr_type = ‘10’."本位币币别标识(如CNY)
it_currencyamount-currency = gt_act-h_waers."本位币币别
it_currencyamount-amt_doccur = gt_act-dmbtr."本位币币别对应的金额
it_currencyamount-exch_rate = gt_act-kursf."汇率(可不传输)
APPEND it_currencyamount.
ENDIF.

你可能感兴趣的:(ABAP,SAP,abap,SAP)