# Mass Block and Archiving Flag for Inactive Business Partners

> A custom background program that finds business partners with no accounting posting, sales order or purchase order for a given period and sets a central block or archiving flag on those without open items. It retires old customers and vendors in a controlled way for master data cleanup and before an S/4HANA conversion; test mode only produces the candidate list.

- Type: Program, Custom development, Background program
- Module: CA
- Estimated effort: M (4–6 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/mass-block-inactive-business-partners-program/


## Why is the standard not enough?

In BP, the central block and archiving flag are set record by record; XD05 blocks customers one at a time. There is no standard tool that lists "business partners with no activity for 24 months and no open items" and flags them in bulk. This program calculates the last activity date from accounting, sales and purchasing documents and flags those passing the rule with a log.

### Closest standard alternatives

- BP: Sets the central block and archiving flag record by record; no inactivity analysis.
- XD05: Blocks customers one at a time; no bulk processing at vendor or business partner level.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| BUT000 | Business partner; central block and archiving flag written through the BAPI | Write | - | ECC + S/4 |
| CVI_CUST_LINK | Linked customer number | Read | CVI_CUST_LINK-PARTNER_GUID = BUT000-PARTNER_GUID | ECC + S/4 |
| CVI_VEND_LINK | Linked vendor number | Read | CVI_VEND_LINK-PARTNER_GUID = BUT000-PARTNER_GUID | ECC + S/4 |
| BSID | Customer open items and last posting date | Read | BSID-KUNNR = CVI_CUST_LINK-CUSTOMER | ECC + S/4 |
| BSAD | Customer cleared items: last posting date | Read | BSAD-KUNNR = CVI_CUST_LINK-CUSTOMER | ECC + S/4 |
| BSIK | Vendor open items and last posting date | Read | BSIK-LIFNR = CVI_VEND_LINK-VENDOR | ECC + S/4 |
| BSAK | Vendor cleared items: last posting date | Read | BSAK-LIFNR = CVI_VEND_LINK-VENDOR | ECC + S/4 |
| VBAK | Date of the last sales document | Read | VBAK-KUNNR = CVI_CUST_LINK-CUSTOMER | ECC + S/4 |
| EKKO | Date of the last purchasing document | Read | EKKO-LIFNR = CVI_VEND_LINK-VENDOR | ECC + S/4 |

## BAPIs and functions used

- BAPI_BUPA_CENTRAL_GETDETAIL: Reads the current central data of the business partner
- BAPI_BUPA_CENTRAL_CHANGE: Sets the central block or the archiving flag
- BAPI_TRANSACTION_COMMIT: Saves a successful change permanently
- BAPI_TRANSACTION_ROLLBACK: Rolls back the change on error

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_PARTN | Business partner | Range / multiple | BUT000-PARTNER | No |
| S_GROUP | BP grouping | Range / multiple | BUT000-BU_GROUP | No |
| S_BUKRS | Company code (activity check) | Range / multiple | BSID-BUKRS | No |
| P_MONTHS | Inactivity period (months) | Single value | - | Yes |
| P_BLOCK | Set central block | Radio button | - | No |
| P_ARCH | Set archiving flag | Radio button | - | No |
| P_TEST | Test mode (candidate list only) | Checkbox | - | No |

## Result list columns

| Column | Source |
|---|---|
| Business partner | BUT000-PARTNER |
| Name | BUT000-NAME_ORG1 |
| Grouping | BUT000-BU_GROUP |
| Customer | CVI_CUST_LINK-CUSTOMER |
| Vendor | CVI_VEND_LINK-VENDOR |
| Created on | BUT000-CRDAT |
| Last activity date | Calculated: MAX(BSID/BSAD/BSIK/BSAK-BUDAT, VBAK-ERDAT, EKKO-BEDAT) |
| Months inactive | Calculated: Today − last activity date (months) |
| Open items | Calculated: Number of open items in BSID and BSIK |
| Action | Calculated: Block set / Archiving flag set / Skipped |
| Status | Calculated: Success / Test / Warning / Error and BAPI message |

## How does the program work?

1. The selected business partners are read from BUT000; those already blocked or archived, and those created more recently than the inactivity period (CRDAT), are skipped.
2. Linked customer and vendor numbers are found through CVI_CUST_LINK and CVI_VEND_LINK.
3. Last activity date = the latest of: posting date (BUDAT) in BSID/BSAD and BSIK/BSAK, creation date (ERDAT) in VBAK, document date (BEDAT) in EKKO.
4. Months inactive = today − last activity date; if below the threshold, the business partner is skipped. Those with open items in BSID or BSIK are always listed as "skipped".
5. In test mode only the candidate list is produced. In a real run, the current data is read with BAPI_BUPA_CENTRAL_GETDETAIL, the central block or archiving flag is set with BAPI_BUPA_CENTRAL_CHANGE depending on the selection, and BAPI_TRANSACTION_COMMIT is called.
6. The result is kept in ALV and in the application log; the changes also appear in the business partner change documents.

## Authorization objects

- B_BUPA_GRP: Change in the business partner grouping (ACTVT 02)
- B_BUPA_ATT: Access to the field group for central block and archiving flag

## Frequently asked questions

### Does the archiving flag delete the record?

No. The archiving flag only marks the record as a candidate for archiving; deletion is possible only with the standard archiving object after the linked documents are archived. A central block closes the record to new transactions and can be removed later if needed.

### Are posting and sales blocks on the customer and vendor side set as well?

The basic version sets the central block or archiving flag at business partner level. If needed, customer posting and order blocks and vendor posting and purchasing blocks can be set in the same run; this takes about two extra days.

### What if some business partners must not be blocked even when inactive?

Business partners to exclude can be given on the selection screen or in an exception list (e.g. group companies, public bodies). The candidate list from test mode can also be sent for approval, and the real run done only for approved ones.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=ca-inactive-business-partner-mass-block
