BAPI_PO_CREATE1帐户分配错误

时间:2016-11-02 08:37:45

标签: sap abap bapi

我找到了两个函数,BAPI_PO_CREATEBAPI_PO_CREATE1。由于CREATE1有更新的修改日期,我认为这是最好的修改日期。举个例子,我在没有材料的情况下创建了一个相当简单的购买。

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.

因此,我使用总账科目和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.

但是,我继续收到错误消息:

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

不应该是这种情况,当我在ME21n中填写相同的确切数据时,我仍然会收到交货日期警告,但不会收到采购订单项目上的错误。我遇到过两个不同的SAP注释,但它们都不能实现。同样,即使我从帐户中删除WBS元素,我仍然会收到错误消息。

我也尝试在BAPI结构的CO-object字段中填写WBS元素,但这没有做任何事情。我可以在BAPI中追踪它抛出此错误消息的点,但我无法找出它为什么会发生。

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

1 个答案:

答案 0 :(得分:0)

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