2011 Oct 28 7:52 PM
Hi Experts,
I have two purchase orders in my ALV internal table. One is received from MIGO and the other is received from ML81 transactions. I want to check the FINAL INVOICE INDICATOR box using FM BAPI_PO_CHANGE for these PO's. PO which is received thru MIGO is working fine. But the PO which is received thru ML81 is giving me error in my BAPIRET2 table.
Below is my code.
MOVE: WA_EKPO-EBELP TO I_BAPIMEPOITEM-PO_ITEM,
WA_EKPO-WERKS TO I_BAPIMEPOITEM-PLANT,
'X' TO I_BAPIMEPOITEM-FINAL_INV.
APPEND I_BAPIMEPOITEM.
MOVE: WA_EKPO-EBELP TO I_BAPIMEPOITEMX-PO_ITEM,
'X' TO I_BAPIMEPOITEMX-PO_ITEMX,
'X' TO I_BAPIMEPOITEMX-PLANT,
'X' TO I_BAPIMEPOITEMX-FINAL_INV.
APPEND I_BAPIMEPOITEMX.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = L_PO "Here I am passing PO Number(10020633)
TABLES
RETURN = I_BAPIRET2 "Errors
POITEM = I_BAPIMEPOITEM
POITEMX = I_BAPIMEPOITEMX.
IF SY_SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
The Errors are:
MEPO 000 Purchase order still contains faulty items
BAPI 003 Instance 10020633 of object type PurchaseOrder could not be changed
06 436 In case of Account Assignment, please enter acc. assignment data for item
I am totally stuck over here. Am I missing any parameters to pass in the BAPI. Please help me.
Thanks.
2011 Oct 29 3:45 AM
Hi Nani,
It seems is all ok in code. Try to change a po using bapi from se37.
Regards,
Madhu.
2011 Oct 29 8:30 AM
Hi,
As far as i know, The BAPI has two structures, one will take all its respective values to which the PO should be changed and other will take all its change indicators.
So it is something like. If you want to change a field you will pass that field in first structure of BAPI and in the second structure you will send the indicator. So to which ever field you pass the indicator that field will change.
Here in your below code, the first strucuture would be I_BAPIMEPOITEM and the second one would be I_BAPIMEPOITEMX.
So if you pass plant to the first one and do not pass the change indicator to second, then it will not change the plant. Simillarly you have to do for others.
But for all this to hapen, you need to know according to configuration in your system for a PO, what values should be mandatorily passed to the first strucure so that a particular field in a PO can be changed.
So please consult your functional consultant for all those details to help you figure out any other values which you also need to pass as extra so that the PO can be changed.
Hope this helps.
Thanks,
Venkatesh
2011 Oct 29 8:56 AM
hi use this to get your values
CALL FUNCTION 'BAPI_PO_GETDETAIL1'
EXPORTING
PURCHASEORDER = P_EBELN
ACCOUNT_ASSIGNMENT = ' '
ITEM_TEXT = ' '
HEADER_TEXT = ' '
DELIVERY_ADDRESS = ' '
VERSION = ' '
SERVICES = ' '
SERIALNUMBERS = ' '
INVOICEPLAN = ' '
IMPORTING
POHEADER = POHEADER
POEXPIMPHEADER =
TABLES
RETURN = RETURN3
POITEM = I_BAPIMEPOITEM
POADDRDELIVERY =
POSCHEDULE =
POACCOUNT =
POCONDHEADER =
POCOND =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POTEXTHEADER =
POTEXTITEM =
POEXPIMPITEM =
POCOMPONENTS =
POSHIPPINGEXP =
POHISTORY =
POHISTORY_TOTALS =
POCONFIRMATION =
ALLVERSIONS =
POPARTNER =
EXTENSIONOUT =
SERIALNUMBER =
INVPLANHEADER =
INVPLANITEM =
POHISTORY_MA =
.
2011 Oct 31 1:36 PM
Hi,
Use the FM BAPI_PO_GETDETAIL to get the corresponding details of the PO and then pass these details to BAPI_PO_CHANGE. Also it seems that the PO number you are using does not have the correct information,
Try using another PO number.
Regards,
2011 Nov 01 4:03 AM
Nani,
06 436 In case of Account Assignment, please enter acc. assignment data for item
There seems to this functional error and BAPI parameter seems to be correct.
Just try changing this order (FINAL_INV field value) online with ME22n and check if you encounter the same error.
If yes, consult a functional consultant for the solution.
Regards,
Diwakar
2011 Nov 01 7:31 AM
Hi
Account assignment are basically used for direct charge of material or material without a material number.
K = Cost Center,
P = Project
A = Asset
You specify which account assignment object is to be charged via the account assignment category such as (cost center, sales order, and so on) Which accounts are to be charged when the incoming invoice or goods receipt is posted & which account assignment data you must provide.
You can see this at ME21N/ ME22N under item overview.
If the posting is directly to a cost center(K) or Asset(A) we need this Account assigment category .
Pass the account assginment category in : BAPI_PO_CHANGE-POACCOUNT , it depends upon each line item .
Hope it helps ....!
Regards
Swapnil Kamble
Edited by: swapnil kamble on Nov 1, 2011 8:31 AM
2011 Nov 01 2:33 PM
Hi Everybody,
Thank you so much for the responses.
Madhurao and Diwakar:
I tried to test this BAPI in SE37. If the PO is received thru MIGO, it has only account assignmnet category as F(Order) and if the PO is received thru ML81 then it has both account assignmnet category F(Order) and Item Category D(Service). These account assignments and item categories are seen in Item Overview of transaction ME22N.
Both PO's received thru MIGO and ML81 is working correctly even if I test thru SE37 or directly thru ME22N.
Swapnil:
Account assignment category is not available in BAPI_PO_CHANGE-POACCOUNT. It is available in structure BAPIMEPOITEM-ACCTASSCAT.
For a PO which is received thru ML81, I have passed the account assignment category in structures BAPIMEPOITEM and BAPIMEPOITEMX. I am getting same errors.
Prafull:
The PO type is CALL or RP it is created with 8 digits/charaters(Ex: 10012852).
If a PO type is NB it is created with 6 digits/characters(Ex: 118288).
Zahid and Venkatesh:
I think I am passing all the fields required in my BAPI parameters. But still I am getting the same error. I am just stuck here.
I still don't understand, what parameters am I missing. Does any one have any idea why is this happening? Please Advice/Suggest.
Thanks.
2011 Nov 01 3:06 PM
Hi nani,
Even though you pass the same details that you are passing in program to the BAPI in SE37 transaction- You are not getting any errors? Is it correct?
That means you are not getting any values in that return internal table from SE37-correct?
if above is true, then can you check if these messages are of type E or I or W.. I think instead of checking the SY-SUBRC from BAPI.. Try to check this internal table with messages type 'E' as this is the internal table with any error messages if occurs.
Hope this helps.
Thanks,
Venkatesh.
2011 Nov 01 3:34 PM
The account assignment category is not available in POACCOUNT, but the GL and cost center are. I think you should be entering them there.
Rob
2011 Nov 01 6:37 PM
Hi Venkatesh,
Even though you pass the same details that you are passing in program to the BAPI in
SE37 transaction- You are not getting any errors? Is it correct?If the PO is received from MIGO then YES, I am not getting any messages of type "E". But, if the PO is received thru ML81 then I am getting errors as said in my thread above. All these errors are of type "E".
Thanks.
2011 Nov 01 6:40 PM
Hi Rob,
I tried testing the BAPI in SE37 giving the details as below. But, I am still getting errors.
Import Parameters
PURCHASEORDER = 10013215
Tables
POITEM
PO_ITEM = 00010
PLANT = 0010
FINAL_INV = X
ITEM_CAT = D
ACCTASSCAT = F
POITEMX
PO_ITEM = 00010
PO_ITEMX = X
PLANT = X
FINAL_INV = X
ITEM_CAT = X
ACCTASSCAT = X
POACCOUNT
PO_ITEM = 00010
GL_ACCOUNT = 650080 "I didn't give Cost Center because it is BLANK in my case.
POACCOUNTX
PO_ITEM = 00010
PO_ITEMX = X
GL_ACCOUNT = X
When I execute the BAPI, I am getting errors in my RETURN table.
E MEPO 000 Purchase order still contains faulty items
E BAPI 003 Instance 10020633 of object type PurchaseOrder could not be changed
E 06 436 In case of Account Assignment, please enter acc. assignment data for item
E BS 007 "Material purchase order" is not allowed (ORD 5037567)
Please let me know if I have done anything wrong here. Is there any other way I can achieve this? Anybody please suggest.
Thanks.
2012 Sep 21 6:14 PM
In this case, check to make sure the leading zeroes are in the line item number. Must be 00010 instead of 10. These odd messages appear when the leading zeroes are missing.
2016 Feb 23 12:14 PM