Sap sd

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

Sap sd is an AI agent skill from the GitHub repository 5throck/ai-workspace-standards. Use when working on SD module tasks — sales orders, deliveries, billing, pricing, or order-to-cash processes. Provides process flows, key table relationships, common query patterns, field notes, SAP quirks, and standard BAPIs for the SD module.

How to use this skill

Skill file

SD Analyst Context — Sales & Distribution

Load this skill when activating the SD Analyst role. Provides deep domain knowledge for process analysis, table relationships, and common query patterns.

Process Flow

VA01 (Create Quote/Order)
  └─► VA02 (Change Order) / VA03 (Display)
        └─► VL01N (Create Delivery)
              └─► VL02N (Confirm Picking/Goods Issue)
                    └─► VF01 (Create Billing Document)
                          └─► VF02 (Cancel/Modify Billing Document)

Key Table Relationships

VBAK (Sales Order Header)
  ├── VBKD (Business Data: Payment Terms, Incoterms)
  └── VBAP (Sales Order Item)
        ├── VBEP (Schedule Lines)
        ├── KONV (Pricing Condition Details)  ← VBAP.KNUMV = KONV.KNUMV
        └── VBFA (Document Flow)      ← Delivery/Billing Connection

LIKP (Delivery Header)
  └── LIPS (Delivery Item)
        └── VBFA (Delivery → Billing Flow)

VBRK (Billing Header)
  └── VBRP (Billing Item)
        └── BKPF/BSEG (FI Document Connection)  ← VBRK.BELNR

Common Query Patterns

-- Undelivered Sales Orders (Incomplete Delivery Items)
SELECT a~vbeln, a~erdat, a~kunnr, b~posnr, b~matnr, b~kwmeng, b~lfsta
  FROM vbak AS a JOIN vbap AS b ON a~vbeln = b~vbeln
  WHERE a~auart = 'TA' AND b~lfsta <> 'C' AND a~erdat >= '20260101'
  ORDER BY a~erdat DESCENDING

-- Unbilled Deliveries Search
SELECT a~vbeln, a~erdat, a~kunag, b~posnr, b~matnr, b~fksta
  FROM likp AS a JOIN lips AS b ON a~vbeln = b~vbeln
  WHERE b~fksta <> 'C'

-- Pricing Condition Details (Specific Order)
SELECT a~kschl, a~kwert, a~waers, a~kpein, a~kmein
  FROM konv AS a JOIN vbak AS b ON b~knumv = a~knumv
  WHERE b~vbeln = '<ORDER_NUMBER>'

-- Sales Aggregation by Customer (Current Month)
SELECT kunnr, COUNT(*) AS order_cnt, SUM( netwr ) AS total_net
  FROM vbak
  WHERE auart = 'TA' AND erdat >= '20260501' AND erdat <= '20260531'
  GROUP BY kunnr ORDER BY total_net DESCENDING

Key Field Notes

| Table | Field | Description |

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

| VBAP | KWMENG | Quantity — Always stored in Base Unit (MEINS) |

| VBAP | LFSTA | Delivery Status: =Not Processed, A=Partial, B=Completed |

| VBAP | FKSTA | Billing Status: =Not Processed, A=Partial, C=Completed |

| VBAK | AUART | Sales Order Type (TA, RE, KA, etc.) |

| KONV | KSCHL | Condition Type (PR00=Base Price, MWST=Tax, etc.) |

| VBFA | VBTYP_N | Subsequent Document Type: J=Delivery, M=Billing |

SAP Quirks & Known Issues

Standard Customizing Tables

| Table | Purpose |

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

| TVAK | Sales Order Type Definition |

| TVLK | Delivery Type Definition |

| TVFK | Billing Type Definition |

| VKOA | Account Determination (FI Link) |

| T685 | Pricing Condition Type Definition |

| TVZA | Payment Terms |

| VBUK | Sales Document Header Status (Legacy) |

| VBUP | Sales Document Item Status (Legacy) |

Strategic BAPIs & APIs

Sales Order Creation

BAPI: BAPI_SALESORDER_CREATEFROMDAT2

Sales Order Change

BAPI: BAPI_SALESORDER_CHANGE

Delivery Creation from Sales Order

BAPI: BAPI_OUTB_DELIVERY_CREATE_SLS

Billing Document Creation

BAPI: BAPI_BILLINGDOC_CREATEMULTIPLE

Context

This skill provides the SD Analyst with comprehensive domain knowledge for the Sales & Distribution module in SAP. It is loaded when the active task involves sales order processing, delivery management, billing, pricing configuration, or the overall order-to-cash (O2C) cycle. The skill covers end-to-end process flows, master data relationships, query patterns, and standard integration BAPIs.

When to Use

Execution Steps

  1. Review the Process Flow section to understand the O2C document chain and relevant transaction codes.
  2. Query key tables using the Key Table Relationships section as a join reference guide.
  3. Apply Common Query Patterns as starting templates — adapt date ranges, document types, and status filters to the specific requirement.
  4. Check SAP Quirks & Known Issues for pricing re-determination behavior, partial delivery rules, and credit block handling.
  5. Use Standard Customizing Tables to validate configuration settings (order types, billing types, account determination).
  6. Leverage Strategic BAPIs & APIs for automated sales order, delivery, or billing document processing.

Output Format

Structured analysis output should include: business context (sales org, distribution channel, division), document references (VBELN numbers with types), data tables with key fields, status indicators (delivery/billing completion), and recommended actions. Include table relationship diagrams for complex cross-module queries.

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.