# Business Logic — JKKShkaFinJiKikiStaAddCC.callKktkSvcKeiAdd() [375 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKShkaFinJiKikiStaAddCC` |
| Layer | Common Component (CC) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKShkaFinJiKikiStaAddCC.callKktkSvcKeiAdd()

This method handles the **"Cancelled / Dissolved" status update** for equipment provision service contracts during the equipment launch completion registration process. It is invoked as part of the `addShkaFinJiKiStaAdd()` processing flow when a multi-function router's phone adapter function is active and the equipment operation service service start (update type 140) has been executed.

The method performs a multi-phase business operation. First, it retrieves a list of service contract numbers via the EKK0081B034 service component (equipment provision service contract — service contract number list lookup with function code 3). Then, for each service contract, it fetches the agreement details via EKK0081A010 (service agreement lookup, function code 2) and identifies any associated telephone service contracts (service code CD00130_02 = "02").

For each telephone service contract whose status is NOT "010" (Accepted), the method iterates through all associated equipment provision service records (via EKK0341B029). For each equipment record, if its status is NOT "910" (Dissolved) and NOT "920" (Cancelled), the method branches based on the contract status:

- **Accepted (010) or Approved (020)**: Executes the cancellation process via EKK0341C330 (equipment provision service contract cancellation).
- **Other statuses (pending, service start, etc.)**: Executes the full dissolution flow — EKK0341C340 (contract dissolution initiation), EKK0341C350 (dissolution confirmation), and optionally EKK0341C370 (dissolution procedure completion) if no generation registration date is pending.

After processing the status update, if the equipment details (equipment provision service contract number, equipment change number, home equipment model code, equipment serial number) differ from previously processed values, the method checks whether return equipment registration is needed via `isHmpinKiki()`. If not already registered, it calls `callHmpinKikiAdd()` to register the return equipment.

