# 08. SAP SuccessFactors BTP 연동 ## 연동 아키텍처 ``` SAP SuccessFactors (HR Master) │ OData API ▼ SAP BTP Integration Suite (CPI) │ 필드 매핑 + 스케줄링 │ REST API (JSON) ▼ WTM Spring Boot POST /api/wtm/integration/hr/sync ``` ## 단계별 구현 | Phase | 방식 | 설명 | |-------|------|------| | **PH1-1** | Excel 파일 업로드 | SA가 SF Export 파일을 수동 업로드. BTP 불필요 | | **PH1-2** | BTP 배치 (일 1회) | SAP BTP CPI → WTM REST API 자동 호출 | | **PH2** | 실시간 이벤트 | SF Employee Events → BTP → WTM Webhook | ## HR Master Data 필드 매핑 (No.2) | SAP SuccessFactors | WTM 컬럼 | 설명 | |---------------------|----------|------| | personIdExternal | employee_number | 사번 (= 로그인 ID) | | firstName + lastName | full_name | 성명 | | email | email | 이메일 | | businessUnit | business_unit | 조직 LV1 | | division | division | 조직 LV2 | | department | department | 조직 LV3 | | customString1 | discipline_team | 조직 LV4 (Discipline/Team) | | customString2 | part | 조직 LV5 (Part) | | attendanceType | attendance_type | 근태 유형 | | jobCode | individual_job_code | 직무 코드 | ## Spring Boot 수신 API ```java @RestController @RequestMapping("/api/wtm/integration/hr") @PreAuthorize("hasRole('SYSTEM') or @wbx.check('USER', 'ADMIN')") public class HrIntegrationController { /** PH1-1: SA 수동 Excel 업로드 */ @PostMapping("/upload") public HrSyncResult uploadExcel(@RequestParam("file") MultipartFile file) { return hrSyncService.uploadFromExcel(file); } /** PH1-2: SAP BTP 자동 동기화 수신 */ @PostMapping("/sync") public HrSyncResult sync(@Valid @RequestBody HrSyncRequest request) { return hrSyncService.syncAll(request.employees()); } } public record HrSyncRequest( List employees, String syncSource, // "SAP_BTP" | "MANUAL_UPLOAD" LocalDateTime syncTime ) {} public record HrEmployeeDto( String employeeNumber, String fullName, String email, String businessUnit, String division, String department, String disciplineTeam, String part, String attendanceType, String individualJobCode, LocalDate startDate, LocalDate endDate, boolean isActive ) {} ``` ## P6 연동 (NF.14) > 물리적 I/F 없음 — 파일 기반만 - PM이 P6 Export Excel을 `/api/wtm/projects/{id}/wbs/upload`에 업로드 - PCM이 `/api/wtm/projects/{id}/wbs/versions/{ver}/approve`로 승인 - 월 1회 Snapshot 비교 (No.32) ## Cognite 연동 (NF.15, PH2) ``` Export 대상 (No.80): - Employee Dimension - Project Dimension - Canonical WBS Dimension - Time Fact Table - Mapping Version Metadata ``` ```java @GetMapping("/api/wtm/integration/cognite/export") @PreAuthorize("@wbx.check('INTEGRATION', 'EXPORT')") public CogniteExportData export(@RequestParam LocalDate from, @RequestParam LocalDate to) { return cogniteExportService.export(from, to); } ``` ## 사전 확보 사항 | 항목 | 제공 주체 | 마감 | |------|----------|------| | BTP 테넌트 접근 권한 | 한화시스템/SAP | W2 | | SF OData API 엔드포인트 + 인증 정보 | 한화시스템 | W2 | | 필드 매핑 확정 (SF → WTM) | 한화오션 + 아큐라 | W3 | | BTP CPI iFlow 개발 권한 | 한화시스템 | PH1-2 | | P6 WBS Export 샘플 파일 | 한화오션 | W1 | | Cognite Extractor 서버 접근 | 한화시스템 | PH2 |