Sap mm

From 5throck/ai-workspace-standards · View interactive version

Sap mm is an AI agent skill from the GitHub repository 5throck/ai-workspace-standards. Use when working on MM module tasks — purchasing, goods receipt, material master, inventory, or procure-to-pay processes. Provides process flows, key table relationships, common query patterns, field notes, SAP quirks, and standard BAPIs for the MM module.

How to use this skill

Skill file

MM Analyst Context — Materials Management

Load this skill when activating the MM Analyst role. Provides deep domain knowledge for purchasing, goods receipt, material master, and inventory.

Process Flow

ME51N (Create Purchase Requisition)
  └─► ME21N (Create Purchase Order)
        └─► MIGO 101 (Goods Receipt)
              ├─► MIRO (Invoice Verification)
              │     └─► FBL1N (Vendor Line Item Display)
              └─► MIGO 122 (Return Delivery)

MM01 (Create Material Master) ─► MM02 (Change) ─► MM60 (MRP Run)

Key Table Relationships

EBAN (Purchase Requisition Header)
  └─► EBKN (Purchase Requisition Account Assignment)

EKKO (Purchase Order Header)
  ├─► EKPO (Purchase Order Item)
  │     └─► EKET (Delivery Schedule)
  └─► EKES (Vendor Confirmation)

MKPF (Material Document Header — GR/GI)
  └─► MSEG (Material Document Item)
        └─► EKPO (Purchase Order Item Reference)

MARA (Material Master — General)
  ├─► MARC (Material Master — Plant)
  ├─► MARD (Material Master — Storage Location)
  └─► MBEW (Material Valuation — Cost)

Common Query Patterns

-- Unreceived Purchase Orders Search
SELECT a~ebeln, a~erdat, a~lifnr, b~ebelp, b~matnr, b~menge, b~wemng
  FROM ekko AS a JOIN ekpo AS b ON a~ebeln = b~ebeln
  WHERE b~elikz = ' ' AND a~erdat >= '20260101' AND a~bsart = 'NB'
  ORDER BY a~erdat DESCENDING

-- Stock Status by Storage Location
SELECT matnr, werks, lgort, labst, einme, speme
  FROM mard
  WHERE werks = '1000' AND labst > 0
  ORDER BY labst DESCENDING

-- Goods Movement by Material (Current Month)
SELECT a~mblnr, a~budat, b~matnr, b~werks, b~lgort, b~bwart, b~menge, b~meins
  FROM mkpf AS a JOIN mseg AS b ON a~mblnr = b~mblnr AND a~mjahr = b~mjahr
  WHERE a~budat >= '20260501' AND a~budat <= '20260531'
  ORDER BY a~budat DESCENDING

-- Material Valuation (Moving Average Price)
SELECT matnr, bwkey, vprsv, verpr, stprs, peinh, laepr
  FROM mbew
  WHERE bwkey = '1000' AND matnr = '<MATERIAL_NUMBER>'

Key Field Notes

| Table | Field | Description |

|-------|-------|-------------|

| EKPO | ELIKZ | Delivery Completed Indicator: X=Completed |

| EKPO | WEMNG | Goods Receipt Quantity |

| EKPO | REMNG | Remaining Quantity (MENGE - WEMNG) |

| MSEG | BWART | Movement Type (101, 122, 201, 261, etc.) |

| MARD | LABST | Unrestricted-use Stock |

| MARD | EINME | Quality Inspection Stock |

| MARD | SPEME | Blocked Stock |

| MBEW | VPRSV | Price Control: S=Standard, V=Moving Average |

| MBEW | VERPR | Moving Average Price |

SAP Quirks & Known Issues

Standard Customizing Tables

| Table | Purpose |

|-------|---------|

| T001W | Plant |

| T001L | Storage Location |

| T024 | Purchasing Group |

| T161 | Purchase Order Types |

| T156 | Movement Types |

| T157H | Movement Type Help Text |

Strategic BAPIs & APIs

Purchase Order Creation

BAPI: BAPI_PO_CREATE1

Purchase Order Change

BAPI: BAPI_PO_CHANGE

Goods Movement

BAPI: BAPI_GOODSMVT_CREATE

Material Master Save

BAPI: BAPI_MATERIAL_SAVEDATA

Context

This skill provides the MM Analyst with comprehensive domain knowledge for the Materials Management module in SAP. It is loaded when the active task involves purchasing, goods receipt, material master management, inventory, or the procure-to-pay (P2P) cycle. The skill covers document flows, master data hierarchies, query patterns, and standard BAPIs for procurement operations.

When to Use

Execution Steps

  1. Review the Process Flow section to understand the P2P document chain from requisition to invoice.
  2. Query key tables using the Key Table Relationships section — trace from EKKO/EKPO (PO) through MKPF/MSEG (GR) to MBEW (valuation).
  3. Apply Common Query Patterns for unreceived POs, stock status, goods movements, and material valuation.
  4. Check SAP Quirks & Known Issues for moving average price reversal behavior, split valuation, and GR-based IV constraints.
  5. Use Standard Customizing Tables to validate plant, storage location, purchasing group, and movement type configuration.
  6. Leverage Strategic BAPIs & APIs for PO creation/change, goods movement, and material master maintenance.

Output Format

Structured analysis output should include: purchasing organization and group context, PO/GR reference numbers, material and plant details, quantity and value breakdowns, delivery status indicators, and valuation information. Include stock summary tables by storage location when relevant.

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.