TABLET COVERAGE AUTOMATION REPORT
Process Overview
| Field | Details |
|---|---|
| Process Name | Tablet Coverage Automation |
| Segment | GSC – Global Supply Chain |
| Process Family | Lenovo India |
| Process Users | Wyzmindz Solutions Pvt Ltd |
| Process Purpose | The automation builds Tablet Coverage in the specified column order, derives Disty/Non-Disty, maps city attributes and Brand, keeps only TABLET and TABLET OPTS, calculates CA and writes a formatted Excel workbook. |
Version History
| Version Tag | Prepared By | Date of Update | Validated By | Reviewed By | Approved By | Revision Details |
|---|---|---|---|---|---|---|
| V 1.0 | Sharanya J | 22-12-2025 | Navneeth | Sushruth Vasista | Vishwanath Mosale | SOP Document Creation |
Distribution & Access List
| Designation | Read | Write | Approval |
|---|---|---|---|
| Analyst | Yes | No | No |
| Team Lead | Yes | Yes | No |
| Manager | Yes | Yes | Yes |
| Process Detail | Description |
|---|---|
| Inputs | AP Data Dump, City Mapping, MTM Master. |
| Output | Tablet_Coverage.xlsx; worksheet Tablet Coverage. |
| Brand filter | TABLET and TABLET OPTS only. |
| Business | TABLET for every row. |
1.1 Purpose and Scope
Create a standardized Tablet Coverage workbook. COLUMN_MAP defines the output order; None columns remain blank until their relevant business logic is applied.
1.2 Source-to-Output Mapping
| Tablet Coverage Column | AP / Reference Source |
|---|---|
| Bill_Blog | Data Type |
| SO_No | Sales No |
| Billing_Type | Doc Type |
| Order_Creation_Date | Order Date |
| T1 LPP Code | Blank |
| Payer_Code | Sold To Customer Number |
| Disty | Sold To Customer Name |
| Disty/Non-Disty | Derived rule |
| MTM | Material |
| Description | Material Dec |
| Quantity | Volume |
| CA | Derived rule |
| Plant | Develiery Plant |
| Material_Group | Sub Brand |
| Brand | MTM Master lookup |
| Transaction | Product Group |
| Series | Mktg Name |
| Special_Bid_No | Contract Number |
| Customer_PO_No | Customer Po Number |
| Ship_to_City | Ship to City |
| State / Territory / Region | City Mapping lookup |
| AWB_Number | Ext Bol No |
| Shipping_Condition | Shipping Type |
| Billing Block / Delivery blocks | Blank |
| Line_Item_No | SO# Item |
| Req_Delivery_Date | Blank |
| Billing_Date | Billing Doc. Date |
| Net Value | Local Total Price |
| Distribution_Channel | Channel Code |
| RD/VAR | Blank |
| Month | Blank / future logic |
| Business | TABLET |
| backlogtype | Backlog Type |
| APDATA_segment / AP_Segment / Segment | Blank / future logic |
| Billing_Doc | Billing Number |
1.3 Business Rules
| Rule | Logic |
|---|---|
| Disty/Non-Disty | ONE TIME CUSTOMER → Non-Disty; all other values → Disty. |
| City mapping | Ship_to_City → CityCorrect in City Mapping → return State, Territory and Region. |
| Business | Set to TABLET for every row. |
| Brand | Coverage MTM → MTM Master MTM → return Brand. |
| Brand filter | Keep TABLET and TABLET OPTS only. |
| CA | TABLET → CA equals Quantity; TABLET OPTS → CA equals 0. |
| Date formatting | Order_Creation_Date and Billing_Date displayed as dd-mm-yyyy. |
| Numeric/delimiter fields | Payer_Code, Quantity, CA, Line_Item_No, Net Value and Distribution_Channel; check implementation preserves leading zeros and decimal precision. |
1.4 Configuration and Dependencies
AP_PATH = r"...\AP Data Dump ... .xlsb"
CITY_MAPPING_PATH = r"...\City Mapping.xlsx"
MTM_MASTER_PATH = r"...\MTM Master.xlsx"
OUTPUT_PATH = r"...\Tablet_Coverage.xlsx"
- AP headers must match COLUMN_MAP exactly after whitespace trimming.
- City Mapping requires CityCorrect, State, Territory and Region.
- MTM Master requires MTM and Brand.
- Install pandas, openpyxl and pyxlsb for XLSB input.
1.5 Process Flow
- Start → validate file paths and read AP Data Dump.
- Build output columns in COLUMN_MAP order.
- Derive Disty/Non-Disty.
- Map State, Territory and Region from City Mapping.
- Set Business = TABLET; map Brand from MTM Master.
- Filter Brand to TABLET and TABLET OPTS.
- Calculate CA, format dates and process numeric fields.
- Write Tablet_Coverage.xlsx and validate.
1.6 Run Procedure
- Confirm AP Data Dump, City Mapping and MTM Master are current.
- Verify all paths and output location.
- Close Tablet_Coverage.xlsx if open.
- Run in VS Code terminal:
python your_script_name.py. - Review warnings and completion counts.
- Open the output and complete validation.
1.7 Detailed Logic
Disty / Non-Disty
coverage["Disty/Non-Disty"] = coverage["Disty"].apply(
lambda x: "Non-Disty" if str(x).strip().upper() == "ONE TIME CUSTOMER" else "Disty"
)
City Lookup
Normalize Ship_to_City and use it as the lookup key against CityCorrect. Return State, Territory and Region; unmatched cities remain blank.
Brand and Filter
lookup_brand = make_lookup(mtm_master, "MTM", "Brand", "MTM Master")
coverage["Brand"] = coverage["MTM"].fillna("").astype(str).str.strip().str.upper().map(lookup_brand).fillna("")
allowed_brands = {"TABLET", "TABLET OPTS"}
coverage = coverage[coverage["Brand"].astype(str).str.strip().str.upper().isin(allowed_brands)].reset_index(drop=True)
CA
coverage["CA"] = coverage.apply(
lambda row: row["Quantity"] if str(row["Brand"]).strip().upper() == "TABLET" else 0,
axis=1
)
Formatting
Use actual datetime values for Order_Creation_Date and Billing_Date and apply Excel number format dd-mm-yyyy. Payer_Code, Line_Item_No and Net Value require special care: integer conversion may remove leading zeros or decimals. Confirm desired display against the working script.
1.8 Validation Checklist
- Output file opens and worksheet is Tablet Coverage.
- Columns and order match COLUMN_MAP.
- Brand values are only TABLET and TABLET OPTS.
- Business is TABLET on all output rows.
- CA equals Quantity for TABLET and 0 for TABLET OPTS.
- City attributes and Brand match their reference files.
- Dates display dd-mm-yyyy.
- Numeric values preserve identifiers and financial precision.
- Filters and frozen header are present.
1.9 Troubleshooting
| Symptom | Action |
|---|---|
| Input not found | Check configured paths and filename. |
| AP column warning | Check exact source header spelling and spaces. |
| City fields blank | Check CityCorrect and the return columns in City Mapping. |
| Brand blank / no rows after filter | Check MTM matches and returned Brand values. |
| CA incorrect | Check Brand, Quantity type and order of operations. |
| Date serial numbers | Convert to datetime and set dd-mm-yyyy number format. |
| PermissionError | Close output in Excel and verify write access. |
| Numbers lose zeros/decimals | Review numeric casting; keep identifier columns as text if required. |
Appendix – Quick Run Checklist
- Verify paths.
- Run script.
- Check warnings and row counts.
- Validate Brand, CA, Disty/Non-Disty and city lookups.
- Check dates, numeric fields and output formatting.