# BAPI_PO_CHANGE — Change Purchase Order

> Changes an existing purchase order: header fields, items, schedule lines, account assignment, conditions and texts, and can also add new items. It is the standard way to update prices, quantities or delivery dates from a custom program or an inbound interface. Pass the item number in both POITEM and POITEMX, set 'X' only for the fields you change, and commit with BAPI_TRANSACTION_COMMIT when RETURN has no errors.

- Modules: MM
- Type: BAPI
- Function group: 2012
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/bapi-po-change/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| PURCHASEORDER | BAPIMEPOHEADER-PO_NUMBER | Purchase order number | Yes |
| POHEADER | BAPIMEPOHEADER | Header data | - |
| POHEADERX | BAPIMEPOHEADERX | Header change flags | - |
| TESTRUN | BAPIFLAG-BAPIFLAG | Test run (no update) | - |
| NO_MESSAGING | BAPIFLAG-BAPIFLAG | No output (message) determination | - |
| NO_PRICE_FROM_PO | BAPIFLAG-BAPIFLAG | Do not adopt price from last document | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| EXPHEADER | BAPIMEPOHEADER | Header data (result) |
| EXPPOEXPIMPHEADER | BAPIEIKP | Foreign trade header data (result) |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| RETURN | BAPIRET2 | Return messages | - |
| POITEM | BAPIMEPOITEM | Item data | - |
| POITEMX | BAPIMEPOITEMX | Item change flags | - |
| POSCHEDULE | BAPIMEPOSCHEDULE | Delivery schedule lines | - |
| POSCHEDULEX | BAPIMEPOSCHEDULX | Schedule line change flags | - |
| POACCOUNT | BAPIMEPOACCOUNT | Account assignment data | - |
| POACCOUNTX | BAPIMEPOACCOUNTX | Account assignment change flags | - |
| POCOND | BAPIMEPOCOND | Item conditions | - |
| POCONDX | BAPIMEPOCONDX | Condition change flags | - |
| POTEXTHEADER | BAPIMEPOTEXTHEADER | Header texts | - |
| POTEXTITEM | BAPIMEPOTEXT | Item texts | - |
| EXTENSIONIN | BAPIPAREX | Customer fields (inbound) | - |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_PO_CHANGE'
  EXPORTING
    purchaseorder = lv_purchaseorder
  IMPORTING
    expheader = lv_expheader
    exppoexpimpheader = lv_exppoexpimpheader
  TABLES
    return = lt_return
    poitem = lt_poitem
    poitemx = lt_poitemx
    poschedule = lt_poschedule
    poschedulex = lt_poschedulex
    poaccount = lt_poaccount
    poaccountx = lt_poaccountx
    pocond = lt_pocond
    pocondx = lt_pocondx
    potextheader = lt_potextheader.
```

## Related tables

EKET, EKKN, EKKO, EKPO

