# L_TO_CANCEL — Cancel Transfer Order

> Cancels open items of a transfer order, like LT15, either all open items or the items listed in T_LTAP_CANCL. It is used in RF and interface programs when a warehouse task is no longer needed. Confirmed items cannot be cancelled; the function then raises TO_CONFIRMED or ITEM_CONFIRMED.

- Modules: WM
- Type: Function module
- Function group: L03B
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/l-to-cancel/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| I_LGNUM | LTAK-LGNUM | Warehouse number | Yes |
| I_TANUM | LTAK-TANUM | Transfer order number | Yes |
| I_SOLEX | LTAK-SOLEX | Planned processing time from external system | - |
| I_CANCL | RL03B-CANCL | Cancel all open items | - |
| I_SUBST | RL03T-SUBST | Include subsystem items | - |
| I_QNAME | LTAP-QNAME | User performing the cancellation | - |
| I_UPDATE_TASK | RL03A-VERBU | Update via update task | - |
| I_COMMIT_WORK | RL03B-COMIT | Commit inside the function | - |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| T_LTAP_CANCL | LTAP_CANCL | Items to cancel | Yes |

## Exceptions

- TO_CONFIRMED: Transfer order already confirmed
- TO_DOESNT_EXIST: Transfer order does not exist
- ITEM_CONFIRMED: Item already confirmed
- ITEM_DOESNT_EXIST: Item does not exist
- FOREIGN_LOCK: Object locked by another user
- DOUBLE_LINES: Duplicate lines passed
- NOTHING_TO_DO: Nothing to process
- XFELD_WRONG: Invalid indicator value
- SU_MOVEMENT_PARTLY_CONFIRMED: Storage unit movement partly confirmed
- UPDATE_WITHOUT_COMMIT: Update task used without commit
- NO_AUTHORITY: No authorization

## Call template (ABAP)

```abap
CALL FUNCTION 'L_TO_CANCEL'
  EXPORTING
    i_lgnum = lv_i_lgnum
    i_tanum = lv_i_tanum
  TABLES
    t_ltap_cancl = lt_t_ltap_cancl
  EXCEPTIONS
    to_confirmed = 1
    to_doesnt_exist = 2
    item_confirmed = 3
    item_doesnt_exist = 4
    foreign_lock = 5
    double_lines = 6
    nothing_to_do = 7
    xfeld_wrong = 8
    OTHERS = 9.
```

## Related tables

LTAK, LTAP