The method implements a **delegation pattern**, routing business logic to specialized service components and internal helper methods. Its role in the larger system is as a shared business component called during equipment launch completion batch processing — specifically handling the financial/accounting state transition of equipment provision service contracts when converting from VA (Virtual AP) to multi-function routers.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["callKktkSvcKeiAdd params"])
    START --> INIT["Set dtm = updDtm Initialize temporaryData map"]
    INIT --> CALL_EKK0081B034["Call SC EKK0081B034 EKK0081B034CBSMsg FUNC_CODE_3=3 Get service contract number list"]
    CALL_EKK0081B034 --> LOOP_SVC["For each service contract from EKK0081B034 result"]
    LOOP_SVC --> CALL_EKK0081A010_1["Call SC EKK0081A010CBSMsg FUNC_CODE_2=2 Fetch service agreement for svc_kei_no Store in svcKeiList"]
    CALL_EKK0081A010_1 --> GET_SVC_LIST["getSvcKeiNoList svcKeiList Build list of service contract numbers"]
    GET_SVC_LIST --> MAIN_LOOP["For each svcKeiNo in svcKeiNoList"]
    MAIN_LOOP --> CALL_EKK0081A010_2["Call SC EKK0081A010CBSMsg FUNC_CODE_2=2 Get service agreement details"]
    CALL_EKK0081A010_2 --> GET_SVC_CD["Extract svcCd from result"]
    GET_SVC_CD --> CHECK_TEL{svcCd equals CD00130_02 Telephone?}
    CHECK_TEL -->|Yes| SET_TEL["Set svcKeiNoTel and svcMsg telephone service contract"]
    CHECK_TEL -->|No| SKIP_TEL["Skip not telephone"]
    SET_TEL --> TEL_CONDITION{svcKeiNoTel not empty AND svcKeiStat is NOT 010 Accepted?}
    SKIP_TEL --> TEL_CONDITION
    TEL_CONDITION -->|Yes| CALL_EKK0341B002["Call SC EKK0341B002CBSMsg FUNC_CODE_1 Get equipment provision service contract details"]
    CALL_EKK0341B002 --> CHECK_EMPTY{Result empty?}
    CHECK_EMPTY -->|Yes| RETURN_DTM["Return dtm"]
    CHECK_EMPTY -->|No| LOOP_KKTKEQUIP["For each equipment service record"]
    RETURN_DTM --> END_RETURN
    LOOP_KKTKEQUIP --> CHECK_DUPLICATE{kktkSvcKeiNo duplicate?}
    CHECK_DUPLICATE -->|Yes| SKIP_ITER["Skip continue"]
    CHECK_DUPLICATE -->|No| EXTRACT_FIELDS["Extract kktkSvcKeiNo kikiChgNo taknkikiModelCd kikiSeizoNo kktkSvcKeiStat kktkSbtCd mskmDtlNo"]
    SKIP_ITER --> NEXT_ITER
    EXTRACT_FIELDS --> STAT_CHECK{Is kktkSvcKeiStat NOT 910 Cancelled AND NOT 920 Rescinded?}
    STAT_CHECK -->|No already cancelled| NEXT_ITER
    STAT_CHECK -->|Yes active status| STAT_SUB_CHECK{Is 010 Accepted or 020 Approved?}
    STAT_SUB_CHECK -->|Yes Accepted or Approved| EXEC_CANCEL["Call SC EKK0341C330CBSMsg FUNC_CODE_1 Execute cancellation RSN_CD_05=05"]
    EXEC_CANCEL --> UPDATE_DTM_1["Update dtm from response"]
    UPDATE_DTM_1 --> NEXT_ITER
    STAT_SUB_CHECK -->|No pending or other| EXEC_RIKEI["Calculate svcEndYmd and chrgEndYmd staymd minus 1 chrgStaymd minus 1"]
    EXEC_RIKEI --> CALL_CANCEL_INIT["Call SC EKK0341C340CBSMsg FUNC_CODE_1 Execute contract dissolution IDO_DIV_00026=00026"]
    CALL_CANCEL_INIT --> UPDATE_DTM_2["Update dtm"]
    UPDATE_DTM_2 --> CALL_CANCEL_CONFIRM["Call SC EKK0341C350CBSMsg FUNC_CODE_1 Confirm contract dissolution SVC_DLRE_CD_01=01"]
    CALL_CANCEL_CONFIRM --> UPDATE_DTM_3["Update dtm Extract geneAddDtm"]
    UPDATE_DTM_3 --> GENE_CHECK{geneAddDtm is not null and is empty?}
    GENE_CHECK -->|Yes no registration| CALL_CANCEL_COMPLETE["Call SC EKK0341C370CBSMsg FUNC_CODE_1 Confirm dissolution procedure SVC_DSL_TTDKI_FIN_FLG=1"]
    GENE_CHECK -->|No has registration| SKIP_COMPLETE
    CALL_CANCEL_COMPLETE --> UPDATE_DTM_4["Update dtm"]
    UPDATE_DTM_4 --> NEXT_ITER
    SKIP_COMPLETE --> NEXT_ITER
    NEXT_ITER{More records?}
    NEXT_ITER -->|Yes| LOOP_KKTKEQUIP
    NEXT_ITER -->|No| EQUIP_COMPARE{Equipment details differ from previous?}
    EQUIP_COMPARE -->|No| RETURN_DTM
    EQUIP_COMPARE -->|Yes| CALL_IS_HMPIN["Call isHmpinKiki Check return equipment registration"]
    CALL_IS_HMPIN --> HMPIN_CHECK{Return equipment registration not needed?}
    HMPIN_CHECK -->|No registered| RETURN_DTM
    HMPIN_CHECK -->|Yes not registered| CALL_RETURN_EQUIP["Call callHmpinKikiAdd Register return equipment"]
    CALL_RETURN_EQUIP --> UPDATE_WORK["Update work variables kktkSvcKeiNoWk etc"]
    UPDATE_WORK --> RETURN_DTM
    RETURN_DTM --> END_RETURN(["Return dtm"])
    END_RETURN --> FINISH(["End"])
