Coder Social home page Coder Social logo

sap-samples / cloud-cap-samples Goto Github PK

View Code? Open in Web Editor NEW
441.0 66.0 478.0 5.92 MB

This project contains sample applications for SAP Cloud Application Programming Model.

Home Page: https://cap.cloud.sap/

License: Apache License 2.0

JavaScript 64.47% HTML 12.14% TypeScript 0.14% CAP CDS 23.25%
sample sample-code sap-cap cap nodejs sap-btp business-technology-platform

cloud-cap-samples's Introduction

Welcome to cap/samples

Find here a collection of samples for the SAP Cloud Application Programming Model organized in a simplistic monorepo setup.

See Overview of contained samples:

REUSE status

Preliminaries

  1. Ensure you have the latest LTS version of Node.js installed (see Getting Started)

  2. Install @sap/cds-dk globally:

    npm i -g @sap/cds-dk
  3. Optional: Use Visual Studio Code

Download

If you've Git installed, clone this repo as shown below, otherwise download as ZIP file.

git clone https://github.com/sap-samples/cloud-cap-samples samples
cd samples

Setup

In the samples folder run:

npm install

Run

With that you're ready to run the samples, for example:

cds watch bookshop

After that open this link in your browser: http://localhost:4004

When asked to log in, type alice as user and leave the password field blank, which is the default user.

Testing

Run the provided tests with jest or mocha, for example:

npx jest

While mocha is a bit smaller and faster, jest runs tests in parallel and isolation, which allows to run all tests.

Code Tours

Take one of the guided tours in VS Code through our CAP samples and learn which CAP features are showcased by the different parts of the repository. Just install the CodeTour extension for VS Code. We'll add more code tours in the future. Stay tuned!

Get Support

Check out the documentation at https://cap.cloud.sap.
In case you've a question, find a bug, or otherwise need support, use our community to get more visibility.

License

Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

cloud-cap-samples's People

Contributors

ajinkyapatil8190 avatar btbernard avatar cherians avatar chgeo avatar danjoa avatar david-kunz avatar dependabot[bot] avatar dinurp avatar elenaoresharova avatar etimr avatar gregorwolf avatar hm23 avatar ianquigley-sap avatar iwonahahn avatar johannes-vogel avatar lakshmicr avatar mikhailgoncharov avatar pianocktail avatar pierrefritsch avatar qmacro avatar renejeglinsky avatar sevladimirs avatar sjvans avatar stewsk avatar swaldmann avatar thenickest avatar tobiasso85 avatar tsteckenborn avatar vkozyura avatar vobu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-cap-samples's Issues

Debug VSCode

Hello,

You have written:
For example, in VS Code switch to Debug view and launch one of the prepared cds run launch configurations.

I have started the debugger then I can see
Debugger listening on ws://127.0.0.1:47299
Debugger attached.
Waiting for the debugger to disconnect...

Unfortunately, I am not able to connect with chrome://inspect.

Can you please tell me what am I doing wrong?
Thank you

image

My launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

    {
        "name": "cds run",
        "request": "launch",
        "type": "node", "runtimeExecutable": "npx","runtimeArgs": ["-n"],  
        "program": "${workspaceFolder}\\srv\\cat-service.js",         
        "args": ["--", "cds","run","--in-memory?" ], // the leading "--" arg ensures it works with as well as without debugging    
        "console": "integratedTerminal",
        "skipFiles": [ "<node_internals>/**" ]
    }
]

}

Expand on draft enabled entity

Hi,

I have a problem using TextArrangement if the associated entity is draft enabled.

Scenario:

@odata.draft.enabled
@cds.odata.valuelist
entity Servers
  name : String

@odata.draft.enabled
entity Systems
  name : String
  @Common      : {
                Text            : server.name,
                TextArrangement : #TextOnly
        }
  server : Association to Servers;

I edit the "Systems" entity with Fiori then I use the value help on the "server" field, when I close the value help I get the ID instead of the name:
image

Investigating I found that the get on the "Systems" draft entity returns null in the expand:

GET {{server}}/services/Systems(ID=9e1dde5c-9ddb-4700-9dc9-a5108d7150d2,IsActiveEntity=false)?
&$select=server
&$expand=server($select=name)

