MM Program Custom development Mass upload

Mass Purchase Order Creation from Excel Program

Short answer: A custom program that creates purchase orders in bulk from Excel or CSV rows, grouping them by vendor, purchasing organization and group number. It checks all rows in test mode first, then lists the number created for each order and the messages per row.

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

Why is the standard not enough?

ME21N creates each order one at a time on screen. ME59N only converts existing purchase requisitions; it does not cover bulk orders placed without a requisition. LSMW recordings are fragile on the ME21N Enjoy screens. Project purchases with hundreds of items or periodic price-list orders need a templated upload with a test mode.

Who uses it? Buyers, project buying teams and teams that regularly place bulk orders from price lists.

Closest standard alternatives

  • ME21N Create Purchase Order. Creates orders one at a time on screen; does not read a file.
  • ME59N Automatic Generation of Purchase Orders. Converts existing requisitions into orders automatically; does not create bulk orders without requisitions.

Tables used

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

TableRoleAccessSystem
EKKOPurchasing Document HeaderOrder header: vendor, organization, document typeWriteECC + S/4
EKPOPurchasing Document ItemOrder item: material, plant, quantity, priceWriteECC + S/4
EKETPurchasing Schedule LinesSchedule line and delivery dateWriteECC + S/4
EKKNAccount Assignment in Purchasing DocumentAccount assignment: cost center or WBS elementWriteECC + S/4
LFM1Vendor Master: Purchasing Organization DataVendor purchasing organization data and block (check)ReadECC + S/4
MARCPlant Data for MaterialMaterial exists in the plant (check)ReadECC + S/4
EINEPurchasing Info Record: Purchasing Organization DataInfo record net price when the price is blankReadECC + S/4

BAPIs and functions used

  • BAPI_PO_CREATE1Create Purchase Order. Creates each order group as one purchase order; only checks in test mode
  • BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves a successful order permanently
  • BAPI_TRANSACTION_ROLLBACKRoll Back BAPI Transaction. Rolls back the changes of a failed order
  • TEXT_CONVERT_XLS_TO_SAPConvert Excel File to SAP Format. Reads the Excel file into an internal table

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
P_FILEUpload file (XLSX or CSV)Single value—YesC:\temp\siparisler.xlsx
P_BSARTOrder document typeSingle valueEKKO-BSARTYesNB
P_TESTTest mode (check without posting)Checkbox—NoX
P_INFOTake price from info record if blankCheckbox—NoX

Input file columns

The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.

#ColumnTarget fieldRequired
1Group no (same number = same order)By rule Grouping key in the file; together with vendor and organization it defines the order headerYes
2VendorEKKO-LIFNRYes
3Purchasing organizationEKKO-EKORGYes
4Purchasing groupEKKO-EKGRPYes
5Company codeEKKO-BUKRSYes
6Material (blank for text items)EKPO-MATNRNo
7Short textEKPO-TXZ01No
8PlantEKPO-WERKSYes
9QuantityEKPO-MENGEYes
10UnitEKPO-MEINSNo
11Net price (blank = info record)EKPO-NETPRNo
12Delivery dateEKET-EINDTYes
13Account assignment categoryEKPO-KNTTPNo
14Cost centerEKKN-KOSTLNo
15WBS elementEKKN-PS_PSP_PNRNo

Sample upload file

1Group no (same number = same order) *Vendor *Purchasing organization *Purchasing group *Company code *Material (blank for text items)Short textPlant *Quantity *UnitNet price (blank = info record)Delivery date *Account assignment categoryCost centerWBS element
2110024510000011000RM-1001Carton box 40x3010005,000PC12/05/2026
3110024510000011000RM-1002Stretch film 50 cm1000800KG38.5012/05/2026
4210070010000031000Site freight service10001PC45,00012/10/2026PP-26-0012-03
A view built with fictional sample data; not real system data.

Result list columns

#ColumnSource
1RowCalculated Row number in the file
2Group noCalculated Group number from the file
3VendorEKKO-LIFNR
4Purchase orderEKKO-EBELN
5ItemEKPO-EBELP
6Net valueEKPO-NETWR
7StatusCalculated From the BAPI return messages: checked, created or error
8MessageCalculated First error or success message from the BAPI return table

Sample result list

RowGroup noVendorPurchase orderItemNet valueStatusMessage
211002454500013301000108,500CreatedPurchase order 4500013301 created
3110024545000133010002030,800CreatedPurchase order 4500013301 created
421007000ErrorWBS element P-26-0012-03 is not an account assignment element
A view built with fictional sample data; not real system data.

How does the program work?

  1. The file is read from the user’s PC (TEXT_CONVERT_XLS_TO_SAP) or, in a background job, from the application server; rows are split into order headers by group number, vendor, purchasing organization, purchasing group and company code.
  2. Every row is checked: the vendor’s purchasing organization data (LFM1) and blocks, the material existing in the plant (MARC), the unit of measure, the delivery date and the account assignment. If the price is blank, it is taken from the valid purchasing info record (EINE).
  3. Rows are mapped to the BAPI_PO_CREATE1 structures: POHEADER, POITEM, POSCHEDULE and, for account-assigned items, POACCOUNT (cost center or WBS element).
  4. In test mode the BAPI is called with TESTRUN = X, so all errors and warnings are visible without a number being assigned.
  5. In a real run BAPI_TRANSACTION_COMMIT is called after each successful order and BAPI_TRANSACTION_ROLLBACK after a failed one; the result list shows the order number and row messages, and failed rows can be downloaded as a separate file.

Performance notes

Committing per order isolates failed orders. Run files above a few thousand rows as a background job. For order types with a release strategy, the created orders enter the normal release flow.

Features

  • Test mode (check without posting)
  • Line-by-line result and error log
  • Download failed lines as a separate file The corrected file can be uploaded again with the same template.
  • Export to Excel An empty upload template can be downloaded as Excel.
  • Runs as a background job

Authorization objects

  • M_BEST_BSAPurchase order create authorization by document type
  • M_BEST_EKOPurchase order create authorization by purchasing organization
  • M_BEST_EKGPurchase order create authorization by purchasing group
  • M_BEST_WRKPurchase order create authorization by plant

Frequently asked questions

Do the created orders go through the release strategy?

Yes. BAPI_PO_CREATE1 creates the order with the standard rules; if the order type and value match a release strategy, the order waits for release.

Can conditions (discounts, freight) be loaded too?

They can be loaded through the POCOND structure by adding condition type and amount columns to the template. Each extra field group increases the effort range.

Can this program be used on S/4HANA?

Yes. BAPI_PO_CREATE1 is supported on S/4HANA. For a clean core approach, the same file logic can also be built on the purchase order API.

Packages that include this solution

CA Package Custom

Excel Mass Data Upload Pack

A pack that puts the five bulk uploads key users run most often into one upload structure: material master, equipment master with installation at a …

5 components · v1.0

Related reports

MM Report Custom ALV report

Open Purchase Orders by Vendor Report

A custom ALV report that shows, per vendor, the quantity not yet received, the open order value and the days of delay since the delivery date in a …

EKKO · EKPO · EKET · LFA1

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: Mass Purchase Order Creation from Excel Program