AGENT SKILL

sap-sd

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.

License 许可
AGPL-3.0
最近更新
2026-11-14
Stars
★ 25
Forks
9

01 前言 Front Matter

name
sap-sd
owner
sd-analyst
scope
co-abap
status
active
version
1.0.0
metadata
{ "type": "module", "triggers": [ "sap-sd", "sales order", "delivery", "billing", "pricing", "O2C" ] }
relates_to
[ { "type": "follows", "skill": "sap-mm" } ]
description
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.
last_reviewed
1786752000000
prerequisites
vsp MCP server

03 SKILL.md 正文

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)
  • Sales Order Type: TA (Standard), RE (Return), KA (Consignment), CS (Service)
  • Delivery Type: LF (Standard Delivery), LR (Return Delivery)
  • Billing Type: F2 (Standard Billing), G2 (Credit Memo), L2 (Debit Memo)

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

  • Pricing Re-determination: KONV records are deleted and recreated — use CDHDR/CDPOS for history tracking
  • Partial Delivery: Split based on VBEP (Schedule Lines), one VBAP item can have multiple VBEP records
  • Return Orders (RE): Always check VBAK.AUGRU (Order Reason) field
  • Credit Block: VBUK.CMGST = B indicates a credit block — check before shipment
  • VBFA Document Flow: Recursive structure requires repeated queries for multi-level tracking

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

  • ORDER_HEADER_IN: AUART (Type), VKORG (Sales Org), VTWEG (Dist. Channel), SPART (Division), KUNNR (Sold-to)
  • ORDER_ITEMS_IN: MATERIAL, PLANT, TARGET_QTY, TARGET_QU (UoM), SALES_UNIT
  • ORDER_PARTNERS: PARTN_ROLE (SP=Sold-to, SH=Ship-to, BP=Bill-to), PARTN_NUMB
  • RETURN: Standard BAPI return — check TYPE = 'E' before BAPI_TRANSACTION_COMMIT

Sales Order Change

BAPI: BAPI_SALESORDER_CHANGE

  • SALESDOCUMENT: Sales Order Number (VBELN)
  • ORDER_HEADER_IN: Fields to change — REQ_DATE_H, PURCH_NO_C, INCOTERMS1
  • ORDER_HEADER_INX: Checkboxes for changed fields (X = changed)
  • ORDER_ITEM_IN: ITM_NUMBER, REQ_QTY, PLANT — item-level changes
  • ORDER_ITEM_INX: Checkboxes for changed item fields
  • RETURN: Standard BAPI return — commit with BAPI_TRANSACTION_COMMIT

Delivery Creation from Sales Order

BAPI: BAPI_OUTB_DELIVERY_CREATE_SLS

  • SHIP_POINT: Shipping Point (VSTEL)
  • DUE_DATE: Requested delivery date (filters which order items are due)
  • SALES_ORDER_ITEMS: VBELN (Sales Order), POSNR (Item) — leave empty to process all due items
  • DELIVERY: Returns created delivery number
  • RETURN: Standard BAPI return — commit with BAPI_TRANSACTION_COMMIT

Billing Document Creation

BAPI: BAPI_BILLINGDOC_CREATEMULTIPLE

  • BILLINGDATAIN: REF_DOC (Delivery/Order number), REF_DOC_CA (Category: J=Delivery, C=Order), BILL_DATE
  • ERRORS: Error table — check before commit
  • SUCCESS: Returns created billing document numbers
  • Note: Commit individually per document via BAPI_TRANSACTION_COMMIT; batch processing supported

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

  • Working on sales order creation, modification, or analysis (VA01/VA02/VA03)
  • Processing deliveries, picking, or goods issue (VL01N/VL02N)
  • Creating or reviewing billing documents (VF01/VF02)
  • Analyzing pricing conditions, condition types, or rebate processing
  • Investigating order-to-cash (O2C) process gaps or document flow issues
  • Building reports or queries against SD tables (VBAK, VBAP, LIKP, VBRK)

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

  • abap-dev — ABAP development patterns and coding standards for SD custom programs
  • sap-fi — Financial Accounting integration via billing documents (VKOA account determination)
  • sap-le — Logistics Execution for delivery processing and shipping
  • post-write-chain — Post-write review and validation workflow
  • performance-tuning — Query optimization for large SD table datasets

04 同仓库更多 Skills

5throck
5throck/ai-workspace-standards

i18n-layout

Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.

★ 25
5throck
5throck/ai-workspace-standards

i18n-layout

Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.

★ 25
5throck
5throck/ai-workspace-standards

i18n-layout

Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.

★ 25
5throck
5throck/ai-workspace-standards

i18n-layout

Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.

★ 25
5throck
5throck/ai-workspace-standards

i18n-layout

Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.

★ 25
5throck
5throck/ai-workspace-standards

i18n-layout

Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.

★ 25