ORDER LOAD AUTOMATION REPORT
Process Overview
| Field | Details |
|---|---|
| Process Name | Order Load Automation |
| Segment | REL |
| Process Family | Lenovo India |
| Process Users | Wyzmindz Solutions Pvt Ltd |
| Process Purpose | Automated preparation and enrichment of Order Load from the primary Order Load file and reference mapping files. The automation replaces repetitive manual Excel operations with a repeatable Python process while retaining validation controls for mapping completeness and output quality. |
Version History
| Version Tag | Prepared By | Date of Update | Validated By | Reviewed By | Approved By | Revision Details |
|---|---|---|---|---|---|---|
| V 1.0 | Wyzmindz | 08-10-2026 | — | Process Owner | Process Manager | SOP creation for automated Order Load |
| V 1.1 | — | — | — | — | — | Future automation / business-rule revisions |
Distribution & Access List
| Designation | Read | Write | Approval |
|---|---|---|---|
| Analyst | Yes | No | No |
| Team Lead | Yes | Yes | No |
| Manager | Yes | Yes | Yes |
1.1 Purpose
The purpose of this SOP is to define the standard procedure for running the Order Load automation, preparing the Order Load data, applying business and mapping rules, generating derived fields, and producing the final standardized Excel output. The SOP also documents the Python logic so that the process can be operated, validated and maintained consistently.
1.2 Scope
- Geographic Scope: India.
- Business Segment: REL.
- Core Activity: Generate an enriched Order Load output containing the required source and derived fields.
- Source Data: Order Load XLSB file in the
Datasheet. - Reference Data: RM Mapping, PCSD, Monday Order Load, AP Data and Region&Vertical mapping workbooks.
- Output: Excel workbook, sheet
Data.
1.3 Business / Process Overview
- The Order Load source contains order, customer, product, billing and sales ownership information.
- CA is updated for SMO / OPTIONS records.
- WS BDM is assigned using
End_Cust_Code→DMU IDmapping. - DT/AIO, Conversion, Fcrad Check, Premium and Reasons are derived through controlled lookups.
- Direct/Indirect is derived from
Distribution_Channel. - Region and Vertical are rebuilt using the Region&Vertical mapping.
- Blank or unmatched values are handled according to the rule for each field.
1.4 Responsibility and Authority
| Role | Responsibility |
|---|---|
| Analyst | Run automation, validate output and investigate exceptions. |
| Process Owner | Confirm business rules and mapping requirements. |
| Process Manager | Review process changes and approve revisions. |
| Approval Authority | Approve final process/output changes. |
1.5 Escalation Matrix
| Level | Name | Designation | Email ID |
|---|---|---|---|
| 1 | Process Manager | Manager | As per internal escalation list |
| 2 | Approval Authority | Director / Approver | As per internal escalation list |
1.6 RACI Matrix
| Report / Process | Responsible | Accountable | Consultation | Informed |
|---|---|---|---|---|
| Order Load | Analyst | Process Owner | Process Manager | Lenovo India / Wyzmindz |
1.7 Access Required
- Access to the Order Load source folder.
- Access to RM Mapping workbook.
- Access to PCSD workbook.
- Access to Monday Order Load reference workbook.
- Access to AP Data workbook.
- Access to Region&Vertical mapping workbook.
- Read/write access to the output folder.
- Python environment with
pandas,pyxlsbandopenpyxl. - MS Excel for final review.
1.8 Overview of Tools
| Sl. No | Tool / Component | Purpose |
|---|---|---|
| 1 | Python | Runs the Order Load automation. |
| 2 | Pandas | Reads, filters, transforms, maps and writes Excel data. |
| 3 | pyxlsb | Reads XLSB source workbooks. |
| 4 | openpyxl | Supports XLSX output writing. |
1.9 Legends and Mapping Rules
| Source Value / Rule | Output / Meaning |
|---|---|
| Brand = SMO AND V_Brand = OPTIONS | CA = 0 |
| Distribution_Channel = 21 | Direct |
| Distribution_Channel ≠ 21 | Indirect |
| DT/AIO lookup starts with AIO | AIO |
| Other matched DT/AIO category | DT |
Unmatched lookup where rule specifies - |
- |
| Unmatched Region / Vertical | #NA |
1.10 Dependencies
- Order Load XLSB file.
- RM Mapping workbook.
- PCSD XLSB file.
- Monday Order Load XLSB file.
- AP Data XLSB file.
- Region&Vertical mapping workbook.
- Configured file paths and expected source columns.
1.11 Schedule of Reporting
The automation is executed according to the Order Load reporting cycle. Before execution, the operator must confirm that the latest Order Load and supporting mapping/reference files are being used.
1.12 Process Flow Chart
- START → Run Python Order Load automation.
- Step 1: Read Order Load XLSB –
Datasheet. - Step 2: Clean source column names.
- Step 3: Apply CA rule.
- Step 4: Load RM Mapping and populate WS BDM.
- Step 5: Create
SOMTMITEM Quantity. - Step 6: Load PCSD and derive DT/AIO.
- Step 7: Load Monday Order Load and derive Conversion + Fcrad Check.
- Step 8: Load AP Data and derive Premium + Reasons.
- Step 9: Derive Direct/Indirect from
Distribution_Channel. - Step 10: Load Region&Vertical and derive Region + Vertical.
- Step 11: Validate output columns and values.
- Step 12: Write
Orderload_Automated.xlsx. - END → Order Load automation completed.
1.13 Steps of Procedure
- Confirm the latest Order Load and all reference mapping files are available.
- Update input/output file paths if locations or reporting periods have changed.
- Read the Order Load XLSB
Datasheet usingpandasandpyxlsb. - Clean source column names using
strip(). - Apply the SMO + OPTIONS CA rule.
- Load RM Mapping
WS BDMsheet and mapEnd_Cust_Code→DMU ID→BDM. - Create
SOMTMITEM Quantityby concatenatingSOMTMITEMandQuantity. - Load PCSD, filter Brand = DSK, and map
MTM→Product_Category→ DT/AIO. - Load Monday Order Load and map
SOMTMITEM Quantity→Exe/Un-ExeandFCrad. - Load AP Data and apply the Premium material criteria.
- Create the AP Reasons key:
Sales No + Material + SO# Item + Volume, then map it to Order LoadSOMTMITEM Quantityand returnBlock code. - Set Direct/Indirect:
Distribution_Channel21 → Direct; otherwise Indirect. - Load Region&Vertical. The current mapping has headers on Excel row 2, so
header=1is used. MatchSales_Manager→Rationalised Sales_Manager→ Region / Vertical. - Remove the existing Order Load Region column before creating the new Region column.
- Build final output columns in the required order and write the
Datasheet. - Review validation checks before downstream use.
1.14 Code Logic and Automation Details
The automation follows a controlled read → clean → filter → map → derive → validate → output sequence.
A. Input Configuration
orderload_file = r"...Order Load Summary ...xlsb"
rm_mapping_file = r"...RM Mapping ...xlsx"
output_file = r"...Orderload_Automated.xlsx"
pcsd_file = r"...PCSD ...xlsb"
monday_file = r"...Order Load ...xlsb"
ap_data_file = r"...AP Data ...xlsb"
mapping_file = r"...Mapping-1787634732938.xlsx"
These parameters allow the same script to be reused for a new Order Load cycle by changing file locations rather than rewriting the transformation logic.
B. Order Load Loading
df = pd.read_excel(orderload_file, sheet_name="Data", engine="pyxlsb")
df.columns = df.columns.str.strip()
The script reads the Data sheet from the XLSB source and trims header whitespace.
C. CA Rule
mask = (
df["Brand"].astype(str).str.strip().str.upper().eq("SMO")
& df["V_Brand"].astype(str).str.strip().str.upper().eq("OPTIONS")
)
df.loc[mask, "CA"] = 0
Only rows satisfying both conditions are changed.
D. WS BDM Mapping
bdm_lookup = (
rm_bdm.drop_duplicates(subset=["DMU ID"], keep="first")
.set_index("DMU ID")["BDM"]
)
df["WS BDM"] = df["End_Cust_Code"].map(bdm_lookup)
df["WS BDM"] = df["WS BDM"].fillna("-")
End_Cust_Code is the Order Load key; DMU ID is the mapping key and BDM is the returned value.
E. SOMTMITEM Quantity
df["SOMTMITEM Quantity"] = (
df["SOMTMITEM"].fillna("").astype(str).str.strip()
+ df["Quantity"].fillna("").astype(str).str.strip()
)
The two values are concatenated without a separator. This field is reused as a lookup key for Conversion, Fcrad Check and Reasons.
F. DT/AIO Mapping
pcsd_dsk = pcsd[
pcsd["Brand"].astype(str).str.strip().str.upper().eq("DSK")
].copy()
product_category_lookup = (
pcsd_dsk.drop_duplicates(subset=["Material"], keep="first")
.set_index("Material")["Product_Category"]
)
df["DT/AIO"] = df["MTM"].map(product_category_lookup)
Only PCSD rows with Brand = DSK are used. Returned Product_Category values are standardized: values starting with AIO become AIO; other matched values become DT; unmatched values become -.
G. Conversion and Fcrad Check
conversion_lookup = (
monday.drop_duplicates(subset=["SOMTMITEM Quantity"], keep="first")
.set_index("SOMTMITEM Quantity")["Exe/Un-Exe"]
)
df["Conversion"] = df["SOMTMITEM Quantity"].map(conversion_lookup)
fcrad_lookup = (
monday.drop_duplicates(subset=["SOMTMITEM Quantity"], keep="first")
.set_index("SOMTMITEM Quantity")["FCrad"]
)
df["Fcrad Check"] = df["SOMTMITEM Quantity"].map(fcrad_lookup)
The same concatenated key is used to retrieve two different return fields from the Monday reference.
H. Premium Mapping
brand_condition = ap_data["Brand Code"].astype(str).str.strip().str.upper().eq("MOB")
sub_brand_condition = ap_data["Sub Brand"].astype(str).str.strip().str.upper().eq("THINKPAD")
product_category = ap_data["Product_Category"].astype(str).str.strip().str.upper()
product_category_condition = product_category.str.startswith("X") | product_category.eq("T SERIES")
premium_data = ap_data[brand_condition & sub_brand_condition & product_category_condition].copy()
premium_materials = premium_data["Material"].dropna().astype(str).str.strip()
df["Premium"] = mtm_clean.where(mtm_clean.isin(set(premium_materials)), "-")
AP Data is filtered to MOB + ThinkPad + T Series or any X-starting Product_Category. The Order Load MTM is checked against the qualifying Material list.
I. Reasons Mapping
The AP Data Reasons lookup key is built as:
AP Reasons Key = Sales No + Material + SO# Item + Volume
Order Load lookup key = SOMTMITEM Quantity → Return field = Block code
The AP Data key is matched to Order Load SOMTMITEM Quantity. The returned value is Block code. Blank or unmatched values are represented as -.
J. Direct / Indirect
df["Direct/Indirect"] = df["Distribution_Channel"].apply(
lambda x: "Direct" if str(x).strip() == "21" else "Indirect"
)
Distribution_Channel value 21 is Direct. Every other value is Indirect.
K. Region / Vertical
region_vertical = pd.read_excel(
mapping_file,
sheet_name="Region&Vertical",
header=1
)
region_lookup = (
region_vertical.drop_duplicates("Rationalised Sales_Manager", keep="first")
.set_index("Rationalised Sales_Manager")["Region"]
)
vertical_lookup = (
region_vertical.drop_duplicates("Rationalised Sales_Manager", keep="first")
.set_index("Rationalised Sales_Manager")["Vertical"]
)
The current mapping sheet has its headers on Excel row 2, so header=1 is used. Sales_Manager is matched to Rationalised Sales_Manager and Region / Vertical are returned.
L. Region Column Replacement
if "Region" in df.columns:
df = df.drop(columns=["Region"])
df["Region"] = sales_manager_clean.map(region_lookup)
df["Region"] = df["Region"].replace(r"^\s*$", pd.NA, regex=True).fillna("#NA")
df["Vertical"] = sales_manager_clean.map(vertical_lookup)
df["Vertical"] = df["Vertical"].replace(r"^\s*$", pd.NA, regex=True).fillna("#NA")
The Order Load already contains a Region column. The automation deliberately removes that existing column and creates a new Region column using the defined mapping logic. This prevents the old Region values from being retained.
M. Final Output Construction
| Output Column | Source / Logic |
|---|---|
| CA | SMO + OPTIONS → 0 |
| WS BDM | End_Cust_Code → DMU ID → BDM |
| SOMTMITEM Quantity | SOMTMITEM + Quantity |
| DT/AIO | MTM → PCSD Material → Product_Category → AIO/DT |
| Conversion | SOMTMITEM Quantity → Monday Exe/Un-Exe |
| Fcrad Check | SOMTMITEM Quantity → Monday FCrad |
| Premium | MTM → qualifying AP Data Material |
| Direct/Indirect | Distribution_Channel 21 → Direct; else Indirect |
| Reasons | SOMTMITEM Quantity → AP Reasons key → Block code |
| Region | Sales_Manager → Rationalised Sales_Manager → Region |
| Vertical | Sales_Manager → Rationalised Sales_Manager → Vertical |
N. Output Write
df.to_excel(
output_file,
sheet_name="Data",
index=False
)
1.15 Output Overview
The generated workbook contains the Order Load Data sheet with the original source columns plus the automated and derived fields required by the business rules. The output is saved as an XLSX workbook.
1.16 Validation Checklist
- Output workbook is created successfully.
- Output row count is reviewed against the input Order Load.
- SMO + OPTIONS records have CA = 0.
- WS BDM mappings are reviewed for matched and
-records. - DT/AIO contains only
AIO,DTor-as applicable. - Conversion and Fcrad Check are reviewed against the Monday reference.
- Premium is populated only for qualifying AP Data materials.
Distribution_Channel21 is Direct; all other values are Indirect.- Reasons is reviewed for matched Block code and
-values. - Existing Region was removed and the new Region was generated from
Sales_Managermapping. - Vertical is generated from the same Region&Vertical mapping.
- Final column order is checked against the approved output header list.
1.17 Exception Handling
| Exception | Action |
|---|---|
| Mapping workbook missing | Verify configured path and file availability. |
| Required sheet not found | Open the workbook and verify exact sheet name. |
| Source columns changed | Stop and review source structure before rerunning. |
| Reasons key column missing | Verify Sales No, Material, SO# Item and Volume exist in AP Data. |
| Region / Vertical all #NA | Verify Sales_Manager values match Rationalised Sales_Manager. |
| Unmatched lookup | Review source key and mapping workbook; do not manually guess values. |
| Output save failure | Close the output workbook and verify folder/write permissions. |
| pyxlsb engine error | Verify XLSB format and pyxlsb installation. |
Appendix A – Quick Run Checklist
- Confirm latest Order Load XLSB.
- Confirm RM Mapping workbook.
- Confirm PCSD workbook.
- Confirm Monday Order Load workbook.
- Confirm AP Data workbook.
- Confirm Region&Vertical mapping workbook.
- Verify all configured paths.
- Run the Python automation.
- Review record count and output columns.
- Review
-and#NAvalues. - Open and validate the generated output.
Appendix B – Detailed Code Explanation, Usage Guide and Error Handling
The following section explains how the operator should prepare the Python environment, configure file paths, execute the script, interpret successful completion, and troubleshoot common failures.
B.1 Objective of the Python Automation
The Python script automates repetitive Excel activities required to prepare the Order Load output. Instead of manually applying multiple filters, lookups and derived-field formulas, the script performs these operations in a controlled sequence.
B.2 Before Running the Code – Required Setup
- Python installed and available from Command Prompt / VS Code terminal.
- All Order Load and reference workbooks available.
- The Python script saved as a
.pyfile. - Write access to the output folder.
- Input/output workbooks closed before execution.
B.3 Install Required Python Libraries
python -m pip install pandas
python -m pip install pyxlsb
python -m pip install openpyxl
Using python -m pip is recommended because it installs packages into the Python interpreter associated with the selected Python command.
B.4 Import Section – What Each Library Does
| Library / Import | Purpose |
|---|---|
| pandas | Reads Excel files, filters records, creates lookup tables, transforms columns and writes the final workbook. |
| pyxlsb | Excel-reading engine used to read XLSB source workbooks. |
| openpyxl | Supports writing the XLSX output. |
B.5 File Path Configuration
orderload_file = r"...Order Load Summary ...xlsb"
rm_mapping_file = r"...RM Mapping ...xlsx"
pcsd_file = r"...PCSD ...xlsb"
monday_file = r"...Order Load ...xlsb"
ap_data_file = r"...AP Data ...xlsb"
mapping_file = r"...Mapping-1787634732938.xlsx"
output_file = r"...Orderload_Automated.xlsx"
These are the first values to check before every new run. When a new reporting file is received, update the relevant path. Do not change transformation logic unless the source structure or business rule has changed.
B.6 How to Run the Code – Step by Step
- Open the Python file in VS Code.
- Confirm the selected Python interpreter is the environment where
pandas,pyxlsbandopenpyxlare installed. - Check all configured file paths.
- Close the input and output Excel workbooks if open.
- Open the VS Code Terminal.
- Run:
python your_script_name.py - Wait for the success message.
- Open the generated
Orderload_Automated.xlsxfile. - Check the
Datasheet using the validation checklist. - Review unexpected
-or#NAvalues before downstream use.
B.7 Expected Successful Run
==============================================
Order Load automation completed successfully
==============================================
Output saved successfully.
The exact row count and mapped values will change with each reporting file. The important controls are that the script completes without a traceback, an output file is created, the row count is reasonable, and the automated fields pass validation.
B.8 Common Errors and How to Fix Them
| Possible Error | Action |
|---|---|
ModuleNotFoundError: No module named 'pandas' |
Run: python -m pip install pandas. Verify the VS Code interpreter. |
ModuleNotFoundError: No module named 'pyxlsb' |
Run: python -m pip install pyxlsb. |
FileNotFoundError |
Check exact file path, filename, drive and extension. |
PermissionError: [Errno 13] Permission denied |
Close the output Excel file and verify write permission. |
ValueError: Worksheet named 'WS BDM' not found |
Verify the RM Mapping workbook contains the WS BDM sheet. |
ValueError: Worksheet named 'Region&Vertical' not found |
Verify the mapping workbook sheet name and spelling. |
KeyError: 'Sales_Manager' |
Verify the Order Load source column name and header. |
KeyError: 'Material' / 'Block code' |
Verify AP Data source columns and header row. |
KeyError: 'Sales No' / 'SO# Item' / 'Volume' |
Verify AP Data Reasons source columns. |
All Region / Vertical values are #NA |
Verify Sales_Manager matches Rationalised Sales_Manager and the mapping sheet is read with the correct header row. |
Reasons values are all - |
Verify the AP concatenated key exactly matches Order Load SOMTMITEM Quantity. |
| pyxlsb engine error | Verify the source is a valid XLSB workbook and pyxlsb is installed. |
B.9 Troubleshooting Sequence
When an error occurs, do not immediately change the transformation logic. Follow this order:
- Read the last lines of the traceback; they usually identify the failed line and missing item.
- Check the file path and file name.
- Check the worksheet name.
- Check the source column names.
- Check the Python interpreter selected in VS Code.
- Check whether the required package is installed in that interpreter.
- Open the reference workbook and verify the expected mapping headers.
- Only after these checks, review the business logic or mapping rules.
B.10 Header Row Control – Region&Vertical
The current Region&Vertical mapping has its headers on Excel row 2, so the script currently uses header=1. If the source layout changes, inspect the workbook before changing the code. A fixed header=1 means Excel row 2; header=0 means Excel row 1.
B.11 Safe Maintenance Rules
- Do not overwrite approved reference mapping workbooks without keeping a controlled copy.
- Do not change lookup keys or return fields without business approval.
- Do not manually overwrite automated output values without recording the reason.
- After any code change, test against a known sample and compare with an approved output.
- When changing file paths for a new reporting period, change only the configuration values unless the source structure has changed.
- Review all unexpected
-and#NAvalues before downstream use.
B.12 Operator Quick Reference
| Task | What to Do |
|---|---|
| New Order Load | Change orderload_file. |
| New output location | Change output_file. |
| New RM Mapping workbook | Change rm_mapping_file. |
| New PCSD file | Change pcsd_file. |
| New Monday reference | Change monday_file. |
| New AP Data file | Change ap_data_file. |
| New Region&Vertical mapping | Change mapping_file. |
| Mapping headers moved | Inspect the sheet and update header handling if required. |
| New Python machine | Install required packages and verify interpreter. |
| Output validation | Use Section 1.16 checklist. |
B.13 Important Control Point
The automation is intended to standardize repeatable data preparation. It does not replace business validation of new or ambiguous mappings. Any unexpected source structure, missing mapping, unmatched lookup or suspicious output should be reviewed before the Order Load output is used downstream.