# Dyeing and Finishing Recipe Versioned Upload and Management Program

> A custom program that loads lab-approved dyeing and finishing recipes (dyestuffs, chemicals, concentrations, liquor ratio) into SAP as bills of material per colour, versioned with a change number. Every recipe change becomes a new dated version; production orders take the recipe valid on that day and the old recipe stays in the history.

- Type: Program, Custom development, Mass upload
- Module: PP
- Estimated effort: M (7–10 working days)
- Industry: Textile and Apparel
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/dyeing-and-finishing-recipe-versioned-upload-program/


## Why is the standard not enough?

CS01/CS02 maintain the bill of material manually, item by item; they do not convert concentrations (% on weight of fabric or g/l) into quantities for the base quantity and do not show the difference between the old and new recipe. Recipes from the lab therefore often stay outside SAP, and costing and stock consumption do not reflect reality. The program calculates the recipe and loads it with a difference list and a change number.

### Closest standard alternatives

- CS02: Changes the BOM manually; no concentration calculation and no difference upload from a file.
- CS01: Creates a new BOM item by item; no bulk transfer from the lab recipe.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| MAST | Material-to-BOM link; created with the first recipe | Read / write | - | ECC + S/4 |
| STKO | BOM header: alternative, base quantity, validity | Write | STKO-STLNR = MAST-STLNR AND STKO-STLAL = MAST-STLAL | ECC + S/4 |
| STPO | Recipe items: dyestuff and chemical quantities | Write | STPO-STLNR = STKO-STLNR | ECC + S/4 |
| AENR | Change number and validity date for versioning | Read | AENR-AENNR = parameter | ECC + S/4 |
| MKAL | Check that the production version points to the right alternative | Read | MKAL-MATNR = MAST-MATNR AND MKAL-WERKS = MAST-WERKS | ECC + S/4 |
| MARA | Component existence and deletion flag check | Read | MARA-MATNR = STPO-IDNRK | ECC + S/4 |

## BAPIs and functions used

- CSAP_MAT_BOM_CREATE: Creates the first BOM for a colour without a recipe
- CSAP_MAT_BOM_READ: Reads the valid recipe version for the difference list
- CSAP_MAT_BOM_MAINTAIN: Saves the new recipe version with the change number

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | Recipe file (XLSX or CSV) | Single value | - | Yes |
| P_WERKS | Plant | Single value | MAST-WERKS | Yes |
| P_STLAN | BOM usage | Single value | MAST-STLAN | Yes |
| P_AENNR | Change number | Single value | AENR-AENNR | Yes |
| P_TEST | Test mode (difference list only) | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Colour / product material | MAST-MATNR | Yes |
| Alternative | STKO-STLAL | No |
| Base quantity | STKO-BMENG | Yes |
| Base unit | STKO-BMEIN | Yes |
| Lab recipe no. | Recipe number from the lab system; written to the BOM header text | No |
| Component (dyestuff/chemical) | STPO-IDNRK | Yes |
| Concentration | Value in % on weight of fabric or g/l | No |
| Concentration type | OWF (% on weight of fabric) or GL (g/l) | No |
| Liquor ratio | Fabric to bath ratio, e.g. 1:8 | No |
| Component unit | STPO-MEINS | Yes |
| Valid from | AENR-DATUV | Yes |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| Material | MAST-MATNR |
| Alternative | STKO-STLAL |
| Component | STPO-IDNRK |
| Old quantity | Calculated: STPO-MENGE in the valid version |
| New quantity | STPO-MENGE |
| Change number | AENR-AENNR |
| Status | Calculated: Added, changed, unchanged, removed or error |
| Message | Calculated: Check or function return message |

## How does the program work?

1. The file exported from the lab or dye dispensing system is read: colour/product material, recipe number, dyestuffs and chemicals, concentration and its type (% on weight of fabric or g/l), liquor ratio.
2. Concentrations are converted into quantities for the BOM base quantity (e.g. 100 kg fabric): for % on weight of fabric, quantity = base × % / 100; for g/l, quantity = base × liquor ratio × g/l / 1000.
3. The components are checked to exist in MARA without a deletion flag; the change number given must be open and valid in AENR.
4. If the material has no BOM in MAST, CSAP_MAT_BOM_CREATE creates the first alternative. If it has one, CSAP_MAT_BOM_READ reads the valid version, a difference list (added, removed, changed components) is prepared and CSAP_MAT_BOM_MAINTAIN saves the new version under the change number with its validity date.
5. If colour variants are kept as separate alternatives (STKO-STLAL), the program checks that the related production version (MKAL) points to that alternative and warns if not.
6. In test mode only the difference list is shown; in a real run the result of every row is logged.

## Authorization objects

- C_STUE_WRK: BOM change authorization by plant
- C_STUE_BER: Authorization by BOM authorization group
- C_AENR_BGR: Authorization to use the change number

## Frequently asked questions

### What if the liquor ratio differs by machine?

The quantity of chemicals given in g/l depends on the liquor ratio. A separate alternative can be kept per machine group, or the g/l chemicals can be recalculated with the machine's liquor ratio and order quantity when the production order is created. The second option needs extra development and is estimated separately.

### Does it work for companies using PP-PI master recipes?

Yes. Components are still kept in the BOM and loaded the same way. If process parameters such as temperature and time should also be written to the master recipe, the scope grows; that part is assessed separately during setup.

### How can older versions of a recipe be seen?

Each version is dated by its change number, so the old recipe is displayed in CS03 by choosing the validity date. The program also offers a report mode that lists all recipe versions of a material in date order.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=pp-dyeing-finishing-recipe
