SD Program Custom development Interface Retail

Daily Transfer of Store POS and Retail Sales to SAP

Short answer: A custom interface that transfers the end-of-day sales of store tills into SAP. Sales are totalled per store, day and material and posted as goods issues from store stock, while turnover and payment types (cash, credit card, gift voucher) are posted to accounting; the till total and the amount posted in SAP are compared in a reconciliation list.

Estimated effort
L · 12–18 working days
System
ECC and S/4HANA
Tables
7
Scope
Global · 1 industries
Built by
NeKuDos Teknoloji
Last updated

Why is the standard not enough?

In the retail industry solution, POS sales are received with standard IDocs; systems without that solution have no ready inbound for till sales. Each store's daily sales are deducted from stock with MIGO/MB1A and posted to accounting manually with FB50, while entering them one by one as cash sales orders is not workable at high volume. The custom interface does this automatically every day and shows the differences.

Who uses it? Retail operations teams, store accounting, inventory control and finance teams.

Closest standard alternatives

  • MIGO Goods Movement. Deducts store sales from stock manually; no file import and no combined accounting posting.
  • FB50 G/L Account Posting (Single Screen). Posts turnover to accounting manually; no reconciliation with stock and till totals.

Tables used

The tables the program reads and updates. ECC and S/4HANA differences are marked separately.

TableRoleAccessSystem
T001WPlants/BranchesPlant representing the store, and its nameReadECC + S/4
T001LStorage LocationsStore storage locationReadECC + S/4
MEANInternational Article Numbers (EANs) for MaterialBarcode to material mappingReadECC + S/4
MARDStorage Location Data for MaterialStock check in the store locationReadECC + S/4
MSEGMaterial Document ItemGoods issue items for sales (ECC)WriteECC only
MATDOCMaterial Documents (S/4HANA)Goods issue items for sales (S/4HANA)WriteS/4HANA only
BKPFAccounting Document HeaderTurnover and collection accounting document; reference for the duplicate checkRead / writeECC + S/4

S/4HANA notes

  • MARD → MATDOC: In S/4HANA stock quantities are no longer stored physically; reading MARD returns values calculated on the fly from MATDOC through a compatibility view. Reads still work, but test performance on very large selections.
  • MSEG → MATDOC: In S/4HANA MATDOC replaces MSEG; reading MSEG works through a compatibility view but is slow at high volumes.

BAPIs and functions used

  • BAPI_GOODSMVT_CREATEPost Goods Movement. Posts the goods issue for sales from store stock
  • BAPI_ACC_DOCUMENT_POSTAccounting: Post Document. Posts turnover, VAT and payment types to accounting
  • BAPI_SALESORDER_CREATEFROMDAT2Create Sales Order. Optional: creates cash sales orders for SD statistics
  • BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Commits each store-day posting

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
P_PATHFolder of the end-of-day filesSingle value—Yes/interface/pos/gelen/
P_BUDATPosting date (blank = sales day)Single valueBKPF-BUDATNo—
P_BWARTSales movement typeSingle valueMSEG-BWARTYes251
P_SDORDAlso create cash sales ordersCheckbox—No—
P_TESTTest mode (check without posting)Checkbox—NoX

Input file columns

The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.

#ColumnTarget fieldRequired
1Store (plant)T001W-WERKSYes
2Storage locationT001L-LGORTNo
3Sales dateBKPF-BUDATYes
4BarcodeMEAN-EAN11Yes
5QuantityMSEG-MENGEYes
6Net amountBSEG-WRBTRYes
7Tax codeBSEG-MWSKZYes
8Payment typeBy rule POS payment type code; mapped to a G/L account during installationNo

Sample upload file

1Store (plant) *Storage locationSales date *Barcode *Quantity *Net amount *Tax code *Payment type
2M012000111/15/2026869000012345631,497K2KART
3M012000111/15/202686900006543211349.90K2NAKIT
4M015000111/15/20268690000777001-1-899K2KART
A view built with fictional sample data; not real system data.

Result list columns

