Skip to content

Lesson 12 Practice — Consume the Support Issue BO with EML ​

In Lesson 11 Practice, you completed:

text
ZISSUE_###
    ↓
ZR_ISSUE_###
    ↓
Managed Behavior Definition
    ↓
ZBP_R_ISSUE_###

Now consume that Business Object from ABAP.

Create:

text
ZCL_ISSUE_EML_###

Your target architecture is:

text
ZCL_ISSUE_EML_###
        ↓
       EML
        ↓
ZR_ISSUE_###
        ↓
Managed RAP
        ↓
ZISSUE_###

This practice is intentionally more independent than the guided Reservation exercise.

Do not copy the Reservation class and simply rename identifiers.

Rebuild the transaction from the requirements.


Practice information ​

TimeAbout 3 hours
PrerequisiteLesson 12 teacher-led work
Business ObjectZR_ISSUE_###
ConsumerZCL_ISSUE_EML_###
PersistenceZISSUE_###
Main focusEML + transactional buffer

1. Verify your starting BO ​

Before writing EML, verify that these objects activate:

text
ZR_ISSUE_###
Behavior Definition for ZR_ISSUE_###
ZBP_R_ISSUE_###

Your BDEF should provide at least:

text
create
update
delete
managed UUID numbering
read-only UUID
read-only administrative fields
persistent table mapping
lock master
ETag master

If the BO does not activate, repair Lesson 11 first.


2. Create the EML consumer class ​

Create:

text
ZCL_ISSUE_EML_###

Implement:

text
IF_OO_ADT_CLASSRUN

Do not put this logic into:

text
ZBP_R_ISSUE_###

This class is an external BO consumer.


3. Write the architecture before the syntax ​

In your notes, complete:

text
ABAP consumer:
________________________

EML target root:
________________________

Entity alias:
________________________

Managed persistence:
________________________

Then explain what each arrow means:

text
Consumer → EML → BO → Persistence

4. Reserved practice Issue Numbers ​

Use:

text
93000001
93000002

Use them only for this Lesson 12 practice.

Your final result should leave:

text
93000001

persisted for inspection while:

text
93000002

is deleted through EML.


5. Make the exercise repeatable ​

A previous run may already contain one or both reserved Issue Numbers.

Build a safe reset.

Requirements:

  1. read the root CDS to discover UUIDs belonging to 93000001 or 93000002;
  2. if any exist, delete them through EML;
  3. inspect the cleanup FAILED and REPORTED responses;
  4. commit the cleanup only if the delete succeeded, and check the save responses and return code;
  5. do not use direct SQL DELETE against ZISSUE_###.

If deletion or its commit fails, output the responses, roll back, and stop the class before creating new data.

The read-only lookup may use ABAP SQL against:

text
ZR_ISSUE_###

The modification itself must use EML.


6. CREATE two Issues through EML ​

Use one:

text
MODIFY ENTITIES

create request to create two Issue instances.

Use %cid values such as:

text
ISSUE_A
ISSUE_B

Do not provide:

text
Uuid
administrative fields

RAP owns those technical values.


7. Required Issue A values ​

Use values equivalent to:

text
IssueNo:        93000001
Title:          EML practice issue A
Description:    Transaction buffer exercise
RequesterEmail: issue.a@example.com
Priority:       H
Status:         O
ReportedOn:     current system date
EstimatedCost:  80.00
CurrencyCode:   EUR

Adapt only if your own persistence uses a slightly different field definition.


8. Required Issue B values ​

Use values equivalent to:

text
IssueNo:        93000002
Title:          EML practice issue B
Description:    Delete exercise
RequesterEmail: issue.b@example.com
Priority:       M
Status:         O
ReportedOn:     current system date
EstimatedCost:  40.00
CurrencyCode:   EUR

9. Inspect CREATE responses ​

Request all three relevant response channels:

text
MAPPED
FAILED
REPORTED

Output them.

Then answer:

Why should MAPPED contain two Issue entries? ​

Why should the generated UUIDs already be available before COMMIT? ​