```

**Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `FUC_CODE_1` | `"1"` | Fixed function code 1 — standard processing |
| `FUC_CODE_2` | `"2"` | Fixed function code 2 — lookup only |
| `FUC_CODE_3` | `"3"` | Fixed function code 3 — list retrieval |
| `CD00130_02` | `"02"` | Service code for telephone |
| `KKTK_STAT_010` | `"010"` | Accepted status (equipment provision service contract) |
| `KKTK_STAT_020` | `"020"` | Approved status (equipment provision service contract) |
| `KKTK_STAT_910` | `"910"` | Dissolved status (equipment provision service contract) |
| `KKTK_STAT_920` | `"920"` | Cancelled status (equipment provision service contract) |
| `KKTK_SVC_CD_C004` | `"C004"` | Optical telephone for VoIP (equipment provision service code) |
| `SVC_CANCEL_RSN_CD_05` | `"05"` | Cancellation for other reasons |
| `SVC_KEI_STAT_010` | `"010"` | Accepted status (service contract) |
| `IDO_DIV_00026` | `"00026"` | Discrepancy division — equipment addition |
| `SVC_DLRE_CD_01` | `"01"` | Service dissolution code — normal dissolution |
| `HMPIN_KIKI_STAT_001` | `"001"` | Delivered status (return equipment status) |
| `HMPIN_DIV_1` | `"1"` | Cancellation item (return division) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for executing SC calls and maintaining transaction context |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service component request invoker used to dispatch all SC (Service Component) calls |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter object for reading/writing business data during SC interactions |
| 4 | `fixedText` | `String` | Fixed text configuration resource (used for localization and error message formatting) |
| 5 | `funcCd` | `String` | Function code identifying the calling screen/operation context |
| 6 | `kikiMsg` | `CAANMsg` | Equipment message object containing the primary equipment provision service contract data, including service start status, model codes, and delivery information |
| 7 | `updDtm` | `String` | Update date/time string (YYYYMMDDHHMMSS format) — serves as the baseline timestamp for all dissolution/cancellation operations |
| 8 | `baseYMD` | `String` | Base year-month-day string (YYYYMMDD) — used as the reservation application date for service agreement lookups |
| 9 | `staymd` | `String` | Service start year-month-day — used to calculate the service end date (staymd - 1 day) for dissolution processing |
| 10 | `chrgStaymd` | `String` | Billing start year-month-day — used to calculate the billing end date (chrgStaymd - 1 day) for dissolution processing |
| 11 | `kktkSvcNo` | `String` | Equipment provision service number — the identifier for the equipment provision service being processed |
| 12 | `idoDiv` | `String` | Discrepancy division code — classifies the type of contract change (e.g., "00026" for equipment addition, "00019" for address change) |
| 13 | `haisoNo` | `String` | Delivery number — identifier for the delivery associated with the equipment, used in return equipment processing |
| 14 | `kikiIchiiMsg` | `CAANMsg` | Equipment line item message — contains detailed equipment line item data for multi-function router processing |

**Instance fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `svcKeiKaisenUcwkNo` | `String` | Service contract revision work number — used as a key for the EKK0081B034 list lookup (v7.00.51 change) |
| `vaKikiUmFlg` | `boolean` | VA equipment existence flag — set to true when any equipment record has active status (not 910/920); indicates VA equipment is present |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callSC` (EKK0081B034) | EKK0081B034 | Service contract number list — retrieves all service contract numbers for the equipment provision service revision work number |
| R | `callSC` (EKK0081A010 x2) | EKK0081A010 | Service agreement — fetched once per svc_kei_no during the pre-scan loop and once in the main loop; retrieves service contract agreement details including service code and status |
| R | `callSC` (EKK0341B002) | EKK0341B002 | Equipment provision service contract details — retrieves the list of equipment service records associated with the telephone service contract number |
| C | `callSC` (EKK0341C330) | EKK0341C330 | Equipment provision service contract cancellation — executes cancellation for equipment in Accepted (010) or Approved (020) status; reason code 05 (other reasons) |
| U | `callSC` (EKK0341C340) | EKK0341C340 | Equipment provision service contract dissolution initiation — initiates the contract dissolution with calculated end dates (svcEndYmd, chrgEndYmd); discrepancy division 00026 (equipment addition) |
| U | `callSC` (EKK0341C350) | EKK0341C350 | Equipment provision service contract dissolution confirmation — confirms the dissolution with service end date, billing end date, and normal dissolution code (SVC_DLRE_CD_01) |
| U | `callSC` (EKK0341C370) | EKK0341C370 | Equipment provision service contract dissolution procedure completion — finalizes dissolution when no generation registration date is pending (geneAddDtm is empty) |
| R | `isHmpinKiki` | — | Return equipment registration check — determines whether the return equipment is already registered |
| C | `callHmpinKikiAdd` | — | Return equipment registration — registers the returned equipment by first checking delivery status, then either cancelling delivery (if delivered) or registering return receipt |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: addShkaFinJiKiStaAdd | `JKKShkaFinJiKikiStaAddCC.addShkaFinJiKiStaAdd()` -> `JKKShkaFinJiKikiStaAddCC.callKktkSvcKeiAdd()` | EKK0081B034 [R] Service contract number list; EKK0081A010 [R] Service agreement; EKK0341B002 [R] Equipment service records; EKK0341C330 [C] Cancellation; EKK0341C340 [U] Dissolution initiation; EKK0341C350 [U] Dissolution confirmation; EKK0341C370 [U] Dissolution completion; callHmpinKikiAdd [C] Return equipment registration; EDK0011A010 [R] Delivery agreement; EDK0011C090 [U] Delivery cancellation; EDK0301D010 [C] Return receipt |

