# BAPI_ROUTING_CREATE — Create Routing

> Creates a routing with header, material assignment, sequences, operations, component assignments, PRTs and inspection characteristics in one call. It is used in master data migration and in uploads from engineering or PLM systems. Run it first with TESTRUN, link operations to the header through the task list keys, and commit only if RETURN contains no E message.

- Modules: PP
- Type: BAPI
- Function group: CPCC_BUS1012
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/bapi-routing-create/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| TESTRUN | BAPIFLAG | Test run (no update) | - |
| PROFILE | BAPI1012_CONTROL_DATA-PROFILE | Profile | - |
| BOMUSAGE | BAPI1012_CONTROL_DATA-BOM_USAGE | BOM usage | - |
| APPLICATION | BAPI1012_CONTROL_DATA-APPLICATION | BOM application | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| GROUP | BAPI1012_TSK_C-TASK_LIST_GROUP | Task list group |
| GROUPCOUNTER | BAPI1012_TSK_C-GROUP_COUNTER | Group counter |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| TASK | BAPI1012_TSK_C | Task list header | Yes |
| MATERIALTASKALLOCATION | BAPI1012_MTK_C | Material assignment | - |
| SEQUENCE | BAPI1012_SEQ_C | Sequences | - |
| OPERATION | BAPI1012_OPR_C | Operations | - |
| SUBOPERATION | BAPI1012_SUB_OPR_C | Suboperations | - |
| COMPONENTALLOCATION | BAPI1012_COM_C | Component assignments | - |
| PRODUCTIONRESOURCE | BAPI1012_PRT_C | Production resource/tool assignments | - |
| INSPCHARACTERISTIC | BAPI1012_CHA_C | Inspection characteristics | - |
| TEXT | BAPI1012_TXT_C | Long text lines | - |
| RETURN | BAPIRET2 | Return messages | - |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_ROUTING_CREATE'
  IMPORTING
    group = lv_group
    groupcounter = lv_groupcounter
  TABLES
    task = lt_task
    materialtaskallocation = lt_materialtaskallocation
    sequence = lt_sequence
    operation = lt_operation
    suboperation = lt_suboperation
    componentallocation = lt_componentallocation
    productionresource = lt_productionresource
    inspcharacteristic = lt_inspcharacteristic
    text = lt_text
    return = lt_return.
```

## Related tables

MAPL, PLAS, PLFL, PLKO, PLPO