{
  "@odata.context": "$metadata#Systems(server,ID,IsActiveEntity,server(hostname,ID,IsActiveEntity))/$entity",
  "ID": "9e1dde5c-9ddb-4700-9dc9-a5108d7150d2",
  "IsActiveEntity": false,
  "server": null
}

If I remove the draft annotation on the "Servers" entity there is no the problem.
If I create a draft version of the "Server" entity I don't have the problem.
Seems that the expand is trying to read the draft version of the "Servers" entity.

This repository shows the problem:
https://github.com/sbarzaghialteaup/cap_test_draft

Thanks and Best Regards

Documentation cds compile --to cdl

I notice that the documentation shown after entering cds compile ? does not list cdl as a target format for the -2 | --to option. --to cdl is however shown under in the examples section of the displayed help and does appear to produce a valid cdl when an appropriate csn file is provided.

In my use case, I was starting with an external edmx. I imported using cds import to produce csn, then used cds compile --to cds to generate a model definition. The external service was not available for consumption.

My current cds version information:

@sap/cds: 3.34.2
@sap/cds-compiler: 1.26.2
@sap/cds-dk: 1.8.4
@sap/cds-foss: 1.2.0
@sap/cds-reflect: 2.11.0
@sap/cds-runtime: 1.2.2

Unable to build

I cloned and I was trying to build using npm i. I always get the error as below.
image

I tried deleting node_modules folder and redoing npm install, but no luck.

Fiori preview for bookshop doesnot work

I am able to run the application, and view the services and the odata output. But when I click on "..in FIori" it opens up a page like below :

image

and I can see the below error in console :

