# BAPI_BATCH_CHANGE — Change Batch

> Changes the attributes of an existing batch, such as expiration date, vendor batch or next inspection date, like transaction MSC2N. It is used for mass updates of batch data from quality or warehouse systems. Mark every field you change in BATCHATTRIBUTESX, pass the plant if batches are plant-specific, 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-change/

## 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 | Yes |
| BATCHATTRIBUTESX | BAPIBATCHATTX | Change flags for batch attributes | Yes |
| BATCHCONTROLFIELDS | BAPIBATCHCTRL | Control parameters | - |
| INTERNALNUMBERCOM | BAPIBNCOM | Data for internal number assignment | - |
| EXTENSION1 | BAPIBNCOMZ | Customer data for number assignment | - |
| MATERIAL_LONG | BAPIBATCHKEY-MATERIAL_LONG | Material number (long) | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| BATCHATTRIBUTES | BAPIBATCHATT | Batch attributes after the change |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| RETURN | BAPIRET2 | Return messages | - |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_BATCH_CHANGE'
  EXPORTING
    material = lv_material
    batch = lv_batch
    batchattributes = lv_batchattributes
    batchattributesx = lv_batchattributesx
  IMPORTING
    batchattributes = lv_batchattributes
  TABLES
    return = lt_return.
```

## Related tables

MCH1, MCHA

