This blog is about extending the Standard Fiori Elements based application using the Virtual Elements.
Business Scenario & Requirement Overview
Recently, I have requested to extend the Standard
Manage Billing Document app with additional filter as “Sales Document”.
Manage Billing Documents is Fiori Element’s based application, which navigates from Billing Document( List Report) to Billing Document detail ( Object Page).
Sales Document exist at Item Level in the Billing Document.
Challenges
- Sales Document (SO) number exist in the Billing Document Item.
- Needs to bring the Item Level field in the main filter bar (Selection Screen)
Technical Solution & design the solution
Step by Step Approach
Step1 : Identify the Main ODATA Service and Consumption CDS
Step 2 : Identify the Associated CDS from main consumption CDS
Step 3: Extend the Main CDS with required field.
Step 4: In the Extended CDS add the annotations for
UI Selection Field
End user Text Label
Virtual Element Annotations
@ObjectModel.virtualElement ,
@ObjectModel.filter.transformedBy: 'ABAP:ZCL_TESTKAM'
( Please refer my existing blog on virtual element for detail on Virtual Elements )
https://blogs.sap.com/2019/04/26/fiori-elements-utilizing-cds-with-virtual-elements/
Step 5: Implement the Exit Class for deriving data for virtual element
Implementation :
Based on the above Steps, lets us extend the
standard Manage Billing Document App
Identify the ODATA Service and Backend CDS Data Model, can just put F12 and get the information
ODATA Service: SD_CUSTOMER_INVOICES_MANAGE
Consumption CCDS: C_BillingDocument_F0797
Extend the main CDS field and add
the virtual Element as follows
Associated Entity detail for which field needs to be used
- Associated Entity – Item
- Associated Entity Field – SalesDocument
Implement the class with interface required for virtual Elements
- IF_SADL_EXIT_FILTER_TRANSFORM
That’s it, just run the application to see the new Sales Document Filter. enter the sales document number and press go.
Wow, we are done 😊 Lets clear the cache and see the app
Sales Document is available in filter bar 😊
So don’t wait to share your SAP findings and knowledge.
#KeepLearing#KeepGrowing
Regards,
Mohit Bansal