2010 Jul 08 12:56 PM
Hi experts,
Am using bapi_po_change for creating one item for purchase order.
In this function module am passing purchase order number.
And I pass po_item and po_itemx table. But the item is not getting created in ekpo table. What will be the problem??
My piece of code for test purpose.
select single ebelp into lv_ebelp from ekpo where ebeln = v_ebeln and ebelp = v_ebelp.
if sy-subrc <> 0.
clear wa_poitem.
wa_poitem-po_item = po_item.
wa_poitem-short_text = s_text.
wa_poitem-material = material.
append wa_poitem to t_poitem.
clear wa_poitemx.
wa_poitemx-po_item = po_item.
append wa_poitemx to t_poitemx.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = v_ebeln
* POHEADER =
* POHEADERX =
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
* PARK_UNCOMPLETE =
* PARK_COMPLETE =
* IMPORTING
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
RETURN = t_return
POITEM = t_poitem
POITEMX = t_poitemx
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
* POTEXTHEADER =
* POTEXTITEM =
* ALLVERSIONS =
* POPARTNER =
* POCOMPONENTS =
* POCOMPONENTSX =
* POSHIPPING =
* POSHIPPINGX =
* POSHIPPINGEXP =
* POHISTORY =
* POHISTORY_TOTALS =
* POCONFIRMATION =
* SERIALNUMBER =
* SERIALNUMBERX =
* INVPLANHEADER =
* INVPLANHEADERX =
* INVPLANITEM =
* INVPLANITEMX =
* POHISTORY_MA =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN =
.
endif.
2010 Jul 08 1:18 PM
Hi
you need to maintain the values in X table for all the entries you are making in po_item table, like.
wa_poitemx-short_text = 'x'.
wa_poitemx-material = 'x'.
just add this code in your X table, this will let your X table know that for which fields you are making changes.
Please see the below code for more clarity.
LOOP AT IT_PO INTO WA_PO. " CHANGING VALUES IN OUR INTERNAL TABLE.
WA_PO-SHORT_TEXT = 'PURCHASE ORDER FOR CHANGE'.
WA_PO-NET_PRICE = '3500.00'.
WA_PO-QUANTITY = 15.
WA_PO-MATERIAL = 'REM'.
MODIFY IT_PO FROM WA_PO. " MODIFYING INTERNAL TABLE.
WA_POX-PO_ITEM = WA_PO-PO_ITEM. " FETCHING THE CORRECT LINE ITEM FOR WHICH THE VALUES WILL BE CHANGED.
WA_POX-SHORT_TEXT = 'X'. " SETTING THE FIELDS WHICH WE ARE CHANGING IN TRUE CONDITION.
WA_POX-NET_PRICE = 'X'.
WA_POX-QUANTITY = 'X'.
WA_POX-MATERIAL = 'X'.
APPEND WA_POX TO IT_POX.
CLEAR : WA_PO, WA_POX.
ENDLOOP.
I have marked X for all the fields for which I have made changes in my PO_ITAM table.
Hope this will work for you
thanks.
Lalit Gupta
2010 Jul 08 1:23 PM
if you declared yout itemx table of the same type like the poitemx from the BAPI, i wonder why this statement:
wa_poitemx-po_item = po_item.
doesnt dump or even gets marked as error when compiling.
2010 Jul 08 1:36 PM
HI
I don't think it will give any dump or error.
becasue wa_poitem-po_item = po_item. and wa_poitemx-po_item = po_item.
Ideally it should be like .
wa_poitemx-po_item = wa_poitem-po_item.
but we are passing only the valules of one line item, if in case we will change the values of multiple line items then we will have to write, wa_poitemx-po_item = wa_poitem-po_item. so that it can identify which line item we are changing.
Thanks
Lalit Gupta
2010 Jul 08 2:13 PM
Hi Lalit,
I tried by putting X for itemx for all the items am entering in item table. But still the item is not appearing in ekpo table.
2010 Jul 09 6:32 AM
Hi Sridevi
I hope you have made correct changes but according to your last post. I beleive your PO has been released with faulty items.
so you need to talk to functional consultant.
I think they might be able to help you.
Thanks
Lalit Gupta
2010 Jul 09 11:50 AM
Hi All,
Now am facing another problem.
The entries are getting created in ekpo table and in eket table. But in EKET table the entry is getting created twice with only change of ETENR value being 0001 and 0002. Rest of the fields have the same value.
What is the problem.? how to solve this??
Regards
Sridevi S
Edited by: Sridevi Sivanandam on Jul 9, 2010 12:50 PM
2010 Jul 09 11:59 AM
2010 Jul 09 12:09 PM
Hi Keshav,
I dont have any idea about the transaction. If u can help me on that it will be helpful.
For the previously existing ebelp of ebeln only one data is available for that in EKET table.
For the ones I have created two records are existing.
Regards
Sridevi S
2010 Jul 09 12:44 PM
If you are not aware please ask your functional consultant to create the same entry in ME22N, so that he can help you analysing the error( if its thrown in standard transaction ).
2010 Jul 09 1:17 PM
Hi Keshav,
While I trying to create in transaction ME22 the entry is getting created only once in eket table.
Regards
Sridevi S
2010 Jul 08 4:29 PM
2010 Jul 09 5:57 AM
Hi keshav,
The following is the return message:
Instance 100655 of object type PurchaseOrder could not be changed
Purchase order still contains faulty items
Releases already effected are liable to be reset
Item category B can only be used with account assignment category.
Am passing item category as B only. I dont know what does the third statement mean.
Values am passing..
po_item = 00009.
s_text = test creation.
material = 000000000850007262.
clear wa_poitem.
wa_poitem-po_item = po_item.
wa_poitem-short_text = s_text.
wa_poitem-material = material.
wa_poitem-item_cat = 'B'.
wa_poitem-quantity = '210'.
wa_poitem-plant = '0975'.
append wa_poitem to t_poitem.
clear wa_poitemx.
wa_poitemx-po_item = po_item.
wa_poitemx-short_text = 'X'.
wa_poitemx-material = 'X'.
wa_poitemx-item_cat = 'X'.
wa_poitemx-quantity = 'X'.
wa_poitemx-plant = 'X'.
append wa_poitemx to t_poitemx.
clear wa_poschedule.
wa_poschedule-po_item = po_item.
wa_poschedule-delivery_date = '09/02/2010'.
wa_poschedule-quantity = '1'.
append wa_poschedule to t_poschedule.
clear wa_poschedulex.
wa_poschedulex-po_item = po_item.
wa_poschedulex-delivery_date = 'X'.
wa_poschedulex-quantity = 'X'.
append wa_poschedulex to t_poschedulex.
2010 Jul 09 6:28 AM
Hi All,
I managed to create line item for the purchase order. Hope net price is mandatory.
But Am getting different sets of messages. Need to know what does it mean.
"Wholesale Import PO 100659 changed
Following mandatory roles missing in partner maintenance: CP"
What does that second line mean.
Regards
Sridevi S
2010 Jul 09 1:26 PM
Hi Sridevi,
you cannot change a scheduling aggrement using this bapi.