# BAPI_CUSTOMER_CREATEFROMDATA1 — Create Customer from Reference (Online Store)

> Creates a customer by copying a reference customer and sales area and adding personal or company data; SAP designed it for online store scenarios. It suits simple B2C registrations rather than full customer master migrations. In S/4HANA customers are maintained as business partners, so prefer the business partner APIs there; check RETURN and commit afterwards.

- Modules: SD
- Type: BAPI
- Function group: V02D
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/bapi-customer-createfromdata1/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| PI_PERSONALDATA | BAPIKNA101_1 | Personal data of the customer | Yes |
| PI_OPT_PERSONALDATA | BAPIKNA105 | Optional personal data | - |
| PI_COMPANYDATA | BAPIKNA106 | Company (organization) data | - |
| PI_OPT_COMPANYDATA | BAPIKNA105 | Optional company data | - |
| PI_CONSUMEREN | BAPIKNA107-CONSUMER_FLAG | Consumer flag | - |
| PI_COPYREFERENCE | BAPIKNA102 | Reference customer and sales area to copy from | Yes |
| PI_CREDIT_CONTROL_FLAG | BAPIKNA108-X_FLAG | Credit control flag | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| CUSTOMERNO | BAPIKNA103-CUSTOMER | Customer number created |
| RETURN | BAPIRETURN1 | Return messages |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_CUSTOMER_CREATEFROMDATA1'
  EXPORTING
    pi_personaldata = lv_pi_personaldata
    pi_copyreference = lv_pi_copyreference
  IMPORTING
    customerno = lv_customerno
    return = lv_return.
```

## Related tables

KNA1, KNB1, KNVV

