cancel
Showing results for 
Search instead for 
Did you mean: 

How to restrict number of column exposed by xsoData service at runtime

Former Member
0 Kudos

Hi All,

I have created one xsoData service over calculation view (imported one BW cube).

I want to expose few characteristics of cube and a key figure.

I want to decide this key figure at run time,means if i have say three key figures say quantity, cost and revenue apart of my characteristics.

when i run this service, i should be able to pass key figure name for which i want to see data.

Can i have a variable for column name for this purpose and how i can pass it its value ?

Please suggest.

Regards,

Rohit

Accepted Solutions (1)

Accepted Solutions (1)

ranjit_alapati
Participant
0 Kudos

Hi Rohit,

You can use $select option in the oData call to list down the columns/fields to be available in the result of Odata. The key figures would be aggregated by the rest of the dimensions mentioned in the $select.

Best Regards,

Ranjit

Former Member
0 Kudos

Hi Ranjit,

As per my knowledge, $Select can be used to filter out number of column from existing available columns.

Say there are 10 characteristics and 10 keyfigures in my calculation view.

Out of which i have exposed 3 chars and 3 KFs using 'WITH' keyword, for keyfigures i want to have one variable or placeholder in my xS ODATA  service whose value i want to pass from UI( through XS service URL).

So my service should fetch 3 Characteristics and a keyfigure say qty or cost or revenue.

Please let me know if anything is still not clear.

Regards,

Rohit

Answers (1)

Answers (1)

sreehari_vpillai
Active Contributor
0 Kudos

Hi Rohit,

That is not possible. You have to expose all the columns and you can filter out only using $select. XSODATA file can not take any other input parameters to restrict it. How ever, the query will be created dynamically only. So it will not affect the performance even if you expose all the columns in your XSODATA.

Sreehari

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Yes you can limit the number of columns exposed by the XSODATA service. Just use the WITH syntax to list the sub-set of the columns you wish to expose.  For example:

service namespace "sap.hana.democontent.epmNext"  {

   "sap.hana.democontent.epmNext.models::CV_SALESORDER_DYNAMIC_JOIN"

    as "SalesByRegion" with ("REGION", "TOTAL_SALES", "SALES", "SHARE_SALES")  

  keys generate local "ID"

    aggregates always; 

}

Former Member
0 Kudos

Hi Thomas,

Thanks for the reply.

I have already used to restrict the number of columns using 'WITH' keyword.

Say there are 10 characteristics and 10 keyfigures in my calculation view.

Out of which i have exposed 3 chars and 3 KFs using 'WITH' keyword, for keyfigures i want to have one variable or placeholder in my xS ODATA  service whose value i want to pass from UI( through XS service URL).

So my service should fetch 3 Characteristics and a keyfigure say qty or cost or revenue.

Please let me know if anything is still not clear.

Regards,

Rohit