Appearance
Lesson 18 Practice — Add Work Notes to the Support Issue BO
Your Support Issue application is currently a single-node draft-enabled RAP BO:
text
IssueExtend it to:
text
Issue
└── Work NotesA Work Note belongs to exactly one Issue.
The child must participate in:
text
managed behavior
draft
locking
authorization
DCL
projection
OData V4
Fiori Elements
EMLPractice information
| Time | About 3 hours |
| Prerequisite | Lesson 18 guided exercise |
| Root | ZR_ISSUE_### |
| Child active table | ZISSNOTE_### |
| Child CDS | ZR_ISSUE_NOTE_### |
| Child draft table | ZDISSNOTE_### |
| Child projection | ZC_ISSUE_NOTE_### |
| EML class | ZCL_ISSUE_COMP_### |
1. Target BO
Build:
text
Issue
└── Work NotesUse:
text
Issue
→ root
Work Note
→ childCardinality:
text
Issue 1
→
0..* Work Notes2. Create Child Persistence
Create:
text
ZISSNOTE_###Required fields:
text
client
note_uuid
issue_uuid
note_no
note_text
note_category
local_last_changed_atRecommended types:
text
client → ABAP client type
note_uuid → SYSUUID_X16
issue_uuid → SYSUUID_X16
note_no → NUMC(4)
note_text → CHAR(255)
note_category → CHAR(20)
local_last_changed_at → ABP_LOCINST_LASTCHANGE_TSTMPLTechnical key:
text
client + note_uuid3. Create the Child CDS Entity
Create:
text
ZR_ISSUE_NOTE_###Requirements:
text
define view entity
not root
select from ZISSNOTE_###
@AccessControl.authorizationCheck: #CHECK
association to parent ZR_ISSUE_###Expose:
text
_Note parent association
NoteUuid
IssueUuid
NoteNo
NoteText
NoteCategory
LocalLastChangedAtUse a sensible actual association name such as:
text
_Issue4. Model the To-Parent Association
Use the child:
text
IssueUuidto identify the root Issue key.
The ON condition must cover the complete root key.
Expose the association exactly once in the child select list.
5. Add Composition to the Issue Root
Modify:
text
ZR_ISSUE_###Add:
text
composition [0..*]to:
text
ZR_ISSUE_NOTE_###Use an association name such as:
text
_NotesExpose _Notes in the root select list.
6. Protect Child Reads
Create Access Control for:
text
ZR_ISSUE_NOTE_###Use the parent Issue's:
text
ResponsibleUserthrough the to-parent association.
Required read rule:
text
parent ResponsibleUser
=
current userDo not hard-code a user ID.
Base Behavior
7. Create-Enable the Composition
In the Issue root behavior add:
text
association _Noteswith:
text
create
with draftThe child must be created through the parent.
8. Add Child Behavior
Add another define behavior block in the same base BDEF.
Requirements:
text
persistent table = ZISSNOTE_###
draft table = ZDISSNOTE_###
lock dependent by parent
authorization dependent by parent
ETag master = LocalLastChangedAt
update
delete
managed numbering for NoteUuid
IssueUuid read-only
NoteNo mandatory on create
NoteNo read-only on update
parent association with draft
complete persistence mappingDo not add normal:
abap
create;to the child.
9. Generate Child Draft Table
Place the cursor on:
text
ZDISSNOTE_###Use:
text
Ctrl+1Generate the draft table.
Activate it.
Do not manually maintain the draft administration fields.
10. Activate the Base Composition
Activate:
text
ZISSNOTE_###
ZR_ISSUE_NOTE_###
child Access Control
modified ZR_ISSUE_###
ZDISSNOTE_###
modified base BDEF
related behavior artifactsDo not proceed until the base BO activates cleanly.
EML Composition Challenge
11. Create ZCL_ISSUE_COMP_###
Implement:
text
IF_OO_ADT_CLASSRUNRules:
text
external EML consumer
no IN LOCAL MODE
no direct SQL writes12. Find an Owned Issue
Use a protected read against:
text
ZR_ISSUE_###Find one Issue owned by the current user.
Use an existing practice Issue if available.
Store its:
text
Uuid13. Create a Work Note by Association
Use:
text
CREATE BY \_NotesCreate:
text
NoteNo = 0001
NoteText = Initial troubleshooting note
NoteCategory = TECHNICALDo not supply:
text
NoteUuid
IssueUuidInspect:
text
MAPPED
FAILED
REPORTED14. Prove Managed Child Numbering
From:
text
MAPPEDretrieve the generated:
text
NoteUuidassociated with your child %cid.
The consumer must not generate the UUID itself.
15. Commit the Child
Use:
text
COMMIT ENTITIESwith response handling.
Verify:
text
Work Note persisted
parent Issue unchanged except BO-wide change metadata16. Read by Association
Use EML to read:
text
Issue
BY \_NotesRequest:
text
RESULT
LINK
FAILEDOutput the returned Work Notes.
17. Explain LINK
Use your runtime result to identify:
text
source Issue key
→
target Work Note keyDo not infer the relationship from internal-table ordering.
Deep Create Challenge
18. Create an Issue and Two Notes Together
Create:
text
one new Issue
two Work Notesinside one:
text
MODIFY ENTITIESRequirements:
text
root %cid
CREATE BY \_Notes
child %cid_ref
child %target
two child %cid valuesDo not split the operation just to obtain the root UUID.
19. Deep Create Evidence
Before commit inspect:
text
MAPPED root component
MAPPED note component
FAILED
REPORTEDAfter commit verify:
text
one Issue
two related Work NotesProjection Layer
20. Create Child Projection
Create:
text
ZC_ISSUE_NOTE_###Requirements:
text
projection on ZR_ISSUE_NOTE_###
#CHECK
metadata extensions enabled
all Work Note fields projected
parent association redirected to ZC_ISSUE_###Use:
text
redirected to parent21. Redirect Root Composition
Modify:
text
ZC_ISSUE_###Expose:
text
_Notesand redirect it to:
text
ZC_ISSUE_NOTE_###Use:
text
redirected to composition child22. Protect Projection Child Reads
Create Access Control for:
text
ZC_ISSUE_NOTE_###Inherit access conditions from:
text
ZR_ISSUE_NOTE_###Do not repeat the same ownership expression manually.
Projection Behavior
23. Extend the Root Projection BDEF
Expose:
text
_Noteswith:
text
create
with draft24. Add Child Projection Behavior
Add behavior for:
text
ZC_ISSUE_NOTE_###Expose:
text
use etag
use update
use delete
use association parent with draftDo not use:
text
use createfor the child.
Service and UI
25. Add Work Notes to the Service
Modify:
text
ZUI_ISSUE_###Expose:
text
ZC_ISSUE_NOTE_###with alias:
text
WorkNotesKeep the existing OData V4 UI Service Binding.
Reload it after activation.
26. Add the Work Notes Facet
Modify the root Issue metadata.
Add a facet:
text
type = #LINEITEM_REFERENCE
targetElement = _Notes
label = Work NotesChoose a sensible position after the main Issue details.
27. Create Child Metadata
Create Metadata Extension for:
text
ZC_ISSUE_NOTE_###Add line-item metadata for:
text
NoteNo
NoteText
NoteCategoryFiori Draft Runtime
28. Create a Draft Work Note
Open an owned Issue.
Choose:
text
EditCreate one Work Note in the child facet.
Before Save verify:
text
ZISSNOTE_###
→ no new active row
ZDISSNOTE_###
→ draft Work Note exists29. Save the Composition Tree
Choose:
text
SaveExpected:
text
Issue draft activates
Work Note draft activates
active Work Note appears
draft Work Note disappears30. Discard a Child Modification
Edit the Issue again.
Change or delete the Work Note.
Before Save, inspect active and draft state.
Choose:
text
Cancel / DiscardExpected:
text
active Work Note unchanged
draft modification removed31. Verify the Root Total ETag
Capture the Issue root:
text
LastChangedAtChange and save only a Work Note.
Read:
text
LastChangedAtagain.
Expected:
text
root total ETag changedRepair Tasks
32. Wrong Relationship Type
Temporarily reason about replacing:
text
compositionwith:
text
associationRestore the composition.
Identify the whole–part semantics that would be lost.
33. Missing To-Parent Association
Break the child:
text
association to parentRun syntax check.
Restore the direct parent relationship.
34. Incorrect Child Create
Try to reason about adding:
abap
create;to the managed child.
Restore the correct model:
text
create through root association35. Missing Lock Dependency
Break:
text
lock dependent byRepair it.
Identify the actual lock master.
36. Missing Authorization Dependency
Break:
text
authorization dependent byRepair it.
Identify the actual authorization master.
37. Missing Draft Association
Remove:
text
with draftfrom one side of the behavior relationship.
Restore it.
Explain why active/draft navigation must remain state-consistent.
38. Projection Not Redirected
Remove one:
text
redirected to parentor:
text
redirected to composition childstatement.
Repair the projection hierarchy.
39. Child Missing from Service
Remove:
text
WorkNotesfrom the Service Definition.
Reload the service binding.
Restore the child exposure.
Submission Checklist
40. Checklist
41. End-of-Practice Model
You should now be able to implement:
text
Issue
│
│ composition
↓
Work Notethrough all RAP layers:
text
persistence
CDS composition
to-parent association
base behavior
create by association
lock dependency
authorization dependency
draft
projection redirection
OData service
Fiori child facet
EML deep createThat is the core pattern for a managed multi-node RAP Business Object.