2 weeks ago
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>
Thx for any help
Best regards,
Santiago
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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;
})
User | Count |
---|---|
69 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.