Failed to create cache for binding sap.ui.model.odata.v4.ODataListBinding: /Authors - TypeError: Cannot read property '$kind' of undefined at Object.wrapChildQueryOptions (https://sapui5.hana.ondemand.com/resources/sap/ui/core/library-preload.js?eval:4172:11259) at eval (https://sapui5.hana.ondemand.com/resources/sap/ui/core/library-preload.js?eval:4172:3481) at https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:596:173 at c (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:591:99) at new S (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:593:773) at S.then (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:596:151) at eval (https://sapui5.hana.ondemand.com/resources/sap/ui/core/library-preload.js?eval:4172:3457) at Array.map (<anonymous>) at Object.fetchResolvedSelect (https://sapui5.hana.ondemand.com/resources/sap/ui/core/library-preload.js?eval:4172:3400) at eval (https://sapui5.hana.ondemand.com/resources/sap/ui/core/library-preload.js?eval:3762:413) sap.ui.model.odata.v4.ODataBinding

"ERR! Could not install from "../common" as it does not contain a package.json file." for cf push -f gen/srv

I cloned the repo and did cds watch bookshop. Opened http://localhost:4004 -- all good.

Then followed only https://cap.cloud.sap/docs/advanced/deploy-to-cloud to deploy to the Bookshop example to my HDI in SCP Trial.

But in step https://cap.cloud.sap/docs/advanced/deploy-to-cloud#deploy-using-cf-push the command

cf push -f gen/srv --random-route

failed:

$ cf push -f gen/srv --random-route
Pushing from manifest to org a109df31trial / space dev as [email protected]...
Using manifest file /Users/i000000/Projects/cloud-cap-samples/bookshop/gen/srv/manifest.yaml
Getting app info...
Updating app with these attributes...
  name:                bookshop-srv
  path:                /Users/i000000/Projects/cloud-cap-samples/bookshop/gen/srv
  disk quota:          1G
  health check type:   port
  instances:           1
  memory:              128M
  stack:               cflinuxfs3
  services:
    bookshop-db-hdi-container
  routes:
    bookshop-srv-terrific-civet-rc.cfapps.eu10.hana.ondemand.com

Updating app bookshop-srv...
Mapping routes...
Comparing local files to remote cache...
Packaging files to upload...
Uploading files...
 1.86 KiB / 1.86 KiB [============================================================================================================] 100.00% 1s

Waiting for API to complete processing files...

Staging app and tracing logs...
          Using default npm version: 6.13.4
   -----> Installing yarn 1.21.1
          Copy [/tmp/buildpacks/5dbe64bf3d3c2193d7e1ab2679366053/dependencies/527e472b80235f08997eeb3ddca77906/yarn-1.21.1-any-stack-fd04cba1.tgz]
          Installed yarn 1.21.1
   -----> Creating runtime environment
          PRO TIP: It is recommended to vendor the application's Node.js dependencies
          Visit http://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring
          NODE_ENV=production
          NODE_HOME=/tmp/contents187127754/deps/0/node
          NODE_MODULES_CACHE=true
          NODE_VERBOSE=false
          NPM_CONFIG_LOGLEVEL=error
          NPM_CONFIG_PRODUCTION=true
   -----> Building dependencies
          Installing node modules (package.json)
   npm ERR! code ENOLOCAL
   npm ERR! Could not install from "../common" as it does not contain a package.json file.
   npm ERR! A complete log of this run can be found in:
   npm ERR!     /tmp/cache/final/.npm/_logs/2020-04-09T15_09_18_422Z-debug.log
          **ERROR** Unable to build dependencies: exit status 1
   Failed to compile droplet: Failed to run all supply scripts: exit status 14
   Exit status 223
   Cell e7a50627-16cd-4ddf-b175-9b42fd470c14 stopping instance 05f23b5f-19e4-444c-a647-b9b41624342f
   Cell e7a50627-16cd-4ddf-b175-9b42fd470c14 destroying container for instance 05f23b5f-19e4-444c-a647-b9b41624342f
Error staging application: App staging failed in the buildpack compile phase
FAILED

Indeed, there is no folder common under the gen, while the gen/srv/package.json has it as a dependency:

{
  "name": "@capire/bookshop",
  "version": "1.0.0",
  "description": "A simple self-contained bookshop service.",
  "dependencies": {
    "@capire/common": "../common",
    "@sap/cds": "^3.33.1",
    "express": "^4.17.1"
  },
  "scripts": {
    "genres": "cds serve test/genres.cds",
    "start": "cds run",
    "watch": "cds watch"
  },
  "cds": {
    "requires": {
      "db": {
        "kind": "sql"
      }
    }
  }
}

Mashup in DKOM branch is not wokring

Hi,
I cloned this repository and switched to the DKOM branch.
I opened the project with VSCode and selected the req.http file.
When I try to run the GET Orders expanding on shippingAddress I get the "Unauthorized" error

01

then, if I try by using only the "ALICE" user without password, I get "Not Found"

02

Where is the problem?

Simmaco

Says SQLite needs to be installed & Prompts to install it every time!

Get a prompt to install SQLite in every session of mine! (This is happening since Week2 tutorials). Here are the Steps:

  1. Clicked SQLTools icon on the IDE, it shows "No Connections. Click here to add one" (but we did have a datasource configured and used it before!)
  2. Checked File>Preferences>Sqltools...shows the connection settings previously entered.
  3. Clicked 'Connect' on the status bar of the IDE and it displays "you need to install "[email protected]" to connect to sqlite - bookshop." (which I had installed thrice/four times previously!
  4. Clicked 'Install' to install it successfully again. Now SQLTools > Connections shows the connection to bookshop and the 'Connect' icon next to it and clicking on it shows the views and tables as before.
  5. Signout/close the session and come back into AppStudio later (after restart) and step1 occurs again.

Kindly help. Is this a bug, or do I need to be following a specific sequence of steps? Thanks in advance!

Authorizations in service results in crashing

While trying a few thing on the documentation on cap.cloud.sap page I created a new project using the "Getting Started in a Nutshell". I was able to push the project to my trial account with the documentation. As the documentation is somewhat unclear on a few points I have uploaded my code to Github - Maybe there is an issue in the structure of my project or my files? It states that there is "No service matches xsuaa", although I have created a service file and definition in the default-env.json analogous to the sample file.

Code: https://github.com/timoschuetz/capm-auth

I deploy the service with
cds build/all cf push -f gen/srv --random-route

Now I am planning to add authorization to the service, but it is always failing - these are the logs:

2020-01-08T14:05:33.181+0000 [APP/PROC/WEB/0] ERR at getCredentialsFromXsEnv (/home/vcap/deps/0/node_modules/@sap/cds-services/lib/util/xsenv.js:41:20) 2020-01-08T14:05:33.181+0000 [APP/PROC/WEB/0] ERR at _jwt (/home/vcap/deps/0/node_modules/@sap/cds-services/lib/adapter/auth/passport.js:47:53) 2020-01-08T14:05:33.181+0000 [APP/PROC/WEB/0] ERR at _getOneStrategyByName (/home/vcap/deps/0/node_modules/@sap/cds-services/lib/adapter/auth/passport.js:85:80) 2020-01-08T14:05:33.182+0000 [APP/PROC/WEB/0] ERR at _getStrategy (/home/vcap/deps/0/node_modules/@sap/cds-services/lib/adapter/auth/passport.js:121:10) 2020-01-08T14:05:33.182+0000 [APP/PROC/WEB/0] ERR at _autoDetectStrategy (/home/vcap/deps/0/node_modules/@sap/cds-services/lib/adapter/auth/passport.js:168:10) 2020-01-08T14:05:33.182+0000 [APP/PROC/WEB/0] ERR at _getAuthConfig (/home/vcap/deps/0/node_modules/@sap/cds-services/lib/adapter/auth/passport.js:206:40) 2020-01-08T14:05:33.182+0000 [APP/PROC/WEB/0] ERR at passport (/home/vcap/deps/0/node_modules/@sap/cds-services/lib/adapter/auth/passport.js:252:22) 2020-01-08T14:05:33.182+0000 [APP/PROC/WEB/0] ERR at Function.passport (/home/vcap/deps/0/node_modules/@sap/cds-services/lib/index.js:22:46) 2020-01-08T14:05:33.182+0000 [APP/PROC/WEB/0] ERR jse_shortmsg: 'No service matches xsuaa', 2020-01-08T14:05:33.182+0000 [APP/PROC/WEB/0] ERR jse_info: {}, 2020-01-08T14:05:33.182+0000 [APP/PROC/WEB/0] ERR message: 'No service matches xsuaa' } 2020-01-08T14:05:33.422+0000 [APP/PROC/WEB/0] OUT Exit status 143

cds.deploy keeps trying to seed data even if csv-file does not exist anymore

I created a Books.csv file following the tutorial https://cap.cloud.sap/docs/get-started/in-a-nutshell.
After deploying to hana, the table gets created, the data gets imported, everything works fine.
Then I wanted to see what happens if I alter the schema afterwards by doing a change on the entity, so I added a column 'country' to the 'Books' entity in schema.cds, added a value for 'country' in the Books.csv and deployed again. Still worked fine.

Then I wanted to see what happens if I have existing data and do a change on the schema which causes an error. So I changed the property of 'country' of the 'Books' entity from String(10) to String(5) having existing values larger than 5 characters to cause an error.
This causes the deployment to fail, because it was recognized, that in my csv file I tried to add larger values than my table allows. So I deleted the Books.csv file and deployed again, but now, even though the Books.csv was deleted, the deployment task still has a reference to it

image

So I tried to do a cds build to cleanup, but this didn't make a change. How can this be fixed?

Error cloning the samples repo

hi, during week 2 unit 2 and 3 is not created in my application cloud platform in unit 2 product directory and in unit 3 test directory. Why ?

installation has run and finished. for unit 2
installation completed but not finished. Un
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week2-unit3
cd projects/cloud-cap-samples

user: projects $ git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week2-unit3
fatal: destination path 'projects/cloud-cap-samples' already exists and is not an empty directory.
user: projects $ cd projects/cloud-cap-samples
user: cloud-cap-samples $ npm install
npm WARN lifecycle The node binary used for scripts is /extbin/bin/node but npm is using /usr/local/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.

@sap/capire-samples@ install /home/user/projects/projects/cloud-cap-samples
(npm -s run lerna) && lerna bootstrap --hoist

not found: lerna

  • [email protected]
    added 614 packages from 288 contributors and audited 518 packages in 23.047s

18 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

lerna notice cli v3.20.2
lerna info Bootstrapping 1 package
lerna info Installing external dependencies
lerna info hoist Pruning hoisted dependencies
lerna info hoist Finished pruning hoisted dependencies
lerna info hoist Finished bootstrapping root
lerna info Symlinking packages and binaries
lerna success Bootstrapped 1 package
removed 614 packages and audited 518 packages in 27.529s

1 package is looking for funding
run npm fund for details

found 0 vulnerabilities

user: cloud-cap-samples $ cd packages/bookshop
user: bookshop $ cds watch

[cds] - running nodemon...
--ext cds,csn,csv,ts,mjs,cjs,js,json,properties,edmx,xml
--exec cds serve all --with-mocks --in-memory?

[cds] - using bindings from: { registry: '/home/user/.cds-services.json' }
[cds] - model loaded from 4 file(s):

db/schema.cds
srv/admin-service.cds
srv/cat-service.cds
../../node_modules/@sap/cds/common.cds

[cds] - connect to db { database: ':memory:' }

filling sap.capire.bookshop.Authors from db/data/sap.capire.bookshop-Authors.csv
filling sap.capire.bookshop.Books from db/data/sap.capire.bookshop-Books.csv
/> successfully deployed to sqlite in-memory db

[cds] - serving AdminService { at: '/admin' }
[cds] - serving CatalogService { at: '/browse', impl: 'srv/cat-service.js' }

[cds] - launched in: 1199.000ms
[cds] - server listening on { url: 'http://localhost:4004' }
[ terminate with ^C ]

GET /browse/Books
GET /browse/Currencies
GET /browse/Orders
[2020-04-30T23:45:40.554Z | WARNING | 1054450]: Method Not Allowed

The Cours Teacher have another Folders. They want now TESTS/Orders.http

best regards

UUID OData v2 adapter proxy

Hello,

I have entity with UUID key (with @odata.type: string) that I provide in OData and I use v2 adapter to work with smart sapui5 controls.
When I call entity set using v2 it works perfectly but when I call entity by key /Entity(guid'XXXXXXXXX') as it supposed to be by v2 standard, the adapter doesn't handle it. But removing 'guid' part works.

Can you please help with how I should define this key properly to work with v2 adapter?

Thank you,
Best Regards,
Semyon

Handler for GET request

Let's suppose i want to create a static helloworld service, which should simply return a string when called. Am i forced to define a function ?

Another way to see the problem:

service helloworld {
// empty service with no functions/entities exposed 
}

How do i register an handler (let's suppose i'm using node) in this case for the "GET /helloworld" request ? Is it possibile ?

sap/fe/AppComponent is deprecated

When I launch the fiori apps, a message appears saying that This class of the AppComponent is deprecated, please use "sap.fe.core.AppComponent" instead.

Cannot find local module '../../../db/src/data/model

index.cds

using from './lib/cds/solicitation';

solicitation.cds
namespace "sprolimslabservapi";

using sprolimslabservapi.data.model as app from '../../../db/src/data/model';

service solicitation_service {
  entity solicitation as projection on app.solicitation;
}

db structure
image

srv structure
image

access .....br10.hana.ondemand.com/v2/
Error: Cannot find local module '../../../db/src/data/model'\n

this course is for those who are already involved with java and cloud

it is not to understand what is meant here. this time the course is absolutely not for rent but for people who have done this course x times. with this installation i do not understand how to use CF LOGIN. why is this not explained to BSP? i will continue without demos. You probably think we are magicians and understand your thoughts from a distance. watch the video yourself. see how fast the demonstration is and you can hardly watch it. Hey, we took this course because we are renting. and read your pdf translation, this is simply translated via google.

Tree Table, oData v2

Hello,
we want to create a TreeTable using oData v2. Our CDS entities look like this:

agreements > licenses > positions.

The agreements are loaded on a detail page while licenses and positions should be loaded within a TreeTable as parent and children nodes ( https://openui5.hana.ondemand.com/entity/sap.ui.table.TreeTable/sample/sap.ui.table.sample.TreeTable.BasicODataTreeBinding/code/localService%2Fmockdata%2FNodes.json ).
How has the service to look like in order to achieve this?

How to create a oData V2 service?

Hi team
as I test, follow most of our tutorial, we will create a oData V4 service by default. Do we have a tutorial to create oData V2 service?
Thanks.

BUILD ERROR : npm ERR! @sap/capire-samples@ install: `(npm -s run lerna) && lerna bootstrap --hoist`npm ERR! Exit status 1

image

Please refer to this snapshot .
This error was faced after trying to build cloud-sap-samples after cloning git repo to web-ide :-

npm install> @sap/capire-samples@ install /sapmnt/C9J/xs/app_working/gcl0139/executionroot/cb1ec35f-570d-4b8e-ba16-680d1e4910c0/app/META-INF/.sap_java_buildpack/tomcat/temp/builder/sap.cds.mta/builds/build-1370146842113914157/cap-samples> (npm -s run lerna) && lerna bootstrap --hoistmodule.js:550 throw err; ^Error: Cannot find module 'libnpx'

Why I got 403 error: 'CREATE is only allowed with static instance-based authorization'

Hello,

I add authentication to my FooService and Books:

annotate FooService with @(requires: 'authenticated-user');
annotate FooService.Books with @(restrict: [
{
grant: ['READ', 'CREATE', 'WRITE', 'DELETE'],
where: 'id = $user.id'
}
]);

When create a Books, I got 403 error with message : 'CREATE is only allowed with static instance-based authorization' , how can I fix it?

Not able to create using Fiori draft.

I have created a project with Fiori draft enabling but getting the following error while clicking create on the Fiori tile.

NEW PfgRequests null

POST DSPPfgService.PfgRequests_drafts
[2020-06-03T14:50:43.070Z | ERROR | 1894620]: Cannot convert undefined or null to object
[INTERNAL ERROR] TypeError: Cannot convert undefined or null to object
at removeDraftUUID (C:\Users\i077624\OneDrive - SAP SE\DSP\CAP Learning\DSPPortal\node_modules@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:224:5)
at C:\Users\i077624\OneDrive - SAP SE\DSP\CAP Learning\DSPPortal\node_modules@sap\cds-runtime\lib\cds-services\services\handlers\onCreateDraft.js:96:14
Please report this error.

bookstore cds build fails

Hi

When I run the bookstore app, the cds build fails with the following errors:

cds compile failed due to these errors...

at srv\services.cds:9:49-55: Info: This select item replaces "author" from table alias "Products" (in view:"sap.capire.bookstore.CatalogService.Books"/query:1)
at srv\services.cds:33:12-31: Error: Cannot find package module '@sap/capire-media'


Environment:
Windows 10
node v11.15.0
npm 6.7.0
+-- @sap/[email protected]

Kind Regards

Serdar

mismatch of Db schema and test data

there is some mismatch of declared db schema and test data CSV files leading to error for "No Column found ... " in Week 1 unit 4 bookshop project

fiori sample (sap.fe) is no more working with sapui5 1.78

With the latest sapui5, the fiori sample is no more working!

As a workaround, add sap.fe.templates to required libs

data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout, sap.fe.templates"

Also in each app component manifest replace dependecy sa.fe to

"dependencies": {
            "libs": {
                "sap.fe.templates": {}
            }
        }

because with 1.78 a deprecated dialog will be shown for sap.fe.
sap.fe.template internally requires sap.fe.core and sap.fe.macros so this seems to be the new core ref.

Maybe you can create a ticket for the sapui5 team, because the sandbox ushell error seems to be comming from async loading manifest dependencies.

Regards Holger

HANA service creation fails

hi,
on Building Applications with SAP Cloud Application Programming ModelChristian Georgi
Week 3 unit 4 - I have found the problem service offering 'hana' not
after the input - cf create-service hana hdi-shared bookshop-db-hdi-container -
there was no error before that.

best regards
Bild1

Server will crash when query with filter like: $filter=false and age ge 12

entity:

entity Foo : managed {
  key ID: UUID;
  startTime: DateTime;
  name: String;
  age: Integer;
}

service:

service TestService {
   entity Foo as projection on my.Foo;
}

query:

http://localhost:4004/test/Foo?$filter=false
http://localhost:4004/test/Foo?$filter=age ge 12
http://localhost:4004/test/Foo?$filter=false or age ge 12
query 1 and 2 are right, but 3 with error:

[INTERNAL ERROR] TypeError: left is not iterable
at ExpressionToCQN._binary (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js:259:25)
at ExpressionToCQN.parse (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js:294:21)
at _filter (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/readToCQN.js:42:50)
at readToCQN (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/readToCQN.js:243:5)
at odataToCQN (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/odataToCQN.js:24:14)
at OdataContext.get (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/utils/OdataContext.js:265:23)
at Object.context [as handler] (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/services/handlers/onRead.js:13:15)
at next (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/services/hooks/On.js:185:37)
at On._middleware (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/services/hooks/On.js:214:5)
at Promise (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/services/hooks/On.js:84:12)
Please report this error.

cannot install node modules

I tried the following command in the sample folder to install node modules but I got the following error:

c:\samples>npm i

npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@capire%2fcommon - Not found
npm ERR! 404
npm ERR! 404 '@capire/common@^3.31.1' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of '@capire/bookshop'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xxx\AppData\Roaming\npm-cache_logs\2020-03-23T09_45_31_320Z-debug.log

issue with @sap/cds/common in Visual Studio

I am using Visual Studio for SAP Cloud Application programming.
I get error with below statement , it says "Cannot find package module '@sap/cds/common'". Can anyone help me with this?

using { sap } from '@sap/cds/common';

other db option.

I embrace the new standard but wonders what if I want to use other db like oracle, mssql or other than sqlite/hana. I hope and know this is very common question for many.

Many-many association example

Hi colleagues

I request you to provide a working example showing many-many relation in CAP. This seems to be a fundamental requirement for any business application and I dont see any documentation describing it for reference.

Request you to share.

error when deploying following openSAP-week3-unit5

Hello everyone !

I'm having some troble whyle trying to run the example of week 3 unit 5 of open sap course
https://github.com/SAP-samples/cloud-cap-samples/tree/openSAP-week3-unit5
https://open.sap.com/courses/cp7/items/y6qAYiWpxGJqIpCYpwzn6

in the homepage i have this errors :
image

in the Books page i have this errors :
image

i followed the steps in the demo presentend in the course and also checked in the git repository, can someone help me to understand what i have made wrong?

week4 Unit 4

week4 Unit 4
in the demo the page of the instructor in the attachment,
WEEK4-U4-1
WEEK4-U4-myLocal

week4 Unit 4
in the demo the page of the docent in the facility WEEK4-U4-1, and my view when Week4 U4 is selected
WEEK4-U4-myLocal. it is not the same directory structure.
what is the next step?

Wrong resource paths, no creation of new "Products"

cloud-cap-samples/packages/officesupplies/db/csv/sap.capire.officesupplies-Products.csv (Branch openSAP-week3-unit2

1.) The paths to the images in officesupplies/db/csv/sap.capire.officesupplies-Products.csv point to an SAP internal location. They can't be reached from external.
2.) The Fiori "Create" doesn't work. A create of a new product results in an empty line and a subsequent error, that the task can not be completed due to backend problems.

this course is not for the faint of heart but for those who are already involved with java and cloud

it is not to understand what is meant here. this time the course is absolutely not for rent but for people who have done this course x times. with this installation i do not understand how to use CF LOGIN. why is this not explained to BSP? i will continue without demos. You probably think we are magicians and understand your thoughts from a distance. watch the video yourself. see how fast the demonstration is and you can hardly watch it. Hey, we took this course because we are renting. and read your pdf translation, this is simply translated via google.

Translated with www.DeepL.com/Translator (free version)

Annotation for DataFieldWithUrl

Hi,

The annotation for DataFieldWithUrl in Overview Pages is:

https://sapui5.hana.ondemand.com/#/topic/65731e6b823240398e33133908efdaa1

<Record Type="com.sap.vocabularies.UI.v1.DataFieldWithUrl">
    <PropertyValue Property="Label" String="Link to"/>
    <PropertyValue Property="Value" String="Google Maps"/>
    <PropertyValue Property="Url">
        <Apply Function="odata.fillUriTemplate">
            <String>https://www.google.de/maps/place/{street},{city}</String>
            <LabeledElement Name="street">
                <Apply Function="odata.uriEncode">
                    <Path>Address/Street</Path>
                </Apply>
            </LabeledElement>
            <LabeledElement Name="city">
                <Apply Function="odata.uriEncode">
                    <Path>Address/City</Path>
                </Apply>
            </LabeledElement>
        </Apply>
    </PropertyValue>
</Record>

Is this possible with cds?

Thank you and Best Regards

An error occurred during serialization of the entity collection

I think this line:

items.forEach (item => ordersByID [item.parent_ID] .total += item.netAmount)

Sholud be:

items.forEach (item => ordersByID [item.parent_ID] .total += parseFloat(item.netAmount))

Otherwise, i get the serialization error when browsing Orders entities:

<error> <code>null</code> <message> An error occurred during serialization of the entity collection. An error occurred during serialization of the entity with the following key(s): ID: 7e2f2640-6866-4dcf-8f4d-3027aa831cad, IsActiveEntity: true. Serialization of the 'total' property failed. Invalid value 011.1115.00 (JavaScript string). A number or a string representing a number must be specified as value for type Edm.Decimal. </message> </error>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.