cancel
Showing results for 
Search instead for 
Did you mean: 

Primary Key update in RAP

0 Kudos

Hello All,

We have a requirement, where the CDS have 3 primary keys, out of which 2 keys will be entered by the user, and the 3rd primary key should be auto populated based on the 2 keys, that were entered by the user.

Consider in the Fiori app, user enters value as A and B for the first two primary keys, on clicking save, the third primary key should be auto-populated as A-B.

Is this possible? While checking the SAP help documentation, I see the concepts of UUID, late numbering, Early numbering concepts, but unable to find a way to achieve the above functionality.

Thanks,
Naga

Ramjee_korada
Active Contributor

Hi Naga,

Have you tried to use Adjust numbering concept?

It helps you to adjust key fields during save sequence.

Best wishes,

Ramjee Korada

0 Kudos

Hi Ramjee,

We are trying update the primary which is a character based one, so I guess the adjust numbering concept will not work in this scenario.

Thanks and Regards,

Naga

TamasFodor
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

We helped you to accept the answer, since there were no updates after few days. You can unaccept it anytime if you have further questions.

Kind regards,

Tamas

View Entire Topic
_4ndr3as_
Explorer
0 Kudos

Ciao Sunkara,

not sure, because I don't have deep knowledge, but did you check via the Behavior Definition and Determine logic?

determination get_key3 on save { field key1, key2; }<br>

The method get_key3 can be implemented in your behavior impl class.

METHOD get_key3.
READ ENTITIES OF ... IN LOCAL MODE
ENTITY ...
FIELDS ( ... )
WITH CORRESPONDING #( keys )
RESULT DATA(...).
....
ENDMETHOD.

Again no garantie on that.

Regards Andreas

0 Kudos

Thanks for the update.

I've tried this approach, but it didn't work for the primary keys. It worked for the non-primary keys.