# Automatic Conversion of Released Purchase Requisitions to Purchase Orders Program

> A custom background program that assigns released requisitions not yet converted to an order to a vendor via the source list and info record, groups them by vendor, purchasing group and plant and converts them into purchase orders. Buyers no longer create orders by hand for recurring materials; requisitions without a clear source stay on a separate hold list.

- Type: Program, Custom development, Background program
- Module: MM
- Estimated effort: M (5–7 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/automatic-purchase-requisition-to-purchase-order-conversion-job/


## Why is the standard not enough?

ME59N converts requisitions into orders automatically, but it needs the automatic PO flag in the material and vendor master and a single fixed source; it has no item-count limit, value threshold, minimum waiting days or hold list that tells the buyer which requisitions found no source. ME57 is interactive. The custom program applies the conversion rules of the customer's policy and emails the result to the buyer.

### Closest standard alternatives

- ME59N: Converts requisitions with the automatic PO flag and a single source; no item limit, waiting days or hold list.
- ME57: Assigns requisitions to sources and converts them manually; does not run in the background.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| EBAN | Released requisition items; ordered quantity and reference are updated when the order is created | Write | - | ECC + S/4 |
| EORD | Source list: fixed and valid vendor | Read | EORD-MATNR = EBAN-MATNR AND EORD-WERKS = EBAN-WERKS | ECC + S/4 |
| EINA | Info record general data | Read | EINA-MATNR = EBAN-MATNR AND EINA-LIFNR = EORD-LIFNR | ECC + S/4 |
| EINE | Info record price and delivery time | Read | EINE-INFNR = EINA-INFNR AND EINE-EKORG = EBAN-EKORG AND EINE-WERKS = EBAN-WERKS | ECC + S/4 |
| EKKO | Header of the created order | Write | - | ECC + S/4 |
| EKPO | Order items with requisition reference | Write | EKPO-BANFN = EBAN-BANFN AND EKPO-BNFPO = EBAN-BNFPO | ECC + S/4 |

## BAPIs and functions used

- BAPI_PO_CREATE1: Creates the purchase order with requisition references per group
- BAPI_TRANSACTION_COMMIT: Saves successful orders permanently
- BAPI_TRANSACTION_ROLLBACK: Rolls back changes in test mode or on error

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_WERKS | Plant | Range / multiple | EBAN-WERKS | Yes |
| S_EKGRP | Purchasing group | Range / multiple | EBAN-EKGRP | No |
| S_BSART | Requisition type | Range / multiple | EBAN-BSART | No |
| S_MATNR | Material | Range / multiple | EBAN-MATNR | No |
| P_BSART | Order type to create | Single value | EKKO-BSART | Yes |
| P_DAYS | Minimum days since release | Single value | - | No |
| P_MAXIT | Maximum items per order | Single value | - | No |
| P_TEST | Test mode (simulate without creating orders) | Checkbox | - | No |

## Result list columns

| Column | Source |
|---|---|
| Requisition | EBAN-BANFN |
| Req. item | EBAN-BNFPO |
| Material | EBAN-MATNR |
| Quantity | EBAN-MENGE |
| Vendor determined | EORD-LIFNR |
| Purchase order | EKKO-EBELN |
| Order item | EKPO-EBELP |
| Status | Calculated: Order created, hold list or error |
| Message | Calculated: Source determination result or BAPI return message |

## How does the program work?

1. EBAN is read by plant, purchasing group, requisition type and material; only items that are released (FRGKZ at its post-release value, FRGDT filled), not deleted, with an ordered quantity (BSMNG) below the requisition quantity and released at least N days ago remain.
2. The vendor is determined: if EORD has a fixed source (FLIFN = X) valid on the requisition date and not blocked (NOTKZ blank), it is used; otherwise a single valid source list entry is accepted. With several sources or none, the requisition goes to the hold list.
3. Price and delivery time come from the EINA/EINE info record; without an info record the requisition goes to the hold list.
4. Requisitions are grouped by vendor, purchasing organization, purchasing group, plant and currency; BAPI_PO_CREATE1 is called with at most P_MAXIT items per group, passing the requisition reference (PREQ_NO/PREQ_ITEM).
5. Successful orders are saved with BAPI_TRANSACTION_COMMIT; on error or in test mode BAPI_TRANSACTION_ROLLBACK runs. The result log and the hold list are emailed to the purchasing group.

## Authorization objects

- M_BANF_WRK: Requisition processing authorization by plant
- M_BEST_BSA: Create authorization by order type (job user)
- M_BEST_EKO: Create authorization by purchasing organization
- M_BEST_WRK: Order authorization by plant

## Frequently asked questions

### Do the created orders go through the release strategy?

Yes. Because the program creates the order with the standard BAPI, the release strategy is determined as usual. Orders above the value threshold wait for approval; they can be followed in a separate report.

### What happens to materials without a source list?

Requisitions without a determined vendor are written to the hold list and are not converted. The list is emailed to the purchasing group; once the buyer defines the source, the next run processes the requisition automatically.

### Can it be used on S/4HANA?

Yes. BAPI_PO_CREATE1 is supported in S/4HANA and the EBAN, EORD and EINA/EINE structures are the same. For a clean core approach, reading can use I_PurchaseRequisitionItemAPI01 and creation the released purchase order API.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=mm-pr-to-po-auto-conversion-job
