界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
开发与工程 · SKILL.md

sap-mb5b-export

sap-mb5b-export

【开发与工程】Automate SAP GUI for Windows transaction MB5B from an Excel list of plants and storage locations, export one workbook per target, add the storage-location column, and merge successful exports per plant. Use when Codex needs to run or diagnose MB5B Excel exports, perform a dry run, validate a new SAP GUI locale, or inspect language-independent SAP and…

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: sap-mb5b-export description: Automate SAP GUI for Windows transaction MB5B from an Excel list of plants and storage locations, export one workbook per target, add the storage-location column, and merge successful exports per plant. Use when Codex needs to run or diagnose MB5B Excel exports, perform a dry run, validate a new SAP GUI locale, or inspect language-independent SAP and Windows dialog controls.

SAP MB5B Export

Use the bundled Python workflow. Do not recreate the SAP automation with VBS or PowerShell.

Required Workflow

  1. Read references/environment.md before the first run on a machine or after an SAP GUI or Windows upgrade.
  2. Run scripts/check_environment.py with the input workbook. Add --require-sap before a live run.
  3. Run scripts/mb5b_export.py with --dry-run and review all individual and merged output paths.
  4. On a new SAP GUI language, version, theme, or Windows scale, run a live --limit 1 test before processing all rows.
  5. Run the complete export only after the one-row file has the expected filename and Data!D1 header.
  6. Report exit code 2 as partial success and use the log to identify failed plant/storage pairs.

Commands

python scripts/check_environment.py --input "<LOCAL_WORKSPACE>\保管場所.xlsx" --require-sap

python scripts/mb5b_export.py `
  --input "<LOCAL_WORKSPACE>\保管場所.xlsx" `
  --date 2026-02-28 `
  --dry-run

python scripts/mb5b_export.py `
  --input "<LOCAL_WORKSPACE>\保管場所.xlsx" `
  --date 2026-02-28 `
  --limit 1

Pass --overwrite only when the user explicitly permits replacing existing individual and merged files. Use --output-dir to keep test exports separate from production files.

Language Independence

  • Use SAP technical control IDs and Windows control structure only.
  • Never add window-title, button-label, translated-message, OCR, or fixed-coordinate matching to execution logic.
  • Treat labels as diagnostic data only.
  • Stop on an ambiguous multi-button dialog. Do not guess which action means allow, save, or overwrite.
  • Use --inspect-ui --output-dir <directory> passively while the user has the unsupported dialog open. This writes screenshots and a control-tree JSON without clicking anything.
  • Preserve the one-submit-per-state rule. Do not retry clicks in a loop.

Output Contract

  • Individual: MB5B_<plant>_<storage>_<YYYYMMDD>.xlsx
  • Merged: MB5B_<plant>_<YYYYMMDD>.xlsx
  • Insert column D when needed, set D1 to the configured storage header, and fill data rows with the target storage code.
  • Keep one header row in each plant merge and append only successful individual files in input order.
  • Return 0 for full success, 1 for preflight/startup failure, and 2 for partial export or merge failure.

Do not bulk-delete files or directories. Keep runtime logs and diagnostics local and out of source control.

我的收藏