What would make you stop the lifecycle instead of continuing? ​


10. Retrieve the generated UUIDs safely ​

Do not assume the mapped table order unless you can prove it.

Locate the mapping for:

text
ISSUE_A
ISSUE_B

using %cid.

Save the generated UUIDs in normal variables such as:

text
uuid_a
uuid_b

Do not manually generate UUIDs.


11. READ Issue A before COMMIT ​

Before committing the create, use:

text
READ ENTITIES

with:

text
uuid_a

Read at least:

text
Uuid
IssueNo
Title
Priority
Status
EstimatedCost
CurrencyCode

Output the result.

Then explain:

What does this prove about the RAP transactional buffer? ​


12. Commit the creates ​

Use the long response form of:

text
COMMIT ENTITIES

for:

text
ZR_ISSUE_###

Retrieve:

text
FAILED
REPORTED

for the save phase.

Check:

text
sy-subrc

Capture it immediately after COMMIT ENTITIES, before console output or further operations. If it is nonzero or FAILED is not initial, output the responses, execute ROLLBACK ENTITIES, and stop. Apply this guard to every commit in the exercise.

Do not use sy-dbcnt as the RAP transaction result.


13. READ Issue A after COMMIT ​

Read all fields of Issue A.

Inspect:

text
IssueNo
Status
LocalCreatedBy
LocalCreatedAt
LocalLastChangedBy
LocalLastChangedAt
LastChangedAt

Compare this with your direct-SQL experience from Lesson 9.


14. First UPDATE — buffer only ​

Change Issue A from:

text
Status = O

to:

text
Status = I

Also change one ordinary business field, for example:

text
Description = Buffered update - rollback

Use:

text
MODIFY ENTITIES
UPDATE FIELDS

Do not commit.


15. READ the uncommitted update ​

Use EML to read Issue A again before commit.

Expected buffer state:

text
Status      = I
Description = Buffered update - rollback

Output the result.


16. Roll back the UPDATE ​

Use:

text
ROLLBACK ENTITIES

Then read Issue A again.

Expected state:

text
Status = O

and the original Description should be restored.

Document:

text
Before rollback:
After rollback:

17. Explain what rollback proved ​

Write a short explanation using all of these terms:

text
persistent state
transactional buffer
interaction phase
ROLLBACK ENTITIES

Do not describe rollback merely as:

text
undo

Explain what was undone and where it existed.


18. UPDATE again and commit ​

Repeat the update to:

text
Status = I

This time use a Description such as:

text
Updated through EML

Inspect:

text
FAILED
REPORTED

Then commit successfully.


19. Prove the committed UPDATE ​

Read Issue A again.

Expected:

text
IssueNo      = 93000001
Status       = I
Description  = Updated through EML

Inspect whether the last-change timestamp changed.


20. DELETE Issue B ​

Delete only:

text
uuid_b

through EML.

Do not delete by:

text
IssueNo

inside the actual EML delete request.

The technical BO key is the UUID.


21. Commit the DELETE ​

Use:

text
COMMIT ENTITIES

and inspect:

text
FAILED
REPORTED
sy-subrc

Do not continue silently if the delete fails.


22. READ the deleted key ​

Try to read:

text
uuid_b

through EML after the delete commit.

Record:

text
RESULT:
FAILED:

Explain how the read response indicates that the instance is no longer available.


23. Final READ of Issue A ​

Read all fields of:

text
uuid_a

Output the result.

This is the final surviving practice instance.


24. Verify with CDS Data Preview ​

Open:

text
ZR_ISSUE_###

Press:

text
F8

Verify:

text
93000001 exists
Status = I

Verify:

text
93000002 does not exist

25. Verify physical persistence ​

Open:

text
ZISSUE_###

Use:

text
Alt+F8

Compare:

text
CDS business-facing names

with:

text
physical table fields

Do not edit the row through table tools.


26. Response audit table ​

Complete this table from your actual run:

OperationMAPPEDFAILEDREPORTEDCommit?
CREATE two Issues
Buffered UPDATEn/aNo
Committed UPDATEn/aYes
DELETE Issue Bn/aYes

