cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Elements consuming CDS view WITH PARAMETERS

former_member209088
Participant

I am going crazy here... I hope someone has an answer.

I have defined a CDS View with Parameters. A partial listing below. This view tests out fine in Eclipse.

When I use this View in FIORI ELEMENTS LIST REPORT, the parameters are ignored. The SelectionField annotation appears to only work as a Filter (based on other views tested without parameters)

Does anyone know how to Pass SelectionFields as a PARAMETER to a subview? I tried (p_gjahr: $projection.gjahr...), which is a syntax error. Or, is there some "parameter annotation" I am missing?

AGAIN: the CDS views work find in Eclipse, the CDS views are defined correctly...just the PARAMETERS appear to be ignored by the oData (or certainly ignored by Firoi Elements).

Note: I need Parameters to pass to a TABLE FUNCTION... so I need PARAMETERS.

Front-End Server: SAP_ABA 750.007 SAP_UI 751.002

ECC: SAP_ABA 750.009

Thanks,

Tim

Accepted Solutions (0)

Answers (4)

Answers (4)

vineela_p
Explorer
0 Kudos

Hi Timothy,

Did you get a solution for this query? Also how could we update Entity set for a smart table if the CDS view having parameters published as an odata?

Regards,

Vineela

former_member209088
Participant
0 Kudos

I did not. I "think" I see how now, but never got around to it, as I did what I needed to do with a zillion nested CDS views...

former_member209088
Participant
0 Kudos

So, I am not completely sure I fully understand what you have done above.

If I want to pass p_gjahr to the CDS view below.

First, I need to get GJAHR on the FioriElement Screen, which I think you have described above, and have shown how to pull this value out of an extension, and put it to variable vGjahr.

Second, I need to get that vGjahr passed to p_gjahr in the CDS Consumption view below. If I have vGJAHR, as described above, what would the binding below look like?.

oSmartTable.setTableBindingPath(??)

Sorry, I am new to the JS world, and not sure how the binding works regards populating the CDS parameter... Maybe you explained it, not understanding it really.

Thanks,

Tim

0 Kudos

Hi Timothy,

Did you manage to fill your CDS parameter from the Fiori Elements app?

torsten_bachmann
Discoverer
0 Kudos

Passing parameters is not yet supported using standard fiori elements functionality. You need to use extensions to pass parameters.

I found the solution idea hidden in the UI5 documentation under "Developing Apps with SAP Fiori Element -> List Report and Object Page -> Extending Generated List Reports and Object Pages -> Adding Custom Fields to the Smart Filter Bar"

You can fill a parameter in the exit "onBeforeRebindTableExtension". This extension is called before the list reports calls the odata service. In the exit you can remove filters, add further filter and also add parameters. Above example in the documentation uses a custom filter field to fill a field.

Passing parameter is done by replacing the url used to select the node data using "setTableBindingPath". Here the exit from my example:

						
sap.ui.controller("Test_Parameter.ext.controller.ListReportExt", {
	onBeforeRebindTableExtension: function(oEvent) {
		var oSmartTable = oEvent.getSource();	
		var oSmartFilterBar = this.byId(oSmartTable.getSmartFilterId());
		var vCategory;
		if (oSmartFilterBar instanceof sap.ui.comp.smartfilterbar.SmartFilterBar) {
			//Custom filter
			var oCustomControl = oSmartFilterBar.getControlByKey("readMode");
			if (oCustomControl instanceof sap.m.ComboBox) {
				vCategory = oCustomControl.getSelectedKey();
				switch (vCategory) {
					case "X":
--->						oSmartTable.setTableBindingPath("/MYNODE('" + vCategory + "')/Set");
						break;
					case "R":
						oSmartTable.setTableBindingPath("/MYNODE('" + vCategory + "')/Set");
						break;
					default:
						break;
				}
			}
		}
	}

snursalim
Participant
0 Kudos

Hi there,

I am able to add the custom field using the extension. However as in my CDS, I have defined several selection fields using annotations. The UI generated by the CDS annotation now doesn't work anymore. Which I suspect because Fiori Elements actually take the ParameterSet annotation (which is generated also by the OData publishing).

Is there any particular setup I need to do?