# BAPI_COSTCENTERGROUP_CREATE — Create Cost Center Group

> Creates a cost center group in a controlling area, with its hierarchy nodes and the cost center values assigned to them. Programs that load a cost center hierarchy from an external system use it instead of KSH1. Pass the nodes in hierarchy order in HIERARCHYNODES and the value ranges of each node in HIERARCHYVALUES, then check RETURN and call BAPI_TRANSACTION_COMMIT.

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

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| CONTROLLINGAREAIMP | BAPICO_GROUP-CO_AREA | Controlling area | Yes |
| TOPNODEONLY | BAPICO_GROUP-TOPNODEONLY | Top node only | - |
| LANGUAGE | BAPI0015_10 | Language for texts | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| CONTROLLINGAREA | BAPICO_GROUP-CO_AREA | Controlling area |
| GROUPNAME | BAPICO_GROUP-GROUPNAME | Name of the created group |
| RETURN | BAPIRET2 | Return message |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| HIERARCHYNODES | BAPISET_HIER | Hierarchy nodes | Yes |
| HIERARCHYVALUES | BAPI1112_VALUES | Hierarchy values | Yes |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_COSTCENTERGROUP_CREATE'
  EXPORTING
    controllingareaimp = lv_controllingareaimp
  IMPORTING
    controllingarea = lv_controllingarea
    groupname = lv_groupname
    return = lv_return
  TABLES
    hierarchynodes = lt_hierarchynodes
    hierarchyvalues = lt_hierarchyvalues.
```

## Related tables

SETHEADER, SETLEAF, SETNODE

