POSTING_INTERFACE_DOCUMENT解决特别总账'W'类型的过账问题

Error F5246 "Special G/L transactions of type & are not supported" is being raised when trying to post a
document via BAPI (i.e. BAPI_ACC_DOCUMENT_POST).
环境
SAP Release Independent •
ERP Financial Accounting •
General Ledger Accounting •
Posting/Clearing •
Accounting interface •
重现问题
Enter a BAPI (i.e. BAPI_ACC_DOCUMENT_POST). 1.
Inform special G/L indicators class = 'W' (bill of exchange). 2.
Post the document. 3.
The system issues message F5246. 4.
原因
Bill of exchange postings are not supported by accounting interface, therefore a bill of exchange posting via
BAPI_ACC_DOCUMENT_POST is not possible. The reason for error F5246 to be raised is that the interface
posting with special G/L indicator W is not designed for a posting with this indicator for downpayment or bill of
exchange.
解决方案
In this case the bill of exchange documents should be posted manually in financial accounting.
Another option to post bill of exchange documents in an automated process is to use batch-input.

SAP给出的解决方案是采用BDC的方式,其实SAP有提供一个函数实现F-02的BATCH-INPUT,代码如下:

1@34qwer*&---------------------------------------------------------------------*
*& Report Y_BAPI_POSTING_INTERFACE
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT y_bapi_posting_interface.

DATA: ls_ftpost TYPE ftpost,
      lt_ftpost TYPE TABLE OF ftpost,
      lt_fttax  TYPE TABLE OF fttax,
      lt_blntab TYPE TABLE OF blntab,
      lv_subrc  TYPE sy-subrc,
      lv_msg    TYPE bapiret2.


CALL FUNCTION 'POSTING_INTERFACE_START'
  EXPORTING
    i_function = 'C'         "For Batch Input.
    i_group    = 'ZSESSION1'  "Name of the session for creation
    i_keep     = 'X'          "Retain the session
    i_user     = sy-uname.    "User name
*CALL FUNCTION 'POSTING_INTERFACE_START'
*  EXPORTING
*    i_function = 'B'         " For Batch Input.
*    i_group    = 'ZSESSION'  " Name of the session for creation
*    i_keep     = 'X'          " Retain the session
*    i_user     = sy-uname.    " User name

DEFINE macro.
  ls_ftpost-fnam = &1.
  ls_ftpost-fval = &2.
  APPEND ls_ftpost TO lt_ftpost.
END-OF-DEFINITION.


"header:
ls_ftpost-stype = 'K'.        "Header indicator
ls_ftpost-count = '001'.      "First item

macro: 'BKPF-BLDAT' '20190919',
       'BKPF-BLART' 'SA',
       'BKPF-BUKRS' '1111',
       'BKPF-BUDAT' sy-datum.

*"items:
ls_ftpost-stype = 'P'.
ls_ftpost-count = '001'.

macro: 'RF05A-NEWBS' '39',
       'RF05A-NEWKO' '2000010',
       'RF05A-NEWUM' 'W',
       'BSEG-ZFBDT' '20190919',
       'BSEG-WRBTR' '100'.

ls_ftpost-stype = 'P'.
ls_ftpost-count = '002'.

macro: 'RF05A-NEWBS' '40',
       'RF05A-NEWKO' '40030103',
       'BSEG-WRBTR' '100',
       'COBL-RMVCT' '100'.


*
CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'
  EXPORTING
    i_tcode   = 'FB01'          "Name of t-code for Posting
    i_sgfunct = 'C'            "Batch input session
  IMPORTING
    e_subrc   = lv_subrc
    e_msgid   = lv_msg-id        "Error handling
    e_msgty   = lv_msg-type      "Error handling
    e_msgno   = lv_msg-number    "Error handling
    e_msgv1   = lv_msg-message_v1 "Error handling
    e_msgv2   = lv_msg-message_v2 "Error handling
    e_msgv3   = lv_msg-message_v3 "Error handling
    e_msgv4   = lv_msg-message_v4 "Error handling
  TABLES
    t_ftpost  = lt_ftpost        "Internal table populated in Step 2
    t_fttax   = lt_fttax        "Relevant for Tax calculation manually
    t_blntab  = lt_blntab       "Relevant only for Call Trans…
  EXCEPTIONS
    OTHERS    = 1.


CALL FUNCTION 'POSTING_INTERFACE_END'.

LOOP AT lt_blntab INTO DATA(ls_blntab).
   WRITE: ls_blntab-belnr,
          ls_blntab-gjahr.
ENDLOOP.

 

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
POSTING_INTERFACE_CLEARING是一个函数,用于进行标准清账操作。它封装了BDC录屏的功能。\[3\]在使用该函数时,如果传入参数ITEM,则必须传入公司代码、记账码和科目。根据你提供的引用内容,你的问题是关于批量创建清账凭证时参照码3的问题。你希望每个参照码3对应一张凭证,但实际上清账凭证创建成功后,参照码3一直沿用了模板中的第一个值。你进行了排查并确认了传参数据的正确性,并清空了相应的内表。然后你尝试使用了free memory来清空ABAP内存变量,并成功解决问题。然而,你想知道使用free memory会有什么影响。 #### 引用[.reference_title] - *1* [SAP-ABAP-清账函数BAPI使用POSTING_INTERFACE_CLEARING,应付暂估外币清账程序](https://blog.csdn.net/Qunending/article/details/124666847)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [清账函数POSTING_INTERFACE_CLEARING的应用](https://blog.csdn.net/wangshaoqiang022/article/details/90234375)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值