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 Data sheet.
  • 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 ID mapping.
  • 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, pyxlsb and openpyxl.
  • 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 – Data sheet.
  • 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

  1. Confirm the latest Order Load and all reference mapping files are available.
  2. Update input/output file paths if locations or reporting periods have changed.
  3. Read the Order Load XLSB Data sheet using pandas and pyxlsb.
  4. Clean source column names using strip().
  5. Apply the SMO + OPTIONS CA rule.
  6. Load RM Mapping WS BDM sheet and map End_Cust_Code → DMU ID → BDM.
  7. Create SOMTMITEM Quantity by concatenating SOMTMITEM and Quantity.
  8. Load PCSD, filter Brand = DSK, and map MTM → Product_Category → DT/AIO.
  9. Load Monday Order Load and map SOMTMITEM Quantity → Exe/Un-Exe and FCrad.
  10. Load AP Data and apply the Premium material criteria.
  11. Create the AP Reasons key: Sales No + Material + SO# Item + Volume, then map it to Order Load SOMTMITEM Quantity and return Block code.
  12. Set Direct/Indirect: Distribution_Channel 21 → Direct; otherwise Indirect.
  13. Load Region&Vertical. The current mapping has headers on Excel row 2, so header=1 is used. Match Sales_Manager → Rationalised Sales_Manager → Region / Vertical.
  14. Remove the existing Order Load Region column before creating the new Region column.
  15. Build final output columns in the required order and write the Data sheet.
  16. 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, DT or - as applicable.
  • Conversion and Fcrad Check are reviewed against the Monday reference.
  • Premium is populated only for qualifying AP Data materials.
  • Distribution_Channel 21 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_Manager mapping.
  • 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 #NA values.
  • 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 .py file.
  • 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

  1. Open the Python file in VS Code.
  2. Confirm the selected Python interpreter is the environment where pandas, pyxlsb and openpyxl are installed.
  3. Check all configured file paths.
  4. Close the input and output Excel workbooks if open.
  5. Open the VS Code Terminal.
  6. Run: python your_script_name.py
  7. Wait for the success message.
  8. Open the generated Orderload_Automated.xlsx file.
  9. Check the Data sheet using the validation checklist.
  10. Review unexpected - or #NA values 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:

  1. Read the last lines of the traceback; they usually identify the failed line and missing item.
  2. Check the file path and file name.
  3. Check the worksheet name.
  4. Check the source column names.
  5. Check the Python interpreter selected in VS Code.
  6. Check whether the required package is installed in that interpreter.
  7. Open the reference workbook and verify the expected mapping headers.
  8. 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 #NA values 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.