**Notes:**
- This method is called from `addShkaFinJiKiStaAdd()` within the same class, triggered when processing the phone adapter function (KKOP_SVC_CD_G02) during update type 140 (equipment operation service start).
- No direct screen entry points were found — this is an internal business component called from CBS (Common Business Service) batch processing logic.
- The method internally delegates to `callHmpinKikiAdd()` which itself calls additional SCs: EDK0011A010 (delivery agreement lookup), EDK0011C090 (delivery cancellation), and EDK0301D010 (return equipment receipt).

## 6. Per-Branch Detail Blocks

**Block 1** — INITIALIZATION (L4989)

> Initialize local variables and the update timestamp.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dtm = updDtm` // Update timestamp initialized from parameter |
| 2 | SET | `svcKeiNoList = null` // Service contract number list |
| 3 | SET | `ekk0081a010outMsg = null` // Service contract info message array |
| 4 | SET | `svcMsg = null` // Service message |
| 5 | SET | `svcKeiNoTel = ""` // Telephone service contract number |
| 6 | SET | `temporaryData = new HashMap<>()` // Temporary data area |

**Block 2** — PRE-SCAN: Retrieve service contract number list (L5008-5017)

> Calls EKK0081B034 to get the list of service contract numbers associated with the revision work number. Uses FUC_CODE_3 = "3" (list retrieval).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081b034InMsg = {{TEMPLATEID, TEMPLATE_ID_EKK0081B034}, {FUNC_CODE, FUC_CODE_3}, {KEY_SVC_KEI_KAISEN_UCWK_NO, svcKeiKaisenUcwkNo}}` |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk0081b034InMsg).getCAANMsgList(...)` // EKK0081B034 CBS — get service contract number list |
| 3 | SET | `ekk0081b034outMsg = result.getCAANMsgList(EKK0081B034CBSMsg1List)` |

**Block 3** — PRE-SCAN LOOP: Build svcKeiList via EKK0081A010 (L5021-5050)

> For each service contract number from EKK0081B034, fetch the full agreement details via EKK0081A010 (FUC_CODE_2 = "2", lookup only). Store in svcKeiList.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiList = new ArrayList<>()` |
| 2 | FOR | `for (int k = 0; k < ekk0081b034outMsg.length; k++)` |
| 3 | SET | `svc_kei_no = ekk0081b034outMsg[k].getString(EKK0081B034CBSMsg1List.SVC_KEI_NO)` |
| 4 | SET | `ekk0081a010InMsg = {{TEMPLATEID, TEMPLATE_ID_EKK0081A010}, {FUNC_CODE, FUC_CODE_2}, {KEY_SVC_KEI_NO, svc_kei_no}, {KEY_GENE_ADD_DTM, ""}, {KEY_RSV_APLY_YMD, baseYMD}}` |
| 5 | CALL | `callSC(handle, scCall, param, fixedText, ekk0081a010InMsg).getCAANMsgList(...)` // EKK0081A010 CBS — service agreement lookup |
| 6 | SET | `svcMsg2 = (result.length > 0) ? result[0] : null` |
| 7 | IF | `svcMsg2 != null` (L5037) |
| 7.1 | EXEC | `svcKeiList.add(svcMsg2)` |

**Block 4** — Build svcKeiNoList (L5056)

> Replaces the old direct extraction method (commented-out getSvcKeiNoList on ekk0081b034outMsg) with the new version using svcKeiList (v7.00.37 change).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `svcKeiNoList = getSvcKeiNoList(svcKeiList)` |

**Block 5** — MAIN LOOP: Iterate service contracts and identify telephone contracts (L5058-5088)

