Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

bapi for create po

Former Member
0 Likes
1,593

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,194

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

7 REPLIES 7
Read only

Former Member
0 Likes
1,194

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

Read only

Former Member
0 Likes
1,194

Are you passing data to the tables parameter PO_ITEM_SCHEDULES?

Read only

0 Likes
1,194

Yes I have entered the data in that module.

Read only

0 Likes
1,194

Hi,

Check the entries in structures PO_ITEMS & PO_ITEM_SCHEDULES.

Regards

Vinod

Read only

former_member233090
Active Contributor
0 Likes
1,194

HI,

Please Search in SDN before you post.

Bhavana

Read only

Former Member
0 Likes
1,194

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

Read only

Former Member
0 Likes
1,195

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