cancel
Showing results for 
Search instead for 
Did you mean: 

Disable popup dialog when I am going to create a new record in a list report

Santiago789
Explorer
0 Kudos

Hello experts, I want that when I press the create button in my list report, it goes directly to the object page to create the data there, in terms of annotations I do not have any fields that appear but the id always appears, however undo continue and the id is generated only with a sequential

<Annotation Term="Capabilities.InsertRestrictions">
<Record Type="Capabilities.InsertRestrictionsType">
<PropertyValue Property="RequiredProperties">
<Collection>
</Collection>
</PropertyValue>

 


</Record>
</Annotation>

 

Santiago789_0-1715672041783.png

Thx for any help

 

Best regards,

Santiago

View Entire Topic
MioYasutake
Active Contributor
0 Kudos

@Santiago789 

If you are using UUID as the key field, specify numbering:managed in the behavior definition as example below:

field ( readonly, numbering:managed ) KeyField1

 https://help.sap.com/docs/abap-cloud/abap-rap/internal-early-numbering

Santiago789
Explorer
0 Kudos
Thanks for the response, we are using sap cap in the backend, how would it be handled in this case?
MioYasutake
Active Contributor
0 Kudos
@Santiago789 For CAP, the easiest way is to use the UUID type for the ID.
Santiago789
Explorer
0 Kudos
@MioYasutake I also have a valid from field which is key, how could I manage it so that it does not appear in the reaction dialog from my cap service?
MioYasutake
Active Contributor
0 Kudos

@Santiago789

The workaround I found is as follows

1. In the data model, add `@cds.on.insert` annotation to the key field and specify an arbitrary value.

  key ID : Integer @cds.on.insert: 1;

If it is a timestamp field, you can use `@cds.on.insert: $now` and below step is not required.

2. Add an event hander for draft create and set the key field.

        this.before(['CREATE'], 'Books.drafts', async (req) => {
            req.data.ID = 100;           
        })