cancel
Showing results for 
Search instead for 
Did you mean: 

csn file in the Cloud Programming Model - S/4 Hana Cloud API

kevin_hu
Active Participant
0 Kudos

Hi,

I was following this tutorial

https://developers.sap.com/tutorials/cap-cloudsdk-1-mock-service.html

Just wondering in Step 3, how the file "API_BUSINESS_PARTNER.json" is generated/acquired. I checked the api.sap.com but could not find it with the same format.

Also my understand is this file is the csn file which is parsed from service cds, am I right?

dj.adams dj.adams.sap

View Entire Topic
dhem
Active Participant

Hey Kevin,

There's a package called "@sap/edm-converters" in SAP's public npm registry (https://npm.sap.com).

To install it, first add an .npmrc file to your project with the following line:

@sap:registry=https://npm.sap.com

Then you should be able to run "npm i -D @sap/edm-converters".

Finally, you should be able to run "npx convert_edm", which should print the tools usage.

Hope that helps!

Dennis

kevin_hu
Active Participant

Download the edmx file from api.sap.com

install edm-converters.

run the command line

To generate CSN file from an EDMX File:

 * Windows: $homedir>./node_modules/@sap/edm-converters/lib/edmToCsn/bin/edmx2csn.cmd -i ${input_folder}/metadata.xml -o ${output_folder} -f 
 * Linux: $homedir>./node_modules/@sap/edm-converters/lib/edmToCsn/bin/edmx2csn.sh -i ${input_folder}/metadata.xml -o ${output_folder} -f 

Got the csn json file, do a cds compile and it works perfect.

Check the Readme for more info

./node_modules\@sap\edm-converters\lib\edmToCsn\README.md

Thanks

santosh_kumar97
Employee
Employee
0 Kudos

Hi Dennis,

i am getting below error while generating csn file out of edmx .

npx convert_edm edmxV40ToJsonV40 --input abcd.edmx

ERROR - MISSING: com.sap.vocabularies.Common.v1 /sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMON',Version='0001',SAP__Origin='LOCAL')/$value

ERROR - Could not convert document: Missing referenced documents