Skip to Content
0
Former Member
Feb 11, 2011 at 06:16 AM

'BAPI_PO_CREATE1' Multiple account assignment is not possible for AFS item

221 Views

'BAPI_PO_CREATE1' -> This BAPI works perfectly without the 'account assignment' option . But for purchase requisitions which have account assignments BAPI returns the error - E|8W |185 |Multiple account assignment is not possible for AFS items.

Can somebody please help me to get this error resoleve .

My coding I have done like below.

DATA: pohead TYPE bapimepoheader.

DATA: poheadx TYPE bapimepoheaderx.

CONSTANTS : c_x VALUE 'X'.

DATA: exp_head TYPE bapimepoheader.

DATA: return TYPE TABLE OF bapiret2 WITH HEADER LINE.

DATA: poitem TYPE TABLE OF bapimepoitem WITH HEADER LINE.

DATA: poitemx TYPE TABLE OF bapimepoitemx WITH HEADER LINE.

DATA: posched TYPE TABLE OF bapimeposchedule WITH HEADER LINE.

DATA: poschedx TYPE TABLE OF bapimeposchedulx WITH HEADER LINE.

DATA: POACCOUNT TYPE TABLE OF BAPIMEPOACCOUNT WITH HEADER LINE.

DATA: POACCOUNTX TYPE TABLE OF BAPIMEPOACCOUNTx WITH HEADER LINE.

pohead-comp_code = '1000'. "IEQ1 plant. "'1000'.

pohead-doc_type = 'NB' .

pohead-creat_date = sy-datum .

pohead-vendor = EKKO-LIFNR. "'0000500004'.

pohead-purch_org = purch_org.

pohead-pur_group = purch_grp.

pohead-langu = sy-langu .

pohead-doc_date = sy-datum.

poheadx-comp_code = c_x.

poheadx-doc_type = c_x.

poheadx-creat_date = c_x.

poheadx-vendor = c_x.

poheadx-langu = c_x.

poheadx-purch_org = c_x.

poheadx-pur_group = c_x.

poheadx-doc_date = c_x.

poitem-po_item = iLineItem. "1.

poitem-material = req_item-MATERIAL. " '000000000040000234'.

poitem-plant = req_item-PLANT.

poitem-quantity = req_item-QUANTITY.

poitem-net_price = NET_PRICE.

poitem-price_unit = PRICE_UNIT.

poitem-shipping = 'Z1'.

poitem-preq_no = req_item-PREQ_NO.

poitem-preq_item = req_item-PREQ_ITEM.

poitem-acctasscat = 'K'.

APPEND poitem.

poitemx-po_item = iLineItem. "1.

poitemx-po_itemx = c_x.

poitemx-material = c_x.

poitemx-plant = c_x .

poitemx-quantity = c_x .

poitemx-tax_code = c_x .

poitemx-item_cat = c_x .

poitemx-acctasscat = c_x .

poitemx-net_price = c_x.

poitemx-price_unit = c_x.

poitemx-shipping = c_x.

poitemx-preq_no = c_x.

poitemx-preq_item = c_x.

poitemx-acctasscat = c_x.

APPEND poitemx.

POACCOUNT-PO_ITEM = iLineItem.

POACCOUNT-SERIAL_NO = iLineItem.

POACCOUNT-GL_ACCOUNT = '0000211010'.

POACCOUNT-SD_DOC = '0001001056'.

POACCOUNT-ITM_NUMBER = '000100'.

POACCOUNT-CO_AREA = '1000'.

APPEND POACCOUNT.

POACCOUNTX-PO_ITEM = '00001'.

POACCOUNTX-SERIAL_NO = '01'." '01'.

POACCOUNTX-PO_ITEMX = 'X'.

POACCOUNTX-SERIAL_NOX = 'X'.

POACCOUNTX-GL_ACCOUNT = 'X'.

POACCOUNTX-SD_DOC = 'X'.

POACCOUNTX-ITM_NUMBER = 'X'.

APPEND POACCOUNTX.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

poheader = pohead

poheaderx = poheadx

IMPORTING

exppurchaseorder = ex_po_number

expheader = exp_head

TABLES

return = return

poitem = poitem

poitemx = poitemx

POACCOUNT = POACCOUNT

POACCOUNTX = POACCOUNTX.