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

query in bapi_po_change

Former Member
0 Likes
1,603

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.

14 REPLIES 14
Read only

Former Member
0 Likes
1,561

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

Read only

Former Member
0 Likes
1,561

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.

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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.

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

Did you try creating the entry through the transaction ?

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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 ).

Read only

0 Likes
1,561

Hi Keshav,

While I trying to create in transaction ME22 the entry is getting created only once in eket table.

Regards

Sridevi S

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,561

What is the return message ?

Read only

0 Likes
1,561

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.

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

Hi Sridevi,

you cannot change a scheduling aggrement using this bapi.