> For each service contract number, fetch details and identify telephone service contracts (svcCd = CD00130_02 = "02").

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (int j = 0; j < svcKeiNoList.size(); j++)` |
| 2 | SET | `svcKeiNo_tmp = svcKeiNoList.get(j)` |
| 3 | SET | `ekk0081a010InMsg = {{TEMPLATEID, TEMPLATE_ID_EKK0081A010}, {FUNC_CODE, FUC_CODE_2}, {KEY_SVC_KEI_NO, svcKeiNo_tmp}, {KEY_GENE_ADD_DTM, ""}, {KEY_RSV_APLY_YMD, baseYMD}}` |
| 4 | CALL | `callSC(handle, scCall, param, fixedText, ekk0081a010InMsg).getCAANMsgList(...)` // EKK0081A010 CBS — get service agreement |
| 5 | SET | `svcKeiMsg = ekk0081a010outMsg[0]` |
| 6 | SET | `svcCd = svcKeiMsg.getString(EKK0081A010CBSMsg1List.SVC_CD)` |

**Block 5.1** — IF: Telephone service code check (L5090) `[CD00130_02="02"]`

> Branch: svcCd equals "02" (Telephone).

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiNoTel = svcKeiMsg.getString(EKK0081A010CBSMsg1List.SVC_KEI_NO)` // Telephone service contract number |
| 2 | SET | `svcMsg = svcKeiMsg` // Telephone service message |

**Block 6** — CONDITION: Telephone service exists and is NOT Accepted (L5153) `[SVC_KEI_STAT_010="010"]`

> Only process if there is a telephone service contract AND its status is NOT "010" (Accepted). This ensures we skip already-accepted contracts.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!"".equals(svcKeiNoTel) && !SVC_KEI_STAT_010.equals(svcMsg.getString(EKK0081A010CBSMsg1List.SVC_KEI_STAT))` |

**Block 6.1** — CALL: Retrieve equipment provision service records (L5166-5174)

> Call EKK0341B002 with FUC_CODE_1 = "1" to get equipment provision service contract details for the telephone service.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0341B002InMsg = {{TEMPLATEID, TEMPLATE_ID_EKK0341B002}, {FUNC_CODE, FUC_CODE_1}, {KEY_SVC_KEI_NO, svcKeiNoTel}, {KEY_KKTK_SVC_CD, KKTK_SVC_CD_C004}, {KEY_SORT_KBN, "2"}}` |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk0341B002InMsg).getCAANMsgList(...)` // EKK0341B002 CBS — equipment provision service contract details |
| 3 | SET | `ekk0341B002outMsg = result.getCAANMsgList(EKK0341B002CBSMsg1List)` |

**Block 6.2** — IF: Result empty check (L5177)

| # | Type | Code |
|---|------|------|
| 1 | IF | `ekk0341B002outMsg == null || ekk0341B002outMsg.length == 0` |
| 1.1 | RETURN | `return dtm` |

**Block 6.3** — Initialization of work variables (L5184-5209)

> Initialize local variables used in the equipment record processing loop.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktkSvcKeiNo = ""` |
| 2 | SET | `kikiChgNo = ""` |
| 3 | SET | `taknkikiModelCd = ""` |
| 4 | SET | `kikiSeizoNo = ""` |
| 5 | SET | `kktkSvcKeiNoWk = ""` |
| 6 | SET | `kikiChgNoWk = ""` |
| 7 | SET | `taknkikiModelCdWk = ""` |
| 8 | SET | `kikiSeizoNoWk = ""` |
| 9 | SET | `kktkSbtCd = ""` |
| 10 | SET | `kktkSvcKeiStat = ""` |
| 11 | SET | `mskmDtlNo = ""` |

**Block 6.4** — EQUIPMENT LOOP: For each equipment service record (L5211)

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (int i = 0; i < ekk0341B002outMsg.length; i++)` |

**Block 6.4.1** — Extract equipment fields (L5214-5228)

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktkSvcKeiNo = ekk0341B002outMsg[i].getString(EKK0341B002CBSMsg1List.KKTK_SVC_KEI_NO)` |
| 2 | SET | `kikiChgNo = ekk0341B002outMsg[i].getString(EKK0341B002CBSMsg1List.KIKI_CHG_NO)` |
| 3 | SET | `taknkikiModelCd = ekk0341B002outMsg[i].getString(EKK0341B002CBSMsg1List.TAKNKIKI_MODEL_CD)` |
| 4 | SET | `kikiSeizoNo = ekk0341B002outMsg[i].getString(EKK0341B002CBSMsg1List.KIKI_SEIZO_NO)` |
| 5 | SET | `kktkSvcKeiStat = ekk0341B002outMsg[i].getString(EKK0341B002CBSMsg1List.KKTK_SVC_KEI_STAT)` |
| 6 | SET | `kktkSbtCd = ekk0341B002outMsg[i].getString(EKK0341B002CBSMsg1List.KKTK_SBT_CD)` |
| 7 | SET | `mskmDtlNo = kikiMsg.getString(EKK0341B029CBSMsg1List.MSKM_DTL_NO)` // v8.00.00 fix: from kikiMsg instead of ekk0341B002outMsg |

