cancel
Showing results for 
Search instead for 
Did you mean: 

CDS View Modification

former_member214928
Participant
0 Kudos

Hello Experts,

We have a requirement to filter/restrict the Sales Order/Quotation based on user default plant.

In the standard CDS view C_SALESORDERWL_F1873 we do not have the option to filter based on plant.

So how can we achieve this in CDS view extension to restrict the result set based on user plant. This user plant will be enhanced at FIORI app side and passed from Manage Sales Order and Sales Quotation app.

I'm new to CDS, please let me know your inputs.

Accepted Solutions (0)

Answers (2)

Answers (2)

Sean_Zhang
Product and Topic Expert
Product and Topic Expert
0 Kudos

I think you're trying to say passed to, not from, right?

"This user plant will be enhanced at FIORI app side and passed from Manage Sales Order and Sales Quotation app."

If YES, then did you want to get the filtered list from the UI?

IF NO, then did you want to the filtered list from the CDS?

I don't think you could reach this by standard CDS extension(maybe, I didn't get the extension point you meant ), how about create your own CDS view if you just want to filter the value?

former_member214928
Participant
0 Kudos

I agree that filtering is not possible by CDS extension.

Creating an own CDS is last option(can be done anytime).We are checking if this can be achieved just by modification.

Yes we want to have the plant values from UI and then pass it to our CDS view to filter records based on that value

anup_deshmukh4
Active Contributor
0 Kudos

You can also check the possibility of filtering out the data in DPC_EXT classes of the Odata service if that helps .

former_member214928
Participant
0 Kudos

We already have the logic in place there, but due to growing list feature for List Control it's not rendering further data as we are deleting records from the available return set (25 entries).

Hence we wanted it to filter out from the query level (CDS) itself.

Sean_Zhang
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

let me summarize my understanding, you would like to directly reuse the CDS like C_SALESORDERWL_F1873 not the OData, not the UI, but you would like to add a filter: Plant in the CDS, and the filter will get a default value by some logic.

Firstly, if Plant is not available in the C_SALESORDERWL_F1873, which you want to directly use, then I don't think it's a feasible way.

In order to extend CDS, official ways are here:

https://help.sap.com/viewer/f2e545608079437ab165c105649b89db/7.51.1/en-US/cff20dc5b0994f2aaba9d8991c...

Then you might ask, the plant field could be introduced by the extension.

Yes, it's possible to introduce field by extension. but it would not possible to have a filter taken effect directly, because, the filter would need some kind of inner join logic to take effect(the words might not precise).

Then, maybe build your own view might be the only way, if my previous assumption is correct.

And I have additional information for you(which might not help your problem, maybe some hints for you), there is some way to have default value by annotation. but the filter will not take influence in direct access from your ABAP code(if you want to consume it in your own ABAP code).

Consumption.defaultValue

https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/7.51.1/en-US/d60c0bf6798a481fb7412bc899...

former_member214928
Participant
0 Kudos

I agree with what you have said and understood. I am able to add fields via extension but as you said we can't filter it out there as it would require inner logic to work.

Then we are left with building own CDS view as said.

Thanks for your support..much appreciated.

anup_deshmukh4
Active Contributor
0 Kudos

Hello Rahul ,

Just giving a wild thought

For the consumption view C_SALESORDERWL_F1873 is there any DCL ( data control language ) associated ( please check for annotation for authorization in C_SALESORDERWL_F1873 ) if yes....please navigate to the DCL and check the authorization object used in DCL and check if the data can be controlled via authorization object .

please check the below link for details

Blog Link

Hope this helps ,

Anup D

former_member214928
Participant
0 Kudos

Hello Anup,

Thanks for your reply. I can see Access Control for the CDS view, but unfortunately we do not have PLANT field through which we need control the data.

anup_deshmukh4
Active Contributor
0 Kudos

ooh Okay,

Option of modifying ( adding palnt with a custom authorization object )DCL can be considered instead of changing the actual CDS . any ways the outcome would be same but insted of hard filter you will have a better control

Changing CDS might affect all the Odata services where CDS it is referred .

Hope this helps,

Anup D

former_member214928
Participant
0 Kudos

Yes changing the CDS would be a big problem. we won't be assigning a custom DCL.

Anyways thanks for your inputs.