cancel
Showing results for 
Search instead for 
Did you mean: 

CDS, BOPF, Fiori Elements - Default Values on Create

mlewis
Explorer

Hi there

System: S/4 Hana 1809

I am creating a custom app using CDS/BOPF/Fiori Elements. All good so far, however, when the users Create a new record they would like certain fields to have default values. Is there a way to do this?

I noticed the BOPF Node API which has a Retrieve Default Values but the generated BOPF does not seem to allow a Node Default Class to be added.

Regards

Mark

Accepted Solutions (1)

Accepted Solutions (1)

maheshpalavalli
Active Contributor
0 Kudos

Hi Mark Lewis,

You can try using the determination. SAP help has a very similar example.

https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/1809.000/en-US/231469eabd9e44819ff8deb2...

As you are having 1809 I am thinking this is draft enabled scenario. If not convert it to draft enabled cds view as the above approach will not work for non draft.

Thanks,

Mahesh

mlewis
Explorer
0 Kudos

Thanks Mahesh

I thought these determinations were done Before Save and not at time of entry in UI. I'll check though and get back to you.

What I need is to be able to prepopulate fields in the UI at time of entry, so when the Create button is pressed the screen shows fields for entry with some values already filled.

Mark

mlewis
Explorer
0 Kudos

Hi Mahesh

The solution does indeed work for Draft enabled apps. Thank you.

Is there any solution for non draft apps?

Mark

maheshpalavalli
Active Contributor
0 Kudos

Hi Mark Lewis,

Yeah The determination is triggerd for draft (when changes are done on the draft version as it actually saves the draft data to db) and for the normal (I would say "Abnormal" :p) non draft scenario determination will work at the time of save.

I would suggest you to go for draft only even if it is a small app as it is very feature rich compared to non draft(the abnormal one). You can check the below blog introduction part which has help links as well.

https://blogs.sap.com/2019/01/09/abap-programming-model-for-sap-fiori-draft-based-for-non-guid-keys-...

Thanks,

Mahesh

Answers (0)