# Business Logic — KKA14901SFLogic.setDispInfo() [202 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA14901SF.KKA14901SFLogic` |
| Layer | Service / Web Logic (Controller-adjacent service layer) |
| Module | `KKA14901SF` (Package: `eo.web.webview.KKA14901SF`) |

## 1. Role

### KKA14901SFLogic.setDispInfo()

The `setDispInfo` method is the display-info preparation routine for the Option Service Contract List screen (KKA14901SF) within K-Opticom's telecommunications contract management system. It transforms raw service-contract data into a display-ready format that populates the OneStop data beans for rendering the option service list. The method performs four distinct business responsibilities: (1) it optionally filters out option contracts from the list when coming from the return-processing screen (CRW10601) for TV service contracts, ensuring only option channel information is shown; (2) it iterates over each option service contract and computes a display service start date (`USE_STA_YMD_01`) based on contract status (active, in-application, or under-contract) and start-channel type (Star Channel, half-year, CP, or Basic Payment); (3) it sets a row display flag (`GYO_DISP_FLG_01`) to alternate between values "1" and "2" for even/odd row visual styling; (4) it clears the service end date to an empty string when it equals the "no-end-date" sentinel `20991231`, and finally selects the default row (index 0) or finds the matching prior-selection row when an inherited option service contract number exists. The method implements a **data-prepare / transformer** pattern — it never calls external SC/CBS services for CRUD operations, instead operating entirely on in-memory data bean structures.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setDispInfo paramBean, svcCd"])
    GET_LIST["Get op_svc_kei_list = paramBean[0].getDataBeanArray(OP_SVC_KEI_LIST)"]
    CHECK_SCREEN["Check: screenId == CRW10601"]
    CHECK_SVC_CD["Check: svcCd == 03 (TV)"]
    GET_EKK0821B001["Get ekk0821b001cbsmsg1list = paramBean[0].getDataBeanArray(EKK0821B001CBSMSG1LIST)"]
    CHECK_BOTH["Check: op_svc_kei_list != null AND count > 0
AND ekk0821b001cbsmsg1list != null AND count > 0"]
    LOOP_OP_SVC["Loop: i from 0 to op_svc_kei_list.getCount()"]
    GET_OP_SVC_CD_1["Get opSvcCd = opSvcKeiInfo.sendMessageString(OP_SVC_CD_01)"]
    SET_DEL_FLG["Set listDelFlg = true"]
    LOOP_OP_CH["Loop: j from 0 to ekk0821b001cbsmsg1list.getCount()"]
    GET_OP_CD_2["Get opChannelSvcCd = opChannelInfo.sendMessageString(OP_SVC_CD_11)"]
    CHECK_MATCH["Check: opSvcCd == opChannelSvcCd"]
    SET_NO_DEL["Set listDelFlg = false, break"]
    REMOVE_ROW["Remove row i from op_svc_kei_list"]
    GET_LIST_COUNT["listCount = op_svc_kei_list.getCount()"]
    LOOP_MAIN["Loop: i from 0 to listCount"]
    SUBBEAN_GET["subbean = op_svc_kei_list.getDataBean(i)"]
    SET_YMD_DEFAULT["ymd = 99991231 (default)"]
    GET_STAT["Get op_svc_kei_stat"]
    CHECK_STAT["Check: stat == 010 OR 020 OR 030"]
    GET_DSP_SVCTK["Get ymd from DSP_SVCTK_STAYMD_01"]
    GET_OP_SVC_CD_3["Get opSvcCd from subbean"]
    CHECK_STAR_CD["Check: opSvcCd == B034 OR B083 OR B104 OR B109"]
    GET_USE_YMD["Get ymd from SVC_USE_STA_KIBO_YMD_01"]
    ELSE_STAT["Else: non-active status"]
    GET_SVC_DTM["Get ymd from SVC_STA_DTM_01 if Star Channel"]
    GET_DSP_YMD_ALT["Get ymd from DSP_SVCTK_STAYMD_01 if not Star Channel"]
    SET_USE_YMD["Set ymd = USE_STA_YMD_01"]
    SET_GYO["Set GYO_DISP_FLG_01 = 1 (even) OR 2 (odd)"]
    GET_SVC_END["Get svcEndYmd"]
    CHECK_END["Check: svcEndYmd == 20991231"]
    CLEAR_END["Set svcEndYmd = empty string"]
    CHECK_CNT["Check: listCount > 0"]
    SET_INIT_SEL["Set OP_SVC_KEI_SEL = 0"]
    GET_CUST_LIST["Get custKeiHktgiList = getDataBeanArray(CUST_KEI_HKTGI_LIST)"]
    GET_CUST_INF["Get custKeiHktgiInf from list[0]"]
    GET_HKTG_CNT["opHktgCnt = custKeiHktgiInf.getCount(OP_SVC_KEI_NO_03)"]
    CHECK_HKTG["Check: opHktgCnt > 0"]
    GET_OP_NO["Get opSvcKeiNo"]
    LOOP_MATCH["Loop: cnt from 0 to op_svc_kei_list.getCount()"]
    GET_SUBBEAN["subbean = op_svc_kei_list.getDataBean(cnt)"]
    GET_NOW_NO["Get nowOpSvcKeiNo"]
    CHECK_NO_MATCH["Check: opSvcKeiNo == nowOpSvcKeiNo"]
    SET_SEL_ROW["Set OP_SVC_KEI_SEL = String.valueOf(cnt)"]
    SET_EMPTY_SEL["Set OP_SVC_KEI_SEL = empty"]
    END_NODE(["Return"])
    START --> GET_LIST --> CHECK_SCREEN
    CHECK_SCREEN -->|Yes| CHECK_SVC_CD
    CHECK_SCREEN -->|No| GET_LIST_COUNT
    CHECK_SVC_CD -->|svcCd == 03| GET_EKK0821B001
    CHECK_SVC_CD -->|No| GET_LIST_COUNT
    GET_EKK0821B001 --> CHECK_BOTH
    CHECK_BOTH -->|Both have data| LOOP_OP_SVC
    CHECK_BOTH -->|Else| GET_LIST_COUNT
    LOOP_OP_SVC --> GET_OP_SVC_CD_1 --> SET_DEL_FLG --> LOOP_OP_CH
    LOOP_OP_CH --> GET_OP_CD_2 --> CHECK_MATCH
    CHECK_MATCH -->|Yes| SET_NO_DEL
    CHECK_MATCH -->|No| LOOP_OP_CH
    SET_NO_DEL --> REMOVE_ROW
    REMOVE_ROW --> LOOP_OP_CH
    GET_LIST_COUNT --> LOOP_MAIN
    LOOP_MAIN --> SUBBEAN_GET --> SET_YMD_DEFAULT --> GET_STAT
    GET_STAT --> CHECK_STAT
    CHECK_STAT -->|stat == 010/020/030| GET_DSP_SVCTK
    CHECK_STAT -->|Else| ELSE_STAT
    GET_DSP_SVCTK --> GET_OP_SVC_CD_3
    GET_OP_SVC_CD_3 --> CHECK_STAR_CD
    CHECK_STAR_CD -->|Star Channel| GET_USE_YMD
    CHECK_STAR_CD -->|Not Star Channel| SET_USE_YMD
    GET_USE_YMD --> SET_USE_YMD
    ELSE_STAT --> GET_SVC_DTM
    GET_SVC_DTM --> CHECK_STAR_CD
    SET_USE_YMD --> SET_GYO --> GET_SVC_END --> CHECK_END
    CHECK_END -->|Yes| CLEAR_END
    CHECK_END -->|No| SET_EMPTY_SEL
    CLEAR_END --> CHECK_CNT
    SET_EMPTY_SEL --> END_NODE
    CHECK_CNT -->|listCount > 0| SET_INIT_SEL --> GET_CUST_LIST --> GET_CUST_INF --> GET_HKTG_CNT
    CHECK_CNT -->|listCount == 0| SET_EMPTY_SEL
    GET_HKTG_CNT --> CHECK_HKTG
    CHECK_HKTG -->|opHktgCnt > 0| GET_OP_NO --> LOOP_MATCH
    CHECK_HKTG -->|opHktgCnt == 0| END_NODE
    LOOP_MATCH --> GET_SUBBEAN --> GET_NOW_NO --> CHECK_NO_MATCH
    CHECK_NO_MATCH -->|Match| SET_SEL_ROW --> END_NODE
    CHECK_NO_MATCH -->|No match| LOOP_MATCH
```

### Constant Resolution

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `JCRScreenConst.SCREEN_ID_CRW10601` | `"CRW10601"` | Return screen ID — indicates the user navigated back from the return-processing screen |
| `JKKCommonConst.SVC_CD_TV` | `"03"` | Service code for TV service (NHK/television contracts) |
| `JKKCommonConst.MAX_YMD` | `"20991231"` | Sentinel value meaning "no end date" — displayed service end date is cleared to empty |
| `OP_SVC_CD_STA_CHN_SET` | `"B034"` | Star Channel full-term (1-year) subscription code |
| `OP_SVC_CD_STA_CHN_HALF_YEAR` | `"B083"` | Star Channel half-year subscription code |
| `OP_SVC_CD_STA_CHN_CP` | `"B104"` | Star Channel CP (Carrier Partner) subscription code |
| `OP_SVC_CD_STA_CHN_BS_PAS` | `"B109"` | Star Channel Basic/Pass subscription code |
| `JKKCommonConst.SVC_KEI_STAT_010` | `"010"` | Active / In-service contract status |
| `JKKCommonConst.SVC_KEI_STAT_020` | `"020"` | Under S-IF application status |
| `JKKCommonConst.SVC_KEI_STAT_030` | `"030"` | Under-contract (contracted) status |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `OneStopDataBeanAccess[]` | Array of OneStop data beans carrying the screen's data model. Index 0 holds the option service contract list (`OP_SVC_KEI_LIST`), option channel info list (`EKK0821B001CBSMSG1LIST`), and customer contract inheritance data (`CUST_KEI_HKTGI_LIST`). This is the primary data structure that the method mutates — setting display dates, row flags, service end dates, and selection index. |
| 2 | `svcCd` | `String` | Service code identifying the service type (e.g., `"03"` for TV). Used in the CRW10601 return-screen filter branch — only TV service contracts trigger the option channel filtering logic. |

**Instance fields read by this method:**
- None directly — all state is accessed through the `paramBean` parameter and `JCCWebCommon.getScreenId(this)` (via `this` instance for screen ID retrieval).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getScreenId` | JCCWebCommon | - | Retrieves the current screen ID for conditional routing (CRW10601 return screen detection) |
| R | `OneStopDataBeanAccessArray.getCount` | OneStopDataBeanAccessArray | - | Reads the row count of the option service contract list |
| R | `OneStopDataBeanAccessArray.getDataBean` | OneStopDataBeanAccessArray | - | Retrieves a data bean at a given index from the option service contract list |
| R | `OneStopDataBeanAccess.getDataBeanArray` | OneStopDataBeanAccess | - | Retrieves a sub-list (array) of data beans by key (option service list, EKK0821B001 list, customer inheritance list) |
| - | `OneStopDataBeanAccess.sendMessage` | OneStopDataBeanAccess | - | Calls `getCount` on the customer inheritance info data bean |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Reads or writes individual string fields on data beans (get/set operations) |
| R | `OneStopDataBeanAccessArray.getCount` | OneStopDataBeanAccessArray | - | Reads count of the EKK0821B001 option channel info list |
| - | `OneStopDataBeanAccessArray.remove` | OneStopDataBeanAccessArray | - | Removes a row from the option service contract list (for filtering) |

This method performs **no database CRUD operations**. It is purely an in-memory data preparation and transformation method operating on OneStop data bean structures. The operations are classified below by their in-memory equivalent:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `OneStopDataBeanAccess.getDataBeanArray` | KKW02301SFConst | - | Reads option service contract list data from paramBean (in-memory list retrieval) |
| R | `OneStopDataBeanAccess.getDataBeanArray` | KKW02301SFConst | - | Reads EKK0821B001 option channel info list (in-memory list retrieval) |
| R | `OneStopDataBeanAccessArray.getCount` | KKW02301SFConst | - | Reads row count of lists for iteration |
| R | `OneStopDataBeanAccessArray.getDataBean` | KKW02301SFConst | - | Reads individual option service contract records |
| R | `OneStopDataBeanAccess.sendMessageString` (GET) | KKW02301SFConst | - | Reads individual data fields (opSvcCd, opSvcKeiStat, DSP_SVCTK_STAYMD_01, etc.) |
| U | `OneStopDataBeanAccessArray.remove` | KKW02301SFConst | - | Removes option service rows that don't match channel info (filtering) |
| U | `OneStopDataBeanAccess.sendMessageString` (SET) | KKW02301SFConst | - | Sets display fields: USE_STA_YMD_01, GYO_DISP_FLG_01, SVC_END_DTM_01, OP_SVC_KEI_SEL |
| R | `JCCWebCommon.getScreenId` | JCCWebCommon | - | Gets current screen ID for conditional routing |

## 5. Dependency Trace

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKA14901SFLogic.searchList` | `searchList` -> `setDispInfo` | `sendMessageString` [U] USE_STA_YMD_01, sendMessageString [U] GYO_DISP_FLG_01, sendMessageString [U] SVC_END_DTM_01, sendMessageString [U] OP_SVC_KEI_SEL, getDataBean [R] OP_SVC_KEI_LIST, getCount [R] OP_SVC_KEI_LIST |

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(screenId == CRW10601)` (L2855)
> If the current screen is the return screen (CRW10601), filter the option service list to show only option channel information.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `screenId = JCCWebCommon.getScreenId(this)` // Get current screen ID [-> JCRScreenConst.SCREEN_ID_CRW10601 = "CRW10601"] |
| 2 | IF | `JCRScreenConst.SCREEN_ID_CRW10601.equals(screenId)` [SCREEN_ID_CRW10601="CRW10601"] (L2855) |

**Block 1.1** — IF `(svcCd == 03)` [TV Service] (L2858)
> Within the return screen path, only process TV service contracts.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.SVC_CD_TV.equals(svcCd)` [SVC_CD_TV="03"] (L2858) |

**Block 1.1.1** — GET option channel info list (L2862-2863)
> Retrieve the option channel info list for filtering.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ekk0821b001cbsmsg1list = paramBean[0].getDataBeanArray(KKW02301SFConst.EKK0821B001CBSMSG1LIST)` // [-> "オプションチャンネル情報一覧" (Option Channel Info List)] |

**Block 1.1.2** — IF (both lists have data) (L2866-2872)
> If both the option service list and option channel info list are non-empty, proceed with filtering.

| # | Type | Code |
|---|------|------|
| 1 | IF | `op_svc_kei_list != null && op_svc_kei_list.getCount() > 0` (L2866) |
| 2 | AND | `ekk0821b001cbsmsg1list != null && ekk0821b001cbsmsg1list.getCount() > 0` (L2868) |

**Block 1.1.2.1** — OUTER LOOP: iterate over option service contracts (L2871-2897)
> For each option service contract, check if it exists in the option channel info list. If not found, remove it.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `i = 0; i < op_svc_kei_list.getCount(); i++` (L2871) |
| 2 | SET | `opSvcKeiInfo = op_svc_kei_list.getDataBean(i)` // Get current option service row |
| 3 | CALL | `opSvcCd = opSvcKeiInfo.sendMessageString(KKW02301SFConst.OP_SVC_CD_01, X31CWebConst.DATABEAN_GET_VALUE)` // [-> "オプションサービスコード" (Option Service Code)] (L2876) |
| 4 | SET | `listDelFlg = true` // TRUE means delete (L2879) |

**Block 1.1.2.1.1** — INNER LOOP: check against option channel info (L2881-2889)
> Compare the option service code against each channel info entry.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `j = 0; j < ekk0821b001cbsmsg1list.getCount(); j++` (L2881) |
| 2 | SET | `opChannelInfo = ekk0821b001cbsmsg1list.getDataBean(j)` |
| 3 | CALL | `opChannelSvcCd = opChannelInfo.sendMessageString(KKW02301SFConst.OP_SVC_CD_11, X31CWebConst.DATABEAN_GET_VALUE)` // Get channel option service code |
| 4 | IF | `opSvcCd.equals(opChannelSvcCd)` (L2884) |

**Block 1.1.2.1.1.1** — Match found: keep this row (L2885-2887)
> The option service code matches a channel info entry — do not delete.

| # | Type | Code |
|---|------|------|
| 1 | SET | `listDelFlg = false` // Mark as NOT to delete (L2885) |
| 2 | EXEC | `break` // Exit inner loop (L2886) |

**Block 1.1.2.1.2** — ELSE: row does not match any channel (L2890-2896)
> No match found in channel info — remove this row from the list.

| # | Type | Code |
|---|------|------|
| 1 | IF | `listDelFlg` is true (L2890) |
| 2 | CALL | `op_svc_kei_list.remove(i)` // Remove row from list [-> "オプションサービス契約" (Option Service Contract)] (L2894) |
| 3 | COMMENT | // "Remove from list" — 一覧から削除 (L2893) |

**Block 2** — MAIN LOOP: prepare display data for each option service contract (L2900-2999)
> Iterate over all remaining option service contracts and set display fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `listCount = op_svc_kei_list.getCount()` (L2900) |
| 2 | FOR | `i = 0; i < listCount; i++` (L2901) |
| 3 | SET | `subbean = null` (L2902) |
| 4 | CALL | `subbean = op_svc_kei_list.getDataBean(i)` (L2903) |
| 5 | SET | `ymd = "99991231"` // Default value (L2905) |
| 6 | CALL | `op_svc_kei_stat = subbean.sendMessageString(KKW02301SFConst.OP_SVC_KEI_STAT_01, X31CWebConst.DATABEAN_GET_VALUE)` // [-> "オプションサービス契約ステータス"] (L2907) |

**Block 2.1** — IF `(stat == 010 OR 020 OR 030)` [Active/In-Application/Under-Contract] (L2908-2944)
> For active status contracts, determine the display service start date based on status and star channel code.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_010.equals(stat) OR SVC_KEI_STAT_020.equals(stat) OR SVC_KEI_STAT_030.equals(stat)` [SVC_KEI_STAT_010="010", SVC_KEI_STAT_020="020", SVC_KEI_STAT_030="030"] (L2908-2911) |
| 2 | CALL | `ymd = subbean.sendMessageString(KKW02301SFConst.DSP_SVCTK_STAYMD_01, X31CWebConst.DATABEAN_SET_VALUE)` // [-> "表示用サービス提供開始年月日"] (L2921) |
| 3 | CALL | `opSvcCd = subbean.sendMessageString(KKW02301SFConst.OP_SVC_CD_01, X31CWebConst.DATABEAN_GET_VALUE)` (L2925) |

**Block 2.1.1** — IF `(opSvcCd is Star Channel)` (L2927-2933)
> When the option service code is a Star Channel subscription type, use the service start date preference (requested start date) as the display date.

| # | Type | Code |
|---|------|------|
| 1 | IF | `opSvcCd != null AND (opSvcCd == B034 OR B083 OR B104 OR B109)` [B034="Star Channel full-term", B083="Star Channel half-year", B104="Star Channel CP", B109="Star Channel Basic/Pas"] (L2927-2932) |
| 2 | CALL | `ymd = subbean.sendMessageString(KKW02301SFConst.SVC_USE_STA_KIBO_YMD_01, X31CWebConst.DATABEAN_GET_VALUE)` // [-> "サービス利用開始希望年月日"] (L2930) |
| 3 | COMMENT | // "Set service usage start preference date as start date" — サービス利用開始希望年月日を利用開始日とする (L2929) |

**Block 2.2** — ELSE: non-active status (L2936-2949)
> For contracts that are not in active/application/under-contract status, use a different date source.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | Non-active status branch (L2936) |
| 2 | CALL | `opSvcCd = subbean.sendMessageString(KKW02301SFConst.OP_SVC_CD_01, X31CWebConst.DATABEAN_GET_VALUE)` (L2940) |
| 3 | IF | `opSvcCd != null AND (opSvcCd == B034 OR B083 OR B104 OR B109)` (L2941-2945) |

**Block 2.2.1** — IF Star Channel in non-active status (L2946-2950)
> Use the service start datetime (TR display date) from the system.

| # | Type | Code |
|---|------|------|
| 1 | IF | `opSvcCd is Star Channel type` (L2946-2949) |
| 2 | CALL | `ymd = subbean.sendMessageString(KKW02301SFConst.SVC_STA_DTM_01, X31CWebConst.DATABEAN_GET_VALUE)` // [-> "サービス開始年月日時刻"] (L2949) |

**Block 2.2.2** — ELSE: non-Star Channel in non-active status (L2952-2958)
> Use the display service provision start date.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | Non-Star Channel branch (L2953) |
| 2 | CALL | `ymd = subbean.sendMessageString(KKW02301SFConst.DSP_SVCTK_STAYMD_01, X31CWebConst.DATABEAN_SET_VALUE)` // [-> "表示用サービス提供開始年月日"] (L2957) |

**Block 2.3** — Set display start date (L2961)
> Write the computed `ymd` value to the bean's use start date field.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `subbean.sendMessageString(KKW02301SFConst.USE_STA_YMD_01, X31CWebConst.DATABEAN_SET_VALUE, ymd)` // [-> "利用開始日"] |

**Block 2.4** — IF/ELSE `(row index even/odd)` — Row display flag (L2964-2970)
> Set alternating row display flag for visual striping (even rows = "1", odd rows = "2").

| # | Type | Code |
|---|------|------|
| 1 | IF | `i % 2 == 0` (L2964) |
| 2 | CALL | `subbean.sendMessageString(KKW02301SFConst.GYO_DISP_FLG_01, X31CWebConst.DATABEAN_SET_VALUE, "1")` // [-> "行表示フラグ", "Even row = 1"] (L2965) |
| 3 | ELSE | `i % 2 != 0` (L2968) |
| 4 | CALL | `subbean.sendMessageString(KKW02301SFConst.GYO_DISP_FLG_01, X31CWebConst.DATABEAN_SET_VALUE, "2")` // "Odd row = 2" (L2969) |

**Block 2.5** — Check service end date (L2973-2979)
> If the service end date equals the sentinel value `20991231`, clear it to empty string for display (means "no end date").

| # | Type | Code |
|---|------|------|
| 1 | CALL | `svcEndYmd = subbean.sendMessageString(KKW02301SFConst.SVC_END_DTM_01, X31CWebConst.DATABEAN_GET_VALUE)` // [-> "サービス終了年月日時刻"] |
| 2 | IF | `JKKCommonConst.MAX_YMD.equals(svcEndYmd)` [MAX_YMD="20991231"] (L2977) |
| 3 | COMMENT | // "If end date is maximum, don't display" — 終了年月日が最大の場合は、表示しない (L2975) |
| 4 | CALL | `subbean.sendMessageString(KKW02301SFConst.SVC_END_DTM_01, X31CWebConst.DATABEAN_SET_VALUE, "")` // Clear to empty string (L2978) |

**Block 3** — IF/ELSE `(listCount > 0)` — Initial selection logic (L2982-3043)
> Set the default row selection: default to row 0, or find the matching inherited option service contract number from a previous selection.

| # | Type | Code |
|---|------|------|
| 1 | IF | `listCount > 0` (L2982) |

**Block 3.1** — Set default selection to row 0 (L2984)
> Set the initial selected row to the first item.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `paramBean[0].sendMessageString(KKW02301SFConst.OP_SVC_KEI_SEL, X31CWebConst.DATABEAN_SET_VALUE, "0")` // [-> "オプションサービス契約選択値"] (L2984) |
| 2 | COMMENT | // "Initial selection" — 初期選択 (L2983) |

**Block 3.2** — Get customer inheritance list (L2989-2998)
> Retrieve inherited customer contract data to find a prior option service contract number.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `custKeiHktgiList = paramBean[0].getDataBeanArray(KKW02301SFConst.CUST_KEI_HKTGI_LIST)` // [-> "顧客契約引継リスト"] |
| 2 | CALL | `custKeiHktgiInf = custKeiHktgiList.getDataBean(0)` |
| 3 | SET | `subbean = null` (L3003) |
| 4 | CALL | `opHktgCnt = custKeiHktgiInf.sendMessage(KKW02301SFConst.OP_SVC_KEI_NO_03, X31CWebConst.DATABEAN_GET_COUNT)` // [-> "オプションサービス契約番号"] (L3006) |

**Block 3.3** — IF `(opHktgCnt > 0)` — Find inherited contract (L3008-3035)
> When there is an inherited option service contract number, find the matching row and select it.

| # | Type | Code |
|---|------|------|
| 1 | IF | `opHktgCnt > 0` (L3008) |
| 2 | CALL | `opSvcKeiNo = custKeiHktgiInf.sendMessageString(KKW02301SFConst.OP_SVC_KEI_NO_03, X31CWebConst.DATABEAN_GET_VALUE, "0")` // Get inherited option service contract number |

**Block 3.3.1** — Loop to find matching row (L3013-3034)
> Search through the option service list to find the row matching the inherited number.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `cnt = 0; cnt < op_svc_kei_list.getCount(); cnt++` (L3013) |
| 2 | SET | `subbean = op_svc_kei_list.getDataBean(cnt)` |
| 3 | CALL | `nowOpSvcKeiNo = subbean.sendMessageString(KKW02301SFConst.OP_SVC_KEI_NO_01, X31CWebConst.DATABEAN_GET_VALUE)` // [-> "オプションサービス契約番号"] |
| 4 | IF | `opSvcKeiNo.equals(nowOpSvcKeiNo)` (L3019) |

**Block 3.3.1.1** — Match found: select this row (L3021-3023)
> The option service contract numbers match — set this as the selected row and break.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean[0].sendMessageString(KKW02301SFConst.OP_SVC_KEI_SEL, X31CWebConst.DATABEAN_SET_VALUE, String.valueOf(cnt))` // Select row at index cnt (L3021) |
| 2 | COMMENT | // "If option service contract matches, recognize as selected row" — オプションサービス契約が一致する場合、選択行であると認識 (L3020) |
| 3 | EXEC | `break` (L3022) |

**Block 4** — ELSE: empty list (L3039-3043)
> When there are no option service contracts, clear the selection value to empty.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | `listCount == 0` (L3039) |
| 2 | COMMENT | // "List is empty, set selection position to empty" — リストが無いので選択位置を()にする (L3040) |
| 3 | CALL | `paramBean[0].sendMessageString(KKW02301SFConst.OP_SVC_KEI_SEL, X31CWebConst.DATABEAN_SET_VALUE, "")` // Set selection to empty string (L3042) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `op_svc_kei_list` | Field | Option Service Contract List — the list of option service contracts displayed on the screen |
| `opc_svc_kei_stat_01` | Field | Option Service Contract Status — status code of the option service contract |
| `OP_SVC_CD_01` | Field | Option Service Code — the code identifying a specific option service |
| `OP_SVC_CD_11` | Field | Option Channel Service Code — the option service code used when matching against channel info |
| `OP_SVC_CD_STA_CHN_SET` | Field | Star Channel full-term (1-year) subscription option service code |
| `OP_SVC_CD_STA_CHN_HALF_YEAR` | Field | Star Channel half-year subscription option service code |
| `OP_SVC_CD_STA_CHN_CP` | Field | Star Channel Carrier Partner subscription option service code |
| `OP_SVC_CD_STA_CHN_BS_PAS` | Field | Star Channel Basic/Pass subscription option service code |
| `DSP_SVCTK_STAYMD_01` | Field | Display service provision start date — the date shown on screen for when service begins |
| `SVC_USE_STA_KIBO_YMD_01` | Field | Service usage start preference date — customer's requested start date |
| `SVC_STA_DTM_01` | Field | Service start datetime — the system's actual service start date/time |
| `USE_STA_YMD_01` | Field | Usage start date — the final computed display date for service start |
| `GYO_DISP_FLG_01` | Field | Row display flag — alternating "1"/"2" for visual row striping |
| `SVC_END_DTM_01` | Field | Service end datetime — the service end date/time |
| `OP_SVC_KEI_SEL` | Field | Option service contract selection value — the index of the currently selected row |
| `CUST_KEI_HKTGI_LIST` | Field | Customer contract inheritance list — carries over contract info from prior contracts |
| `OP_SVC_KEI_NO_03` | Field | Option service contract number in the customer inheritance list |
| `OP_SVC_KEI_NO_01` | Field | Option service contract number in the option service contract list |
| `EKK0821B001CBSMSG1LIST` | Field | EKK0821B001 CBS message 1 list — option channel information data from CBS |
| `svcCd` | Field | Service code — identifies the service type (e.g., "03" = TV) |
| CRW10601 | Screen ID | Return screen — the screen used for processing returns/cancellations |
| SVC_KEI_STAT_010 | Constant | "010" — Active / In-service contract status |
| SVC_KEI_STAT_020 | Constant | "020" — Under S-IF application status |
| SVC_KEI_STAT_030 | Constant | "030" — Under-contract (contracted) status |
| MAX_YMD | Constant | "20991231" — Sentinel date meaning "no end date" (displayed as empty) |
| TV | Business term | Television service — NHK and television broadcast contracts |
| Star Channel | Business term | Star Channel — K-Opticom's video-on-demand/subscription streaming service |
| CP | Business term | Carrier Partner — a third-party partner providing option services |
| OneStop | Architecture term | OneStop — K-Opticom's unified web application framework for service operations |
| OneStopDataBeanAccess | Technical term | Data bean access class in the OneStop framework for reading/writing screen data fields |
| OneStopDataBeanAccessArray | Technical term | Array of OneStopDataBeanAccess objects for iterating over list data |
