0

私は 2 つの関数を見つけまし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.

そのため、原価対象として G/L 勘定と 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 に同じ正確なデータを入力すると、まだ納期の警告が表示されますが、発注書のエラーは表示されません。2 つの異なる SAP ノートに出くわしましたが、どちらも実装できません。また、アカウントから WBS 要素を削除しても、エラー メッセージが表示されます。

また、BAPI 構造の CO オブジェクト フィールドに WBS 要素を入力しようとしましたが、何も起こりませんでした。BAPI でこのエラー メッセージがスローされるポイントを追跡できますが、なぜエラーが発生するのかわかりません。

メソッド全体: http://hastebin.com/ufarisozav.xml

4

1 に答える 1