Procure-to-Pay (PTP) automated data generator that creates end-to-end P2P documents via JCo RFC: purchase requisition, purchase order, goods receipt, and invoice verification. This tool generates realistic SAP transaction data on S/4HANA IDES, similar to the OTC data generator.
hdbcli.
(see vault)(see vault)/Users/antonio.carbone/P2P/All vendors below have company code 1710 (LFB1) + purchasing org 1710 (LFM1), USD currency, not blocked.
Reconciliation account 0021100000 (AP domestic).
| Vendor | Name | Payment Terms | Notes |
|---|---|---|---|
0017300001 | Domestic US Supplier 1 | 0004 | Most info records, primary vendor |
0017300002 | Domestic US Supplier 2 | 0004 | Several info records |
0017300006 | Domestic US Supplier 6 (Returns) | 0004 | QM materials |
0017300010 | Domestic US Supplier 10 | 0004 | |
0017300080 | Domestic US Supplier (Ariba Network) | 0004 | |
0017300081 | Domestic US Supplier (Ariba Sourcing) | 0004 | |
0017300082 | Domestic US Supplier (Ariba Sourcing) | 0004 | |
0017300083 | Domestic US Supplier (Ariba Sourcing) | 0004 | |
0017300273 | Domestic US Supplier CPD | 0004 | |
EWM17-SU01 | (EWM Supplier) | 0004 | EWMS4 materials |
0017300003 (ERS),
0017300007 (subcontractor),
0017300031/50/51 (foreign currency EUR/CAD),
0017300015/16/17/19 (supplier financing/VCard),
0017300030/32/33/34 (withholding tax),
0017300090 (Ariba FIN),
0017300095/96 (commission/royalties).
All ROH (raw material) materials below have BESKZ='F' (external procurement), standard price
(VPRSV=S), and purchasing info records with vendor 0017300001 in purch org 1710.
| Material | Description | UoM | Std Price | Vendor Price | Purch Group |
|---|---|---|---|---|---|
RM12 | RAW12, Repetitive Manuf. | ST | $1.00 | $1.05 | 001 |
RM120 | RAW120, Quality Managed | ST | $1.25 | $1.31 | 002 |
RM15 | RAW15 | ST | $0.20 | $0.21 | 001 |
RM16 | RAW16 | ST | $0.25 | $0.24 | 001 |
R-302 | RAW302, PD | ST | $0.08 | $0.60 | 001 |
R-401 | RAW401, D1 | ST | $1.00 | $0.80 | 001 |
R-410 | RAW410, PD | ST | — | $1.00 | 001 |
R-411 | RAW411, PD | ST | — | $3.00 | 001 |
R-412 | RAW412, PD | ST | — | $2.00 | 001 |
MZ-RM-R100-01 | BKR-100 Frame | ST | $145.87 | — | Z90 |
MZ-RM-R100-02 | BKR-100 Handle Bars | ST | $2.86 | — | Z90 |
| Material | Description | UoM | Mov Avg Price | Vendor Price | Purch Group |
|---|---|---|---|---|---|
HB01 | Operating Supply 01 | ST | $51.00 | $60.00 | 002 |
Moving average price materials will have their MBEW.VERPR updated on GR/IR posting. This is normal SAP behavior but means the valuation price may shift over time.
ME23N → Environment → Document Flow to trace the complete chain.
Creates an internal request for procurement. Can be created manually, via MRP, or programmatically via BAPI. The PR triggers the purchasing workflow and may require release approval.
| Tcode | Purpose |
|---|---|
ME51N | Create Purchase Requisition |
ME52N | Change Purchase Requisition |
ME53N | Display Purchase Requisition |
| Function Module | Purpose |
|---|---|
BAPI_PR_CREATE | Create purchase requisition with items and account assignments |
BAPI_PR_CHANGE | Change existing purchase requisition |
BAPI_PR_GETDETAIL | Read purchase requisition details |
BAPI_TRANSACTION_COMMIT | Persist changes (WAIT='X') |
| Table | Description | Key Fields Written |
|---|---|---|
EBAN | Purchase Requisition | BANFN, BNFPO, BSART, MATNR, TXZ01, MENGE, MEINS, WERKS, LGORT, EKGRP, EKORG, AFNAM, LFDAT, PREIS, PEINH, WAERS |
EBKN | PR Account Assignment | BANFN, BNFPO, ZEBKN, SAKTO, KOSTL, AUFNR, PS_PSP_PNR, WRBTR |
| Config Table | Description |
|---|---|
T16FC | Release groups |
T16FD | Release codes (approval steps) |
T16FS | Release strategies |
T16FE | Release strategy assignment (characteristics) |
EBAN fields: FRGKZ (release indicator), FRGST (release status),
FRGRL (complete flag), FRGSX (release strategy).
Workflow template: WS20000075.
| PR Number | Item | Material | Qty | Vendor | Released | Status |
|---|---|---|---|---|---|---|
0010001494 | 00010 | R-302 | 97 ST | 0017300001 | FRGRL=X | OK |
BAPI: BAPI_PR_CREATE → BAPI_TRANSACTION_COMMIT (WAIT='X').
Header: PR_TYPE='NB' (standard).
Item fields: PREQ_ITEM, MATERIAL, PLANT, QUANTITY, UNIT, DELIV_DATE, PURCH_ORG, PUR_GROUP, PREQ_NAME, DES_VENDOR.
Note: Item structure is BAPIMEREQITEMIMP — uses DES_VENDOR (not VENDOR), no DOC_TYPE at item level.
Warning: 06/418 “Can delivery date be met?” — normal when using today's date (lead time ~15 days).
-- HANA SQL: Verify PR
SELECT BANFN, BNFPO, MATNR, MENGE, FRGRL, EBELN FROM EBAN WHERE BANFN = '0010001494';
Creates a purchase order (doc type NB = standard PO) with header, items, schedule lines,
and account assignments. Can reference a PR or be created directly.
| Tcode | Purpose |
|---|---|
ME21N | Create Purchase Order |
ME22N | Change Purchase Order |
ME23N | Display Purchase Order |
ME29N | Release Purchase Order |
ME28 | Mass Release POs |
ME59N | Automatic PO Generation from PRs |
| Function Module | Purpose |
|---|---|
BAPI_PO_CREATE1 | Create PO with header, items, schedule lines, account assignments |
BAPI_PO_CHANGE | Change existing PO |
BAPI_PO_GETDETAIL1 | Read PO details |
BAPI_PO_RELEASE | Release PO programmatically |
BAPI_TRANSACTION_COMMIT | Persist changes (WAIT='X') |
| Structure | Field | Value |
|---|---|---|
POHEADER | COMP_CODE | 1710 |
| DOC_TYPE | NB (Standard PO) | |
| VENDOR | Vendor number | |
| PURCH_ORG | Purchasing organization | |
| PUR_GROUP | Purchasing group | |
POHEADERX | COMP_CODE, DOC_TYPE, VENDOR, PURCH_ORG, PUR_GROUP | X (flags) |
POITEM | PO_ITEM, MATERIAL, PLANT, STGE_LOC, QUANTITY, PO_UNIT, NET_PRICE, PRICE_UNIT, TAX_CODE | Per item |
POSCHEDULE | PO_ITEM, SCHED_LINE, DELIVERY_DATE, QUANTITY | One schedule line per item |
POACCOUNT | PO_ITEM, SERIAL_NO, GL_ACCOUNT, COSTCENTER | For account-assigned items |
| Table | Description | Key Fields Written |
|---|---|---|
EKKO | PO Header | EBELN, BUKRS, BSTYP='F', BSART, LIFNR, EKORG, EKGRP, WAERS, BEDAT |
EKPO | PO Items | EBELN, EBELP, MATNR, TXZ01, MENGE, MEINS, NETPR, PEINH, WERKS, LGORT, MWSKZ |
EKET | Schedule Lines | EBELN, EBELP, ETENR, EINDT, MENGE |
EKKN | Account Assignment | EBELN, EBELP, ZEKKN, SAKTO, KOSTL, AUFNR |
PRCD_ELEMENTS | Pricing Conditions | KNUMV, KPOSN, KSCHL, KBETR, KWERT |
Same T16F* tables as PR. EKKO fields: FRGKE (release status), FRGSX
(strategy), FRGRL (complete). Release docs in EKAB.
Workflow template: WS20000076.
| PO Number | Item | Material | Qty | Net Price | From PR | Status |
|---|---|---|---|---|---|---|
4500001819 | 00010 | R-302 | 97 ST | 0.60 USD | 0010001494 | OK |
BAPI: BAPI_PO_CREATE1 → BAPI_TRANSACTION_COMMIT (WAIT='X').
Export field: EXPPURCHASEORDER (not PURCHASEORDER).
PR linkage: Set PREQ_NO and PREQ_ITEM in POITEM to link PO to PR. Verified EBAN.EBELN updated.
Warning: Price difference: info record price (0.60) vs material std price (0.08) — normal for IDES.
Posts a goods receipt against the purchase order (movement type 101).
Creates a material document and triggers accounting postings (stock debit / GR-IR clearing credit).
| Tcode | Purpose |
|---|---|
MIGO | Goods Movement (GR against PO, mvt type 101) |
| Function Module | Purpose |
|---|---|
BAPI_GOODSMVT_CREATE | Post goods movement (GR, GI, transfer posting) |
BAPI_TRANSACTION_COMMIT | Persist changes (WAIT='X') |
| Structure | Field | Value |
|---|---|---|
GOODSMVT_HEADER | PSTNG_DATE | Today (posting date) |
| DOC_DATE | Today (document date) | |
| REF_DOC_NO | PO number (cross-reference) | |
GOODSMVT_CODE | GM_CODE | 01 (GR for purchase order) |
GOODSMVT_ITEM | MATERIAL | Material number |
| PLANT | Plant | |
| STGE_LOC | Storage location | |
| MOVE_TYPE | 101 (GR against PO) | |
| ENTRY_QNT | Quantity received | |
| ENTRY_UOM | Unit of measure | |
| PO_NUMBER | PO number | |
| PO_ITEM | PO item number |
| Mvt Type | Description |
|---|---|
101 | GR against purchase order |
102 | GR reversal |
103 | GR to blocked stock |
105 | Release from blocked stock |
122 | Return to vendor |
161 | Return delivery |
| Table | Description | Key Fields Written |
|---|---|---|
MATDOC | Material Document (S/4HANA unified) | MBLNR, MJAHR, ZEESSION, BWART='101', MATNR, WERKS, LGORT, MENGE, EBELN, EBELP, SHKZG, BUDAT |
MKPF | Material Doc Header (compat view) | MBLNR, MJAHR, BUDAT, USNAM |
MSEG | Material Doc Items (compat view) | MBLNR, MJAHR, ZEILE, BWART, MATNR, MENGE |
EKBE | PO History (updated) | EBELN, EBELP, VGABE='1' (GR), BELNR, GJAHR |
MARD | Storage Location Stock (updated) | MATNR, WERKS, LGORT, LABST (increased) |
ACDOCA | Universal Journal | Stock account debit (BSX), GR/IR clearing credit (WRX) |
| Mat Doc | Year | PO | Material | Qty | Amount | EKBE.VGABE | Status |
|---|---|---|---|---|---|---|---|
5000002450 | 2026 | 4500001819 | R-302 | 97 ST | 58.20 USD | 1 (GR) | OK |
BAPI: BAPI_GOODSMVT_CREATE → BAPI_TRANSACTION_COMMIT.
GOODSMVT_CODE: is a structure (not string) — set gmCode.setValue("GM_CODE", "01").
MVT_IND: set to B (PO reference) on each item.
Material Ledger fix: Required inserting continuous CKMLHD + CKMLPP + CKMLCR records
(client 100, 2022/012 → 2026/012) for all P2P materials. Error C+/065 = missing CKMLHD,
C+/073 = missing period records. No gaps allowed in period chain.
Enters and verifies the vendor's invoice against the purchase order and goods receipt. Creates an invoice document (RBKP/RSEG) and corresponding accounting entries.
| Tcode | Purpose |
|---|---|
MIRO | Enter Incoming Invoice |
MIR4 | Display Invoice |
MIR7 | Park Invoice |
MIRA | FastEntry (background) |
MRBR | Release Blocked Invoices |
| Function Module | Purpose |
|---|---|
BAPI_INCOMINGINVOICE_CREATE | Post supplier invoice with PO reference |
BAPI_INCOMINGINVOICE_CHANGE | Change existing invoice |
BAPI_TRANSACTION_COMMIT | Persist changes (WAIT='X') |
| Structure | Field | Value |
|---|---|---|
HEADERDATA | INVOICE_IND | X (invoice, not credit memo) |
| DOC_TYPE | RE (incoming invoice) | |
| DOC_DATE | Invoice date | |
| PSTNG_DATE | Posting date | |
| COMP_CODE | 1710 | |
| CURRENCY | USD | |
| GROSS_AMOUNT | Invoice gross amount | |
| CALC_TAX_IND | X (calculate tax) | |
ITEMDATA | INVOICE_DOC_ITEM | Item number |
| PO_NUMBER | PO reference | |
| PO_ITEM | PO item | |
| TAX_CODE | Tax code | |
| ITEM_AMOUNT | Item net amount | |
| QUANTITY | Invoice quantity | |
| PO_UNIT | Unit of measure |
| Table | Description | Key Fields Written |
|---|---|---|
RBKP | Invoice Doc Header | BELNR, GJAHR, BLART, BLDAT, BUDAT, BUKRS, LIFNR, WAERS, RMWWR, WMWST1 |
RSEG | Invoice Doc Items | BELNR, GJAHR, BUZEI, EBELN, EBELP, MENGE, WRBTR, MWSKZ |
RBCO | Account Assignment | BELNR, GJAHR, BUZEI, SAKTO, KOSTL |
EKBE | PO History (updated) | EBELN, EBELP, VGABE='2' (IR), BELNR, GJAHR |
BKPF | Accounting Doc Header | BUKRS, BELNR, GJAHR, BLART, BUDAT (auto-created) |
ACDOCA | Universal Journal | GR/IR clearing debit, Vendor liability credit, Tax |
| Config Table | Description |
|---|---|
T169 | Tolerance keys (AN=amount, AP=amount/item, BD=qty, BW=%) |
T169P | Tolerance limits per company code |
Invoices exceeding tolerance are blocked (RBKP.ZLSPR). Release via MRBR.
Workflow template: WS20001000.
| Inv Doc | Year | PO | Gross Amount | Tax Code | EKBE.VGABE | Status |
|---|---|---|---|---|---|---|
5100001337 | 2026 | 4500001819 | 58.20 USD | I0 | 2 (IR) | OK |
BAPI: BAPI_INCOMINGINVOICE_CREATE → BAPI_TRANSACTION_COMMIT.
Export field: INVOICEDOCNUMBER, FISCALYEAR.
Tax code: Use I0 (A/P Sales Tax, exempt) for TAXUSJ procedure. V0 is invalid.
DIFF_INV: Set to vendor number (invoicing party).
REF_DOC_NO: External invoice reference (free text).
Pays the vendor by creating an outgoing payment document. Can be done manually (F-53) or via the Automatic Payment Program (F110). Debits the vendor account and credits the bank account.
| Tcode | Purpose |
|---|---|
F110 | Automatic Payment Program |
F-53 | Manual outgoing payment |
FBL1N | Vendor line items |
F.13 | Automatic clearing |
| Function Module | Purpose |
|---|---|
BAPI_ACC_DOCUMENT_POST | Post outgoing payment (GL credit + vendor debit) |
RFC_READ_TABLE | Read open vendor items (BSIK) for payment amount |
BAPI_TRANSACTION_COMMIT | Persist changes (WAIT='X') |
| Field | Value | Notes |
|---|---|---|
BUS_ACT | RFBU | Business transaction type |
USERNAME | IDES | Posting user |
COMP_CODE | 1710 | Company code |
DOC_TYPE | KZ | Vendor payment document type |
DOC_DATE | Today | Document date |
PSTNG_DATE | Today | Posting date |
REF_DOC_NO | Invoice doc number | Cross-reference |
HEADER_TXT | P2P Workflow Payment | Header text |
| Line | Table | Account | Amount | Details |
|---|---|---|---|---|
| 001 | ACCOUNTPAYABLE |
Vendor number | + (debit) | Clears the vendor open item from invoice |
| 002 | ACCOUNTGL |
Bank GL account | − (credit) | HOUSEBANKID, HOUSEBANKACCTID |
| Table | Description | Key Fields Written |
|---|---|---|
BKPF | Accounting Document Header | BUKRS, BELNR, GJAHR, BLART='KZ' |
ACDOCA | Universal Journal | Vendor debit + Bank credit |
BSAK | Cleared Vendor Items (index) | Vendor payment clearing |
REGUH | Payment Data (settlement) | LAUFD, LAUFI, LIFNR, VBLNR, RBETR (F110 only) |
REGUP | Payment Items | LAUFD, LAUFI, BUKRS, BELNR, GJAHR (F110 only) |
PAYR | Payment Medium | Check/wire details (F110 only) |
0017300001 has LFB1.ZWELS = CDIP,
meaning only payment methods C (Check), D (ACH CCD),
I (ISO PAIN.001), P (ACH PPD) are allowed.
Method T (ACH CTX) is not in the vendor master — F110 will reject it.
| Method | Description | T042Z | T042E (1710) | Vendor LFB1 |
|---|---|---|---|---|
C | Check | Yes | Yes | Yes |
D | Bank transfer (ACH CCD) | Yes | Yes | Yes |
I | ISO PAIN.001 Credit Transfer | Yes | Yes | Yes |
P | Bank transfer (ACH PPD) | Yes | Yes | Yes |
T | Bank transfer (ACH CTX) | Yes | Yes | No |
House bank: USBK1 / Account 0001 (T012K, company 1710).
Doc type: All methods use BLART = ZP (payment document).
Recommended for production-like testing. Use payment method D and filter to specific invoices.
| # | Action | Details |
|---|---|---|
| 1 | Open F110 | Automatic Payment Transactions |
| 2 | Fill Header | Run Date: today (e.g. 09.04.2026), Identification: unique ID (e.g. P2P2) |
| 3 | Fill Parameter tab |
Company Code: 1710Payment methods: D (ACH CCD) — must be in vendor's LFB1.ZWELSNext payment date: today or future Vendor: 0017300001 to 0017300001
|
| 4 | Fill Free Selection tab |
Add field BELNR (document number)Values: 5100001337 to 5100001338This restricts F110 to only the P2P invoices, excluding old IDES open items. |
| 5 | Run Proposal | Click Proposal → Start immediately. Wait for completion, then check Proposal log. Invoices should appear as payable items. |
| 6 | Run Payment | Click Payment run → Start immediately. Check Payment log for payment document number. |
| 7 | Verify | FBL1N: vendor 0017300001, company 1710 — invoices should show as cleared. |
Simpler, single-invoice payment. Avoids the old open items problem entirely.
| # | Action | Details |
|---|---|---|
| 1 | Open F-53 | Post Outgoing Payment |
| 2 | Fill header fields |
Document Date: today Company Code: 1710Currency: USDBank Account (G/L): look up via T012K → HKONT for HBKID= USBK1, HKTID=0001Amount: 58.20 or 31.80 (matching the invoice)Vendor: 0017300001
|
| 3 | Process Open Items | Press Process Open Items — all open invoices appear. Double-click only the P2P invoice to select it (deselect everything else). |
| 4 | Post | Click Post (Ctrl+S). Note the payment document number. |
| Requirement | Config Location | IDES 1710 Value |
|---|---|---|
| House bank configured | T012 (house bank), T012K (account) | HBKID=USBK1, HKTID=0001 |
| Payment method on vendor | LFB1.ZWELS | CDIP — use C or D in F110 |
| Payment method per company | T042E (ZBUKR + ZLSCH) | C, D, I, P, T all configured |
| Payment method definition | T042Z (LAND1 + ZLSCH) | Country US, all methods BLART=ZP |
| Bank G/L account | T012K.HKONT | Check via SELECT HKONT FROM T012K WHERE BUKRS='1710' |
-- Vendor open items (before payment)
SELECT BUKRS, BELNR, GJAHR, BUZEI, DMBTR, ZLSCH FROM BSIK
WHERE LIFNR = '0017300001' AND BUKRS = '1710' AND GJAHR = '2026';
-- Vendor cleared items (after payment)
SELECT BUKRS, BELNR, GJAHR, AUGBL, AUGDT FROM BSAK
WHERE LIFNR = '0017300001' AND BUKRS = '1710' AND GJAHR = '2026';
-- Payment run details (F110 only)
SELECT LAUFD, LAUFI, LIFNR, VBLNR, RBETR FROM REGUH
WHERE LIFNR = '0017300001' AND ZBUKR = '1710';
Clears the GR/IR clearing account (differences between goods receipt and invoice receipt amounts). This is a periodic maintenance step, not part of the individual transaction flow.
| Tcode | Purpose |
|---|---|
MR11 | GR/IR Account Maintenance (maintain clearing account) |
F.13 | Automatic Clearing |
| Table | Description | Category | Populated By |
|---|---|---|---|
EBAN | Purchase Requisition Items | PR | Step 1 |
EBKN | PR Account Assignment | PR | Step 1 |
EKKO | Purchasing Document Header | PO Header | Step 2 |
EKPO | Purchasing Document Item | PO Items | Step 2 |
EKET | Schedule Lines | PO Schedule | Step 2 |
EKKN | Account Assignment | PO Acct Assgmt | Step 2 |
EKBE | PO History (GR, IR, etc.) | PO History | Steps 3, 4 |
EKAB | PO Release Documentation | PO Release | Step 2 |
EKPA | Partner Functions in Purchasing | PO Partners | Step 2 |
PRCD_ELEMENTS | Pricing Conditions (S/4HANA) | Pricing | Step 2 |
EINA | Purchasing Info Record (General) | Master Data | Config |
EINE | Purchasing Info Record (Purch Org) | Master Data | Config |
EORD | Source List | Master Data | Config |
| Table | Description | Category | Populated By |
|---|---|---|---|
MATDOC | Material Document (S/4HANA unified) | Mat. Document | Step 3 |
MKPF | Material Doc Header (compat view) | Mat. Doc Header | Step 3 |
MSEG | Material Doc Items (compat view) | Mat. Doc Items | Step 3 |
MARD | Storage Location Stock | Stock Levels | Step 3 (updated) |
MBEW | Material Valuation | Valuation | Step 3 (updated) |
| Table | Description | Category | Populated By |
|---|---|---|---|
RBKP | Invoice Document Header | Invoice Header | Step 4 |
RSEG | Invoice Document Items | Invoice Items | Step 4 |
RBCO | Invoice Account Assignment | Invoice Acct | Step 4 |
RBWS | Tax Data per Invoice Item | Invoice Tax | Step 4 |
| Table | Description | Category | Populated By |
|---|---|---|---|
ACDOCA | Universal Journal Entry (S/4HANA) | Universal Journal | Steps 3, 4, 5 |
BKPF | Accounting Document Header | FI Doc Header | Steps 4, 5 |
BSEG | Accounting Document Segment (compat view) | FI Doc Items | Steps 4, 5 |
BSIK | Open Vendor Items (secondary index) | AP Open Items | Step 4 |
BSAK | Cleared Vendor Items (secondary index) | AP Cleared Items | Step 5 |
| Table | Description | Category | Populated By |
|---|---|---|---|
REGUH | Payment Data (Settlement) | Payment Header | Step 5 (F110) |
REGUP | Payment Items | Payment Items | Step 5 (F110) |
PAYR | Payment Medium (Check/Wire) | Payment Medium | Step 5 (F110) |
| Table | Description | Category |
|---|---|---|
BUT000 | Business Partner General (S/4HANA primary) | BP General |
BUT020 | BP Addresses | BP Addresses |
BUT100 | BP Roles (FLVN01 = supplier) | BP Roles |
LFA1 | Vendor General Data (synced via CVI) | Vendor General |
LFB1 | Vendor Company Code Data | Vendor CoCode |
LFM1 | Vendor Purchasing Org Data | Vendor PurchOrg |
LFBK | Vendor Bank Details | Vendor Bank |
| Table | Description | Category |
|---|---|---|
MARA | Material General Data | General |
MARC | Material Plant Data (MRP, Purchasing) | Plant |
MARD | Storage Location Stock | Stock |
MAKT | Material Descriptions | Texts |
MBEW | Material Valuation | Valuation |
MARM | Material Units of Measure | UoM |
| Table | Description | Purpose |
|---|---|---|
T001 | Company Codes | Company code 1710 |
T001K | Valuation Area | Plant-to-company code assignment |
T001W | Plants | Plant definitions |
T001L | Storage Locations | Storage location definitions |
T024E | Purchasing Organizations | Purch org definitions |
T024 | Purchasing Groups | Buyer group definitions |
T030 | Account Determination (OBYC) | BSX, WRX, GBB, PRD transaction keys |
T161 | Purchasing Document Types | NB=standard PO, etc. |
T169/T169P | Tolerance Keys / Limits | Invoice verification tolerances |
T16FC/FD/FS/FE | Release Strategy Config | PR and PO approval workflow |
T042/T042Z | Payment Methods | Payment method configuration |
T052 | Payment Terms | Due dates, discounts |
MARV | MM Posting Period | Current posting period (LFMON/LFGJA) |
CKMLPP/CKMLCR | ML Period/Currency Records | Material Ledger period data |
| Transaction Key | Account Type | Posting |
|---|---|---|
BSX | Stock account | GR debit (stock increase) |
WRX | GR/IR clearing account | GR credit / IR debit |
GBB | Offsetting entry | Cost of goods consumed |
PRD | Price difference account | Standard price variance |
KDM | Exchange rate difference | FX differences on invoice |
| Area | ECC Tables | S/4HANA Table | Notes |
|---|---|---|---|
| Material Documents | MKPF + MSEG | MATDOC | Single unified table |
| Accounting | BSEG + FAGLFLEXA + COEP | ACDOCA | Universal Journal |
| Pricing | KONV | PRCD_ELEMENTS | Pricing in documents |
| Stock | MCHB, MSKA, MSSL, etc. | MARD + MATDOC | Consolidated |
| Vendor Master | LFA1 (standalone) | BUT000 (BP) + CVI | BP mandatory |
| Material Ledger | Optional | Always active | ML infrastructure mandatory |
| CDS View | Description | Base Tables |
|---|---|---|
I_PurchaseRequisition | PR header composite | EBAN |
I_PurchaseRequisitionItem | PR item with all fields | EBAN |
I_PurReqnAcctAssgmt | PR account assignment | EBKN |
I_PurReqnItemPurOrdRef | PR item to PO reference | EBAN |
C_PurchaseReqnHeader | Consumption: Manage PRs | EBAN |
C_Purreqnreleasestatus | Consumption: PR release overview | EBAN |
| CDS View | Description | Base Tables |
|---|---|---|
I_PurchaseOrder | PO header | EKKO |
I_PurchaseOrderAPI01 | PO header (API) | EKKO |
I_PurchaseOrderItem | PO item | EKPO |
I_PurchaseOrderItemAPI01 | PO item (API) | EKPO |
I_PurchaseOrderScheduleLine | PO schedule line | EKET |
I_PurchaseOrderHistory | PO history (GR, IR) | EKBE |
I_PurchaseOrderItemAccountAssignment | PO account assignment | EKKN |
I_PurchaseOrderPricingElement | PO pricing conditions | PRCD_ELEMENTS |
I_PurchaseOrderPartner | PO partner functions | EKPA |
I_PurOrdReleaseStatus | PO release status | EKKO |
C_PurchaseOrderHeader | Consumption: Manage POs | EKKO |
C_PurchaseOrderItem | Consumption: PO items | EKPO |
C_PORelOverviewPage | Consumption: PO release overview | EKKO |
| CDS View | Description | Base Tables |
|---|---|---|
I_MaterialDocumentHeader_2 | Material doc header | MATDOC |
I_MaterialDocumentItem_2 | Material doc item | MATDOC |
I_GoodsMovementItem | Goods movement item | MATDOC |
I_MaterialStock | Material stock overview | MARD |
C_MaterialDocumentItem | Consumption: Mat doc items | MATDOC |
C_GoodsReceiptForPurOrd | Consumption: GR for PO | MATDOC, EKPO |
| CDS View | Description | Base Tables |
|---|---|---|
I_SupplierInvoice | Invoice header | RBKP |
I_SupplierInvoiceAPI01 | Invoice header (API) | RBKP |
I_SupplierInvoiceItem | Invoice item | RSEG |
I_SupplierInvoiceItemPurOrdRef | Invoice to PO reference | RSEG |
I_SupplierInvoiceItemAcctAssgmt | Invoice account assignment | RBCO |
I_SupplierInvoiceTax | Invoice tax data | RBWS |
C_SupplierInvoiceHeader | Consumption: Manage invoices | RBKP |
C_SuplrInvcItemBlkd | Consumption: Blocked invoices | RBKP |
| CDS View | Description | Base Tables |
|---|---|---|
I_JournalEntry | Accounting doc header | ACDOCA, BKPF |
I_JournalEntryItem | Accounting line item | ACDOCA |
I_OperationalAcctgDocItem | Operational accounting | ACDOCA |
I_GLAccountLineItem | G/L line items | ACDOCA |
I_VendorLineItem | Vendor line items | ACDOCA |
I_VendorOpenItem | Vendor open items | ACDOCA |
I_VendorClearedItem | Vendor cleared items | ACDOCA |
I_APAccountBalance | Accounts payable balance | ACDOCA |
I_PaymentProposal | Payment proposal | REGUH |
I_PaymentRun | Payment run | REGUH |
C_APOpenItems | Consumption: AP open items | ACDOCA |
| CDS View | Description | Base Tables |
|---|---|---|
I_Supplier | Supplier general data | LFA1, BUT000 |
I_SupplierCompany | Supplier company code data | LFB1 |
I_SupplierPurchasingOrg | Supplier purchasing org data | LFM1 |
I_SupplierBankAccount | Supplier bank details | LFBK |
I_BusinessPartner | Business Partner general | BUT000 |
I_Product | Product/material general | MARA |
I_ProductPlantBasic | Product plant data | MARC |
I_ProductPlantProcurement | Product procurement data | MARC |
I_ProductValuation | Product valuation | MBEW |
I_PurchasingInfoRecord | Info record general | EINA |
I_PurchasingInfoRecordOrgData | Info record purch org | EINE |
I_SourceOfSupply | Source of supply | EORD |
| Service | Purpose |
|---|---|
API_PURCHASEREQ_PROCESS_SRV | Purchase Requisition CRUD |
API_PURCHASEORDER_PROCESS_SRV | Purchase Order CRUD |
API_MATERIAL_DOCUMENT_SRV | Goods Movements |
API_SUPPLIERINVOICE_PROCESS_SRV | Invoice Verification |
API_BUSINESS_PARTNER | BP/Vendor Master CRUD |
| Step | Function Module | Type | Purpose |
|---|---|---|---|
| 1 | BAPI_PR_CREATE | BAPI | Create purchase requisition |
| 1 | BAPI_PR_CHANGE | BAPI | Change purchase requisition |
| 2 | BAPI_PO_CREATE1 | BAPI | Create purchase order with header, items, schedules, accounts |
| 2 | BAPI_PO_CHANGE | BAPI | Change existing purchase order |
| 2 | BAPI_PO_RELEASE | BAPI | Release purchase order |
| 3 | BAPI_GOODSMVT_CREATE | BAPI | Post goods receipt (mvt type 101 against PO) |
| 4 | BAPI_INCOMINGINVOICE_CREATE | BAPI | Post supplier invoice with PO reference |
| 5 | BAPI_ACC_DOCUMENT_POST | BAPI | Post outgoing payment (vendor debit + bank credit) |
| 5 | RFC_READ_TABLE | RFC | Read open vendor items for payment amount |
| * | BAPI_TRANSACTION_COMMIT | BAPI | Commit transaction (WAIT='X') — after every step |
Direct HANA SQL access is available for configuration changes, debugging, and ad-hoc queries. Requires an SSH tunnel since HANA is not exposed publicly. Same connection as the OTC workflow.
# Start the tunnel (runs in background, idempotent)
ssh -f -N -L 30015:127.0.0.1:30015 root@sapidess4
# Using the shared hana_sql.py tool python3 /tmp/sap-otc-workflow/hana_sql.py "SELECT * FROM EBAN WHERE BANFN='0010000001'" # Interactive SQL prompt python3 /tmp/sap-otc-workflow/hana_sql.py interactive
# Check purchasing organizations python3 /tmp/sap-otc-workflow/hana_sql.py "SELECT EKORG,EKOTX,BUKRS FROM T024E WHERE BUKRS='1710'" # Check purchasing groups python3 /tmp/sap-otc-workflow/hana_sql.py "SELECT EKGRP,EKNAM FROM T024" # Check vendors for company code 1710 python3 /tmp/sap-otc-workflow/hana_sql.py "SELECT LIFNR,AKONT,ZTERM FROM LFB1 WHERE BUKRS='1710'" # Check PO history python3 /tmp/sap-otc-workflow/hana_sql.py "SELECT EBELN,EBELP,VGABE,BELNR,GJAHR FROM EKBE WHERE EBELN='4500000001'" # Check MM posting period python3 /tmp/sap-otc-workflow/hana_sql.py "SELECT BUKRS,LFMON,LFGJA FROM MARV WHERE BUKRS='1710'" # Check open vendor items python3 /tmp/sap-otc-workflow/hana_sql.py "SELECT BUKRS,LIFNR,BELNR,GJAHR,DMBTR,SHKZG FROM BSIK WHERE BUKRS='1710' AND LIFNR='0000100000'" # Check GR/IR clearing account balance python3 /tmp/sap-otc-workflow/hana_sql.py "SELECT RACCT,SUM(HSL) FROM ACDOCA WHERE RBUKRS='1710' AND RACCT='0021100000' GROUP BY RACCT"
| Parameter | Value | Notes |
|---|---|---|
| Host | localhost | Via SSH tunnel |
| Port | 30015 | HANA indexserver (instance 00) |
| Tenant DB | FIV | S/4HANA data lives here |
| Schema | SAPHANADB | All SAP tables |
| User | SAPHANADB | Schema owner, full read/write access |
| Password | (see vault) | Lifetime disabled, no expiry |
/$SYNC or /$TAB)
to take effect in the application layer.
Located at /Users/antonio.carbone/P2P/SAPP2PWorkflow.java. Uses JCo RFC to drive the P2P process.
cd /Users/antonio.carbone/P2P
javac -cp .:../SAPjco/sapjco3.jar SAPP2PWorkflow.java| Script | Purpose |
|---|---|
./ptpgen.sh <count> [stage] | Bulk data generator — create N cycles stopping at chosen stage |
./ptpwf.sh <command> [args] | Passthrough wrapper to SAPP2PWorkflow |
./ptpgen.sh 1 # 1 full cycle (PR→PO→GR→INV)
./ptpgen.sh 10 po # 10x PR→PO only
./ptpgen.sh 100 gr # 100x PR→PO→GR
./ptpgen.sh 100 ir # 100x full pipeline
./ptpgen.sh 10 gr --items 3 --verbose# Individual steps
./ptpwf.sh step1-pr 1 --verbose
./ptpwf.sh step2-po <prNumber>
./ptpwf.sh step3-gr <poNumber>
./ptpwf.sh step4-ir <poNumber>
# Full cycle with stage control
./ptpwf.sh full 10 --stop-at gr --items 3
# Check document status
./ptpwf.sh status <docNumber>| Flag | Description |
|---|---|
--verbose | Print BAPI details and all return messages |
--dry-run | Validate only (no BAPI_TRANSACTION_COMMIT) |
--items N | Max items per document (default: 2) |
--stop-at STAGE | Stop after stage: pr, po, gr, ir (default: ir) |
--pause N | Seconds between steps (default: 3) |
Individual step testing, then full end-to-end cycle.
| Run | PR | PO | GR (MatDoc) | Invoice | Amount | Status |
|---|---|---|---|---|---|---|
| Individual | 0010001494 | 4500001819 |
5000002450 | 5100001337 |
58.20 USD | 4/4 OK |
| Full cycle | 0010001495 | 4500001820 |
5000002451 | 5100001338 |
31.80 USD | 4/4 OK |
2/2 cycles — 100% success rate across Steps 1-4. Step 5 (Payment) via F110 in SAP GUI.
| Error | Cause | Fix |
|---|---|---|
DOC_TYPE is not a member of BAPIMEREQITEMIMP |
BAPI_PR_CREATE item structure has no DOC_TYPE field | Set PR_TYPE in PRHEADER only; use DES_VENDOR for vendor at item level |
06/418 Can delivery date be met? |
Requested delivery date is within lead time window | Warning only — PR/PO is still created. Use future date (+15 days) to avoid |
PURCHASEORDER not in OUTPUT |
BAPI_PO_CREATE1 export field name is different | Use EXPPURCHASEORDER (not PURCHASEORDER) |
GOODSMVT_CODE conversion error |
GOODSMVT_CODE is a structure, not a string | Use getStructure("GOODSMVT_CODE").setValue("GM_CODE", "01") |
C+/065 Error reading ML header |
No CKMLHD record for client 100 (only client 400 exists) | Insert CKMLHD with MANDT='100' for each material's KALN1 from MBEW |
C+/073 Error reading ML period |
Gap in CKMLPP period records (e.g. 2022/011 → 2026/004) | Insert continuous CKMLPP + CKMLCR (CURTP 10+30) for all missing months. STATUS='10' for closed, '01' for open |
FICORE/704 Tax code V0 invalid |
V0 does not exist in TAXUSJ (US tax procedure) | Use I0 (A/P Sales Tax, exempt) for tax-free invoices |
F110 “Pmnt method T should not be considered” |
Vendor LFB1.ZWELS = CDIP — method T not in vendor master |
Use method D (ACH CCD) or C (Check) in F110 Parameter tab |
F110 “doc.balance not zero” |
~150 old IDES open items (2019–2022) summed with P2P invoices | Use Free Selection tab to filter by BELNR, or use F-53 for manual payment |