MM Program Custom development Background program

Automatic Conversion of Released Purchase Requisitions to Purchase Orders Program

Short answer: 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.

Estimated effort
M · 5–7 working days
System
ECC and S/4HANA
Tables
6
Scope
Global
Built by
NeKuDos Teknoloji
Last updated

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.

Who uses it? Buyers, purchasing managers and supply planners.

Closest standard alternatives

  • ME59N Automatic Generation of Purchase Orders. Converts requisitions with the automatic PO flag and a single source; no item limit, waiting days or hold list.
  • ME57 Assign and Process Requisitions. Assigns requisitions to sources and converts them manually; does not run in the background.

Tables used

The tables the program reads and updates. ECC and S/4HANA differences are marked separately.

TableRoleAccessSystem
EBANPurchase RequisitionReleased requisition items; ordered quantity and reference are updated when the order is createdWriteECC + S/4
EORDPurchasing Source ListSource list: fixed and valid vendorReadECC + S/4
EINAPurchasing Info Record: General DataInfo record general dataReadECC + S/4
EINEPurchasing Info Record: Purchasing Organization DataInfo record price and delivery timeReadECC + S/4
EKKOPurchasing Document HeaderHeader of the created orderWriteECC + S/4
EKPOPurchasing Document ItemOrder items with requisition referenceWriteECC + S/4

BAPIs and functions used

  • BAPI_PO_CREATE1Create Purchase Order. Creates the purchase order with requisition references per group
  • BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves successful orders permanently
  • BAPI_TRANSACTION_ROLLBACKRoll Back BAPI Transaction. Rolls back changes in test mode or on error

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
S_WERKSPlantRange / multipleEBAN-WERKSYes1000
S_EKGRPPurchasing groupRange / multipleEBAN-EKGRPNo001
S_BSARTRequisition typeRange / multipleEBAN-BSARTNoNB
S_MATNRMaterialRange / multipleEBAN-MATNRNoRM-*
P_BSARTOrder type to createSingle valueEKKO-BSARTYesNB
P_DAYSMinimum days since releaseSingle value—No1
P_MAXITMaximum items per orderSingle value—No50
P_TESTTest mode (simulate without creating orders)Checkbox—NoX

Result list columns

#ColumnSource
1RequisitionEBAN-BANFN
2Req. itemEBAN-BNFPO
3MaterialEBAN-MATNR
4QuantityEBAN-MENGE
5Vendor determinedEORD-LIFNR
6Purchase orderEKKO-EBELN
7Order itemEKPO-EBELP
8StatusCalculated Order created, hold list or error
9MessageCalculated Source determination result or BAPI return message

Sample result list

RequisitionReq. itemMaterialQuantityVendor determinedPurchase orderOrder itemStatusMessage
001000481000010RM-10015,000100245450001330100010Order createdFixed source and info record price used
001000481100010RM-10021,200100245450001330100020Order createdAdded to the same vendor group
001000481500010RM-2040800Hold listTwo valid sources; the buyer must choose
001000482200020CH-0315300100512ErrorNo info record for plant 1000
A view built with fictional sample data; not real system data.

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.

Performance notes

Restrict the EBAN selection by plant and release date; read EORD and EINE once for the selected materials. Schedule the program once or twice a day outside working hours; use an ENQUEUE lock so that the same requisition is not processed by two jobs.

Features

  • Runs as a background job
  • Test mode (check without posting)
  • Line-by-line result and error log
  • Send the result by email Created orders and the hold list are sent separately to each purchasing group.

Authorization objects

  • M_BANF_WRKRequisition processing authorization by plant
  • M_BEST_BSACreate authorization by order type (job user)
  • M_BEST_EKOCreate authorization by purchasing organization
  • M_BEST_WRKOrder 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.

Packages that include this solution

MM Package Custom

Purchasing Approval and Cycle Time Pack

A four-component pack that shows where purchasing waits between requisition and payment: released requisitions not yet ordered, purchase orders …

4 components · v1.0

Related reports

MM Program Custom Mass upload

Mass Purchase Order Creation from Excel Program

A custom program that creates purchase orders in bulk from Excel or CSV rows, grouping them by vendor, purchasing organization and group number. It …

EKKO · EKPO · EKET · EKKN

Let us build this program for your system

Briefly describe your system and expectations. We will clarify the scope and come back with an effort and price quote.

Related report: Automatic Conversion of Released Purchase Requisitions to Purchase Orders Program