Do not write what you expected.

Record what your program actually returned.


27. Transaction-state audit ​

Complete:

text
State 1 — before CREATE
Issue A:
Issue B:

State 2 — after CREATE, before COMMIT
Issue A:
Issue B:

State 3 — after CREATE COMMIT
Issue A:
Issue B:

State 4 — after first UPDATE, before ROLLBACK
Issue A:

State 5 — after ROLLBACK
Issue A:

State 6 — after committed UPDATE
Issue A:

State 7 — after DELETE commit
Issue A:
Issue B:

This is more important than memorizing EML syntax.


28. Repair exercise A — wrong entity alias ​

Temporarily replace the correct alias with an incorrect entity name in one EML statement.

Run:

text
Ctrl+F2

Read the ADT error.

Restore the correct source.

Explain:

Where does the EML entity alias come from? ​


29. Repair exercise B — try to provide Uuid ​

Temporarily attempt to include:

text
Uuid

as a normal create field/value.

Observe the syntax/contract problem caused by the BDEF's managed read-only key.

Restore the correct create request.

Explain:

Which artifact made Uuid read-only and managed-numbered? ​


30. Repair exercise C — remove COMMIT ​

Temporarily reason through what would happen if you removed the commit after a successful modification.

Do not leave the final solution broken.

Explain:

Why is a successful MODIFY ENTITIES not the same thing as completing the RAP transaction? ​


31. Repair exercise D — use direct SQL UPDATE ​

Do not execute an unsafe write.

Instead, write down why this would be architecturally wrong:

abap
UPDATE zissue_###
  SET status = 'I'
  WHERE uuid = @uuid_a.

Your explanation must mention at least four RAP concerns that direct SQL could bypass.


32. IN LOCAL MODE check ​

Search your consumer class.

It should not contain:

text
IN LOCAL MODE

Explain why a normal external BO consumer should respect the BO contract rather than bypass parts of it.


33. Explain the managed UUID lifecycle ​

Complete:

text
Before CREATE request:
Consumer knows ____________________

During managed CREATE:
RAP generates ____________________

MAPPED connects:
____________________ to ____________________

After COMMIT:
The persistent technical key is ____________________

34. Explain interaction vs save phase ​

Using your own words, distinguish:

text
MODIFY ENTITIES responses

from:

text
COMMIT ENTITIES responses

Why might a future business rule allow the first step but reject the final save?

You do not need validation syntax yet.

That is Lesson 13.


35. Explain EML vs SQL ​

Write a short comparison:

text
ABAP SQL
→ operates on persistence/data sources

EML
→ operates on RAP Business Objects

Then explain why that distinction matters after business behavior exists.


36. Certification-style task ​

Without looking at the guided Reservation code, perform this mini-task:

Create one temporary Issue with EML, retrieve its generated UUID from MAPPED, read it before commit, roll back the transaction, and prove the Issue is not persisted.

Use a different Issue Number from:

text
93000001
93000002

Do not leave the temporary Issue behind.


37. Optional challenge — use BDEF-derived types explicitly ​

Instead of only inline VALUE #( ) expressions, declare one request table using a BDEF-derived type such as:

text
TYPE TABLE FOR CREATE

Populate it first.

Then pass it to the EML create request.

Compare the readability with the inline form.


38. Optional challenge — commit simulation research ​

SAP RAP also provides a commit simulation mode.

Research:

text
COMMIT ENTITIES IN SIMULATION MODE

Answer:

What does it trigger? ​

What does it deliberately not do? ​

Do not replace the main lesson's normal commit with simulation mode.


39. Submission checklist ​


40. End-of-practice model ​

You should now be able to explain this from memory:

text
ABAP consumer
    ↓
MODIFY ENTITIES
    ↓
MAPPED / FAILED / REPORTED
    ↓
RAP transactional buffer
    ↓
READ own changes
    ↓
COMMIT ENTITIES
or
ROLLBACK ENTITIES
    ↓
persistent state

If that model is clear, you are ready for business rules and RAP messages.