EML Part 2: %cid, %cid_ref, MAPPED, FAILED and REPORTED
Preview · a free account unlocks the full lesson
Master the correlation and response side of EML: %cid and %cid ref for linking new instances, deep creates, MAPPED for final keys, FAILED with %fail-cause, and REPORTED messages — and how to evaluate them correctly.
In this lessonShow sectionsHide sections
Visual overview
Explanation
%cid names a new instance before it has a real key, while %cid_ref is used to refer back to that instance elsewhere in the same statement. After a MODIFY, MAPPED returns the new keys, FAILED carries a %fail-cause for anything that didn't work, and REPORTED carries the messages explaining why. A deep create lets you create a header together with its items in one MODIFY, and responses need to be evaluated both after MODIFY and after COMMIT.
Part 1 introduced the EML statements themselves. When you create several related instances at once, you need a way to refer to things that don't have keys yet, and afterward you need to know exactly what happened to each instance — that's the job of content IDs and the response parameters.
%cid gives a name to something that has no key yet. When you create an instance, its key may be assigned later by the business object — a UUID, a number range, or late numbering — so you can't refer to it by key within the same request. Instead you assign it a content ID, such as %cid = 'REQ1'. The value is your own choice, must be unique within that one request, and only lives for the duration of that request.
%cid_ref lets other operations in the same MODIFY refer back to that new instance. You might write CREATE BY \_Item … %cid_ref = 'REQ1' to create items for the request being created in the same statement — a deep create — or EXECUTE submit FROM VALUE #( ( %cid_ref = 'REQ1' ) ) to run an action on it, or UPDATE … %cid_ref = 'REQ1' to change it again. Each item inside %target also gets its own %cid so its key can later be found in MAPPED.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.