Application Development 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: 

BAPI_PO_CREATE1 with Invoice Plan (SE 771)

Yamada
Discoverer
0 Kudos

Hello,

I am using BAPI_PO_CREATE1 for createing a purchase order with poitem-price_unit = 10000, but I receive always the error message 771(SE).

Inputdata:
 poitem-quantity = 10.
 poitem-net_price = 1,333,333.
 poitem-price_unit = 10,000.
 invplanitem-bill_value = 1,334.

Inputting this data in ME21N can successfully create purchase order, but it will fail in BAPI_PO_CREATE1.

Debugging BAPI I could check that message arrives from form CL_MMPUR_IV_PLAN->CHECK_IV_PLAN_PARTIAL where we can see that it has a check(lv_iv_total_val <> lv_po_total).

 lv_iv_total_val = 1,334.
 lv_po_total = lv_po_total = my_po_data-net_value * my_po_data-net_quantity = 1,333,333 * 10 = 13,333,330.

The reason why the two are not equal is because lv_po_total did not divide by PRICE_UNIT.
However, when invplanitem-bill_value = 13,333,330, BAPI will success, but the result is not I want. Bill value should be 1,334.

picture.PNG

Do anyone faced same problem and fixed it in any way? I have to set price_unit = 10000 and want to create purchase order by BAPI.

Thank you for your help & Regards.

2 REPLIES 2

Sandra_Rossi
Active Contributor
0 Kudos

Compare the parameters you pass to BAPI_PO_CREATE1 and the ones returned by BAPI_PO_GETDETAIL1 for the PO created manually.

0 Kudos

Thanks for your reply.

Through BAPI_PO_GETDETIAL1, I noticed that the parameter INVOICE_PERCENTAGE is different.
[DOC_ITEM = 00010] is created by BAPI_PO_CREATE. It's INVOICE_PERCENTAGE is 100.00, but I was not pass this parameter which may be automatically calculated by BAPI.
[DOC_ITEM = 00020] is created by ME22N.  It's INVOICE_PERCENTAGE is 0.00.

picture2.PNG

By the way, when I try to change the BILL_VALUE of the item which was created by BAPI, try to change it from 13,333,330 to 13,333,331 through ME22N, and change it back to 13,333,330, the error message appeared (SE 772 Sum of percentages is not 100% of item value). When changing it to 1,334, error will not appear.

Is this a program bug?