**Block 6.4.2** — IF: Duplicate check (L5218) `[OM-609]`

| # | Type | Code |
|---|------|------|
| 1 | IF | `kktkSvcKeiNoWk.equals(kktkSvcKeiNo)` |
| 1.1 | EXEC | `continue` // Skip duplicate equipment service contract number |
| 2 | SET | `kktkSvcKeiNoWk = kktkSvcKeiNo` |

**Block 6.4.3** — IF: Status NOT Cancelled/Dissolved (L5231) `[KKTK_STAT_910="910", KKTK_STAT_920="920"]`

> Branch: Equipment provision service status is NOT "910" (Dissolved) and NOT "920" (Cancelled). Set vaKikiUmFlg to true for the caller to know VA equipment exists.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!KKTK_STAT_910.equals(kktkSvcKeiStat) && !KKTK_STAT_920.equals(kktkSvcKeiStat)` |
| 1.1 | SET | `vaKikiUmFlg = true` // ANK-4315: Set VA equipment flag |

**Block 6.4.3.1** — IF/ELSE: Status sub-check (L5238) `[KKTK_STAT_010="010", KKTK_STAT_020="020"]`

> Sub-branch: Is the status Accepted (010) or Approved (020)?

**Block 6.4.3.1.1** — IF: Accepted or Approved → Cancel (L5242)

> Execute the cancellation process for equipment in Accepted or Approved status.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0341C330InMsg = {{TEMPLATEID, TEMPLATE_ID_EKK0341C330}, {FUNC_CODE, FUC_CODE_1}, {KKTK_SVC_KEI_NO, kktkSvcKeiNo}, {IDO_DIV, idoDiv}, {UPD_DTM_BF, dtm}, {SVC_CANCEL_RSN_CD, SVC_CANCEL_RSN_CD_05}}` |
| 2 | CALL | `callSC(handle, scCall, param, fixedText, ekk0341C330InMsg)` // EKK0341C330 CBS — equipment provision service contract cancellation |
| 3 | SET | `dtm = ekk0341C330OutMsg.getString(EKK0341C330CBSMsg.UPD_DTM)` |

**Block 6.4.3.1.2** — ELSE: Pending/other status → Dissolution (L5252)

