sap-cloud-sdksap-business-technology-platform

How to generate a service using generate-odata-client from an ECC or S4 using the service's $metadata?


I'm trying to convert a $metadata into a service for use with the SAP Cloud SDK Library.

generate-odata-client --inputDir .\ctradeslipdata_metadata.xml --outputDir tradeslipdata

Error

[2022-06-10T01:36:13.788Z] ERROR    (generator-cli): ErrorWithCause: Generation of services failed.
    at C:\Users\Avell\AppData\Roaming\nvm\v14.17.0\node_modules\@sap-cloud-sdk\generator\dist\generator-cli.js:22:18
Caused by:
Error: EEXIST: file already exists, mkdir 'D:\PESSOAL\PROGRAMACAO\JS\nest\exemplo-api-btp\ctradeslipdata_metadata.xml'

estruct

d----             dist
d----             node_modules
d----             src
d----             test
d----             tradeslipdata
-a---          77 .env
-a---          20 .eslintignore
-a---         681 .eslintrc.js
-a---          49 .gitignore
-a---          51 .prettierrc
-a---       62594 ctradeslipdata_metadata.xml
-a---        5742 default-env.json
-a---         443 manifest.yml
-a---         220 nest-cli.json
-a---        3107 package.json
-a---          97 tsconfig.build.json
-a---         581 tsconfig.json
-a---      317412 yarn.lock

Solution

  • Your command uses an option --inputDir, which needs a directory path as parameter. However, you passed a file, which should be fixed.

    Please check the complete documentation of the generator here.