cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

RAP Application EMail Template CDS Data Source picks old value before save.

08-21-2026 8:27 AM
sh4il3sh Participant
193 views 3 comments
0 Likes
SAP Managed Tags
Subscribe

I have a RAP Read Only application with a button made with CDS Custom Entity.
This throws a popup with value help for user to pick a new departmentcode.

At the METHOD save_modified I am calling the email template created in SE80, the CDS view in email template is the Root CDS View which joins my custom table with sales tables.

The custom table has new departmentcode field which is getting updated.
How do I get the new departmentcode in email CDS instead of old departmentcode please?

0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

aravindhan2529
Participant
0 Likes

Hi @sh4il3sh ,

Yes, the email content can remain configurable through the Email Templates application, so future changes to the subject or email body can be made without changing the ABAP code.

The issue here is not the template itself. Since the email is being triggered from save_modified, the updated departmentcode is still in the RAP transactional buffer, while the email template CDS reads the persisted database value. Therefore, the CDS can return the old value.

I would suggest triggering the email after the RAP changes have been successfully saved, so that the CDS data source can read the latest value.

This way, the solution would be:

RAP update → save → email template → CDS → latest value

The email template can then remain completely configurable, without requiring ABAP changes when the customer wants to modify the email text.

SAP references:

 

 

Hope this helps.

Regards,

Aravindhan Chandran šŸŒæ

sravan_aleshwaram
Contributor
0 Likes

Hello @sh4il3sh 


The email template is likely reading data directly from the CDS view before the updated department code is committed to the database. In save_modified, the new value may exist only in the transactional buffer.

To get the new department code in the email:

Read the updated value from the RAP transactional buffer (entities) instead of the database.
Or trigger the email after successful save/commit so the CDS view reads the latest persisted data.
If using a CDS-based email template, ensure the updated record is committed before the template is generated.

Thanks,
Sravan

sh4il3sh
Participant
0 Likes
thanks for the reply, is there anyway I can pick it up from CDS views? Need the client to change templates in future without code change.