cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

EKEYTYPE: The key argument has to be of type `string` or `number`. Found: `undefined` in CAP.

Boopalan
Explorer
1,459

Hi Experts!

GoodDay!

This issue was raised in between the development (when adding attachment feature to my CAP application – used @cap-js/sdm library as mentioned in CAPIRE documentation)

Below is the structure of my header and attachment entity.

InvoiceHeader – Entity

Boopalan_0-1730193033591.png

Attachment – Entity

Boopalan_1-1730193033592.png

I’ve implemented a custom handler for InvoiceHeader entity on Update event.

Boopalan_2-1730193033594.png

I’m running my application in a hybrid mode and I’m opening my annotated UI application (built using FPM). When trying to edit a record and saving it showing me the below error.

             EKEYTYPE: The key argument has to be of type `string` or `number`. Found: `undefined`

Boopalan_3-1730193094690.png

When I’m debugging it, the error was coming from the SELECT statement (which was working previously) line no.103 like in the below screenshot. However the query executed successfully where you can see the result in aHeaders variable.

Boopalan_4-1730193094697.png

I’m sure “ID” is the only key for InvoiceHeader Entity and the value is coming via “req.data.ID” parameter.

I’m trying to figure it out, I’m not sure where I’m lagging.

Help me to resolve this issue.

Thanks in Advance!!

Best Regards

Boopalan M

SAP Business Application Studio , SAP Cloud Application Programming Model ,

SAP HANA Cloud , SAP HANA Cloud, SAP HANA database 

View Entire Topic
catano
Active Participant
0 Kudos

Hi @Boopalan ,

Have you tried the complete configuration as described in the documentation?

I just tried the setup you described. I received the same error message you do by just adding the npm library and extending the model with the extra attachments field.
In debug I see, that the referenced id in the error message is the repository id of the sdm repository (SAP Document Management).
I added the following configuration to the package.json:

"sdm": {
   "settings": {
   "repositoryId": "<repository-Id>"
   }
}

and I stopped getting the error message.

Regards,
Peter

pedro_iranzo
Product and Topic Expert
Product and Topic Expert
0 Kudos

Indeed, in my case I had a wrong repository ID set. Just for reference, from the docs:

Create a SAP Document Management Integration Option Service instance and key. Using credentials from key onboard a repository and configure the onboarded repositoryId under cds.requires in package.json. Currently only non versioned repositories are supported.

pedro_iranzo
Product and Topic Expert
Product and Topic Expert
0 Kudos
Indeed, in my case I had a wrong repository ID set. Just for reference, from the docs: