Skip to Content

BAPI_PO_CHANGE new po item

May 08 at 06:25 PM


avatar image
Former Member

Hi Everyone,

I'm looking to use the BAPI_PO_CHANGE new po item based on a customer PO that is automatically generated by ERB Catalog.
I've looked at plenty of other wiki results here, and haven't found anything that particularly helps my case.

Here is my code, can anyone lend a hand at what I'm doing wrong to add the line.

        ls_mepoheader     type          bapimepoheader,
        ls_mepoheaderx    type          bapimepoheaderx,
        ls_mepoitem       type          bapimepoitem,
        ls_mepoitemx      type          bapimepoitemx,
        ls_poaccount      type          bapimepoaccount,
        ls_poaccountx     type          bapimepoaccountx,
        ls_meposchedule   type          bapimeposchedule,
        ls_meposchedulx   type          bapimeposchedulx,
        ls_mepocond       type          bapimepocond,
        ls_mepocondx      type          bapimepocondx,
        lv_new_ebelp      type          ebelp,
        lt_mepoitem       type table of bapimepoitem,
        lt_mepoitemx      type table of bapimepoitemx,
        lt_poaccount      type table of bapimepoaccount,
        lt_poaccountx     type table of bapimepoaccountx,
        lt_meposchedule   type table of bapimeposchedule,
        lt_meposchedulx   type table of bapimeposchedulx,
        lt_mepocond       type table of bapimepocond,
        lt_mepocondx      type table of bapimepocondx,
        ls_return         type bapiret2,
        lv_delivery       type          datum.

  perform next_ebelp. "Increments the ebelp line. 

"PO HEADER Table Fill
  ls_mepoheader-po_number = ls_equipment_r-po_quarterly.
  "Nothing Changes in the Header. (No 'X' in X Struct)
"PO ITEM Table Fill ls_mepoitem-po_item = ls_equipment_r-quarterly_ebelp. ls_mepoitemx-po_item = ls_equipment_r-quarterly_ebelp. ls_mepoitemx-po_itemx = 'X'. ls_mepoitem-short_text = ls_equipment_r-short_text. ls_mepoitemx-short_text = 'X'. ls_mepoitem-net_price = ls_equipment_r-price. ls_mepoitemx-net_price = 'X'. ls_mepoitem-acknowl_no = ls_equipment_r-equi_number. ls_mepoitemx-acknowl_no = 'X'. ls_mepoitem-preq_no = ls_equipment_r-pr. ls_mepoitemx-preq_no = 'X'. ls_mepoitem-preq_item = ls_equipment_r-po_line. ls_mepoitemx-preq_item = 'X'. ls_mepoitem-quantity = ls_zitpm07-billingtime. ls_mepoitemx-quantity = 'X'. "PO SCHEDULE Table Fill ls_meposchedule-po_item = ls_equipment_r-quarterly_ebelp. ls_meposchedule-delivery_date = lv_delivery. ls_meposchedulx-delivery_date = 'X'. ls_meposchedule-sched_line = ls_equipment_r-quarterly_ebelp. ls_meposchedule-quantity = ls_zitpm07-billingtime. ls_meposchedulx-quantity = 'X'. ls_meposchedule-sched_line = ls_equipment_r-quarterly_ebelp. ls_meposchedulx-sched_line = 'X'. "PO ACCOUNT Table Fill ls_poaccount-po_item = ls_equipment_r-quarterly_ebelp. ls_poaccount-costcenter = ls_equipment_r-cost_center. ls_poaccountx-costcenter = 'X'. "PO COND Table Fill ls_mepocond-itm_number = ls_equipment_r-quarterly_ebelp. ls_mepocondx-itm_number = 'X'. append ls_mepoitem to lt_mepoitem. append ls_mepoitemx to lt_mepoitemx. append ls_meposchedule to lt_meposchedule. append ls_meposchedulx to lt_meposchedulx. append ls_poaccount to lt_poaccount. append ls_poaccountx to lt_poaccountx. append ls_mepocond to lt_mepocond. append ls_mepocondx to lt_mepocondx. call function 'BAPI_PO_CHANGE' exporting purchaseorder = ls_equipment_r-po_quarterly tables return = lt_return poItem = lt_mepoitem poItemX = lt_mepoitemx poSchedule = lt_meposchedule poSchedulex = lt_meposchedulx poaccount = lt_poaccount poAccountx = lt_poaccountx poCond = lt_mepocond poCondx = lt_mepocondx.

I'm also including the two errors that are most likely the culprits of the problem:
E - BAPI - 003 Instance 4500900444 of Object type Purchase Order could not be changed -poitem

E -MEPO - 001 - Purchase Order Item 00390 still contains faulty schedule lines - poitem

E- 06 - 054 - Doc. type/item cat. ZEB/ (requisition) <-> NB/ (purch. order) - poschedule

Thank you so much for giving me a hand!


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Jürgen L May 08 at 07:37 PM

I would recommend to try the same directly in ME22N, this can tell you if the error is related to the BAPI or to the data and customizing.

I am very certain that you will receive the error 06054 in ME22N too, and because of this error as well the other 2 errors.

Unfortunately you did not show the values of your variables and tables from your BAPI and the existing PO, so maybe the issue is with the data that you use in your BAPI and not with the coding itself.

10 |10000 characters needed characters left characters exceeded
Imre Matyas
May 09 at 09:23 AM

Dear Ashley,

You could find more details about the error 06 054 in the following SAP Knowledge Base Article:

1950198 - ME59N is returning errors ME 083, 06 674, ME 020, 06 054

Please read through the KBA, follow its resolution section and let us know about the results.

Best regards,


10 |10000 characters needed characters left characters exceeded
Guus Werinussa May 10 at 10:28 AM
   ls_meposchedulx-sched_line = 'X'.

it's a number, not a boolean field.

10 |10000 characters needed characters left characters exceeded