‎2010 Jun 04 8:09 AM
I want to run bapi to create purchase order for that I had checked the function module "BAPI_PO_CREATE" in that I had filled all the required fields to run the function module although it is showing two errors
1 E 06026 " Please enter material number or account assignment category"
2 E 06010 " Document contains no items"
I had entered the appropriate material but still it is showing the error and PO number is not generating.
‎2010 Jun 04 8:32 AM
1st Pass the header data
CONSTANTS : c_x VALUE 'X'.
header-comp_code = xxx.
header-doc_type = xxx.
header-creat_date = sy-datum.
header-item_intvl = '10'.
header-vendor = xxxx.
header-langu = ws_langu .
header-purch_org = xx.
header-pur_group = xxx.
header-currency = 'INR'.
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-creat_date = c_x.
headerx-item_intvl = c_x .
headerx-vendor = c_x.
headerx-langu = c_x.
headerx-pmnttrms = c_x .
headerx-purch_org = c_x.
headerx-pur_group = c_x.
loop.
p_int = p_int + 10.
wa_item-po_item = p_int.
wa_item-material = xxxxx.
wa_item-plant = xxxx.
wa_item-quantity = xxxx.
wa_item-tax_code = 'V0'.
wa_item-no_more_gr = 'x'.
APPEND wa_item TO it_item.
wa_itemx-po_item = p_int.
wa_itemx-material = c_x.
wa_itemx-plant = c_x .
wa_itemx-quantity = c_x .
wa_itemx-tax_code = c_x .
wa_itemx-no_more_gr = c_x .
APPEND wa_itemx TO it_itemx.
endloop.
p_pono = ' '.
*AUTO Po Creation
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
IMPORTING
exppurchaseorder = p_pono
TABLES
return = return
poitem = it_item
poitemx = it_itemx.
try using this code
‎2010 Jun 04 8:12 AM
Hi ,
Please run the BAPI explicitly with the data you are passing in your program and see whether it gives same error. Also read the documentation associated with this function module.
Regards,
Uma
‎2010 Jun 04 8:13 AM
Are you passing data to the tables parameter PO_ITEM_SCHEDULES?
‎2010 Jun 04 8:20 AM
‎2010 Jun 04 8:22 AM
Hi,
Check the entries in structures PO_ITEMS & PO_ITEM_SCHEDULES.
Regards
Vinod
‎2010 Jun 04 8:25 AM
‎2010 Jun 04 8:26 AM
You need to set the X parameters as well.
So if you are just passing the material value but not setting X to Xstructures then it treated as if you have not passed the value for material Please see all the corresponding X-Structures are set with X. Same applies to Item table as well.
Regards,
Uma
‎2010 Jun 04 8:32 AM
1st Pass the header data
CONSTANTS : c_x VALUE 'X'.
header-comp_code = xxx.
header-doc_type = xxx.
header-creat_date = sy-datum.
header-item_intvl = '10'.
header-vendor = xxxx.
header-langu = ws_langu .
header-purch_org = xx.
header-pur_group = xxx.
header-currency = 'INR'.
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-creat_date = c_x.
headerx-item_intvl = c_x .
headerx-vendor = c_x.
headerx-langu = c_x.
headerx-pmnttrms = c_x .
headerx-purch_org = c_x.
headerx-pur_group = c_x.
loop.
p_int = p_int + 10.
wa_item-po_item = p_int.
wa_item-material = xxxxx.
wa_item-plant = xxxx.
wa_item-quantity = xxxx.
wa_item-tax_code = 'V0'.
wa_item-no_more_gr = 'x'.
APPEND wa_item TO it_item.
wa_itemx-po_item = p_int.
wa_itemx-material = c_x.
wa_itemx-plant = c_x .
wa_itemx-quantity = c_x .
wa_itemx-tax_code = c_x .
wa_itemx-no_more_gr = c_x .
APPEND wa_itemx TO it_itemx.
endloop.
p_pono = ' '.
*AUTO Po Creation
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
IMPORTING
exppurchaseorder = p_pono
TABLES
return = return
poitem = it_item
poitemx = it_itemx.
try using this code