2010 Sep 28 11:09 AM
Hi!
in all the examples that I've seen about BAPI_PO_CREATE1, almost all the tables are filled.
It's possible to create a PO with header (and x) , item (and x) and account (and x). Only this 6 tables.
If I do it, appears the error ME 083, saying that I have to introduce the cost center, and I've put it in the account table.
This is the code that have the problem.
Thanks for your help.
HEADER--------------------------------------
d_clase_doc = 'AL'.
CLEAR header.
header-comp_code = i_ztmm001k-bukrs.
header-doc_type = d_clase_doc.
header-vendor = i_prov_pedidos-lifnr.
header-purch_org = 'OCVA'.
header-pur_group = '001'.
header-sales_pers = '4290'.
CLEAR headerx.
headerx-comp_code = 'X'.
headerx-doc_type = 'X'.
headerx-vendor = 'X'.
headerx-purch_org = 'X'.
headerx-pur_group = 'X'.
headerx-sales_pers = 'X'.
ITEM ------------------------------------------
DATA: p_contador_pedido TYPE i VALUE 0.
CLEAR i_item.
CLEAR i_itemx.
p_contador_pedido = p_contador_pedido + 10.
i_item-plant = '1056'.
i_item-po_unit = 'M'.
i_item-acctasscat = 'K'.
i_item-trackingno = '4290'.
i_item-quantity = '44'.
i_item-po_item = p_contador_pedido.
i_item-short_text = 'HOLA'.
i_item-po_price = '1'.
i_item-price_unit = '1'.
i_item-tax_code = ''.
i_item-net_price = '27'.
i_item-material = '000000000000009791'.
i_item-item_cat = '0790'."''.
i_itemx-plant = 'X'.
i_itemx-po_unit = 'X'.
i_itemx-acctasscat = 'X'.
i_itemx-trackingno = 'X'.
i_itemx-quantity = 'X'.
i_itemx-po_item = p_contador_pedido.
i_itemx-short_text = 'X'.
i_itemx-po_price = 'X'.
i_itemx-price_unit = 'X'.
i_itemx-tax_code = 'X'.
i_itemx-net_price = 'X'.
i_itemx-material = 'X'.
i_itemx-item_cat = 'X'.
i_itemx-po_itemx = 'X'.
APPEND i_item.
APPEND i_itemx.
ACCOUNT ---------------------------------------------
CLEAR i_account.
CLEAR i_accountx.
i_account-po_item = p_contador_pedido.
i_account-serial_no = 01.
i_account-quantity = '44'.
i_account-costcenter = 'CN274572BE'.
i_account-gl_account = '6020240000'.
i_account-co_area = 'LUBS'.
i_accountx-po_item = p_contador_pedido.
i_accountx-po_itemx = 'X'.
i_accountx-serial_no = 01.
i_accountx-quantity = 'X'.
i_accountx-costcenter = 'X'.
i_accountx-gl_account = 'X'.
i_accountx-co_area = 'X'.
APPEND i_account.
APPEND i_accountx.
BAPI --------------------------
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
no_price_from_po = 'X'
IMPORTING
exppurchaseorder = l_pedido
TABLES
return = i_return
poitem = i_item
poitemx = i_itemx
poaccount = i_account
poaccountx = i_accountx.
2010 Sep 28 11:32 AM
2010 Sep 28 11:39 AM
Hi!
I've do it, but it doesn't work.
The error is the same.
thank you.
2010 Sep 28 11:52 AM
Hi
Since in u r case u r creating the PO with account assigment 'K'. So u need to pass the Cost Center.
'K' reprensents PO with cost center.
Regards,
Raghu.
2010 Sep 28 12:01 PM
Hi Raghu,
I'm passing the cost center in the i_account table.
What are you refering for?
2010 Sep 28 11:52 AM
Hi Adell,
U need to populate the Schedule structure and ITEM_ACC_ASS structure ....
data : ITEM_SCHEDULES type standard table of BAPIMEPOSCHEDULE,
ITEM_SCHEDULEX type standard table of BAPIMEPOSCHEDULX,
ITEM_ACC_ASS type standard table of BAPIMEPOACCOUNT,
ITEM_ACC_ASSX type standard table of BAPIMEPOACCOUNTX.
ITEM_SCHEDULES-PO_ITEM = WA_EXP_ITEM-PO_ITEM.
ITEM_SCHEDULES-SCHED_LINE = '0001'.
ITEM_SCHEDULES-DELIVERY_DATE = WA_EXP_ITEM-EINDT.
ITEM_SCHEDULES-QUANTITY = WA_EXP_ITEM-QUANTITY.
APPEND ITEM_SCHEDULES.
ITEM_SCHEDULEX-PO_ITEM = WA_EXP_ITEM-PO_ITEM.
ITEM_SCHEDULEX-SCHED_LINE = '0001'.
ITEM_SCHEDULEX-DELIVERY_DATE = 'X'.
ITEM_SCHEDULEX-QUANTITY = 'X'.
APPEND ITEM_SCHEDULEX.
ITEM_ACC_ASS-PO_ITEM = WA_EXP_ITEM-PO_ITEM.
ITEM_ACC_ASS-SERIAL_NO = SRL_NO.
ITEM_ACC_ASS-QUANTITY = WA_EXP_ITEM_S_FINAL-QUANTITY.
ITEM_ACC_ASS-DISTR_PERC = WA_EXP_ITEM_S_FINAL-DISTR_PERC.
ITEM_ACC_ASS-GL_ACCOUNT = WA_EXP_ITEM_S_FINAL-GL_ACCOUNT.
ITEM_ACC_ASS-BUS_AREA = GSBER.
ITEM_ACC_ASS-COSTCENTER = WA_EXP_ITEM_S_FINAL-KOSTL.
ITEM_ACC_ASS-CO_AREA = 'XXX'.
ITEM_ACC_ASS-PROFIT_CTR = ''.
APPEND ITEM_ACC_ASS.
SRL_NO = SRL_NO + 1.
ITEM_ACC_ASSX-PO_ITEM = WA_EXP_ITEM-PO_ITEM.
ITEM_ACC_ASSX-SERIAL_NO = '01'.
ITEM_ACC_ASSX-QUANTITY = 'X'.
ITEM_ACC_ASSX-DISTR_PERC = 'X'.
ITEM_ACC_ASSX-GL_ACCOUNT = 'X'.
* ITEM_ACC_ASSX-BUS_AREA = 'X'.
* ITEM_ACC_ASSX-COSTCENTER = 'X'.
ITEM_ACC_ASSX-NET_VALUE = 'X'.
ITEM_ACC_ASSX-CO_AREA = 'X'.
ITEM_ACC_ASSX-PROFIT_CTR = 'X'.
APPEND ITEM_ACC_ASSX.
Hope this will solve ur problem.....
Regards,
Amitava
Edited by: Amitava De on Sep 28, 2010 4:26 PM
2010 Sep 28 11:59 AM
Hi!
I've filled the Shedule table and the error is the same.
And also I've tried to pass the condition table, but it doesn't works.
Thanks.
2010 Sep 28 12:03 PM
Hi
Since u r creating the PO with account assigment 'K'. So u need pass the cost center(COSTCENTER) in structure POACCOUNT.
Regards,
Raghu.
2010 Sep 29 9:44 AM
Finally I've found it,
the note 1361190 solves the problem.
Thanks everybody.