#ColumnSource
1StoreT001W-WERKS
2Store nameT001W-NAME1
3Sales dayCalculated Sales date in the file
4Till turnoverCalculated Σ net amount in the file
5Turnover posted in SAPCalculated Σ revenue lines in the accounting document
6DifferenceCalculated Till turnover − turnover posted in SAP
7Goods issue documentMSEG-MBLNR
8Accounting documentBKPF-BELNR
9Failed rowsCalculated Number of rows not matched or not posted
10StatusCalculated Posted, difference, duplicate or error

Sample result list

StoreStore nameSales dayTill turnoverTurnover posted in SAPDifferenceGoods issue documentAccounting documentFailed rowsStatus
M012Örnek Market Kadıköy11/15/2026184,320.50184,320.500490081223301000451200Posted
M015Örnek Market Bornova11/15/202696,41095,511899490081223401000451211Difference
M018Demo Retail Nilüfer11/15/2026121,780.25121,780.250490081223501000451220Posted
M012Örnek Market Kadıköy11/15/2026184,320.500Duplicate
A view built with fictional sample data; not real system data.

How does the program work?

  1. Each store’s end-of-day file (or the single file of the central POS server) is read from a folder on the application server. The store code is mapped to plant and storage location (T001W, T001L), the POS article code or barcode to the material (MEAN).
  2. Checks: has the same store and day already been processed (document header reference store-date), is the barcode defined, does the material have stock in the store location (MARD). Unmatched rows go to an error file; the rest are processed.
  3. Rows are totalled per store, day and material; returns are kept separate. Turnover is also totalled by tax code and collections by payment type.
  4. Stock: a goods issue for sales (movement type 251, 252 for returns) is posted from the store location with BAPI_GOODSMVT_CREATE.
  5. Accounting: BAPI_ACC_DOCUMENT_POST credits revenue accounts by tax code and debits cash, card receivables and gift voucher accounts by payment type; the profit center is the store. If SD statistics are needed, the same totals can also be created as cash sales orders and invoices (BAPI_SALESORDER_CREATEFROMDAT2).
  6. The reconciliation list shows per store and day the till turnover, the turnover posted in SAP, the difference, and the goods issue and accounting document numbers.

Performance notes

Post store-day-material totals instead of receipt lines; this reduces the number of documents by orders of magnitude. Read the barcode mapping from MEAN once and buffer it. Split stores into parallel background jobs so that the run completes within the night window.

Features

  • Runs as a background job A nightly job processes the files of all stores and prepares the reconciliation list for the morning.
  • Test mode (check without posting)
  • Line-by-line result and error log
  • Download failed lines as a separate file Rows with an unknown barcode can be reprocessed after correction.
  • ALV list (sort, filter, subtotals)

Authorization objects

  • M_MSEG_BWAGoods movement posting authorization by movement type
  • M_MSEG_WMBGoods movement authorization by plant (store)
  • F_BKPF_BUKAccounting posting authorization by company code

Frequently asked questions

Are sales posted per receipt or in totals?

By default they are posted in totals per store, day and material; this is sufficient for stock and accounting and keeps the number of documents low. If receipt detail is needed, the file is archived and the reconciliation list can drill down to receipt lines.

What happens if a product with a barcode unknown in SAP is sold?

The row goes to the error file and the rest of the store-day is processed; the difference appears in the reconciliation list. Once the barcode is defined, only the failed rows are reprocessed.

Do we need this interface if we use the retail industry solution?

In that case the standard POS inbound IDocs are preferred. This interface is for core SAP systems running without the retail industry solution, which is common for manufacturers and wholesalers with their own stores.

Related reports

MM Report Standard ALV report

MB52 – List of Warehouse Stocks on Hand

MB52 is the standard SAP report (program RM07MLBS) that lists current material stocks per plant and storage location by stock type, together with …

MARD · MARA · MAKT · MBEW

SD Report Custom ALV report

Billing Documents Not Posted to Accounting Report

A custom ALV report that lists billing documents which exist in SD but have no accounting document yet, with the reason code, age and amount. At …

VBRK · VBRP · BKPF · KNA1

SD Program Custom Mass upload

Mass Sales Order Creation from Excel Program

A custom program that creates sales orders in bulk from the rows of an order file sent by the customer. It groups rows into orders by customer PO …

VBAK · VBAP · VBEP · VBKD

Let us build this program for your system

Briefly describe your system and expectations. We will clarify the scope and come back with an effort and price quote.

Related report: Daily Transfer of Store POS and Retail Sales to SAP