# BAPI_ALM_ORDER_MAINTAIN — Maintain Maintenance/Service Order

> Creates and changes maintenance and service orders, including header, operations, components, partners, texts and settlement rules, in one call. IT_METHODS controls what happens: each line names an object type, a method (CREATE, CHANGE, DELETE, RELEASE ...) and a reference key, and the list must end with a SAVE line. For changes, fill the matching _UP flag table for every field you send, then call BAPI_TRANSACTION_COMMIT when RETURN has no E or A message.

- Modules: PM
- Type: BAPI
- Function group: IBAPI_ALM_ORDER
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/bapi-alm-order-maintain/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| IV_MMSRV_EXTERNAL_MAINTENACE | BAPI_FLAG | External maintenance via MM service flag | - |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| IT_METHODS | BAPI_ALM_ORDER_METHOD | Methods (processing steps) | Yes |
| IT_HEADER | BAPI_ALM_ORDER_HEADERS_I | Order header data | - |
| IT_HEADER_UP | BAPI_ALM_ORDER_HEADERS_UP | Header change flags | - |
| IT_HEADER_SRV | BAPI_ALM_ORDER_SRVDAT_E | Service data for the order header | - |
| IT_PARTNER | BAPI_ALM_ORDER_PARTN_MUL | Partners | - |
| IT_PARTNER_UP | BAPI_ALM_ORDER_PARTN_MUL_UP | Partner change flags | - |
| IT_OBJECTLIST | BAPI_ALM_ORDER_OBJECTLIST | Object list | - |
| IT_OPERATION | BAPI_ALM_ORDER_OPERATION | Operations | - |
| IT_OPERATION_UP | BAPI_ALM_ORDER_OPERATION_UP | Operation change flags | - |
| IT_RELATION | BAPI_ALM_ORDER_RELATION | Operation relationships | - |
| IT_COMPONENT | BAPI_ALM_ORDER_COMPONENT | Components (material reservations) | - |
| IT_COMPONENT_UP | BAPI_ALM_ORDER_COMPONENT_UP | Component change flags | - |
| IT_SRULE | BAPI_ALM_ORDER_SRULE | Settlement rules | - |
| IT_ESTIMATED_COSTS | BAPI_ALM_ORDER_COSTS_EST_I | Estimated costs | - |
| IT_TASKLISTS | BAPI_ALM_ORDER_TASKLISTS_I | Task lists to include | - |
| IT_TEXT | BAPI_ALM_TEXT | Long text headers | - |
| IT_TEXT_LINES | BAPI_ALM_TEXT_LINES | Long text lines | - |
| IT_USERSTATUS | BAPI_ALM_ORDER_USRSTAT | User statuses | - |
| EXTENSION_IN | BAPIPAREX | Customer extension (input) | - |
| RETURN | BAPIRET2 | Return messages | - |
| ET_NUMBERS | BAPI_ALM_NUMBERS | Numbers of created objects | - |
| ET_NOTIFICATION_NUMBERS | BAPI_ALM_NOTIF_NUMBERS | Numbers of created notifications | - |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
  TABLES
    it_methods = lt_it_methods
    it_header = lt_it_header
    it_header_up = lt_it_header_up
    it_header_srv = lt_it_header_srv
    it_partner = lt_it_partner
    it_partner_up = lt_it_partner_up
    it_objectlist = lt_it_objectlist
    it_operation = lt_it_operation
    it_operation_up = lt_it_operation_up
    it_relation = lt_it_relation.
```

## Related tables

AFIH, AFKO, AFVC, AUFK, RESB

