# BAPI_ABSENCE_CREATE — Create Absence (Infotype 2001)

> Creates an absence record (infotype 2001) such as leave or sickness for a personnel number and period. Leave request and time recording interfaces use it to post approved absences. Lock the employee with BAPI_EMPLOYEE_ENQUEUE, check RETURN for collisions with existing records, and unlock afterwards.

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

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| EMPLOYEENUMBER | BAPIP2001-PERNR | Personnel number | Yes |
| VALIDITYBEGIN | BAPIP2001-BEGDA | Valid from | Yes |
| VALIDITYEND | BAPIP2001-ENDDA | Valid to | Yes |
| ABSENCETYPE | BAPIP2001-AWART | Absence type | Yes |
| START | BAPIP2001-BEGUZ | Start time | - |
| END | BAPIP2001-ENDUZ | End time | - |
| ABSENCEHOURS | BAPIP2001-STDAZ | Absence hours | - |
| NOCOMMIT | BAPI_STAND-NO_COMMIT | No commit (caller commits) | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| RETURN | BAPIRETURN1 | Return message |
| EMPLOYEENUMBER | BAPIP2001-PERNR | Personnel number |
| SUBTYPE | BAPIP2001-SUBTY | Subtype |
| OBJECTID | BAPIP2001-OBJPS | Object identification |
| LOCKINDICATOR | BAPIP2001-SPRPS | Lock indicator |
| VALIDITYBEGIN | BAPIP2001-BEGDA | Valid from |
| VALIDITYEND | BAPIP2001-ENDDA | Valid to |
| RECORDNUMBER | BAPIP2001-SEQNR | Record number |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_ABSENCE_CREATE'
  EXPORTING
    employeenumber = lv_employeenumber
    validitybegin = lv_validitybegin
    validityend = lv_validityend
    absencetype = lv_absencetype
  IMPORTING
    return = lv_return
    employeenumber = lv_employeenumber
    subtype = lv_subtype
    objectid = lv_objectid
    lockindicator = lv_lockindicator
    validitybegin = lv_validitybegin
    validityend = lv_validityend
    recordnumber = lv_recordnumber.
```

## Related tables

PA2001

