1. 생성객체
| 버튼 | 처리 내용 |
|---|---|
| 이수 처리 | Status = C, CompDate = sy-datum |
| 미이수 처리 | Status = N, CompDate = 00000000 |
| 신청 취소 | Status = X, CompDate = 00000000 |
상태 변경 시 기존에 구현한 ZEDU_LOG 로그 저장 로직도 함께 동작한다.
2. 사용한 기존 객체
기존 RAP Root와 Behavior Pool은 그대로 재사용했다.
| 객체 | 용도 |
|---|---|
ZR_ZEDU_ENROLL |
RAP Root View |
ZBP_R_ZEDU_ENROLL |
RAP Behavior Pool Class |
ZC_ZEDU_ENROLL_EDIT |
Fiori 수정/버튼용 Projection View |
ZUI_ZEDU_ENROLL_EDIT |
Fiori 수정용 Service Definition |
ZUI_ZEDU_ENROLL_EDIT_O4 |
OData V4 UI Service Binding |
3. ADT 작업 순서
1. ZR_ZEDU_ENROLL Behavior Definition에 Action 추가
2. ZC_ZEDU_ENROLL_EDIT Behavior Definition에 Action 사용 선언
3. ZBP_R_ZEDU_ENROLL Local Types에 Action Method 구현
4. ZC_ZEDU_ENROLL_EDIT CDS에 Action Button Annotation 추가
5. 관련 객체 Activate
6. Service Binding Activate / Publish 확인
7. Fiori Preview에서 버튼 테스트4. Root Behavior에 Action 추가
ZR_ZEDU_ENROLL Behavior Definition에 아래 Action을 추가했다.
action set_completed result [1] $self;
action set_not_completed result [1] $self;
action set_cancelled result [1] $self;최종 주요 구조는 아래와 같다.
managed implementation in class zbp_r_zedu_enroll unique;
define behavior for ZR_ZEDU_ENROLL alias Enrollment
persistent table zedu_enroll
lock master
{
update;
action set_completed result [1] $self;
action set_not_completed result [1] $self;
action set_cancelled result [1] $self;
determination save_log on modify { update; }
field ( readonly ) EnrollId;
field ( readonly ) CourseId;
field ( readonly ) EmpId;
field ( readonly ) EmpName;
field ( readonly ) DeptName;
field ( readonly ) ReqDate;
field ( readonly ) CreatedBy;
field ( readonly ) CreatedDate;
mapping for zedu_enroll
{
EnrollId = enroll_id;
CourseId = course_id;
EmpId = emp_id;
EmpName = emp_name;
DeptName = dept_name;
Status = status;
ReqDate = req_date;
CompDate = comp_date;
CreatedBy = created_by;
CreatedDate = created_date;
}
}5. Projection Behavior에 Action 노출
ZC_ZEDU_ENROLL_EDIT Behavior Definition에 Root Behavior의 Action을 사용할 수 있도록 선언했다.
projection;
define behavior for ZC_ZEDU_ENROLL_EDIT alias Enrollment
{
use update;
use action set_completed;
use action set_not_completed;
use action set_cancelled;
}6. Behavior Pool Class에 Action 구현
ZBP_R_ZEDU_ENROLL의 Local Types 탭에 Action Method를 구현했다.
METHOD set_completed.
MODIFY ENTITIES OF zr_zedu_enroll IN LOCAL MODE
ENTITY Enrollment
UPDATE FIELDS ( Status CompDate )
WITH VALUE #(
FOR key IN keys
(
%tky = key-%tky
Status = 'C'
CompDate = sy-datum
)
)
FAILED failed
REPORTED reported.
ENDMETHOD.METHOD set_not_completed.
MODIFY ENTITIES OF zr_zedu_enroll IN LOCAL MODE
ENTITY Enrollment
UPDATE FIELDS ( Status CompDate )
WITH VALUE #(
FOR key IN keys
(
%tky = key-%tky
Status = 'N'
CompDate = '00000000'
)
)
FAILED failed
REPORTED reported.
ENDMETHOD.METHOD set_cancelled.
MODIFY ENTITIES OF zr_zedu_enroll IN LOCAL MODE
ENTITY Enrollment
UPDATE FIELDS ( Status CompDate )
WITH VALUE #(
FOR key IN keys
(
%tky = key-%tky
Status = 'X'
CompDate = '00000000'
)
)
FAILED failed
REPORTED reported.
ENDMETHOD.7. Fiori 버튼 Annotation 추가
ZC_ZEDU_ENROLL_EDIT CDS의 EnrollId 필드에 Action 버튼 Annotation을 추가했다.
@UI.lineItem: [
{ position: 10, label: '신청ID' },
{ position: 100, type: #FOR_ACTION, dataAction: 'set_completed', label: '이수 처리' },
{ position: 110, type: #FOR_ACTION, dataAction: 'set_not_completed', label: '미이수 처리' },
{ position: 120, type: #FOR_ACTION, dataAction: 'set_cancelled', label: '신청 취소' }
]
@UI.identification: [
{ position: 10, label: '신청ID' },
{ position: 100, type: #FOR_ACTION, dataAction: 'set_completed', label: '이수 처리' },
{ position: 110, type: #FOR_ACTION, dataAction: 'set_not_completed', label: '미이수 처리' },
{ position: 120, type: #FOR_ACTION, dataAction: 'set_cancelled', label: '신청 취소' }
]
@UI.selectionField: [{ position: 10 }]
key EnrollId,상세 페이지 항목 표시를 위해 각 필드에 @UI.identification을 유지했다.
예시:
@UI.lineItem: [{ position: 20, label: '과정ID' }]
@UI.identification: [{ position: 20, label: '과정ID' }]
CourseId,8. 상세 페이지 항목 표시 설정
상세 화면은 @UI.identification 기준으로 표시된다.
목록 화면 컬럼 → @UI.lineItem
상세 화면 항목 → @UI.identification
상세 화면 섹션 → @UI.facet
Action 버튼 표시 → @UI.lineItem / @UI.identification 의 #FOR_ACTION@UI.facet은 첫 번째 필드 위에 배치했다.
@UI.facet: [
{
id: 'GeneralInfo',
purpose: #STANDARD,
type: #IDENTIFICATION_REFERENCE,
label: '교육 신청 정보',
position: 10
}
]
COMMENTS
댓글
GitHub 계정으로 로그인하면 댓글을 남길 수 있습니다.
댓글을 불러오는 중입니다.