Tool: Generate BPA Files V2 | Version: 2.0 | Platform: Microsoft Excel (Windows)
The Generate BPA Files V2 macro automates the production of Oracle ERP upload files from a daily RFQ (Request for Quotation) spreadsheet. Without this tool, a user would need to manually copy data from the RFQ file into several Oracle upload templates — a process that is slow and error-prone.
This tool handles that automatically:
| What it produces | What Oracle does with it |
|---|---|
| BPA TXT file (one per BPA number) | Updates Blanket Purchase Agreement contract lines |
| Update Lead Times file | Updates item lead times in Oracle |
| Update Buyer Names file | Reassigns item buyer codes in Oracle |
| Assignment Set file | Assigns sourcing rules to items and organisations |
When you open the workbook, go to the Run tab. This is the main control panel. All five buttons are here.
| Button | What it does | When to use it |
|---|---|---|
| Build To Do | Reads your RFQ source file and writes a clean, validated list to the To Do tab. | Every run — always the first step. |
| Open Mapper | Opens the Template Mapper form, where you create or edit output configurations. | First time only (or when you need to change a mapping). |
| Run Template Batch | Uses your saved configurations to generate all output files in one click. | Every run — after reviewing the To Do sheet. |
| Send Email | Opens a draft Outlook email with all output files attached. | After files are generated and ready to distribute. |
| Oracle Refresh | Refreshes the Sourcing Rule reference data from an Oracle extract. | When the Sourcing_Rule tab needs updating. |
| Tab name | Purpose | Do you edit it? |
|---|---|---|
| Run | Main control panel. Buttons and settings. | Yes — fill in Source Path, Initials, Output Path, Email. |
| To Do | Validated data extracted from the RFQ file. Review before generating files. | Yes — review and correct Sourcing_Rule_Name. |
| Log | Record of every row processed, including skip reasons. | No — read only. |
| File_Log | List of every output file created in the last batch run. | No — read only. |
| Email_Template | Email recipient addresses, subject line, and body text. | Yes — set up once. |
| BUYER_ID | Maps buyer full names to Oracle buyer codes. | Yes — keep up to date. |
| Sourcing_Rule | Oracle Sourcing Rule reference data used to fill the Assignment Set template. | No — updated by Oracle Refresh. |
| BPA_Filters | Named filter sets that control which rows are included in the To Do sheet. | Yes — managed via the Build To Do form. |
| BPA_SkipRules | Rules that determine when a row is skipped during validation. | Rarely — adjust only if validation rules change. |
| Saved_Configs | Stores your saved Template Mapper configurations. The Output_Path column can be edited directly to redirect output without re-creating configs. | Mostly no — but Output_Path can be edited manually. |
| TEMP_BPA_TXT | Blank BPA contract upload template. Used by the Mapper. | No — do not modify. |
| TEMP_UPDATE_LEAD_TIMES | Blank Lead Times upload template. | No — do not modify. |
| TEMP_UPDATE_BUYER_NAMES | Blank Buyer Names upload template. | No — do not modify. |
| TEMP_ASSIGNMENT_SET | Blank Assignment Set upload template. | No — do not modify. |
Complete these steps once before your first run. You will not need to repeat them.
Open the Run tab. The left column shows labels; type your values in column B.
| Field | What to enter | Example |
|---|---|---|
| Source Path | The folder where your RFQ Excel file is saved. | C:\Users\darek.krawczynski\Documents\Tools\BPA |
| Source File | The filename of your RFQ file (including extension). | RFQ_MK_2026.xlsx |
| Source Tab | The sheet name inside that file that contains the data. | 2026 |
| Output Path | The folder where generated files will be saved. | C:\Users\darek.krawczynski\Documents\Tools\BPA\Outputs |
| Initials | Your two- or three-letter initials. Used in output file names. | DK |
Open the Email_Template tab and fill in the following rows:
| Row label | What to enter |
|---|---|
| To | Recipient email address(es), separated by semicolons. |
| CC | CC email address(es), separated by semicolons. |
| Subject | Email subject line. You may use the token {DATE} which is replaced automatically with today's date. |
| Body | Body text. The token {FILES} is replaced with a list of attached file names. |
Open the BUYER_ID tab. This table maps each buyer's full name (as it appears in the RFQ file) to their Oracle Buyer ID code. There are two columns:
This is a one-time step. You need to tell the tool how to map data from the To Do sheet into each of the four output templates. This is done using the Open Mapper button. See Section 6a for full instructions.
Every time you need to generate BPA files, you follow two steps:
|
STEP 1 Build To Do |
STEP 2 Run Template Batch |
|
Click Build To Do. Browse to your RFQ source file. Set any column filters needed. Click Run. Then open the To Do tab and review the data — especially the Sourcing_Rule_Name column. |
Click Run Template Batch. Select your saved configs. Select the To Do tab as the source. Click Run. Output files are created in your Output folder, named and ready to upload. |
This step reads your RFQ source file, validates every row, and writes the clean result to the To Do tab.
| 1 | On the Run tab, click Build To Do. The Build To Do form opens. |
| 2 |
Click Browse... and navigate to your RFQ source file. Select it and click OK. The tool automatically scans the file and populates the Source Tab dropdown and the column filter rows below. |
| 3 | Select the correct source tab from the Source Tab dropdown if the file has more than one sheet. |
| 4 |
Set column filters (optional but recommended). Each row in the filter panel corresponds to one column in the source file. Leave a field blank to include all values from that column. Type comma-separated values to include only specific rows. Special filter keywords:
To include only rows where the Decision column is "Yes", add a filter row for Decision
with value
YES. This is the most common setup and is recommended as the default active filter set.
|
| 5 |
Save your filter set (optional). If you use the same filters every time, type a name in the Filter Set Name field and click Save Set. You can reload it next time with Load Set. |
| 6 |
Click Run. The macro reads the source file, validates each row against the skip rules, resolves buyer IDs, and writes all passing rows to the To Do tab. A progress bar shows the status. When complete, a summary message appears. |
| 7 |
Review the To Do sheet before continuing. See Section 7 for what to check. |
Before you can use Run Template Batch, you need to create one saved configuration for each output template. You do this once using Open Mapper. You need to create four configs:
| Config name (suggested) | Template tab | What it produces |
|---|---|---|
BPA_TXT | TEMP_BPA_TXT | One BPA contract file per BPA number |
LEAD_TIMES | TEMP_UPDATE_LEAD_TIMES | Lead time update file |
BUYER_NAMES | TEMP_UPDATE_BUYER_NAMES | Buyer name update file |
ASSIGNMENT_SET | TEMP_ASSIGNMENT_SET | Sourcing rule assignment file |
Follow these steps for each of the four configs:
| 1 | Click Open Mapper on the Run tab. The Template Mapper form opens. |
| 2 |
Template section (top of form): Select This workbook — tab: and choose the appropriate TEMP_ tab from the dropdown.
Then click Scan Template. The Column Mapping section will populate with the template's column names.
|
| 3 |
Data Source section: Select This workbook — sheet: and choose To Do from the dropdown. The tool scans the To Do headers and shows a preview of the first few rows. |
| 4 |
Column Mapping section: For each row, set the Type and Source / Value:
Norm checkbox: Tick this for text columns where you want the macro to clean up
extra spaces and special characters automatically.
|
| 5 |
Filter / Group section: This controls how rows are split into separate files.
|
| 6 |
Output section:
|
| 7 |
Click Save Config. Type a name (e.g. BPA_TXT) and click OK.
The config is saved to the Saved_Configs tab and
will appear in the Run Template Batch form from now on.
|
| 8 | Click Close and repeat from Step 1 for the next template. |
Once your four configs exist, this is all you need to do to generate the output files.
| 1 |
On the Run tab, click Run Template Batch. The Batch Run form opens, showing a list of all your saved configs. |
| 2 |
Select the configs to run. Tick the checkbox next to each config you want. To run all four, tick all four. You can run just one config if you only need to regenerate a specific file type.
|
| 3 |
Select the data source. Choose This Workbook Tab and select To Do from the dropdown. This tells the batch to use the data you built in Step 1. |
| 4 |
Click Run. The macro processes each selected config in sequence. A progress bar shows which config is currently running and how far along it is. |
| 5 |
When complete, a summary message shows how many files were created. The File_Log tab lists every file created, including its name, config, and row count. |
| 6 | Navigate to your output folder and confirm the files are there. They are ready to upload to Oracle. |
After clicking Build To Do, always open the To Do tab before running the batch. The most important column to check is Sourcing_Rule_Name.
The macro automatically matches each vendor to a sourcing rule from the Sourcing_Rule reference tab using the vendor name, currency, and rank. The result is placed in the Sourcing_Rule_Name column.
| Column | What to look for |
|---|---|
| Price | Should be a positive number. Rows with zero or negative price are skipped. |
| Lead Time [days] | Should be a whole number. Ranges (e.g. “30-45”) use the upper value. |
| Buyer | Should resolve to a buyer code. If missing, check the BUYER_ID tab. |
| BPA no. | Must be exactly 9 digits. Rows with invalid BPA numbers are excluded. |
If the row count in the To Do sheet seems lower than expected, check the Log tab. Every skipped row appears there with:
The four TEMP_ tabs are blank Oracle upload templates embedded in the workbook.
The macro copies data into a fresh copy of these templates for each output file — the originals
are never modified.
| Tab | Oracle upload type | Output mode |
|---|---|---|
| TEMP_BPA_TXT | Blanket Purchase Agreement contract lines | One .txt file per BPA number (e.g. 111306362_BPA_25MAR2026.txt) |
| TEMP_UPDATE_LEAD_TIMES | Item lead time update | One combined .xls file for all items |
| TEMP_UPDATE_BUYER_NAMES | Item buyer assignment | One combined .xls file for all items |
| TEMP_ASSIGNMENT_SET | Sourcing rule assignment | One combined .xls file for all items |
TEMP_ tab.
The Mapper configuration references columns by name. Any change will break the mapping.
Maps buyer full names to Oracle buyer codes. The macro uses this during Build To Do to resolve the buyer code for each row.
| Column | Description |
|---|---|
| Buyer Full Name | Exactly as it appears in the RFQ source file (not case-sensitive). |
| BUYER_ID | The Oracle buyer code for that person. |
Contains Oracle sourcing rule data used to auto-populate the Sourcing_Rule_Name column on the To Do sheet during Build To Do. This tab is normally populated using the Oracle Refresh button, but you can also edit it manually to add or adjust rules — for example, to set preferred Rank values.
| Column | Description |
|---|---|
| Vendor_Number | Oracle vendor number. Used as the primary match key. |
| Vendor_Name | Vendor name. Used for fuzzy matching when the vendor number is absent or does not match. |
| Vendor_Site_Code | Vendor site code. |
| Sourcing_Rule_Name | The rule name written into the To Do sheet and the Assignment Set template. |
| Currency | Used to prioritise the best match when multiple rules exist for one vendor. The rule whose currency matches the RFQ row is preferred. |
| Rank | Your preferred priority order. Lower number = higher priority. Blank = lowest priority. |
When multiple sourcing rules exist for the same vendor, the macro selects the best one using the following priority order (highest to lowest):
If more than one rule is equally good, a dropdown is placed in the Sourcing_Rule_Name cell on the To Do sheet so the user can make the final selection manually.
The Rank column gives you direct control over which sourcing rule is selected when a vendor has multiple options. This is the recommended approach when you always want a specific rule for a vendor.
1 and leave the others blank (or set them to 2 and 3).
The macro will select Rank 1 automatically without showing a dropdown.
1 for the preferred rule, 2 for the fallback, and so on.
Rows with no Rank value are treated as the lowest priority.
Stores column filter definitions that control which rows from the source file are included in the To Do sheet. The tab has three columns:
| Column | Description |
|---|---|
| Set_Name | The name of the filter set this row belongs to. |
| Header_Name | The source file column to filter on (e.g. Decision, SET). |
| Values | The value(s) to match. Supports YES, BLANK, a literal value, or a comma-separated list. |
There are two distinct roles a row in this tab can have, determined entirely by the Set_Name value:
| Set_Name value | Role | Does the macro read it? |
|---|---|---|
Active |
The live filter set. This is the only set the macro reads when Build To Do runs. | Yes — always. |
Any other name (e.g. BPA_STANDARD_YES_BLANK) |
A saved preset. Stored for future reuse but ignored at run time. | No — stored only. |
BPA_STANDARD_YES_BLANK) and click Save Set.
The macro writes those filter rows to the tab under that name. This is your saved template —
you can reload it any time.
Active, overwriting the previous Active rows.
Only the Active rows are applied during Build To Do.
BPA_STANDARD_YES_BLANK), and the form refills with those values.
Click Run and they become Active again.
Active is what is actually running right now. Every time you click Run, the form's
current filters become the new Active set automatically.
Active is reserved. You cannot save a preset with that name —
the form will block it and show a warning. Always use a descriptive name for your presets,
such as BPA_STANDARD_YES_BLANK or MY_CUSTOM_FILTER.
Active) will affect what the macro applies on the next run.
Defines the validation rules applied to each source row during Build To Do. Each row in this tab is one rule. Rules with Enabled = YES are active.
| Rule_Type | What it does |
|---|---|
REQUIRED | Skips the row if the specified column is blank. |
DIGITS_LENGTH | Skips the row if the column value is not exactly N digits long (e.g. BPA number must be 9 digits). |
VALUE_IN | Skips the row unless the column value matches one of a comma-separated list. |
VALUE_NOT_IN | Skips the row if the column value matches any value in the list. |
DUPLICATE | Skips subsequent rows where this column duplicates a value already written. |
PRICE_POSITIVE | Skips rows where the price cannot be parsed to a value greater than zero. |
LEAD_TIME | Skips rows where the lead time is blank or not a number (or parseable range). |
Every configuration the macro needs — column mappings, filter sets, skip rules, buyer IDs, email templates, and output paths — is stored inside the workbook itself, across its various tabs. This means the workbook can be copied, emailed, or placed on a shared drive and it will work immediately, with no installation and no external configuration files to manage.
Each user who receives a copy has complete, independent control over their own setup. Changes one user makes to their copy have no effect on anyone else.
When a workbook is passed from one person to another, the saved configurations are already complete — the column mappings, filter settings, and file patterns are all correct. The only value that typically needs updating is the Output_Path, which points to a folder on the original user's computer.
You do not need to delete and recreate configs just to change where files are saved. Go directly to the Saved_Configs tab, find the Output_Path column on the meta-row of each config (the bold blue header row for each config block), and type your own folder path.
This is the standard setup. Each user has their own copy of the workbook on their computer.
| Aspect | Detail |
|---|---|
| Workbook location | Local drive, personal OneDrive folder, or any path the user can access. |
| Source file | Set on the Run sheet. Browsed and updated each run via Build To Do. |
| Output folder | Set in Saved_Configs Output_Path. Points to the user's own output folder. |
| Configs | Created once using Open Mapper. Never need to be recreated unless the template structure changes. |
| BUYER_ID tab | Maintained by the user. Only needs updating when buyers are added or removed. |
| Receiving a new version | Copy the new workbook, open Saved_Configs, update Output_Path on each config's meta-row to point to your folder. Done. |
A team can share one workbook placed on a network drive, SharePoint sync folder, or shared OneDrive location. Because all configuration lives inside the workbook, the team immediately benefits from any improvements made by one member.
| Aspect | Detail |
|---|---|
| Workbook location | Shared network folder, OneDrive shared folder, or SharePoint document library synced locally. |
| Output folder | Each user updates Output_Path in Saved_Configs to point to their own output folder. Alternatively, a shared output folder can be used so all team members write files to the same location. |
| Configs | Created once by one team member. All others inherit the same configs when they open the shared workbook — no individual setup needed. |
| BUYER_ID tab | Maintained centrally. One person updates it; all team members benefit immediately. |
| Sourcing_Rule tab | Updated centrally via Oracle Refresh. One refresh benefits the whole team. |
| Simultaneous editing | Excel does not support two people editing a macro-enabled workbook at the same time. Coordinate within the team — one person runs the macro at a time. |
The macro works with OneDrive and SharePoint provided the files are synced to a local folder on your computer. The macro uses standard Windows file paths — it cannot access web URLs directly.
| Storage location | Compatible? | Notes |
|---|---|---|
| Local drive (C:\, D:\, etc.) | Yes | Always works. Recommended for best performance. |
| OneDrive (synced local folder) | Yes |
OneDrive syncs to a local folder such as
C:\Users\yourname\OneDrive\BPA\Outputs.
Use that local path in Output_Path and on the Run sheet.
Files are synced to the cloud automatically after the macro writes them.
|
| SharePoint (synced via OneDrive client) | Yes |
When a SharePoint document library is synced to your computer via the OneDrive sync client,
it appears as a local folder (e.g.
C:\Users\yourname\CompanyName\SiteName - Documents\BPA).
Use that local path. Files are uploaded to SharePoint automatically after the macro writes them.
|
| Mapped network drive (\\server\share or Z:\) | Yes | Works as long as the drive is connected and the path is accessible when the macro runs. |
| SharePoint web URL (https://...) | No | The macro cannot use web URLs as file paths. You must sync the library locally first using the OneDrive sync client, then use the resulting local folder path. |
After the batch run is complete and you have confirmed the output files are correct, click Send Email.
The macro:
{DATE} in the subject with today's date, and {FILES} in the body with the file names.The Sourcing_Rule tab must be kept up to date for the sourcing rule matching to work correctly. When Oracle data changes (new vendors, updated rules, or site code changes), use Oracle Refresh to update it.
| 1 | Export the Sourcing Rules extract from Oracle in Excel format. |
| 2 | Click Oracle Refresh on the Run tab. |
| 3 | Browse to the Oracle extract file and confirm. |
| 4 | The macro clears the old data from Sourcing_Rule and pastes the new data in its place. |
| Problem | Likely cause | Solution |
|---|---|---|
| Build To Do produces no rows (or far fewer than expected) | Column filters are too restrictive, or the source file path is incorrect. | Check the Log tab for skip reasons. Verify the source path and tab name on the Run sheet. |
| “Source file not found” error | The file has been moved, renamed, or the path on the Run sheet is wrong. | Click Browse... in the Build To Do form to pick the file again. The Run sheet updates automatically. |
| Buyer missing on To Do sheet / rows skipped with “Buyer missing” | The buyer name in the source file is not in the BUYER_ID tab. | Open the BUYER_ID tab, add the missing buyer name and Oracle ID, then re-run Build To Do. |
| Sourcing_Rule_Name column is blank for many rows | The Sourcing_Rule tab is out of date, or the vendor name does not match closely enough. | Run Oracle Refresh to update the Sourcing_Rule data. For individual rows, type the rule name manually. |
| “No rows matched the filter criteria” during batch run | The Filter / Group settings in the saved config do not match any data in the To Do sheet. | Open Mapper, load the config, check the Group by column and filter mode settings, then re-save. |
| “No template columns found” error in Mapper | Scan Template was not run, or the template tab name does not exist. | In the Mapper form, confirm the correct TEMP_ tab is selected and click Scan Template. |
| Run Template Batch produces no files | No configs are selected, or the source (To Do tab) was not chosen. | Ensure at least one config checkbox is ticked and that This Workbook Tab → To Do is selected as the source. |
| Output file names look wrong | The File Pattern in the saved config uses incorrect or missing tokens. | Open Mapper, load the config, and correct the File Pattern field. Valid tokens: {DATE} {GROUP} {TMPL} {INITIALS}. |
| Email button does nothing or shows an Outlook error | Microsoft Outlook is not installed, not set as the default mail client, or is not running. | Open Outlook manually and try again. If Outlook is not available, attach the files from the output folder manually. |
| Macro does not run / buttons are greyed out | Excel macros are disabled in your security settings. | Close the file. Re-open it and click Enable Content when Excel prompts you. If the prompt does not appear, check your Trust Center settings (File → Options → Trust Center → Trust Center Settings → Macro Settings). |