# BAPI_BATCH_SAVE_REPLICA — Save Batch Replica (Create or Change)

> Creates or changes a batch including its status and classification in one call; it is the inbound BAPI used for distributing batches between systems (ALE message type BATMAS). Developers use it when a batch must be replicated with the same number and characteristic values, for example from a central system. Fill the …X flag structures for the fields you pass, provide classification in the CLASSVALUATIONS tables, check RETURN and call BAPI_TRANSACTION_COMMIT.

- Modules: CA
- Type: BAPI
- Function group: VBWB
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/bapi-batch-save-replica/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| MATERIAL | BAPIBATCHKEY-MATERIAL | Material number | Yes |
| BATCH | BAPIBATCHKEY-BATCH | Batch number | Yes |
| PLANT | BAPIBATCHKEY-PLANT | Plant | - |
| BATCHATTRIBUTES | BAPIBATCHATT | Batch attributes | - |
| BATCHATTRIBUTESX | BAPIBATCHATTX | Change flags for batch attributes | - |
| BATCHSTATUS | BAPIBATCHSTATUS | Batch status | - |
| BATCHSTATUSX | BAPIBATCHSTATUSX | Change flags for batch status | - |
| BATCHCONTROLFIELDS | BAPIBATCHCTRL | Control parameters | - |
| BATCHSTORAGELOCATION | BAPIBATCHSTOLOC-STGE_LOC | Storage location | - |
| INTERNALNUMBERCOM | BAPIBNCOM | Data for internal number assignment | - |
| EXTENSION1 | BAPIBNCOMZ | Customer data for number assignment | - |
| MATERIAL_LONG | BAPIBATCHKEY-MATERIAL_LONG | Material number (long) | - |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| CLASSALLOCATIONS | BAPI3060_ALLOCATION | Class assignments | - |
| CLASSVALUATIONSNUM | BAPI3060_VALUATION_NUM | Numeric characteristic values | - |
| CLASSVALUATIONSCHAR | BAPI3060_VALUATION_CHAR | Character characteristic values | - |
| CLASSVALUATIONSCURR | BAPI3060_VALUATION_CURR | Currency characteristic values | - |
| RETURN | BAPIRET2 | Return messages | - |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_BATCH_SAVE_REPLICA'
  EXPORTING
    material = lv_material
    batch = lv_batch
  TABLES
    classallocations = lt_classallocations
    classvaluationsnum = lt_classvaluationsnum
    classvaluationschar = lt_classvaluationschar
    classvaluationscurr = lt_classvaluationscurr
    return = lt_return.
```

## Related tables

AUSP, MCH1, MCHA

