How to do an ME51N mass upload from Excel
ME51N in SAP creates a purchase requisition: internal demand for a material or service at a plant, by a date, often charged to a cost object. For SAP purchase requisition automation, PostNow.ai creates requisitions from Excel through BAPI_PR_CREATE, the BAPI behind ME51N, so an ME51N mass upload is one H row per requisition with D rows for its items. Validate checks the sheet offline, Simulate lets SAP check every requisition and rolls it back, and Run writes each requisition number back to its row.
- Use the Enjoy BAPI. According to SAP Note 1803189,
BAPI_PR_CREATEreplaces the olderBAPI_REQUISITION_CREATE, and SAP Note 217437 is titled "ME21N/ME51N: Batch input and CATT not possible". - SAP's rules still run. Account assignment checks, source determination and release strategy apply to a BAPI-created requisition as they do in ME51N.
This page covers one job: the ME51N mass upload, raising purchase requisitions in bulk from a demand file. Turning those requisitions into orders, or loading purchase orders directly, is covered in ME21N mass upload. The whole purchase-to-pay chain is in SAP process automation, and the other MM uploads, from goods receipts to invoices, are in SAP MM mass upload.
SAP purchase requisition automation: create requisitions from Excel with PostNow.ai
PostNow.ai treats an ME51N mass upload as a template: a designer builds it once against your SAP system and publishes it, and requesters or buyers run their own demand files through it, each user under their own SAP login on their own computer.
- Start from the template or the BAPI. Download the free ME51N purchase requisition template, whose field guide names the
BAPI_PR_CREATEstructure and field behind every column, or search forBAPI_PR_CREATEby name in your own system. Mapping AI reads the column headings and proposes the field mapping; it sees the headings and the BAPI's field list, never your cell values. - One H row per requisition, one D row per item. A marker column groups an
Hrow (document type, such asNB) with itsDrows: material or short text, quantity, unit, delivery date, plant, purchasing group, valuation price, account assignment and, where known, a vendor. The D rows fill thePRITEMtable, and account-assigned items also fillPRACCOUNT. - Let PostNow.ai set the X flags. Every data structure of the BAPI has an X twin that tells SAP which fields to take, and a value without its flag is ignored. PostNow.ai sets the flag for each field you map. In
PRITEMXthe item number is a key, not a flag, so PostNow.ai copies the real item number (00010) across at run time, and copies it into thePRACCOUNTline built from the same D row. Review X-pairs shows every pair before the first run. - Validate the sheet. Validate checks every cell offline: required fields, type, length, date format and allowed values, such as an allow-list of account assignment categories. Whether a material is maintained for the plant or a cost center is valid on the date is SAP's answer, and that comes in Simulate.
- Simulate. PostNow.ai calls
BAPI_PR_CREATEfor every requisition and thenBAPI_TRANSACTION_ROLLBACKinstead of a commit, so SAP's own messages appear on each H row and no requisition is created. - Run. For each requisition PostNow.ai calls the BAPI and commits with
BAPI_TRANSACTION_COMMITonly when SAP returned no error; otherwise it rolls back. In the template's Run Log Message settings, on the Save to Excel tab, save the BAPI'sNUMBERexport to an Excel column: each H row then receives the requisition number SAP assigned, and its Run Log line records user, time and system. - Re-run only what failed. Retry Failed re-posts only the requisitions marked ERROR. If someone clicks Run again on the same sheet, PostNow.ai first lists the requisitions whose Run Log already shows a success and offers Skip posted rows, Post again or Cancel before anything is sent to SAP.
Where a budget holder wants to see the demand before it enters SAP, an approval policy on the template holds the run until an approver has reviewed the rows in the PostNow.ai portal. The approval is tied to that exact data, so a sheet changed after approval needs approval again. SAP's own release strategy still applies afterwards, inside SAP.
Posting route: ME51N recording or BAPI_PR_CREATE
PostNow.ai can post a requisition template through BAPI_PR_CREATE or by replaying a recording of ME51N. For requisitions we start with the BAPI, and the table shows why.
| Route | Use it when | What to plan for |
|---|---|---|
PostNow.ai, BAPI mode on BAPI_PR_CREATE | Material and text items, several items per requisition, account-assigned or stock demand, from one sheet | Fields that exist only on a screen; customer fields go through EXTENSIONIN, which you declare in the template |
| PostNow.ai, recording mode on ME51N | A simple single-item requisition where you want the exact screens your requesters use | SAP Note 217437, "ME21N/ME51N: Batch input and CATT not possible". Prove the recording on a few rows before any volume. |
BAPI_REQUISITION_CREATE | Programs written for the pre-Enjoy ME51 that are still in use | Note 1803189 names BAPI_PR_CREATE as its successor; new templates use the Enjoy BAPI |
Why the Enjoy BAPI. According to SAP's FAQ note on purchase requisition BAPIs (Note 499627), BAPI_REQUISITION_CREATE and BAPI_REQUISITION_CHANGE do not cover all the functions of the ME51N and ME52N transactions, and BAPI_PR_CREATE and BAPI_PR_CHANGE are released as of ERP 6.0. SAP Note 1803189, the FAQ on the end of support for ME21, ME51 and BAPI_PO_CREATE, names BAPI_PR_CREATE and BAPI_PR_CHANGE as the successors of the old pair. The new pair share one structure set (PRHEADER, PRITEM, PRACCOUNT and their X twins), so a creation template and a later change template look alike.
It is the BAPI SAP itself points to. BAPI_PR_CREATE ("Create Enjoy Purchase Requisition", function group 2105) implements method CreateFromData1 of business object PurchaseRequisition. SAP's own S/4HANA developer tutorial uses it as the API to wrap when an ABAP Cloud program needs to create requisitions (SAP tutorial). Before building, open it in SE37 on your system: the parameters for your release are listed there, and the Attributes tab shows the Remote-Enabled Module setting.
One call per requisition. Note 499627 also answers "no" to calling BAPI_PR_CREATE or BAPI_PR_CHANGE several times in sequence for the same requisition. PostNow.ai sends one H row and its D rows as one call and commits it, so each requisition is complete in its own call.
BAPI_PR_CREATE parameters a requisition upload uses
| Parameter | What it carries | Excel side |
|---|---|---|
PRHEADER / PRHEADERX | Document type (PR_TYPE), and optionally AUTO_SOURCE (automatic source determination) and PREQ_NO for external numbering | H row |
PRITEM / PRITEMX | Item number, material or short text, material group, quantity, unit, delivery date, plant, storage location, purchasing group and organisation, valuation price (PREQ_PRICE), price unit, requisitioner, tracking number, account assignment category, desired and fixed vendor, contract, info record | One D row per item |
PRACCOUNT / PRACCOUNTX | Item number, sequence number (SERIAL_NO), G/L account, cost center, order, WBS element, asset | Same D row, account-assigned items only |
PRITEMTEXT, PRHEADERTEXT | Item and header long texts | Optional text columns |
EXTENSIONIN | Customer fields | Declared as extensions in the template |
TESTRUN | Test indicator | Left empty: Simulate calls BAPI_TRANSACTION_ROLLBACK instead of a commit |
NUMBER, RETURN | The new requisition number; SAP's messages | Written back to the H row |
Service requisitions are a separate design. BAPI_PR_CREATE has service tables (SERVICELINES, SERVICELIMIT and their X twins), but according to Note 499627 creating service items needs Enhancement Package 4 with the business function LOG_MM_CI_2 active (switched on in SFW5); SAP KBA 1950319 gives sample records for service and limit requisitions (SAP KBA 1950319). Build and simulate a service template on its own before you mix it with goods items.
The ME51N fields you have to map
A PostNow.ai requisition template is shorter than a purchase order template, because vendor and price can still be open. These are the columns that decide whether a requisition is created and whether it converts cleanly later.
| Column | BAPI field | What to know |
|---|---|---|
| Document type | PRHEADER-PR_TYPE | NB is the standard requisition. The document type brings the number range, the allowed item categories and, for release, whether the requisition is released as a whole or item by item. |
| Material or Short text | PRITEM-MATERIAL, SHORT_TEXT | With a material, SAP takes the description and material group from the material master. A text item has no material, so it needs Short Text, Material Group and a unit in the file. |
| Quantity and Unit | QUANTITY, UNIT | Keep the unit as text; it is the internal unit of measure your system uses. |
| Delivery date | DELIV_DATE | A date field. Set the date format on the column, and plan dates around the planned delivery time and the factory calendar. |
| Plant, Purchasing group | PLANT, PUR_GROUP | Map both as columns or fixed values. The BAPI gets only what the template sends, not a requester's ME51N personal defaults. |
| Valuation price | PREQ_PRICE, PRICE_UNIT | PREQ_PRICE is a BAPI amount field with 9 decimals. The price times the quantity gives the item value that a value-based release strategy reads. |
| Requisitioner, Tracking number | PREQ_NAME, TRACKINGNO | Free fields that let a requester find their demand again in ME53N and in the buyer's worklist. |
Material maintained for the plant. A material without a purchasing view at the plant on the row returns ME 034 "Plant & not created for material &" or ME 046 "Material & not maintained by Purchasing". On a file for a new site that is often every row, so the material extension comes first; see mass create materials with MM01.
Account assignment on requisitions: K, F, P and A
PostNow.ai sends the account assignment category in PRITEM-ACCTASSCAT and the cost object in a PRACCOUNT line built from the same D row. Which fields SAP then requires is set per category in your purchasing Customizing, so read the table as the usual pattern.
| Category | Cost object | PRACCOUNT fields usually needed |
|---|---|---|
| K | Cost center | GL_ACCOUNT, COSTCENTER |
| F | Order | GL_ACCOUNT, ORDERID |
| P | Project | GL_ACCOUNT, WBS_ELEMENT |
| A | Asset | ASSET_NO (and SUB_NUMBER where used) |
| blank | Stock item | No PRACCOUNT line |
- Give
SERIAL_NOa value. Each account assignment line has a two-digit sequence number. For one assignment per item, a fixed value of01does it. - Pad the cost objects. Set leading zeros with a target length on the G/L account and cost center columns (both 10 characters). A cost center typed as 4120 in Excel is
0000004120in SAP. - Category set, no line sent. SAP answers
06 436"In case of account assignment, please enter acc. assignment data for item". MapPRACCOUNTwith its X twin. - The material can force a category. A material that may not be requested to stock returns
ME 062"Account assignment mandatory for material & (enter acc. ass. cat.)". - Cost objects must exist first. Projects and orders that are created for the same initiative have to be in SAP before the requisitions that reference them. Cost centers in bulk are covered in KS01 mass cost center creation.
- The assignment carries forward. When a buyer converts the requisition, category and cost object pass into the purchase order item, so an error here becomes an error on the order.
Source of supply: desired vendor, fixed vendor, contract and info record
PostNow.ai sends whichever source fields the template maps, and SAP's source determination does the rest. The four fields mean different things, and requesters often mix them up.
| Field | BAPI field | What SAP does with it |
|---|---|---|
| Desired vendor | PRITEM-DES_VENDOR | A suggestion from the requester. The buyer can source elsewhere. |
| Fixed vendor | PRITEM-FIXED_VEND with PURCH_ORG | An assigned source. The requisition can then be converted without a sourcing step. |
| Contract | AGREEMENT, AGMT_ITEM | Assigns an outline agreement item as the source. |
| Info record | INFO_REC | Assigns the purchasing info record that supplies vendor and price conditions. |
Automatic source determination can change what you sent. With PRHEADER-AUTO_SOURCE set, or where Customizing determines a source for the material, SAP assigns one from the source list, quota arrangement or contracts. SAP KBA 1896111 covers exactly the case where the fixed vendor on the created requisition differs from the value passed to BAPI_PR_CREATE (SAP KBA 1896111). Decide with purchasing which fields the file fills and which ones source determination owns, and check the assigned source on the first Simulate and the pilot.
Explain the vendor column to requesters. A desired vendor does not secure that supplier. Put that sentence in the template's field notes, and leave the column empty rather than guessed.
Release strategy on uploaded requisitions
PostNow.ai creates each requisition through BAPI_PR_CREATE under the user's own SAP login, so SAP determines the release strategy for it as it does for a requisition entered in ME51N. SAP KBA 1497235, on release strategies that are not determined, lists BAPI_PR_CREATE next to ME51N for the same symptom (SAP KBA 1497235).
- Overall or item-wise release comes from Customizing. SAP Help states that the document type determines whether a requisition is released as a whole or item by item (SAP Help). With item-wise release, a value-based strategy usually reads the item value (characteristic
CEBAN-GSWRT); with overall release, the total of the requisition (CEBAN-GFWRT). Ask purchasing which one your document type uses before you promise approvers a number of approvals. - The valuation price decides the approval level. Where the strategy is value-based,
PREQ_PRICEtimes the quantity is what it evaluates. Review the price column with the same care as the quantities. - Grouping changes the totals. With overall release, how items are grouped into requisitions decides each document's value. Group by requester, project or cost object, as purchasing agrees, and never to stay under an approval limit.
- Warn the approvers. A run of 300 requisitions can land 300 release items in an inbox that normally sees a few a day.
- Unreleased means not yet buyable. A requisition that is still waiting for release is not offered for conversion to a purchase order, so the run is finished for procurement only when the release queue has been worked.
Grouping and numbering: how rows become requisitions
PostNow.ai turns each H row and the D rows below it into one requisition, one BAPI_PR_CREATE call and one number. Thirty H rows create thirty requisitions, however many items sit under them.
- A reference column keeps the groups readable. The free template carries a PR Ref (PR-0001, PR-0002) on every row, so a reviewer sees each requisition as a block and the H/D marker does the grouping.
- Number items with gaps.
00010,00020,00030, so items can be added later in ME52N without renumbering. Item numbers must be unique within each requisition. - Internal numbering by default. SAP takes the next number from the range assigned to the document type, and
NUMBERreturns it. With an external range, the number goes inPRHEADER-PREQ_NOand must lie in that range. - Keep item types apart. Stock items, account-assigned items and text items need different columns. One sheet per type keeps every column meaningful on every row and makes a failure easier to read.
From purchase requisition to purchase order
PostNow.ai writes each requisition number back to its row, which gives the buyer a worklist; the conversion itself happens in SAP purchasing. Plant, quantity, delivery date, account assignment and any assigned source pass into the purchase order item, and the buyer adds what the requisition left open: vendor, price and terms.
| Conversion route | Transaction | When it fits |
|---|---|---|
| Purchase order with reference to the requisition | ME21N | A buyer works through requisitions one order at a time |
| Assign and process requisitions | ME57 | Requisitions still need a source; the buyer assigns one and creates orders from the list |
| Automatic creation of purchase orders | ME59N | Requisitions with an assigned source, where material and vendor master allow automatic purchase orders |
Loading purchase orders directly from Excel, for buys whose vendor and price are already decided, is covered in ME21N mass upload. To change many existing requisitions, SAP's mass-maintenance transaction MEMASSRQ is described in SAP mass change, and the query, edit and re-post loop in Excel in SAP mass change.
ME51N mass upload in S/4HANA
PostNow.ai uses the same BAPI_PR_CREATE template in SAP ECC and S/4HANA; ME51N and its BAPI remain in S/4HANA, and SAP's 2023 developer tutorial builds on that BAPI. A few points change.
- The material number is longer. S/4HANA allows material numbers up to 40 characters, and the BAPI structures carry a long material field for it. Check in
SE11which field your release fills, and map that one. - Fiori apps sit beside ME51N. Requesters may create and approve requisitions in Fiori apps, and the Fiori app for automatic purchase order creation matches ME59N (SAP Learning). Requisitions created by the BAPI appear in those apps like any other.
- OData APIs exist as well. SAP publishes purchase requisition APIs for S/4HANA; in the public cloud edition, release 2402 deprecated
API_PURCHASEREQ_PROCESS_SRVin favour ofAPI_PURCHASEREQUISITION_2. Where your company posts through SAP's published APIs, PostNow.ai's API mode is the third posting method next to BAPI and recording.
Worked example: 14 items for a line shutdown in plant 1010
PostNow.ai handles this with one published ME51N template on BAPI_PR_CREATE. Maintenance in plant 1010 plans a shutdown of line 2 and sends a demand file with 14 items: spare parts with material numbers, and text items for services and consumables. Purchasing agreed three requisitions, one per work package, all document type NB, purchasing group 001. Parts are charged to cost center 4120 on G/L account 400000 (category K); the contractor work goes to maintenance order 4000123 (category F).
The first rows of the sheet, one H row per work package and one D row per item:
| Excel row | PR Ref | Columns filled |
|---|---|---|
| H | PR-0001 | Document type NB |
| D | PR-0001 | Item 00010, material TG-1001, 40 PC, delivery 12.01.2027, plant 1010, purchasing group 001, valuation price 18.50, category K, G/L 400000, cost center 4120 |
| D | PR-0003 | Item 00010, short text "Scaffolding, line 2, 5 days", material group M0600, 1 AU, valuation price 6,800.00, category F, G/L 400000, order 4000123 |
- Validate. Three cells are flagged: two delivery dates pasted as text, and a category typed "Q", which the category column's allow-list (K, F) rejects. All three are fixed in the sheet.
- Simulate. PR-0002 passes. PR-0001 returns
ME 046on item 00030: the bearing it asks for has no purchasing view for plant 1010, and the material team extends it. PR-0003 returns06 436on item 00020, where the order number column is empty. The planner adds the order and a second Simulate is clean. - Pilot. Run Scope covers PR-0002 only. Its requisition number lands on the H row; in ME53N the buyer sees the items, the K assignment on each and the release strategy SAP determined.
- Run. PR-0001 and PR-0003 are created. Each H row holds its requisition number, the Run Log records user, time and system, and the shutdown planner forwards the three numbers to the buyer with the release approver copied.
Every item can be traced from its Excel row to its requisition in SAP, and the buyer converts the released requisitions into purchase orders from that list.
Checklist before an ME51N mass upload
PostNow.ai checks a requisition file in layers: Validate, Simulate, a pilot, then the run. This is the list to go through before a production run.
- One H row per requisition purchasing expects; count H rows against the agreed number of documents.
- Item numbers unique within each requisition and spaced (
00010,00020). - Materials extended to every plant in the file; text items carry short text, material group and unit.
- Cost centers, orders and WBS elements exist and are valid on the delivery date.
- Leading zeros and target lengths set on G/L account, cost center and vendor columns; date format set on the delivery date.
- Valuation prices reviewed, because a value-based release strategy reads them.
- Source fields agreed with purchasing: which columns the file fills, and which ones source determination owns.
- The template's Run Log Message settings save the BAPI's
NUMBERexport to a column (Save to Excel tab). - Simulate clean on every requisition, and the release approvers told how many documents are coming.
What to plan for in an ME51N mass upload
PostNow.ai checks formats and allowed values and keeps operators on the published template; these decisions stay with purchasing and the requesters.
- Requisition or purchase order. If nobody has chosen the vendor or agreed the price, the file is requisition demand. If the vendor column was filled with confidence, the buy may already be decided and belongs on an order.
- Master data first. Material extensions, cost centers and project structures go in before the requisitions that reference them.
- Agree the grouping. By requester, project or cost object, decided with purchasing, because it shapes both the buyer's work and the release totals.
- Plan around MRP. Manual requisitions sit next to the requisitions that planning creates; run the file outside the MRP run so planners see one consistent picture.
- Hand the numbers over. The requester needs the numbers to follow the demand, and the buyer needs to know the documents have arrived.
Making a template like this repeatable for a team (designers who build, operators who only run, a published template in the central library) is covered in Excel to SAP automation. How a requisition fits the rest of purchase-to-pay is in SAP process automation.
ME51N upload errors and the fix
PostNow.ai writes SAP's RETURN messages into the Run Log beside each requisition. BAPI_PR_CREATE often returns a summary line plus the detail behind it, so read past the first message. If a message is still unclear, AI Review explains it from SAP's messages and the field structure, without your cell values.
| Message | What it means | Fix |
|---|---|---|
06 402 Purchase requisition number & created | Success. SAP KBA 3759785 describes systems that return BAPI 000 instead. | Nothing. Save the NUMBER export to a column so the number arrives whichever message SAP sends. |
BAPI 001 No instance of object type PurchaseRequisition has been created | A wrapper: the requisition was not created, and the reason is in the other lines | Read the item-level messages below it in the Run Log |
ME 083 Enter & & | A required field is empty; the variables name it | Add the column, or set the X flag if the value was there |
ME 034 / ME 046 plant not created for material / material not maintained by Purchasing | The material has no purchasing data for that plant | Extend the material, then Retry Failed |
ME 062 Account assignment mandatory for material & | The material may not be requested to stock | Set the category and its cost object, or correct the material |
06 436 In case of account assignment, please enter acc. assignment data for item | A category is set but no PRACCOUNT line reached SAP | Map PRACCOUNT, including SERIAL_NO and the X twin |
ME 039 Delivery date is in the past / ME 078 outside the factory calendar | The date in the file does not fit SAP's date checks | Correct the dates, or confirm with purchasing whether the warning is acceptable |
| Success, but no requisition in ME53N | SAP KBA 1943499 covers a BAPI that reports a number while the tables stay empty; in custom programs, SAP Community answers most often point to a missing BAPI_TRANSACTION_COMMIT | PostNow.ai's Run commits each successful call; open one number in ME53N after the pilot to confirm |
| Fixed vendor differs from the file | Source determination assigned another source (SAP KBA 1896111) | Agree which source fields the file fills; check the source on the pilot |
Message texts are SAP's short texts; your release may word some slightly differently, and whether a message is an error or a warning can depend on your system's message settings.
Free ME51N purchase requisition upload template
PostNow.ai publishes a free ME51N purchase requisition template: an H row per requisition and D rows for its items, three sample requisitions with stock, project, cost center and order items, a field guide that names the BAPI_PR_CREATE structure and field behind every column, and a note on the PRITEMX item-number trap. Open it in PostNow.ai to map and simulate it against your own system, or browse the other SAP materials management templates.
