简体   繁体   English

BAPI_PO_CREATE1 科目 475000 需要分配到 CO 对象

[英]BAPI_PO_CREATE1 Account 475000 requires an assignment to a CO object

I've found two functions, BAPI_PO_CREATE and BAPI_PO_CREATE1 .我发现了两个函数, BAPI_PO_CREATEBAPI_PO_CREATE1 Since the CREATE1 has a more recent modification date, I assumed this would be the best one to use.由于CREATE1修改日期更近,我认为这将是最好的使用。 As an example, I'm creating a rather simple purchase without a material.例如,我正在创建一个没有材料的相当简单的购买。

call function 'BAPI_PO_CREATE1'
  exporting
    poheader   = po_header
    poheaderx  = po_header_x
    testrun    = abap_false
  tables
    return     = returning
    poitem     = po_items
    poitemx    = po_items_x
    poaccount  = po_accounts
    poaccountx = po_accounts_x
    poschedule = po_schedule
    poschedulex = po_schedule_x.

As such, I'm using a G/L Account and WBS element as the cost object:因此,我使用总账科目和 WBS 元素作为成本对象:

append initial line to po_accounts assigning field-symbol(<po_account>).
<po_account>-po_item = current_position.
" Classes that call CONVERSION_EXIT
<po_account>-gl_account = /dim/cl_bonadm_exit=>int_saknr( <item>-gl_account ).
<po_account>-wbs_element = /dim/cl_bonadm_exit=>int_posnr( <item>-wbs_id ).

append initial line to po_accounts_x assigning field-symbol(<po_account_x>).
<po_account_x>-po_item = current_position.
<po_account_x>-po_itemx = abap_true.
<po_account_x>-gl_account = abap_true.
<po_account_x>-wbs_element = abap_true.

However, the I continue to get the error message:但是,我继续收到错误消息:

No instance of object type PurchaseOrder has been created. External reference:
Purchase order item 00010 still contains faulty account assignments
Can delivery date be met?
Account 475000 requires an assignment to a CO object

Which shouldn't be the case, when I fill in the same exact data in ME21n I still get the delivery date warning but not the error on purchase order item.不应该是这样,当我在 ME21n 中填写相同的确切数据时,我仍然收到交货日期警告,但没有收到采购订单项目的错误。 I have come across two different SAP notes but neither of them can be implemented.我遇到过两种不同的 SAP 说明,但都无法实施。 As well, even when I remove the WBS element from the account I still get the error message.同样,即使我从帐户中删除 WBS 元素,我仍然收到错误消息。

I've also tried filling in the WBS element in the CO-object field of the BAPI structure, but that did nothing.我还尝试在 BAPI 结构的 CO-object 字段中填充 WBS 元素,但没有任何效果。 I can trace the point in the BAPI where it throws this error message but I can't find out why it's happening.我可以在 BAPI 中跟踪它抛出此错误消息的点,但我无法找出它发生的原因。

Entire method: http://hastebin.com/ufarisozav.xml整个方法: http : //hastebin.com/ufarisozav.xml

您还需要填充表poaccountx (如功能模块的文档所示),否则系统可能会忽略插入到poaccount表中的部分或全部数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM