# BAPI_AR_ACC_GETOPENITEMS — Customer Account Open Items at Key Date

> Returns the items of a customer account that were open at a given key date, including items cleared later. It is used for aging reports, collection lists and customer self-service portals. Pass the customer number with leading zeros; SECINDEX lets the read use secondary indexes for large accounts.

- Modules: FI
- Type: BAPI
- Function group: 3007
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/bapi-ar-acc-getopenitems/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| COMPANYCODE | BAPI3007_1-COMP_CODE | Company code | Yes |
| CUSTOMER | BAPI3007_1-CUSTOMER | Customer | Yes |
| KEYDATE | BAPI3007-KEY_DATE | Key date | Yes |
| NOTEDITEMS | BAPI3007-NTDITMS_RQ | Include noted items | - |
| SECINDEX | BAPI3007-SINDEX_RQ | Use secondary index | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| RETURN | BAPIRETURN | Return message |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| LINEITEMS | BAPI3007_2 | Open line items | Yes |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_AR_ACC_GETOPENITEMS'
  EXPORTING
    companycode = lv_companycode
    customer = lv_customer
    keydate = lv_keydate
  IMPORTING
    return = lv_return
  TABLES
    lineitems = lt_lineitems.
```

## Related tables

BSAD, BSID

