简体   繁体   中英

BAPI_PO_CREATE1 Account 475000 requires an assignment to a CO object

I've found two functions, BAPI_PO_CREATE and BAPI_PO_CREATE1 . Since the CREATE1 has a more recent modification date, I assumed this would be the best one to use. 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:

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. I have come across two different SAP notes but neither of them can be implemented. As well, even when I remove the WBS element from the account I still get the error message.

I've also tried filling in the WBS element in the CO-object field of the BAPI structure, but that did nothing. I can trace the point in the BAPI where it throws this error message but I can't find out why it's happening.

Entire method: http://hastebin.com/ufarisozav.xml

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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