# BAPI_BATCH_CREATE — Create Batch

> Creates a batch master record for a material, optionally at plant level and with batch attributes such as production date and shelf-life expiration date, like transaction MSC1N. It is used in interfaces from production or quality systems and in batch migration. Leave BATCH empty to get an internally assigned number, check RETURN and call BAPI_TRANSACTION_COMMIT; classification values are maintained separately, for example with BAPI_OBJCL_CHANGE.

- 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-create/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| MATERIAL | BAPIBATCHKEY-MATERIAL | Material number | Yes |
| BATCH | BAPIBATCHKEY-BATCH | Batch number (empty = internal number) | - |
| PLANT | BAPIBATCHKEY-PLANT | Plant | - |
| BATCHATTRIBUTES | BAPIBATCHATT | Batch attributes | - |
| 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) | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| BATCH | BAPIBATCHKEY-BATCH | Created batch number |
| BATCHATTRIBUTES | BAPIBATCHATT | Batch attributes after creation |

## Tables parameters

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

## Call template (ABAP)

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

## Related tables

MCH1, MCHA

