Technical Articles
ABAP CDS : Concatenate 2 Properties to be displayed in Fiori elements value help/ app details
If you are reading this blog, you are well aware of ABAP CDS features and Fiori elements. If not, please visit :
Fiori Element wiki : https://wiki.scn.sap.com/wiki/display/Fiori/Fiori+elements
ABAP CDS : https://wiki.scn.sap.com/wiki/display/ABAP/CDS+-+Core+Data+Services
Once you are well aware of power of SAP S/4HANA, you can utilize readily available annotations to generate beautiful UIs with basic/ close to No knowledge of SAP UI5. But it is recommended to have a basic understanding of the flow of your data from backend to frontend.
Example here is taken from the system with SAP S/4HANA 1709 FPS02. UI Library 1.52 (You can find this from your Chrome network tools)
In most of the standard apps which are template based and released by SAP, check how they have achieved this functionality and you can implement the same in your customized reports.
Visit UI annotations page to go through all the list of annotations to be consumed in CDS.
For our requirement we are joining or concatenating 2 properties coming from your CDS. You can use @Semantics annotations to achieve below requirement. Let us take quick look on how to use it.
In your ABAP CDS, just add this annotation above your property.
say you want to join User id and User name field.
Idea is to display the user id and username in your value help of your selection fields. Our output for below code will be :
You can also add Search parameter on your property so that user can perform a search on both user id and the user name (if user id is not memorized)
@Search: {defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.8}
Now when you perform a search on your value help, you can easily search the values. Also both properties will be concatenated in the form Username(Userid) or e.g Tejas Chouhan (10242)
Thanks ! Happy coding 🙂