> For non-Accepted/Approved active status, execute the full dissolution flow.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcEndYmd = adjustDate(staymd, -1)` // Service end date = staymd minus 1 day |
| 2 | SET | `chrgEndYmd = adjustDate(chrgStaymd, -1)` // Billing end date = chrgStaymd minus 1 day |
| 3 | SET | `ekk341C340InMsg = {{TEMPLATEID, TEMPLATE_ID_EKK0341C340}, {FUNC_CODE, FUC_CODE_1}, {KKTK_SVC_KEI_NO, kktkSvcKeiNo}, {SVC_ENDYMD, svcEndYmd}, {IDO_DIV, IDO_DIV_00026}, {UPD_DTM_BF, dtm}, {MSKM_DTL_NO, mskmDtlNo}}` |
| 4 | CALL | `callSC(handle, scCall, param, fixedText, ekk341C340InMsg)` // EKK0341C340 CBS — contract dissolution initiation |
| 5 | SET | `dtm = ekk341C340outMsg.getString(EKK0341C340CBSMsg.UPD_DTM)` |
| 6 | SET | `ekk341C350InMsg = {{TEMPLATEID, TEMPLATE_ID_EKK0341C350}, {FUNC_CODE, FUC_CODE_1}, {KKTK_SVC_KEI_NO, kktkSvcKeiNo}, {SVC_ENDYMD, svcEndYmd}, {SVC_CHRG_ENDYMD, chrgEndYmd}, {SVC_DLRE_CD, SVC_DLRE_CD_01}, {UPD_DTM_BF, dtm}}` |
| 7 | CALL | `callSC(handle, scCall, param, fixedText, ekk341C350InMsg)` // EKK0341C350 CBS — dissolution confirmation |
| 8 | SET | `dtm = ekk341C350outMsg.getString(EKK0341C350CBSMsg.UPD_DTM)` |
| 9 | SET | `geneAddDtm = ekk341C350outMsg.getString(EKK0341C350CBSMsg.GENE_ADD_DTM)` |

**Block 6.4.3.1.2.1** — IF: geneAddDtm check (L5285) `[IT2-104]`

> If geneAddDtm is not null and is empty string — meaning no generation registration date exists, so proceed with dissolution procedure completion.

| # | Type | Code |
|---|------|------|
| 1 | IF | `geneAddDtm != null && "".equals(geneAddDtm)` |
| 1.1 | SET | `ekk341C370InMsg = {{TEMPLATEID, TEMPLATE_ID_EKK0341C370}, {FUNC_CODE, FUC_CODE_1}, {KKTK_SVC_KEI_NO, kktkSvcKeiNo}, {GENE_ADD_DTM, geneAddDtm}, {SVC_DSL_TTDKI_FIN_FLG, "1"}, {IDO_DIV, idoDiv}, {UPD_DTM_BF, dtm}}` |
| 1.2 | CALL | `callSC(handle, scCall, param, fixedText, ekk341C370InMsg)` // EKK0341C370 CBS — dissolution procedure completion |
| 1.3 | SET | `dtm = ekk341C370outMsg.getString(EKK0341C370CBSMsg.UPD_DTM)` |

**Block 6.4.4** — IF: Equipment details differ from previous (L5324)

> Check if any of the four key equipment fields differ from the work variables (which track the last processed equipment record).

| # | Type | Code |
|---|------|------|
| 1 | IF | `!(kktkSvcKeiNo.equals(kktkSvcKeiNoWk) && kikiChgNo.equals(kikiChgNoWk) && taknkikiModelCd.equals(taknkikiModelCdWk) && kikiSeizoNo.equals(kikiSeizoNoWk))` |

**Block 6.4.4.1** — CALL: isHmpinKiki (L5329)

> Check if return equipment registration is needed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `hmpinKikiUmuFlg = isHmpinKiki(handle, scCall, param, fixedText, kktkSvcKeiNo, kikiChgNo)` |

**Block 6.4.4.2** — IF: Return equipment registration not needed (L5332)

| # | Type | Code |
|---|------|------|
| 1 | IF | `!hmpinKikiUmuFlg` |
| 1.1 | CALL | `callHmpinKikiAdd(handle, scCall, param, fixedText, funcCd, kktkSvcKeiNo, kikiChgNo, taknkikiModelCd, kikiSeizoNo, haisoNo, svcKeiNoTel, kktkSbtCd)` // Register return equipment |
| 1.2 | SET | `kktkSvcKeiNoWk = kktkSvcKeiNo` |
| 1.3 | SET | `kikiChgNoWk = kikiChgNo` |
| 1.4 | SET | `taknkikiModelCdWk = taknkikiModelCd` |
| 1.5 | SET | `kikiSeizoNoWk = kikiSeizoNo` |

**Block 7** — RETURN (L5347)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return dtm` // Return the latest update timestamp |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `callKktkSvcKeiAdd` | Method | Equipment provision service contract cancellation/dissolution handler — processes status transitions for equipment contracts during launch completion |
| `kikiMsg` | Field | Equipment message — primary data carrier containing equipment provision service contract details, service codes, and model information |
| `kikiIchiiMsg` | Field | Equipment line item message — detailed per-line-item equipment data for router processing |
| `svcKeiNo` | Field | Service contract number — unique identifier for a service contract |
| `svcKeiStat` | Field | Service contract status — indicates the current state of a service contract (Accepted, Approved, Dissolved, Cancelled, etc.) |
| `svcCd` | Field | Service code — classifies the type of service (e.g., "02" = Telephone, "01" = Network, "C004" = Optical VoIP) |
| `kktkSvcKeiNo` | Field | Equipment provision service contract number — identifier for an equipment provision service contract line |
| `kktkSvcKeiStat` | Field | Equipment provision service contract status — "010" (Accepted), "020" (Approved), "910" (Dissolved), "920" (Cancelled), "100" (Service in progress) |
| `kikiChgNo` | Field | Equipment change number — identifies a specific equipment change instance |
| `taknkikiModelCd` | Field | Home equipment model code — the model code of the customer-premise equipment |
| `kikiSeizoNo` | Field | Equipment serial number — unique manufacturing serial number of the equipment |
| `kktkSbtCd` | Field | Equipment subtype code — classifies equipment type (A0=STB, F0=Router, R0=Multi-function Router, etc.) |
| `idoDiv` | Field | Discrepancy division code — identifies the type of contract change being performed (e.g., "00019" = Address change, "00026" = Equipment addition, "00031" = Option setting) |
| `haisoNo` | Field | Delivery number — identifier for a delivery record associated with equipment |
| `updDtm` | Field | Update date/time — timestamp in YYYYMMDDHHMMSS format tracking when the last operation occurred |
| `staymd` | Field | Service start year-month-day — the date when the service begins |
| `chrgStaymd` | Field | Billing start year-month-day — the date when billing begins for the service |
| `baseYMD` | Field | Base year-month-day — used as the reservation application date reference |
| `vaKikiUmFlg` | Field | VA equipment existence flag — set to true when at least one equipment record has an active (non-cancelled/dissolved) status |
| `svcKeiKaisenUcwkNo` | Field | Service contract revision work number — internal tracking ID for service contract revision work |
| `geneAddDtm` | Field | Generation addition date/time — timestamp for when the generation (equipment) was added to the system |
| `mskmDtlNo` | Field | Application detail number — detail reference number for the application |
| `svcEndYmd` | Field | Service end year-month-day — calculated as staymd minus 1 day; the last day of service |
| `chrgEndYmd` | Field | Billing end year-month-day — calculated as chrgStaymd minus 1 day; the last day of billing |
| KKTK | Acronym | Kiki Teikyo (Equipment Provision) — Fujitsu's equipment provision service domain |
| SVC_KEI | Acronym | Service Kei (Service Contract) — service contract data entity |
| KKTK_SVC_CD | Field | Kiki Teikyo Service Code — identifies the type of equipment provision service (e.g., "C004" = Optical VoIP) |
| FUC_CODE_1 | Constant | `"1"` — Fixed function code 1: standard processing |
| FUC_CODE_2 | Constant | `"2"` — Fixed function code 2: lookup only |
| FUC_CODE_3 | Constant | `"3"` — Fixed function code 3: list retrieval |
| CD00130_02 | Constant | `"02"` — Service code for Telephone |
| KKTK_STAT_010 | Constant | `"010"` — Accepted (Equipment provision service contract) |
| KKTK_STAT_020 | Constant | `"020"` — Approved (Equipment provision service contract) |
| KKTK_STAT_910 | Constant | `"910"` — Dissolved (Equipment provision service contract) |
| KKTK_STAT_920 | Constant | `"920"` — Cancelled (Equipment provision service contract) |
| SVC_KEI_STAT_010 | Constant | `"010"` — Accepted (Service contract) |
| SVC_CANCEL_RSN_CD_05 | Constant | `"05"` — Cancellation for other reasons |
| IDO_DIV_00026 | Constant | `"00026"` — Discrepancy division: Equipment addition |
| SVC_DLRE_CD_01 | Constant | `"01"` — Normal dissolution |
| EKK0081A010 | SC | Service Agreement CBS — retrieves service contract agreement details |
| EKK0081B034 | SC | Equipment Provision Service Contract — Service Contract Number List Lookup CBS |
| EKK0341B002 | SC | Equipment Provision Service Contract Details CBS — retrieves equipment service records |
| EKK0341C330 | SC | Equipment Provision Service Contract Cancellation CBS |
| EKK0341C340 | SC | Equipment Provision Service Contract Dissolution Initiation CBS |
| EKK0341C350 | SC | Equipment Provision Service Contract Dissolution Confirmation CBS |
| EKK0341C370 | SC | Equipment Provision Service Contract Dissolution Procedure Completion CBS |
| EDK0011A010 | SC | Delivery Agreement CBS — retrieves delivery information |
| EDK0011C090 | SC | Delivery Cancellation CBS |
| EDK0301D010 | SC | Return Equipment Receipt CBS |
| isHmpinKiki | Method | Return equipment registration check — determines if return equipment is already registered |
| callHmpinKikiAdd | Method | Return equipment registration — handles delivery cancellation or return receipt registration |
| adjustDate | Method | Date adjustment utility — adds or subtracts days from a date string |
| CAANMsg | Class | Canonical message container — generic data carrier for SC input/output parameters |
| SessionHandle | Class | Database session handle — manages database connections and transaction context |
| ServiceComponentRequestInvoker | Class | SC request invoker — dispatches service component calls |
| AbstractCommonComponent | Class | Base class for common components — provides SC call infrastructure |
