Step by Step to create Fiori Application through SmartTemplate + WebIDE
- 1. Create CDS view based on sample database table spfli and scarr
- 2. Use tcode /IWFND/MAINT_SERVICE to finish OData service registration
- 3. Create UI5 application using Wizard in WebIDE
- Build a Productive Fiori application in CRM Service area
1. Create CDS view based on sample database table spfli and scarr
Create two CDS views in ABAP development studio. The source code for both are listed below. You just need to copy them into studio and click activate button.
@AbapCatalog.sqlViewName: 'zjerrySQL0309'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'test 20160309'
@ObjectModel: {
createEnabled,
deleteEnabled,
updateEnabled
}
define view Zjerrytest20160309
as select from spfli association [0..1] to scarr as _scarr
on _scarr.carrid = spfli.carrid {
key spfli.carrid,
key _scarr.carrname,
key spfli.connid,
spfli.cityfrom,
spfli.cityto
}
@AbapCatalog.sqlViewName: 'z20160316'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'test odata publish '
@OData.publish: true
@ObjectModel: {
type: #CONSUMPTION,
compositionRoot,
semanticKey: ['Actor'],
createEnabled,
deleteEnabled,
updateEnabled
}
define view Zjerrytest20160316 as select from Zjerrytest20160309 {
@UI.lineItem : [{position:10}]
key Zjerrytest20160309.carrid as Jerryid,
@UI.lineItem : [{position:20}]
key Zjerrytest20160309.carrname as name,
@UI.lineItem : [{position:30}]
key Zjerrytest20160309.cityfrom as startLocation,
@UI.lineItem : [{position:40}]
key Zjerrytest20160309.cityto as target,
@UI.lineItem : [{position:50}]
key Zjerrytest20160309.connid
}
Once activated, there is a hint in studio to tell you the automatically published OData service name, and then tcode for service registration.
2. Use tcode /IWFND/MAINT_SERVICE to finish OData service registration
Specify System Alias = LOCAL and search using the CDS name you get from step1, select the search result and click “Add Selected Services”:
Once added, click “SAP Gateway Client” to test whether the OData service works:
Make sure the metadata request returns 200 success code.
3. Create UI5 application using Wizard in WebIDE
Open WebIDE, File->New->Project from Template, choose Smart Template Application and next:
Select the destination for your backend where CDS view is created, and locate your OData service created just now:
The annotation file is automatically identified, just click Next button:
Choose OData Collection from drop down list and click Finish button:
Once created, the project looks like below. Choose Component.js and click Run button in WebIDE Toolbar:
From rendered application you could see the table is now filled with data fetched from CDS view:
Build a Productive Fiori application in CRM Service area
Would you like to use the introduced technology to build a more complicated and productive Fiori application in CRM Service area? Then follow the steps in this blog Create a CRM Service Order Fiori application within a couple of minutes .
This is splendid.
How did you check this method?
Thanks for the blog but just wondering what ABAP version you need for those CDS tags. I don't think they are available in a 7.40 based system..?
Hi Jason,
I am working on a NW 7.50 system:
And all UI annotation are also documented with a prefix saphelp_nw75: http://help.sap.com/saphelp_nw75/helpdata/en/f8/af07bb0770414bb38a25cae29a12e9/content.htm?frameset=/en/d9/bc687d35fa42ccbb0b9256ce786d51/frameset.htm¤t_toc=/en/d9/bc687d35fa42ccbb0b9256ce786d51/plain.htm&node_id=77
So I think you are right, those annotation are not available in NW7.40.
Best regards,
Jerry
Hello Jerry,
When I just went through this process everything was OK right up to the point where the SAP Web IDE tried to find the annotations file. It could not, and though one can bypass this step it sorts of defeats the purpose.
In your example above the annotation file ends in "VAN".
I presume this should be created when the CDS view is activated. Do you know how to tell if such a file has in fact been activated? Is that file linked to the SEGW service somehow, so the SAP Web IDE can work backwards and look for it?
Moreover, let us say a CDS view gets activated with a certain set (or no) annotations. Then you go into Eclipse, and add some more annotations. I presume the annotation file and SEGW service gets updated?
The reason I am worried, is I changed the end user title of the CDS view (which lives in an annotation) and the activated the view again, but the tile in the SEGW service did not change.
Do you have to delete the service, and then it gets recreate again when you re-activate the CDS view?
Cheersy Cheers
Paul