├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .github ├── CODEOWNERS └── ISSUE_TEMPLATE │ └── session-feedback-template.md ├── .markdownlint.json ├── .vscode └── settings.json ├── CONTRIBUTING.md ├── InstructorSetup.md ├── LICENSE ├── LICENSES └── Apache-2.0.txt ├── README.md ├── REUSE.toml ├── exercises ├── ex1 │ └── README.md ├── ex2 │ └── README.md ├── ex3 │ └── README.md ├── ex4 │ └── README.md ├── ex5 │ └── README.md ├── ex6 │ └── README.md ├── ex7 │ └── README.md ├── ex8 │ └── README.md └── template.md ├── images ├── ex1 │ ├── adding_a_mapping.png │ ├── create.png │ ├── free.png │ ├── selecting_manage_configuration.png │ ├── service_marketplace.png │ ├── studio.png │ └── three_dots.png ├── ex2 │ ├── CAP_Project_Wizard.png │ ├── cap_project_generator.png │ ├── cds_init.png │ ├── command_pallet.png │ ├── login_to_cf.png │ ├── open_template_wizard.png │ ├── run_generator.png │ └── template_wizard.png ├── ex3 │ ├── add_database_connection_to_dbx.png │ ├── add_hdi_container.png │ ├── bind_to_service.png │ ├── create_hdi_service.png │ ├── db_npm_install.png │ ├── dbx_in_vscode.png │ ├── deploy_via_npm_start.png │ └── open_database_explorer.png ├── ex4 │ ├── app_router_config_wizard.png │ └── open_app_router_wizard.png ├── ex5 │ └── xs_security_json.png ├── instructor │ ├── assignCodeJamRC.png │ ├── assignRoleCollection.png │ ├── cleanupCloudFoundry.png │ ├── cleanupDeleteServiceInstances.png │ ├── createSpace.png │ ├── createSpace2.png │ ├── createUser.png │ ├── createUserDialog.png │ ├── deleteUsers.png │ ├── deleterolecollection.png │ ├── enableCloudFoundry.png │ ├── hanaCloudDelete.png │ ├── hanaCloudTools.png │ ├── securityUsers.png │ ├── spaceMembers.png │ └── subaccount.png └── prereq │ ├── clone_project.png │ ├── codespace.png │ ├── node_v_check.png │ └── reopen_remote_container.png ├── prerequisites.md ├── slides ├── BAS_Small.pdf ├── CAP_Small.pdf └── HANA_Small.pdf └── solution └── MyHANAApp ├── .gitignore ├── .pipeline └── config.yml ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── Jenkinsfile ├── README.md ├── app ├── interaction_items │ ├── README.md │ ├── annotations.cds │ ├── package.json │ ├── ui5.yaml │ └── webapp │ │ ├── Component.js │ │ ├── i18n │ │ └── i18n.properties │ │ ├── index.html │ │ ├── manifest.json │ │ └── test │ │ ├── flpSandbox.html │ │ ├── integration │ │ ├── FirstJourney.js │ │ ├── opaTests.qunit.html │ │ ├── opaTests.qunit.js │ │ └── pages │ │ │ ├── Interactions_HeaderList.js │ │ │ ├── Interactions_HeaderObjectPage.js │ │ │ └── Interactions_ItemsObjectPage.js │ │ ├── testsuite.qunit.html │ │ └── testsuite.qunit.js ├── router │ ├── package-lock.json │ ├── package.json │ └── xs-app.json └── services.cds ├── db ├── interactions.cds ├── src │ ├── .hdiconfig │ ├── V_INTERACTION.hdbcalculationview │ └── sleep.hdbprocedure └── undeploy.json ├── eslint.config.mjs ├── mta.yaml ├── package-lock.json ├── package.json ├── srv ├── interaction_srv.cds └── interaction_srv.js └── xs-security.json /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/javascript-node/.devcontainer/base.Dockerfile 2 | 3 | # [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster 4 | ARG VARIANT="22-bookworm" 5 | FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT} 6 | 7 | # Prepare for apt-based install of Cloud Foundry CLI by adding Cloud Foundry Foundation public key & package repository 8 | # (see https://docs.cloudfoundry.org/cf-cli/install-go-cli.html#pkg-linux). 9 | RUN wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - ; \ 10 | echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list 11 | 12 | # Install extra tools for CAP development & deployment. 13 | RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 14 | && apt-get -y install --no-install-recommends sqlite cf8-cli 15 | 16 | # Install global node modules for SAP CAP and frontend development. 17 | RUN su node -c "npm install -g @ui5/cli @sap/cds-dk yo @sapui5/generator-sapui5-templates @sap/generator-base-mta-module @sap/generator-cap-project @sap/generator-fiori @sap/generator-hdb-project mbt mta typescript hana-cli" 18 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/javascript-node 3 | { 4 | "name": "SAP cap-hana-exercises-codejam CodeJam Student Devcontainer", 5 | "build": { 6 | "dockerfile": "Dockerfile", 7 | // Update 'VARIANT' to pick a Node version: 20, 18, 16, 14. 8 | // Append -bullseye or -buster to pin to an OS version. 9 | // Use -bullseye variants on local arm64/Apple Silicon. 10 | "args": { "VARIANT": "22-bookworm" } 11 | }, 12 | 13 | // Set *default* container specific settings.json values on container create. 14 | "settings": {}, 15 | 16 | // Add the IDs of extensions you want installed when the container is created. 17 | "extensions": [ 18 | "dbaeumer.vscode-eslint", 19 | "sapse.vscode-cds", 20 | "sapse.sap-ux-fiori-tools-extension-pack", 21 | "sapos.yeoman-ui", 22 | "hookyqr.beautify", 23 | "coenraads.bracket-pair-colorizer-2", 24 | "eamodio.gitlens", 25 | "yzhang.markdown-all-in-one", 26 | "fivepointseven.node-version", 27 | "bengreenier.vscode-node-readme", 28 | "christian-kohler.path-intellisense", 29 | "humao.rest-client", 30 | "saposs.sap-hana-driver-for-sqltools", 31 | "sapse.vsc-extension-sa", 32 | "mtxr.sqltools", 33 | "pflannery.vscode-versionlens", 34 | "visualstudioexptteam.vscodeintellicode", 35 | "vscode-icons-team.vscode-icons", 36 | "saposs.xml-toolkit", 37 | "dotjoshjohnson.xml", 38 | "SAPSE.hana-database-explorer" 39 | ], 40 | 41 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 42 | "forwardPorts": [ 4004, 3010, 5000 ], 43 | 44 | // Use 'postCreateCommand' to run commands after the container is created. 45 | // "postCreateCommand": "yarn install", 46 | 47 | // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 48 | "remoteUser": "node" 49 | } -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @jung-thomas 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/session-feedback-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Session Feedback Template 3 | about: To give feedback on the session 4 | title: Session Feedback 5 | labels: feedback 6 | assignees: '' 7 | 8 | --- 9 | 10 | Thanks for taking a couple of minutes to give feedback, which will help me improve for next time. 11 | 12 | ## Instructions 13 | 14 | 1. Before doing anything else, hit the green button "Submit new issue" right now to save this issue content 15 | 1. Then go through the questions and mark a single checkbox for each, to represent your answer 16 | 1. Finally, in the empty comment box below this one, please describe what you liked and what you didn't like 17 | 18 | ### What was your experience of the SAP Cloud Application Programming Model before this session? 19 | 20 | - [ ] Not much at all 21 | - [ ] Basic knowledge 22 | - [ ] Used it now and then 23 | - [ ] Regular user 24 | 25 | ### Did this session meet your expectations? 26 | 27 | - [ ] Not really 28 | - [ ] Somewhat 29 | - [ ] Mostly 30 | 31 | ### Was the time allotted to each exercise enough for you to work through them? 32 | 33 | - [ ] Not really 34 | - [ ] On the whole, yes 35 | 36 | ### What did you think of the extra information, explanations and narratives in the exercises? 37 | 38 | - [ ] Too much information 39 | - [ ] Didn't really read it, didn't really bother me though 40 | - [ ] Found it helpful as context and background 41 | 42 | ### How did you find the actual individual tasks in the exercises? 43 | 44 | - [ ] Not relevant enough 45 | - [ ] Hard to do 46 | - [ ] About right 47 | - [ ] Helpful / informative 48 | 49 | ### What is your feeling about the SAP Cloud Application Programming Model? 50 | 51 | - [ ] Still don't like it 52 | - [ ] I'm going to investigate further 53 | - [ ] I am suddenly a believer 54 | - [ ] I am or will be using the CAP more now 55 | 56 | If you have time, please add a comment below to write free-form what you liked and what you disliked about the session. Thanks! 57 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "MD033": false, 3 | "MD013": false 4 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "SAP HANA Database Explorer.displaySapWebAnalyticsStartupNotification": false, 3 | "SAP HANA SQLScript LSP.URL": "https://hana-cockpit.cfapps.us10.hana.ondemand.com", 4 | "SAP HANA Database Artifacts.displaySapWebAnalyticsStartupNotification": false 5 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to this CodeJam 2 | 3 | You want to contribute to this CodeJam? Welcome! Please read this document to understand what you can do: 4 | 5 | * [Help Others](#help-others) 6 | * [Analyze Issues](#analyze-issues) 7 | * [Report an Issue](#report-an-issue) 8 | * [Contribute Code](#contribute-code) 9 | 10 | ## Help Others 11 | 12 | You can help by helping others who use SAP Technology and need support. You will find them e.g. on [SAP Community](https://community.sap.com/). 13 | 14 | ## Analyze Issues 15 | 16 | Analyzing issue reports can be a lot of effort. Any help is welcome! 17 | Go to [the Github issue tracker](https://github.com/SAP-samples/cap-hana-exercises-codejam/issues?state=open) and find an open issue which needs additional work or a bugfix. 18 | 19 | Additional work may be further information, or a minimized jsbin example or gist, or it might be a hint that helps understanding the issue. Maybe you can even find and [contribute](#contribute-code) a bugfix? 20 | 21 | ## Report an Issue 22 | 23 | Once you have familiarized with the guidelines, you can go to the [Github issue tracker](https://github.com/SAP-samples/cap-hana-exercises-codejam/issues/new) to report the issue. 24 | 25 | ### Quick Checklist for Bug Reports 26 | 27 | Issue report checklist: 28 | 29 | * Real, current bug 30 | * No duplicate 31 | * Reproducible 32 | * Good summary 33 | * Well-documented 34 | * Minimal example 35 | 36 | Please report bugs in English, so all users can understand them. 37 | 38 | ### Issue handling process 39 | 40 | When an issue is reported, a committer will look at it and either confirm it as a real issue (by giving the "in progress" label), close it if it is not an issue, or ask for more details. In-progress issues are then either assigned to a committer in GitHub, reported in our internal issue handling system, or left open as "contribution welcome" for easy or not urgent fixes. 41 | 42 | ### Reporting Security Issues 43 | 44 | We take security issues in our projects seriously. We appreciate your efforts to responsibly disclose your findings. 45 | 46 | Please do not report security issues directly on GitHub but using one of the channels listed below. This allows us to provide a fix before an issue can be exploited. 47 | 48 | * **Researchers/Non-SAP Customers:** Please consult SAPs [disclosure guidelines](https://wiki.scn.sap.com/wiki/display/PSR/Disclosure+Guidelines+for+SAP+Security+Advisories) and send the related information in a PGP encrypted e-mail to . Find the public PGP key [here](https://www.sap.com/dmc/policies/pgp/keyblock.txt). 49 | * **SAP Customers:** If the security issue is not covered by a published security note, please report it by creating a customer message at . 50 | 51 | Please also refer to the general [SAP security information page](https://www.sap.com/about/trust-center/security/incident-management.html). 52 | 53 | ### Usage of Labels 54 | 55 | Github offers labels to categorize issues. We defined the following labels so far: 56 | 57 | Labels for issue categories: 58 | 59 | * bug: this issue is a bug in the code 60 | * documentation: this issue is about wrong documentation 61 | * enhancement: this is not a bug report, but an enhancement request 62 | 63 | Status of open issues: 64 | 65 | * unconfirmed: this report needs confirmation whether it is really a bug (no label; this is the default status) 66 | * in progress: this issue has been triaged and is now being handled, e.g. because it looks like an actual bug 67 | * author action: the author is required to provide information 68 | * contribution welcome: this fix/enhancement is something we would like to have and you are invited to contribute it 69 | 70 | Status/resolution of closed issues: 71 | 72 | * fixed: a fix for the issue was provided 73 | * duplicate: the issue is also reported in a different ticket and is handled there 74 | * invalid: for some reason or another this issue report will not be handled further (maybe lack of information or issue does not apply anymore) 75 | * works: not reproducible or working as expected 76 | * wontfix: while acknowledged to be an issue, a fix cannot or will not be provided 77 | 78 | The labels can only be set and modified by committers. 79 | 80 | ### Issue Reporting Disclaimer 81 | 82 | We want to improve the quality of this CodeJam and good bug reports are welcome! But our capacity is limited, so we cannot handle questions or consultation requests and we cannot afford to ask for required details. So we reserve the right to close or to not process insufficient bug reports in favor of those which are very cleanly documented and easy to reproduce. 83 | 84 | Bug report analysis support is very welcome! (e.g. pre-analysis or proposing solutions) 85 | 86 | ## Contribute Code 87 | 88 | You are welcome to contribute code to this CodeJam in order to fix bugs or to implement new features. 89 | 90 | There are three important things to know: 91 | 92 | 1. You must be aware of the Apache License (which describes contributions) and **agree to the Developer Certificate of Origin**. This is common practice in all major Open Source projects. To make this process as simple as possible, we are using *[CLA assistant](https://cla-assistant.io/)*. CLA assistant is an open source tool that integrates with GitHub very well and enables a one-click-experience for accepting the DCO. See the respective section below for details. 93 | 2. There are **several requirements regarding code style, quality, and product standards** which need to be met (we also have to follow them). The respective section below gives more details on the coding guidelines. 94 | 3. **Not all proposed contributions can be accepted**. Some features may e.g. just fit a third-party add-on better. 95 | 96 | ### Developer Certificate of Origin (DCO) 97 | 98 | Due to legal reasons, contributors will be asked to accept a DCO before they submit the first pull request to this project. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/). 99 | This happens in an automated fashion during the submission process: the CLA assistant tool will add a comment to the pull request. Click it to check the DCO, then accept it on the following screen. CLA assistant will save this decision for upcoming contributions. 100 | 101 | This DCO replaces the previously used CLA ("Contributor License Agreement") as well as the "Corporate Contributor License Agreement" with new terms which are well-known standards and hence easier to approve by legal departments. Contributors who had already accepted the CLA in the past may be asked once to accept the new DCO. 102 | 103 | ### Contribution Content Guidelines 104 | 105 | Contributed content can be accepted if it: 106 | 107 | 1. is useful to improve the project (explained above) 108 | 2. follows the applicable guidelines and standards 109 | 110 | The second requirement could be described in entire books and would still lack a 100%-clear definition, so you will get a committer's feedback if something is not right. 111 | These are some of the most important rules to give you an initial impression: 112 | 113 | * Apply a clean coding style adapted to the surrounding code, even though we are aware the existing code is not fully clean 114 | * Run the ESLint code check and make it succeed 115 | * Only access public APIs of other entities (there are exceptions, but this is the rule) 116 | * Comment your code where it gets non-trivial and remember to keep the public JSDoc documentation up-to-date 117 | * Translation and Localization must be supported 118 | * Write a unit test 119 | * Do not do any incompatible changes, especially do not modify the name or behavior of public API methods or properties 120 | * Always consider the developer who USES your control/code! 121 | * Think about what code and how much code he/she will need to write to use your feature 122 | * Think about what she/he expects your control/feature to do 123 | 124 | If this list sounds lengthy and hard to achieve - well, that's what WE have to comply with as well, and it's by far not complete… 125 | 126 | ### How to contribute - the Process 127 | 128 | 1. Make sure the change would be welcome (e.g. a bugfix or a useful feature); best do so by proposing it in a GitHub issue 129 | 2. Create a branch forking the openui5 repository and do your change 130 | 3. Commit and push your changes on that branch 131 | * When you have several commits, squash them into one (see [this explanation](http://davidwalsh.name/squash-commits-git)) - this also needs to be done when additional changes are required after the code review 132 | 133 | 4. In the commit message follow the [commit message guidelines](docs/guidelines.md#git-guidelines) 134 | 5. If your change fixes an issue reported at GitHub, add the following line to the commit message: 135 | * ```Fixes https://github.com/SAP-samples/cap-hana-exercises-codejam/issues/(issueNumber)``` 136 | * Do NOT add a colon after "Fixes" - this prevents automatic closing. 137 | * When your pull request number is known (e.g. because you enhance a pull request after a code review), you can also add the line ```Closes https://github.com/SAP-samples/cap-hana-exercises-codejam/pull/(pullRequestNumber)``` 138 | 6. Create a Pull Request to github.com/SAP-samples/cap-hana-exercises-codejam 139 | 7. Follow the link posted by the CLA assistant to your pull request and accept the Developer Certificate of Origin, as described in detail above. 140 | 8. Wait for our code review and approval, possibly enhancing your change on request 141 | * Note that the UI5 developers also have their regular duties, so depending on the required effort for reviewing, testing and clarification this may take a while 142 | 143 | 9. Once the change has been approved we will inform you in a comment 144 | 10. Your pull request cannot be merged directly into the branch (internal SAP processes), but will be merged internally and immediately appear in the public repository as well. Pull requests for non-code branches (like "gh-pages" for the website) can be directly merged. 145 | 11. We will close the pull request, feel free to delete the now obsolete branch 146 | -------------------------------------------------------------------------------- /InstructorSetup.md: -------------------------------------------------------------------------------- 1 | # Instructor Setup for CodeJam 2 | 3 | ## The SAP BTP SubAccount Details 4 | 5 | Provide details about the SAP BTP SubAccount required for the CodeJam. 6 | 7 | 1. Log in the [SAP BTP Global Account: Developer Advocates Free Tier](https://emea.cockpit.btp.cloud.sap/cockpit/#/globalaccount/275320f9-4c26-4622-8728-b6f5196075f5/accountModel&//?section=HierarchySection&view=TreeTableView). 8 | 1. Navigate to the Direcotries and SubAccounts section.There you will find a folder for CodeJams. Within that is the Subaccount [CAP CodeJam](https://emea.cockpit.btp.cloud.sap/cockpit/#/globalaccount/275320f9-4c26-4622-8728-b6f5196075f5/subaccount/13f4f274-4515-4c67-8274-cbde80a4e744/subaccountoverview). That's where we will work. 9 | ![SAP BTP SubAccount](images/instructor/subaccount.png "SAP BTP SubAccount") 10 | 11 | ## Enable Cloud Foundry and Create a `Dev` Space 12 | 13 | Instructions on how to Enable Cloud Foundry Environment. 14 | 15 | 1. Enable the Cloud Foundry Enviroment. ![Enable Cloud Foundry](images/instructor/enableCloudFoundry.png "Enable Cloud Foundry") 16 | 1. Use the default Enablment dialog choices. 17 | 1. Once the org is created, create a space named `dev` ![Create Space](images/instructor/createSpace.png "Create Space")![Create Space Dialog](images/instructor/createSpace2.png "Create Space Dialog") 18 | 1. Add the other instructors as Space Members with all roles.![Add Space Members](images/instructor/spaceMembers.png "Add Space Members") 19 | 20 | ## Provisioning of SAP HANA Cloud 21 | 22 | Instructions on how to provision SAP HANA Cloud for the event. 23 | 24 | 1. Perform all the steps in 👉 [tutorial: Deploy SAP HANA Cloud](https://developers.sap.com/tutorials/hana-cloud-deploying.html). You now have an SAP HANA database fully accessible to you with the full range of HANA Cloud capabilities. 25 | 26 | ## Adding Users 27 | 28 | Guide on how to add users to the SAP BTP Subaccount and Cloud Foundry Environment 29 | 30 | 1. Navigate to the "Security" section in your SubAccount. `Security -> Users` ![Navigate to User Management](images/instructor/securityUsers.png "Navigate to User Management") 31 | 1. Create User ![Create User](images/instructor/createUser.png "Create User") 32 | 1. Enter the email addresses of the participants and use the `Default identity provider` ![Create User Dialog](images/instructor/createUserDialog.png "Create User Dialog") 33 | 1. Assign them to the `CodeJam` Role Collection. ![Assign Role Collection](images/instructor/assignRoleCollection.png "Assign Role Collection") ![Assign CodeJam Role Collection](images/instructor/assignCodeJamRC.png "Assign CodeJam Role Collection") 34 | 1. Assign the users to the Cloud Foundry `dev` Space ![Add Space Members](images/instructor/spaceMembers.png "Add Space Members") 35 | 36 | ## Clean Up After the Event 37 | 38 | Instructions on how to clean up resources after the event. 39 | 40 | 1. Delete all the HDI container instances from the BTP Cockpit SubAccount/Instances views. ![Delete Service Instances](images/instructor/cleanupDeleteServiceInstances.png "Delete Service Instances") 41 | 42 | 1. Disable the Cloud Foundry Enviroment. This will remove all user access at the CF level and clean up remaining resources. ![Disable Cloud Foundry](images/instructor/cleanupCloudFoundry.png "Disable Cloud Foundry") 43 | 44 | 1. Delete the HANA Cloud Instance to save money. 45 | * From the Subscriptions click on `SAP HANA Cloud`![SAP HANA Cloud Tools](images/instructor/hanaCloudTools.png "SAP HANA Cloud Tools") 46 | * Then `Actions -> Delete`![Delete](images/instructor/hanaCloudDelete.png "Delete") 47 | 48 | 1. Remove Users 49 | * `Security -> Users` ![Navigate to User Management](images/instructor/securityUsers.png "Navigate to User Management") 50 | * Manually delete all workshop users ![Delete Users](images/instructor/deleteUsers.png "Delete Users") 51 | 52 | 1. Remove created Role Collections 53 | * `Security -> Role Collections` 54 | * Manually delete all role collections created by the workshop users ![Delete Role Collection](images/instructor/deleterolecollection.png) 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [2024] [SAP SE] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSES/Apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [2024] [SAP SE] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeJam - Combine SAP Cloud Application Programming Model with SAP HANA Cloud to Create Full-Stack Applications 2 | 3 | [![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/cap-hana-exercises-codejam)](https://api.reuse.software/info/github.com/SAP-samples/cap-hana-exercises-codejam) 4 | 5 | ## Description 6 | 7 | This repository contains the material for the CodeJam on using the SAP Cloud Application Programming Model and SAP HANA Cloud to create Full-Stack Applications. In this CodeJam we will learn how to use an instance of SAP HANA Cloud, develop a multi-target application using SAP Business Application Studio and SAP Cloud Application Programming Model, and create a service layer and SAP Fiori UI that also includes SAP HANA native artifacts, such as calculation views. 8 | 9 | Complete this in-person CodeJam experience and you can receive the following badge on Credly: 10 | [![Credley Badge](https://images.credly.com/images/5d79c77c-2def-4f1a-94a9-9b40d50c6202/blob)](https://www.credly.com/org/sap/badge/developer-skills-codejam-combine-sap-cap-with-sap-h) 11 | 12 | ## What is an SAP CodeJam? 13 | 14 | SAP CodeJam is a hands-on, collaborative event where developers come together to learn about SAP technologies, share knowledge, and work on practical exercises. These events are typically led by SAP experts and provide a great opportunity to network with peers, ask questions, and gain a deeper understanding of SAP solutions through guided tutorials and real-world scenarios. 15 | 16 | ## Overview 17 | 18 | * [SAP Cloud Application Programming Model Presentation from Introduction](./slides/CAP_Small.pdf) 19 | * [SAP HANA Cloud Presentation from Introduction](./slides/HANA_Small.pdf) 20 | * [SAP Business Application Studio Presentation from Introduction](./slides/BAS_Small.pdf) 21 | * [Introduction to SAP Cloud Application Programming Model Video](https://youtu.be/T1gqalbwzHk) 22 | 23 | ## Requirements 24 | 25 | The requirements to follow the exercises in this repository, including hardware and software, are detailed in the [prerequisites](prerequisites.md) file. 26 | 27 | ### Material organization 28 | 29 | The material consists of a series of exercises. Each exercise is contained in a directory, with a main 'readme' file containing the core exercise instructions, with optional supporting files, such as screenshots and sample files. 30 | 31 | ### Following the exercises 32 | 33 | During the CodeJam you will complete each exercise one at a time. At the end of each exercise there are questions; these are designed to help you think about the content just covered, and are to be discussed with the entire CodeJam class, led by the instructor, when everyone has finished that exercise. 34 | 35 | If you finish an exercise early, please resist the temptation to continue with the next one. Instead, explore what you've just done and see if you can find out more about the subject that was covered. That way we all stay on track together and can benefit from some reflection via the questions (and answers). 36 | 37 | > The exercises are written in a conversational way; this is so that they have enough context and information to be completed outside the hands-on session itself. To help you navigate and find what you have to actually do next, there are pointers like this 👉 throughout that indicate the things you have to actually do (as opposed to just read for background information). 38 | 39 | ### The exercises 40 | 41 | Here's an overview of the exercises in this CodeJam. 42 | 43 | * Make certain that you have successfully completed all the [prerequisites](prerequisites.md) 44 | * [Exercise 1 - Set Up SAP HANA Cloud and Development Environment](exercises/ex1/README.md) 45 | * [Exercise 2 - Create an SAP Cloud Application Programming Model Project for SAP HANA Cloud](exercises/ex2/README.md) 46 | * [Exercise 3 - Create Database Artifacts Using Core Data Services (CDS) for SAP HANA Cloud](exercises/ex3/README.md) 47 | * [Exercise 4 - Create a User Interface with CAP (SAP HANA Cloud)](exercises/ex4/README.md) 48 | * [Exercise 5 - Add User Authentication to Your Application (SAP HANA Cloud)](exercises/ex5/README.md) 49 | * [Exercise 6 - Create Calculation View and Expose via CAP (SAP HANA Cloud)](exercises/ex6/README.md) 50 | * [Exercise 7 - Create HANA Stored Procedure and Expose as CAP Service Function (SAP HANA Cloud)](exercises/ex7/README.md) 51 | * [Bonus Homework - Deploy CAP with SAP HANA Cloud project as MTA](exercises/ex8/README.md) 52 | 53 | ## Known Issues 54 | 55 | When creating the HDI Container instance in Exercise 3, the Business Application Studio tooling sometimes does not properly wait for the container creation. In these situations, simply wait a moment for creation to complete and then repeat the step. 56 | 57 | ## Feedback 58 | 59 | If you can spare a couple of minutes at the end of the session, please help me improve for next time by giving me some feedback. 60 | 61 | Simply use this [Give Feedback](https://github.com/SAP-samples/cap-hana-exercises-codejam/issues/new?assignees=&labels=feedback&template=session-feedback-template.md&title=Feedback) link to create a special "feedback" issue, and follow the instructions in there. 62 | 63 | ## How to obtain support 64 | 65 | [Create an issue](https://github.com/SAP-samples/cap-hana-exercises-codejam/issues) in this repository if you find a bug or have questions about the content. 66 | 67 | For additional support, [ask a question in SAP Community](https://answers.sap.com/questions/ask.html). 68 | 69 | ## Further connections and information 70 | 71 | Here are a few pointers to resources for further connections and information: 72 | 73 | ### What is the SAP Cloud Application Programming Model? 74 | 75 | The SAP Cloud Application Programming Model (CAP) is a framework of languages, libraries, and tools for building enterprise-grade services and applications. It provides a consistent end-to-end programming model that includes best practices, out-of-the-box solutions for common tasks, and a set of tools to simplify development. CAP is designed to help developers focus on their business logic while leveraging SAP's powerful technologies. 76 | 77 | For more information, visit the following resources: 78 | 79 | * [SAP Cloud Application Programming Model Overview](https://cap.cloud.sap/docs/) 80 | * [Getting Started with CAP](https://cap.cloud.sap/docs/get-started/) 81 | * [CAP Samples on GitHub](https://github.com/SAP-samples/cloud-cap-samples) 82 | 83 | ### What is SAP HANA Cloud? 84 | 85 | SAP HANA Cloud is a fully managed, in-memory cloud database as a service (DBaaS) that provides advanced data management capabilities. It allows you to manage, store, and process data in real-time, enabling you to build modern applications that require high performance and scalability. SAP HANA Cloud integrates seamlessly with other SAP services and provides tools for data integration, analytics, and application development. 86 | 87 | For more information, visit the following resources: 88 | 89 | * [SAP HANA Cloud Overview](https://www.sap.com/products/hana/cloud.html) 90 | * [Getting Started with SAP HANA Cloud](https://developers.sap.com/tutorials/hana-cloud-getting-started.html) 91 | * [SAP HANA Cloud Documentation](https://help.sap.com/viewer/product/SAP_HANA_CLOUD) 92 | 93 | ### What is SAP Business Application Studio? 94 | 95 | SAP Business Application Studio is a modern development environment tailored for efficient development of business applications for the SAP ecosystem. It provides a powerful set of tools and services for developing, testing, and deploying applications, including support for SAP Fiori, SAP Cloud Application Programming Model (CAP), and SAP HANA. Business Application Studio offers a cloud-based IDE with features such as code completion, debugging, and integrated DevOps capabilities. 96 | 97 | For more information, visit the following resources: 98 | 99 | * [SAP Business Application Studio Overview](https://www.sap.com/products/business-application-studio.html) 100 | * [Getting Started with SAP Business Application Studio](https://developers.sap.com/tutorials/appstudio-onboarding.html) 101 | * [SAP Business Application Studio Documentation](https://help.sap.com/viewer/product/SAP_BUSINESS_APPLICATION_STUDIO) 102 | 103 | ## Contributing 104 | 105 | If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/). 106 | 107 | ## License 108 | 109 | Copyright (c) 2024 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](LICENSES/Apache-2.0.txt) file. 110 | -------------------------------------------------------------------------------- /REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | SPDX-PackageName = "cap-hana-exercises-codejam" 3 | SPDX-PackageSupplier = "thomas.jung@sap.com" 4 | SPDX-PackageDownloadLocation = "https://github.com/sap-samples/cap-hana-exercises-codejam" 5 | SPDX-PackageComment = "The code in this project may include calls to APIs (“API Calls”) of\n SAP or third-party products or services developed outside of this project\n (“External Products”).\n “APIs” means application programming interfaces, as well as their respective\n specifications and implementing code that allows software to communicate with\n other software.\n API Calls to External Products are not licensed under the open source license\n that governs this project. The use of such API Calls and related External\n Products are subject to applicable additional agreements with the relevant\n provider of the External Products. In no event shall the open source license\n that governs this project grant any rights in or to any External Products,or\n alter, expand or supersede any terms of the applicable additional agreements.\n If you have a valid license agreement with SAP for the use of a particular SAP\n External Product, then you may make use of any API Calls included in this\n project’s code for that SAP External Product, subject to the terms of such\n license agreement. If you do not have a valid license agreement for the use of\n a particular SAP External Product, then you may only make use of any API Calls\n in this project for that SAP External Product for your internal, non-productive\n and non-commercial test and evaluation of such API Calls. Nothing herein grants\n you any rights to use or access any SAP External Product, or provide any third\n parties the right to use of access any SAP External Product, through API Calls." 6 | 7 | [[annotations]] 8 | path = "**" 9 | precedence = "aggregate" 10 | SPDX-FileCopyrightText = "2024 SAP SE or an SAP affiliate company and cap-hana-exercises-codejam contributors" 11 | SPDX-License-Identifier = "Apache-2.0" 12 | -------------------------------------------------------------------------------- /exercises/ex1/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 1 - Set Up SAP HANA Cloud and CAP Project 2 | 3 | NOTE: **For the CodeJam it is no longer necessary to provision the SAP HANA Cloud instance**. Your instructor will provide you with access to an SAP BTP Subaccount which already contains an SAP HANA Cloud instance ready to perform the necessary setps in this CodeJam. However you will only have temporary access to this account. If you wish to continue learning from your own account, this page contains the necessary steps to provision your own SAP HANA Cloud instance on SAP BTP Free Trial. 4 | 5 | Only perform these remain steps in Exercise 1 if you want to create your own system after the CodeJam. Otherwise you can proceed directly to 👉 [Exercise 2 - Create an SAP Cloud Application Programming Model Project for SAP HANA Cloud](../ex2/README.md) 6 | 7 | ## Introduction 8 | 9 | First, we need to provision an SAP HANA Cloud database instance. This will be in a "multi-environment" context with the SAP HANA Cloud Administration Tools (see the "Further Study" section below for a link to more information on this). We must then make that database instance available to the environment instance where we'll be managing deployments with HDI containers, which here will be in your Cloud Foundry environment instance. 10 | 11 | ## Exercise 1.1 Deploy SAP HANA Cloud 12 | 13 | We will use the SAP BTP cockpit as a graphical tool to provision your free SAP HANA Cloud instance if you don't already have one in your account. 14 | 15 | First, perform all the steps in 👉 [tutorial: Deploy SAP HANA Cloud](https://developers.sap.com/tutorials/hana-cloud-deploying.html). This is a one time activity. You now have an SAP HANA database fully accessible to you with the full range of HANA Cloud capabilities. 16 | 17 | > **Very important** The system is stopped automatically each night and you need to manually restart every day you want to use it as described in the above tutorial. The most common error that people make is not restarting their HANA Cloud instance. 18 | 19 | ## Exercise 1.2 Set Up SAP Business Application Studio for Development 20 | 21 | SAP Business Application Studio is a development environment available on SAP Business Technology Platform. Before you can start developing using SAP Business Application Studio, you must perform the required onboarding steps that are described in this step once. Please choose your path based upon if you are using the [SAP BTP free tier](https://developers.sap.com/tutorials/btp-free-tier-account.html) or [SAP BTP free trial](https://developers.sap.com/tutorials/hcp-create-trial-account.html). 22 | 23 |
SAP BTP free trial 24 | 25 | 1. If you are using the [SAP BTP free trial](https://developers.sap.com/tutorials/hcp-create-trial-account.html), then perform all the steps in [this tutorial - Set Up SAP Business Application Studio for Development](https://developers.sap.com/tutorials/appstudio-onboarding.html) 26 | 27 |
28 |
SAP BTP free tier 29 | 30 | 1. If you are using the [SAP BTP free tier](https://developers.sap.com/tutorials/btp-free-tier-account.html), then complete the following steps 31 | 32 | 1. From you SAP BTP Global Account in the SAP BTP Cockpit, select the subaccount in which you want to enable the SAP Business Application Studio subscription. 33 | 34 | 1. From the navigation area, click Service Marketplace. 35 | ![Service Marketplace](../../images/ex1/service_marketplace.png) 36 | 37 | 1. In the Service Marketplace page, search for `studio`. 38 | ![Search for Studio](../../images/ex1/studio.png) 39 | 40 | 1. Click Actions icon (three dots) to open the list of available actions. 41 | ![Three Dots](../../images/ex1/three_dots.png) 42 | 43 | 1. Click Create to launch the wizard for subscribing to SAP Business Application Studio. 44 | ![Create](../../images/ex1/create.png) 45 | 46 | 1. In the wizard verify that `SAP Business Application Studio` is selected in the Service field and `free` is selected in the Plan field. 47 | ![Free Plan](../../images/ex1/free.png) 48 | 49 | 1. Click `Create` to subscribe to SAP Business Application Studio. 50 | 51 |
52 | 53 | ## Summary 54 | 55 | Now that you have your SAP HANA Cloud database instance and have setup the basics of your development environment, we are ready to start our development project. 56 | 57 | ## Further Study 58 | 59 | * [Tools to Manage and Access the SAP HANA Cloud, SAP HANA Database](https://developers.sap.com/tutorials/hana-cloud-mission-trial-4.html) 60 | * [SAP HANA Cloud](https://community.sap.com/topics/hana) 61 | * [SAP Business Application Studio](https://community.sap.com/topics/business-application-studio) 62 | * [Subscribing to the SAP HANA Cloud Administration Tools](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/subscribing-to-sap-hana-cloud-administration-tools) 63 | 64 | ### What is SAP HANA Cloud Multi-Environment? 65 | 66 | The SAP HANA Cloud multi-environment is a modern approach to managing and deploying SAP HANA databases. It allows for greater flexibility and scalability by supporting multiple environments such as Cloud Foundry and Kyma. This multi-environment setup enables seamless integration and management of various services and applications within the SAP ecosystem. 67 | 68 | #### Differences from Older Options 69 | 70 | * **Flexibility**: The multi-environment setup supports multiple runtime environments, unlike older options which were limited to a single environment. 71 | * **Scalability**: It provides better scalability options, allowing for dynamic allocation of resources based on demand. 72 | * **Integration**: Enhanced integration capabilities with other SAP services and third-party applications. 73 | * **Management**: Improved tools and interfaces for managing databases and services across different environments. 74 | 75 | ## Next 76 | 77 | Continue to 👉 [Exercise 2 - Create an SAP Cloud Application Programming Model Project for SAP HANA Cloud](../ex2/README.md) 78 | -------------------------------------------------------------------------------- /exercises/ex2/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 2 - Create an SAP Cloud Application Programming Model Project for SAP HANA Cloud 2 | 3 | In this exercise we will use the wizard for the SAP Cloud Application Programming Model to create a project in SAP Business Application Studio that will also support SAP HANA Cloud. 4 | 5 | Perform all the steps in 👉 [tutorial: Create an SAP Cloud Application Programming Model Project for SAP HANA Cloud](https://developers.sap.com/tutorials/hana-cloud-cap-create-project.html) 6 | 7 | ## Summary 8 | 9 | At the end of this tutorial you have your `dev space`, the basic CAP project and have configured source control for this project. 10 | 11 | ### Questions for Discussion 12 | 13 | 1. What is the value of the `dev space` in the SAP Business Application Studio? To help with this discussion point consider the [prerequisites section](../../prerequisites.md) for not using the SAP Business Application Studio.
Answer 14 | The `dev space` in SAP Business Application Studio is a pre-configured development environment tailored for specific scenarios, such as SAP Fiori, SAP HANA, and more. It provides all the necessary tools, extensions, and configurations required for development, reducing setup time and ensuring consistency across different development environments.
15 | 16 | 1. Why do you think it was necessary to login to Cloud Foundry? HANA Cloud itself isn't actually running in Cloud Foundry nor does it use Cloud Foundry for technical connections. But it's important to understand [HDI (HANA Deployment Infrastructure)](https://help.sap.com/docs/HANA_CLOUD_DATABASE/c2cc2e43458d4abda6788049c58143dc/e28abca91a004683845805efc2bf967c.html) containers and how they are controlled via Cloud Foundry service instances.
Answer 17 | Logging into Cloud Foundry is necessary because HDI containers, which are used for managing database artifacts in HANA Cloud, can be controlled via Cloud Foundry service instances regardless of if the HANA instance is deployed into Cloud Foundry or not (it's not in our case). This integration allows for better management and deployment of database artifacts within the SAP ecosystem.
18 | 19 | 1. What's the purpose of the [mta.yaml](https://help.sap.com/docs/HANA_CLOUD_DATABASE/c2b99f19e9264c4d9ae9221b22f6f589/d8226e641a124b629b0e8f7c111cd1ae.html) file?
Answer 20 | The `mta.yaml` file is used to define the structure and components of a multi-target application (MTA). It specifies the modules, resources, and their relationships, enabling the deployment of complex applications across different environments and services in a consistent and automated manner. 21 | * In the context of CAP (Cloud Application Programming), HANA, and Cloud Foundry BTP applications, the `mta.yaml` file helps in bundling different components like database modules, service modules, and UI modules into a single deployable unit. This ensures that all parts of the application are deployed together and can interact seamlessly.
22 | 23 | 1. Who can explain what [NPM](https://docs.npmjs.com/about-npm) is and how and why it is used?
Answer 24 | NPM (Node Package Manager) is a package manager for JavaScript, primarily used to manage dependencies for Node.js projects. During CAP (Cloud Application Programming) and HANA development, NPM is used to install and manage libraries and tools required for building, testing, and deploying applications. It simplifies the process of integrating third-party modules and ensures that all dependencies are up-to-date and compatible. 25 | * One important package is `@sap/cds-dk`, which provides the core tools and libraries for developing CAP applications, including commands for project initialization, building, and deployment. 26 | * Another important package is `@sap/hdi-deploy`, which is used to deploy database artifacts to HANA databases. It helps in managing the deployment of HDI containers and ensures that all database objects are correctly created and maintained.
27 | 28 | 1. Version Control with [Git](https://git-scm.com/). How familiar is everyone with Git? Any ABAP developers in the room (if so we should talk). What's the reason/impact of using local Git repository as we did in this tutorial?
Answer 29 | Using a local Git repository allows developers to track changes to their code, collaborate with others, and maintain a history of their project. It provides version control, enabling developers to revert to previous versions if needed. In this tutorial, using a local Git repository helps in managing the CAP project efficiently, ensuring that changes are documented and can be shared or deployed consistently. 30 | * In a real project, moving to a central Git repository such as GitHub is important for better collaboration, backup, and access control. A central repository allows multiple developers to work on the same project simultaneously, merge changes, and resolve conflicts. It also provides a backup of the codebase and ensures that the latest version of the code is always accessible to the team.
31 | 32 | ## Further Study 33 | 34 | * [Video Version of this Tutorial](https://youtu.be/ydDOGz7P--8) 35 | * [SAP Business Application Studio](https://community.sap.com/topics/business-application-studio) 36 | * [SAP HDI Containers](https://help.sap.com/docs/HANA_CLOUD_DATABASE/c2cc2e43458d4abda6788049c58143dc/e28abca91a004683845805efc2bf967c.html) 37 | * [HANA Cloud: HDI - Under the Hood](https://www.youtube.com/watch?v=UmOkjPxE6Us) 38 | * [Git basics in 10 minutes](https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/) 39 | 40 | ## Next 41 | 42 | Continue to 👉 [Exercise 3 - Create Database Artifacts Using Core Data Services (CDS) for SAP HANA Cloud](../ex3/README.md) 43 | -------------------------------------------------------------------------------- /exercises/ex3/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 3 - Create Database Artifacts Using Core Data Services (CDS) for SAP HANA Cloud 2 | 3 | In this exercise we will use SAP Cloud Application Programming Model (CAP) and Core Data Services (CDS) to generate SAP HANA Cloud basic database artifacts. 4 | 5 | Perform all the steps in 👉 [tutorial: Create Database Artifacts Using Core Data Services (CDS) for SAP HANA Cloud](https://developers.sap.com/tutorials/hana-cloud-cap-create-database-cds.html) 6 | 7 | ## Summary 8 | 9 | You've now designed database tables, deployed them into an SAP HANA Cloud database instance, and loaded data into them using the Database Explorer. 10 | 11 | ### Questions for Discussion 12 | 13 | 1. We loaded data into the tables using the import feature of the Database Explorer. Is anyone familiar with [alternatives](https://cap.cloud.sap/docs/guides/databases#providing-initial-data) to this to get initial data into your new tables?
Answer 14 | In CAP, you can also load CSV files from the project. To do this, place your CSV files in the `db/data` folder of your CAP project. The CAP framework will automatically detect these files and load the data into the corresponding tables during deployment. The CSV files should be named according to the entity they represent, for example, `Books.csv` for the `Books` entity. 15 | 16 | Additionally, you can create CSV files via AI in SAP Build Code. SAP Build Code provides AI-assisted tools to generate CSV files based on your data model. You can use these tools to quickly create and populate CSV files with sample data, which can then be used to initialize your database tables. 17 | 18 | What are the advantages of loading data via HANA Table Import over using the CSV files that are part of the CAP project? 19 | * **Flexibility**: You can import data from various formats and sources, not just CSV files. 20 | * **Large Data Sets**: It is more efficient for handling large data sets, as it can leverage HANA's optimized import mechanisms. 21 | * **Data Transformation**: You can apply transformations and mappings during the import process. 22 | * **Error Handling**: Provides better error handling and logging capabilities. 23 | * **Incremental Loads**: Supports incremental data loads, which is useful for updating existing tables without full reloads. 24 | 25 |
26 | 27 | 1. Where is Country coming from in interactions.cds? [Hint](https://cap.cloud.sap/docs/guides/reuse-and-compose) 28 |
Answer 29 | 30 | ```cds 31 | using { Country } from '@sap/cds/common'; 32 | ``` 33 | 34 | The `@sap/cds-common-content` Node.js module provides a set of common data models and services that can be reused across different CAP projects. It includes predefined entities, types, and annotations that are commonly used in business applications, such as `Country`, `Currency`, and `Language`. By using this module, developers can avoid duplicating common definitions and ensure consistency across their projects. It simplifies the development process by providing a standardized set of reusable components, making it easier to build and maintain CAP applications. 35 | 36 | The `sap.common.Countries` entity is part of the `@sap/cds/common` module and represents a standardized list of countries. This entity includes fields such as `code` and `name`, which can be used to store and retrieve country information in a consistent manner across different CAP applications. By using `sap.common.Countries`, developers can leverage a predefined and widely accepted data model for country information, ensuring compatibility and reducing the need for custom implementations.
37 | 38 | 1. What's the difference between [Composition](https://cap.cloud.sap/docs/guides/domain-modeling#_5-add-compositions) and [Association](https://cap.cloud.sap/docs/guides/domain-modeling#associations)? [Additional reading on Compositions](https://cap.cloud.sap/docs/cds/cdl#compositions) and [additional reading on Associations](https://cap.cloud.sap/docs/cds/cdl#associations) 39 |
Answer 40 | 41 | **Composition**: 42 | * Represents a strong ownership relationship where the lifecycle of the child entity is dependent on the parent entity. 43 | * If the parent entity is deleted, the child entities are also deleted. 44 | * Example: 45 | 46 | ```cds 47 | entity Order { 48 | key ID : UUID; 49 | Items : Composition of many OrderItems on Items.parent = $self; 50 | } 51 | 52 | entity OrderItems { 53 | key ID : UUID; 54 | parent : Association to Order; 55 | product : String; 56 | quantity : Integer; 57 | } 58 | ``` 59 | 60 | * Use Composition when you want to model a whole-part relationship where the parts cannot exist without the whole. 61 | 62 | **Association**: 63 | * Represents a weaker relationship where the associated entities can exist independently. 64 | * Deleting the parent entity does not affect the associated entities. 65 | * Example: 66 | 67 | ```cds 68 | entity Customer { 69 | key ID : UUID; 70 | name : String; 71 | orders : Association to many Order on orders.customer = $self; 72 | } 73 | 74 | entity Order { 75 | key ID : UUID; 76 | customer : Association to Customer; 77 | totalAmount : Decimal; 78 | } 79 | ``` 80 | 81 | * Use Association when you want to model a relationship where the entities can exist independently and have their own lifecycle. 82 | 83 |
84 | 85 | 1. In the service implementation (interaction_srv.cds), how do you know you are creating an OData service? 86 |
Answer 87 | In the service implementation (`interaction_srv.cds`), you can identify that you are creating an OData service by the use of the `service` keyword and the annotations that specify the OData protocol. For example: 88 | 89 | ```cds 90 | service InteractionService { 91 | @odata.draft.enabled 92 | entity Interactions as projection on my.Interactions; 93 | } 94 | ``` 95 | 96 | The `@odata.draft.enabled` annotation indicates that the service supports OData draft functionality. Additionally, the `service` keyword defines an OData service that exposes the specified entities. These annotations and keywords are part of the CDS syntax that CAP uses to generate OData services automatically. 97 | 98 | The default service type in CAP is the OData V4 service. When you define a service using the `service` keyword in CDS, it is automatically treated as an OData service unless specified otherwise. 99 |
100 | 101 | ## Further Study 102 | 103 | * [Video Version of this Tutorial](https://youtu.be/hlHY7eBriRA) 104 | * [SAP HANA Database Explorer](https://help.sap.com/docs/HANA_CLOUD/a2cea64fa3ac4f90a52405d07600047b/7fa981c8f1b44196b243faeb4afb5793.html?locale=en-US) 105 | * [Domain Modeling with CDS](https://cap.cloud.sap/docs/guides/domain-modeling) 106 | * [Generated HDI Artifacts](https://cap.cloud.sap/docs/guides/databases-hana#generated-hdi-artifacts) 107 | 108 | ## Next 109 | 110 | Continue to 👉 [Exercise 4 - Create a User Interface with CAP (SAP HANA Cloud)](../ex4/README.md) 111 | -------------------------------------------------------------------------------- /exercises/ex4/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 4 - Create a User Interface with CAP (SAP HANA Cloud) 2 | 3 | In this exercise we will use services based on SAP Cloud Application Programming Model Node.js and use an SAP Fiori wizard to create a user interface. 4 | 5 | Perform all the steps in 👉 [tutorial: Create a User Interface with CAP (SAP HANA Cloud)](https://developers.sap.com/tutorials/hana-cloud-cap-create-ui.html) 6 | 7 | ## Summary 8 | 9 | You now have an SAPUI5 based user interface for your CAP application. But in fact we've done much more than that in this exercise. You've also added and configured the application router and "wired" the configuration between the CAP and the application router. 10 | 11 | ### Questions for Discussion 12 | 13 | 1. We added an [Application Router](https://www.npmjs.com/package/@sap/approuter) to your application, but what is it really and why is it helpful?
AnswerThe Application Router (@sap/approuter) is a Node.js package that acts as a reverse proxy. It routes incoming requests to backend microservices and handles authentication, authorization, and other cross-cutting concerns. It simplifies the development of cloud applications by managing these aspects centrally.
14 | 15 | 1. Why does the file default-env.json work? Hint it has everything to do with [@sap/xsenv](https://www.npmjs.com/package/@sap/xsenv). How does `cds bind` [avoid the need for the default-env.json](https://cap.cloud.sap/docs/advanced/hybrid-testing#bind-to-cloud-services)?
AnswerThe `default-env.json` file works because it contains environment variables that are read by the `@sap/xsenv` package to configure the application. The `@sap/xsenv` package simplifies the process of reading these variables and binding services to the application. The `cds bind` command avoids the need for the `default-env.json` file by directly binding cloud services to the CAP application, using service bindings defined in the SAP Business Technology Platform (BTP) environment.
16 | 17 | 1. What is the difference between the standalone and managed app router, and why and when might you use each?
AnswerThe standalone app router is deployed and managed by the developer, giving full control over its configuration and updates. It is suitable for custom scenarios where specific configurations are needed. The managed app router, on the other hand, is provided as a service by SAP and is automatically updated and maintained. It is ideal for standard use cases where ease of maintenance and reduced operational overhead are prioritized.
18 | 19 | 1. What is the `cds bind` command, CAP hybrid testing, and why is this important to developers?
AnswerThe `cds bind` command is used to bind services to a CAP application, allowing it to connect to external services such as databases or messaging systems. CAP hybrid testing refers to the ability to test CAP applications both locally and in the cloud, ensuring that they work correctly in different environments. This is important to developers because it allows them to develop and test their applications in a flexible and efficient manner, reducing the risk of issues when deploying to production.
20 | 21 | ## Further Study 22 | 23 | * [@sap/approuter](https://www.npmjs.com/package/@sap/approuter) - A Node.js module that acts as a reverse proxy, routing incoming requests to backend microservices. It handles authentication, authorization, and other cross-cutting concerns, simplifying the development of cloud applications. 24 | * [@sap/xsenv](https://www.npmjs.com/package/@sap/xsenv) - A Node.js module that simplifies the process of reading environment variables and binding services to SAP applications. It helps in configuring applications by extracting service bindings and credentials from the environment. 25 | 26 | ## Next 27 | 28 | Continue to 👉 [Exercise 5 - Add User Authentication to Your Application (SAP HANA Cloud)](../ex5/README.md) 29 | -------------------------------------------------------------------------------- /exercises/ex5/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 5 - Add User Authentication to Your Application (SAP HANA Cloud) 2 | 3 | In this exercise we will define security and enable user authentication and authorization for your SAP HANA Cloud CAP application. 4 | 5 | Perform all the steps in 👉 [tutorial: Add User Authentication to Your Application (SAP HANA Cloud)](https://developers.sap.com/tutorials/hana-cloud-cap-add-authentication.html) 6 | 7 | ## Summary 8 | 9 | While we could use CAP to mock the authentication, we've gone a step further in this exercise and generated a real XSUAA instance and added authentication to our application in a way that allows us to still test via the locally running services in the Business Application Studio. 10 | 11 | ### Questions for Discussion 12 | 13 | 1. Why is the `redirect-uris` needed in the [xs-security.json](https://www.npmjs.com/package/@sap/approuter#xs-appjson-configuration-file)?
Answer 14 | The `redirect-uris` are needed in the `xs-security.json` to specify the URIs to which the authentication service can redirect the user after a successful login. This ensures that the user is redirected to a valid and trusted location within the application. 15 | The `xs-app.json` configuration file is used to define the routes and authentication settings for the SAP Application Router. It includes properties such as `authenticationMethod`, `routes`, and `redirect-uris` to control how requests are handled and authenticated. This configuration ensures secure access to the application and proper routing of requests.
16 | 17 | 1. What other [authentication strategies](https://cap.cloud.sap/docs/node.js/authentication#strategies) could we have used with CAP?
Answer 18 | Other authentication strategies that could be used with CAP include: 19 | - Dummy Authentication: Used for local development and testing without real authentication. 20 | - Mocked Authentication: Simulates authentication for testing purposes. 21 | - Basic Authentication: Uses a username and password for authentication. 22 | - JWT (JSON Web Token): Uses tokens for stateless authentication. 23 | - XSUAA (SAP Authorization and Trust Management Service): Provides OAuth2-based authentication and authorization. 24 | - IAS (Identity Authentication Service): SAP's cloud-based identity service. 25 | - Custom Authentication: Implementing custom logic to handle authentication based on specific requirements. 26 | Each of these strategies offers different mechanisms for verifying user identities and can be chosen based on the specific requirements and security policies of the application.
27 | 28 | 1. Why did the request to `/user-api/` work? We didn't code it and CAP didn't provide it. So [where did it come from](https://blogs.sap.com/2021/02/20/sap-tech-bytes-approuter-user-api-service/)?
Answer 29 | The request to `/user-api/` worked because it is provided by the SAP Application Router. The Application Router includes a built-in service called `user-api` that exposes user information and authentication details. This service is automatically available when using the Application Router, allowing applications to access user-related data without needing to implement this functionality themselves.
30 | 31 | ## Further Study 32 | 33 | - [SAP CAP Authentication](https://cap.cloud.sap/docs/node.js/authentication) 34 | - [XSUAA in Hybrid Setup](https://cap.cloud.sap/docs/node.js/authentication#xsuaa-setup) 35 | - [CAP Authorization and Access Control](https://cap.cloud.sap/docs/guides/authorization) 36 | - [SAP BTP Roles and Role Collections](https://help.sap.com/docs/BTP/65de2977205c403bbc107264b8eccf4b/14a877c6e2f14832999df500ffa6e05e.html) 37 | 38 | ## Next 39 | 40 | Continue to 👉 [Exercise 6 - Create Calculation View and Expose via CAP (SAP HANA Cloud)](../ex6/README.md) 41 | -------------------------------------------------------------------------------- /exercises/ex6/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 6 - Create Calculation View and Expose via CAP (SAP HANA Cloud) 2 | 3 | In this exercise we will learn how to combine HANA native artifacts, like calculation views, with SAP Cloud Application Programming Model (CAP). 4 | 5 | Perform all the steps in 👉 [tutorial: Create Calculation View and Expose via CAP (SAP HANA Cloud)](https://developers.sap.com/tutorials/hana-cloud-cap-calc-view.html) 6 | 7 | ## Summary 8 | 9 | You've now experienced Calculation View development in the Business Application Studio. For some of you this might have been a big change from HANA Studio. For others coming from SAP Web IDE, the difference isn't really all that much. 10 | 11 | But perhaps more importantly you now know how to create a CAP `proxy` entity to import an existing database artifact into CAP (and therefore also use it in the service layer). This can be done for database tables that weren't modeled in CAP or that come from another schema/container as well as SQL Views. 12 | 13 | ### Questions for Discussion 14 | 15 | 1. This was a very basic Calculation View and perhaps everyone in the room is already familiar with Calculation Views; but if new to the topic -- what is a [Calculation View](https://help.sap.com/docs/SAP_HANA_PLATFORM/52715f71adba4aaeb480d946c742d1f6/18e1d60a75524e43b81acff652dae772.html) and how is it different from a [SQL View](https://help.sap.com/docs/HANA_CLOUD_DATABASE/c1d3f60099654ecfb3fe36ac93c121bb/20d5fa9b75191014a33eee92692f1702.html)?
AnswerA Calculation View is a powerful feature in SAP HANA that allows for complex data transformations and aggregations. It is different from a SQL View in that it can include multiple data sources, advanced calculations, and graphical modeling, whereas a SQL View is a simpler, predefined query on a single table or a set of joined tables.
16 | 17 | 1. Why did we change from a [namespace](https://cap.cloud.sap/docs/guides/domain-modeling#using-namespaces) to a [context](https://cap.cloud.sap/docs/cds/cdl#context) in steps three?
AnswerWe changed from a namespace to a context to better organize and encapsulate the entities and services within the CAP model. Contexts provide a way to group related entities and services, making the model more modular and easier to manage. But most important in this case is the need for the proxy entity name to match the underlying database object (in this case the Calculation View) EXACTLY. The namespace is applied to everything in the file, but the context allows us to have the same functionality but only applied to a section of the objects in the cds file. This allows us to have the benefits above for all the native CDS objects but also keep the specific, simple name to match the Calculation View.
18 | 19 | 1. What is [`@cds.persistence.exists`](https://cap.cloud.sap/docs/cds/annotations#persistence) doing?
AnswerThe `@cds.persistence.exists` annotation indicates that the entity already exists in the database and should not be created or altered by the CAP framework. It is used to integrate existing database artifacts into the CAP model without modifying them. This is particularly useful when you want to use existing tables, views, or other database objects that were not created by CAP but need to be part of your CAP service. By using this annotation, you ensure that CAP does not attempt to recreate or modify these objects during deployment, thus preserving their original structure and data.
20 | 21 | 1. What is [`@cds.persistence.calcview`](https://cap.cloud.sap/docs/advanced/hana#calculated-views-and-user-defined-functions) doing?
AnswerThe `@cds.persistence.calcview` annotation is used to indicate that the entity represents a calculation view in SAP HANA. This allows CAP to recognize and interact with the calculation view as part of the service layer.
22 | 23 | ## Further Study 24 | 25 | * [CAP - Using Native SAP HANA Artifacts](https://cap.cloud.sap/docs/advanced/hana) 26 | * [SAP HANA Cloud, SAP HANA Database Modeling Guide for SAP Business Application Studio](https://help.sap.com/docs/HANA_CLOUD_DATABASE/d625b46ef0b445abb2c2fd9ba008c265/9ed48614318a4831a8a6b3e3222a05f0.html) 27 | * [hana-cli inspectView](https://github.com/SAP-samples/hana-developer-cli-tool-example#inspectview) 28 | The `hana-cli inspectView` command is used to inspect the details of a calculation view in SAP HANA. It provides metadata about the view, including its structure, columns, and dependencies. This command is useful for understanding the composition and properties of a calculation view, which can aid in debugging and development. 29 | 30 | ## Next 31 | 32 | Continue to 👉 [Exercise 7 - Create HANA Stored Procedure and Expose as CAP Service Function (SAP HANA Cloud)](../ex7/README.md) 33 | -------------------------------------------------------------------------------- /exercises/ex7/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 7 - Create HANA Stored Procedure and Expose as CAP Service Function (SAP HANA Cloud) 2 | 3 | In this exercise we will further combine SAP HANA Cloud native artifacts with the SAP Cloud Application Programming Model (CAP), and expose SQLScript procedures as service functions. 4 | 5 | Perform all the steps in 👉 [tutorial: Create HANA Stored Procedure and Expose as CAP Service Function (SAP HANA Cloud)](https://developers.sap.com/tutorials/hana-cloud-cap-stored-proc.html) 6 | 7 | ## Summary 8 | 9 | The goals of this exercise are vary similar to the previous one. Import and Expose an existing database artifact via CAP. But there are some major differences here for Stored Procedures. Unlike views they aren't exposed as entities but as [functions or actions](https://cap.cloud.sap/docs/guides/providing-services#actions-and-functions). 10 | 11 | ### Questions for Discussion 12 | 13 | 1. What's [`SQLSCRIPT_SYNC`](https://help.sap.com/docs/HANA_CLOUD_DATABASE/d1cb63c8dd8e4c35a0f18aef632687f0/31321d64e34e4a808fb448e6fa312c03.html)?
AnswerIn some scenarios you may need to let certain processes wait for a while (for example, when executing repetitive tasks). Implementing such waiting manually may lead to "busy waiting" and to the CPU performing unnecessary work during the waiting time. To avoid this, SQLScript offers a built-in library SYS.SQLSCRIPT_SYNC containing the procedures SLEEP_SECONDS and WAKEUP_CONNECTION.
14 | 15 | 1. Why did we have to redeploy to the HANA Database after adding the Calculation View to the CAP service but didn't need to do the same when adding the Stored Procedure?
AnswerThe Calculation View creates an entity via the Service Definition which requires deployment into the database (creating a SQL View on top of the Calculation View) for access via OData. However functions and actions, which are used to access SQLScript objects, do not need such entities generated and therefore don't need a database deployment before they can be accessed.
16 | 17 | 1. What's the difference between a [function and an action](https://cap.cloud.sap/docs/guides/providing-services#actions-vs-functions)?
AnswerFunctions are read-only operations that do not change the state of the system, while actions can perform operations that modify the state of the system.
18 | 19 | 1. Why did we use module CAP (https://cap.cloud.sap/docs/releases/archive/2022/mar22#driver-agnostic-results-for-stored-procedures) instead of `hdb` directly to call the Stored Procedure? You can read more about it [here](https://blogs.sap.com/2022/04/07/sap-tech-bytes-hana-client-tools-for-javascript-developers-part-4-xsjs-and-cap/).
AnswerUsing the CAP module provides a driver-agnostic way to call stored procedures, which simplifies the code and makes it more maintainable compared to using the `hdb` module directly.
20 | 21 | ## Further Study 22 | 23 | * [CAP - Using Native SAP HANA Artifacts](https://cap.cloud.sap/docs/advanced/hana) 24 | * [SAP HANA Cloud, SAP HANA SQLScript Reference](https://help.sap.com/docs/HANA_CLOUD_DATABASE/d1cb63c8dd8e4c35a0f18aef632687f0/28f2d64d4fab4e789ee0070be418419d.html) 25 | * [hdb module](https://www.npmjs.com/package/hdb) - The `hdb` module is a Node.js client for SAP HANA that allows you to execute SQL queries, call stored procedures, and manage database connections. 26 | * [sap-hdb-promisfied module](https://www.npmjs.com/package/sap-hdb-promisfied) - The `sap-hdb-promisfied` module is a wrapper around the `hdb` module that adds promise support, making it easier to work with asynchronous operations in a more readable and maintainable way. 27 | 28 | ## Next 29 | 30 | Continue to 👉 [Exercise 8 - Deploy CAP with SAP HANA Cloud project as MTA](../ex8/README.md) 31 | -------------------------------------------------------------------------------- /exercises/ex8/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 8 Bonus Homework - Deploy CAP with SAP HANA Cloud project as MTA 2 | 3 | > **Note:** This exercise cannot be performed during the CodeJam because we are using a shared BTP subaccount with limited resources. However, you can complete this exercise later in your own environment. If you do not have access to a corporate BTP account, you can sign up for a [BTP trial account](https://www.sap.com/products/business-technology-platform/trial.html) to try it out. Knowing how to deploy the final application with real security in a production environment is valuable as it ensures that your application is secure and scalable. 4 | 5 | In this exercise, you will learn how to deploy a CAP project with SAP HANA Cloud as a Multi-Target Application (MTA). This involves creating an MTA project, configuring the deployment, and deploying it to SAP Business Technology Platform. 6 | 7 | Perform all the steps in 👉 [tutorial: Deploy CAP with SAP HANA Cloud project as MTA](https://developers.sap.com/tutorials/hana-cloud-cap-deploy-mta.html) 8 | 9 | ## Summary 10 | 11 | In this exercise, you have successfully deployed a CAP project with SAP HANA Cloud as an MTA. You learned how to create an MTA project, configure the deployment, build the MTA archive, and deploy it to SAP BTP. 12 | 13 | ## Questions for Discussion 14 | 15 | 1. What is the Cloud MTA Build Tool?
AnswerThe Cloud MTA Build Tool (MBT) is a command-line tool used to build multi-target applications (MTAs). It packages the application into a deployable archive (MTAR file) that can be deployed to SAP Business Technology Platform.
16 | 17 | 1. Why is the db-deployer application in a Stopped status?
AnswerThe db-deployer application is in a Stopped status because it is only needed during the deployment process to set up the database schema. Once the deployment is complete, the application is stopped to save resources.
18 | 19 | ## Further Study 20 | 21 | * [MTA Build Tool](https://sap.github.io/cloud-mta-build-tool/) 22 | * The MTA Build Tool (MBT) is a command-line tool used to build multi-target applications (MTAs). It packages the application into a deployable archive (MTAR file) that can be deployed to SAP Business Technology Platform. 23 | * [xs-security.json](https://help.sap.com/docs/btp/sap-business-technology-platform/add-authentication-and-functional-authorization-checks-to-your-application?locale=en-US&q=xs-security.json) 24 | * The `xs-security.json` file is used to define the security configuration for applications deployed to SAP BTP, including roles, scopes, and attributes. 25 | * [MTAR file](https://help.sap.com/docs/btp/sap-business-technology-platform/multitarget-applications-in-cloud-foundry-environment?locale=en-US&q=MTAR+) 26 | * An MTAR file is a deployable archive created by the MTA Build Tool that contains all the resources and modules of a multi-target application. 27 | * [SAP BTP Cloud Foundry Runtime](https://help.sap.com/docs/btp/sap-business-technology-platform/cloud-foundry-environment?locale=en-US&q=Cloud+Foundry) 28 | * The SAP BTP Cloud Foundry Runtime is a platform-as-a-service (PaaS) offering that allows developers to build, deploy, and run applications on SAP Business Technology Platform using Cloud Foundry. 29 | * [Cloud Foundry Deploy](https://docs.cloudfoundry.org/devguide/deploy-apps/deploy-app.html) 30 | * Cloud Foundry Deploy refers to the process of deploying applications to the Cloud Foundry environment, including pushing the application code, binding services, and managing application instances. 31 | * [MultiApps CF CLI Plugin](https://github.com/cloudfoundry/multiapps-cli-plugin) 32 | * This is a Cloud Foundry CLI plugin (formerly known as CF MTA Plugin) for performing operations on Multitarget Applications (MTAs) in Cloud Foundry, such as deploying, removing, viewing, etc. It is a client for the CF MultiApps Controller (known also as CF MTA Deploy Service), which is an MTA deployer implementation for Cloud Foundry. The business logic and actual processing of MTAs happens into CF MultiApps Controller backend. 33 | * [Cloud Foundry Application Routes](https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html) 34 | * Cloud Foundry Application Routes are used to map URLs to applications running in the Cloud Foundry environment, allowing external access to the applications. 35 | -------------------------------------------------------------------------------- /exercises/template.md: -------------------------------------------------------------------------------- 1 | # Exercise nn - Title 2 | 3 | At the end of this exercise, ... 4 | 5 | ## Section 6 | 7 | ... 8 | 9 | ## Another section 10 | 11 | ... 12 | 13 | ## Summary 14 | 15 | At this point ... 16 | 17 | ## Further reading 18 | 19 | * ... 20 | 21 | --- 22 | 23 | If you finish earlier than your fellow participants, you might like to ponder these questions. There isn't always a single correct answer and there are no prizes - they're just to give you something else to think about. 24 | 25 | https://markdown-it.github.io/markdown-it/#MarkdownIt.parse -------------------------------------------------------------------------------- /images/ex1/adding_a_mapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex1/adding_a_mapping.png -------------------------------------------------------------------------------- /images/ex1/create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex1/create.png -------------------------------------------------------------------------------- /images/ex1/free.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex1/free.png -------------------------------------------------------------------------------- /images/ex1/selecting_manage_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex1/selecting_manage_configuration.png -------------------------------------------------------------------------------- /images/ex1/service_marketplace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex1/service_marketplace.png -------------------------------------------------------------------------------- /images/ex1/studio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex1/studio.png -------------------------------------------------------------------------------- /images/ex1/three_dots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex1/three_dots.png -------------------------------------------------------------------------------- /images/ex2/CAP_Project_Wizard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex2/CAP_Project_Wizard.png -------------------------------------------------------------------------------- /images/ex2/cap_project_generator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex2/cap_project_generator.png -------------------------------------------------------------------------------- /images/ex2/cds_init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex2/cds_init.png -------------------------------------------------------------------------------- /images/ex2/command_pallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex2/command_pallet.png -------------------------------------------------------------------------------- /images/ex2/login_to_cf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex2/login_to_cf.png -------------------------------------------------------------------------------- /images/ex2/open_template_wizard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex2/open_template_wizard.png -------------------------------------------------------------------------------- /images/ex2/run_generator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex2/run_generator.png -------------------------------------------------------------------------------- /images/ex2/template_wizard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex2/template_wizard.png -------------------------------------------------------------------------------- /images/ex3/add_database_connection_to_dbx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex3/add_database_connection_to_dbx.png -------------------------------------------------------------------------------- /images/ex3/add_hdi_container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex3/add_hdi_container.png -------------------------------------------------------------------------------- /images/ex3/bind_to_service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex3/bind_to_service.png -------------------------------------------------------------------------------- /images/ex3/create_hdi_service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex3/create_hdi_service.png -------------------------------------------------------------------------------- /images/ex3/db_npm_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex3/db_npm_install.png -------------------------------------------------------------------------------- /images/ex3/dbx_in_vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex3/dbx_in_vscode.png -------------------------------------------------------------------------------- /images/ex3/deploy_via_npm_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex3/deploy_via_npm_start.png -------------------------------------------------------------------------------- /images/ex3/open_database_explorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex3/open_database_explorer.png -------------------------------------------------------------------------------- /images/ex4/app_router_config_wizard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex4/app_router_config_wizard.png -------------------------------------------------------------------------------- /images/ex4/open_app_router_wizard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex4/open_app_router_wizard.png -------------------------------------------------------------------------------- /images/ex5/xs_security_json.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/ex5/xs_security_json.png -------------------------------------------------------------------------------- /images/instructor/assignCodeJamRC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/assignCodeJamRC.png -------------------------------------------------------------------------------- /images/instructor/assignRoleCollection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/assignRoleCollection.png -------------------------------------------------------------------------------- /images/instructor/cleanupCloudFoundry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/cleanupCloudFoundry.png -------------------------------------------------------------------------------- /images/instructor/cleanupDeleteServiceInstances.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/cleanupDeleteServiceInstances.png -------------------------------------------------------------------------------- /images/instructor/createSpace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/createSpace.png -------------------------------------------------------------------------------- /images/instructor/createSpace2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/createSpace2.png -------------------------------------------------------------------------------- /images/instructor/createUser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/createUser.png -------------------------------------------------------------------------------- /images/instructor/createUserDialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/createUserDialog.png -------------------------------------------------------------------------------- /images/instructor/deleteUsers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/deleteUsers.png -------------------------------------------------------------------------------- /images/instructor/deleterolecollection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/deleterolecollection.png -------------------------------------------------------------------------------- /images/instructor/enableCloudFoundry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/enableCloudFoundry.png -------------------------------------------------------------------------------- /images/instructor/hanaCloudDelete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/hanaCloudDelete.png -------------------------------------------------------------------------------- /images/instructor/hanaCloudTools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/hanaCloudTools.png -------------------------------------------------------------------------------- /images/instructor/securityUsers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/securityUsers.png -------------------------------------------------------------------------------- /images/instructor/spaceMembers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/spaceMembers.png -------------------------------------------------------------------------------- /images/instructor/subaccount.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/instructor/subaccount.png -------------------------------------------------------------------------------- /images/prereq/clone_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/prereq/clone_project.png -------------------------------------------------------------------------------- /images/prereq/codespace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/prereq/codespace.png -------------------------------------------------------------------------------- /images/prereq/node_v_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/prereq/node_v_check.png -------------------------------------------------------------------------------- /images/prereq/reopen_remote_container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/images/prereq/reopen_remote_container.png -------------------------------------------------------------------------------- /prerequisites.md: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | 3 | There are hardware, software and service prerequisites for participating in this CodeJam. The exercises will be shown executing in the [SAP Business Application Studio](https://community.sap.com/topics/business-application-studio) as the development tool. However you can also execute them [locally on your own tooling such as Microsoft VSCode](#prerequisites-for-performing-the-exercises-locally) or using a [Dev Container](#prerequisites-for-performing-the-exercises-in-a-dev-container) or [Codespace](#prerequisites-for-performing-the-exercises-in-a-codespaces). See separate section for each of these options. 4 | 5 | ## Normal Prerequisites (SAP Business Application Studio) 6 | 7 | ### Hardware 8 | 9 | * If attending an in-person CodeJam, please bring your own laptop. 10 | 11 | ### Software 12 | 13 | * [A web browser supported by the SAP Business Application Studio](https://help.sap.com/docs/SAP%20Business%20Application%20Studio/9d1db9835307451daa8c930fbd9ab264/8f46c6e6f86641cc900871c903761fd4.html#availability) 14 | 15 | ### Services 16 | 17 | * You will get access to the provided SAP BTP account for the CodeJam. If you want to continue learning afterwards, you can also sign up for a free SAP Business Technology Platform trial account: 18 | * [Tutorial: Get an SAP BTP Account for Tutorials](https://developers.sap.com/tutorials/btp-cockpit-setup.html) 19 | 20 | ## Prerequisites for Performing the Exercises Locally 21 | 22 | In this exercise variant, you will install all development tools locally in your laptop and develop test there. Unfortunately the SAP HANA Graphical Calculation View Editor is not supported as a VSCode Extension yet, so those steps must be performed in the SAP Business Application Studio. However the rest of the exercises are possible locally. 23 | 24 | There is also a brand new option that allows you to use VSCode locally but remotely connect it to your Business Application Studio dev space. This avoids the need to install all the prerequisites to local development. To read more about this option, [see here](https://blogs.sap.com/2023/05/09/product-updates-for-sap-business-application-studio-2304/?source=social-Global-YOUTUBE-MarketingCampaign-Developers-Business_Technology_Platform_Umbrella-spr-9927419192-account_name&campaigncode=CRM-XB23-MKT-DGEALL&sprinklrid=9927419192). 25 | 26 | ### Summary of Microsoft Visual Studio Code Desktop Client for SAP Business Application Studio 27 | 28 | The Microsoft Visual Studio Code Desktop Client for SAP Business Application Studio allows developers to use the familiar VSCode interface while connecting remotely to their SAP Business Application Studio dev space. This setup provides the following benefits: 29 | 30 | * **Reduced Local Setup**: Developers can avoid installing all development tools locally, as they can leverage the tools available in the remote dev space. 31 | * **Seamless Integration**: The integration ensures a smooth development experience with access to all necessary tools and extensions. 32 | * **Flexibility**: Developers can work from different environments without worrying about local setup inconsistencies. 33 | 34 | For detailed information, refer to the [blog post](https://blogs.sap.com/2023/05/09/product-updates-for-sap-business-application-studio-2304/?source=social-Global-YOUTUBE-MarketingCampaign-Developers-Business_Technology_Platform_Umbrella-spr-9927419192-account_name&campaigncode=CRM-XB23-MKT-DGEALL&sprinklrid=9927419192). 35 | 36 | ### Local Hardware 37 | 38 | * None 39 | 40 | ### Local Software 41 | 42 | * Ensure that you have [Node.js](https://nodejs.org/en/download/) version [18](https://nodejs.org/dist/latest-v18.x/), [20](https://nodejs.org/dist/latest-v20.x/), or [22](https://nodejs.org/dist/latest-v22.x/) installed locally. Make sure you run the latest long-term support (LTS) version of Node.js with an even number like 20. Refrain from using odd versions, for which some modules with native parts will have no support and thus might even fail to install. In case of problems, see the [Troubleshooting guide for CAP](https://cap.cloud.sap/docs/get-started/troubleshooting#npm-installation). 43 | ![Node.js Version Check](images/prereq/node_v_check.png) 44 | 45 | * [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). 46 | 47 | * [Install the Cloud Foundry command line interface](https://docs.cloudfoundry.org/cf-cli/install-go-cli.html) 48 | 49 | * [Add CAP tooling](https://developers.sap.com/tutorials/cp-apm-nodejs-create-service.html#f1f8e95a-3c77-462b-80fc-0579d49e4afe) 50 | 51 | * [Install Microsoft Visual Studio Code](https://code.visualstudio.com/) 52 | 53 | * [Install VS Code extensions](https://developers.sap.com/tutorials/cp-apm-nodejs-create-service.html#77505c79-8374-4afb-99a6-9530fb52f968) 54 | 55 | * [Install SAP Fiori tools Extension Pack](https://marketplace.visualstudio.com/items?itemName=SAPSE.sap-ux-fiori-tools-extension-pack) 56 | 57 | * [Install SAP Cloud MTA Build Tool](https://sap.github.io/cloud-mta-build-tool/download/) 58 | 59 | ### Local Services 60 | 61 | * See [Normal Prerequisites Services Section](#services) 62 | 63 | ## Prerequisites for Performing the Exercises in a Dev Container 64 | 65 | In this scenario you will develop locally but we will reduce the amount of setup steps and tools you need to install by using [development containers](https://code.visualstudio.com/docs/remote/containers). This uses Docker Desktop and VSCode extensions provided by Microsoft to configure and remotely connect VSCode to this a container. 66 | 67 | ![Dev Container Architecture](https://code.visualstudio.com/assets/docs/devcontainers/containers/architecture-containers.png) 68 | 69 | ### Dev Container Software 70 | 71 | * [Install Microsoft Visual Studio Code](https://code.visualstudio.com/) 72 | 73 | * [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). 74 | 75 | * [VS Code Extension for Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) 76 | 77 | * A Docker based container orchestration tool such as [Docker Desktop](https://www.docker.com/products/docker-desktop/) on Windows and MacOS or [Docker for Linux](https://docs.docker.com/engine/install/) on Linux 78 | > The license for Docker Desktop has changed - see [Docker is Updating and Extending Our Product Subscriptions](https://www.docker.com/blog/updating-product-subscriptions/) for an overview. 79 | 80 | * [Clone this Repository](https://github.com/SAP-samples/cap-hana-exercises-codejam) 81 | ![Clone Project](images/prereq/clone_project.png) 82 | 83 | * When the project opens in VSCode you should receive a dialog in the lower right corner that the "Folder contains a Dev Container". Choose to `Reopen in Container` 84 | ![Reopen in Container](images/prereq/reopen_remote_container.png) 85 | 86 | ### Node.js Docker Images for Dev Containers 87 | 88 | When using Dev Containers, you might encounter different Node.js Docker images such as `buster`, `bullseye`, and `bookworm`. These names refer to different Debian releases that the Node.js images are based on: 89 | 90 | * **buster**: This is based on Debian 10. It is an older, stable release. 91 | * **bullseye**: This is based on Debian 11. It is the current stable release and is recommended for most users. 92 | * **bookworm**: This is based on Debian 12. It is the testing release and includes the latest features but might not be as stable as `bullseye`. 93 | 94 | In the context of Dev Containers, these images are used to provide a consistent development environment. You can choose the appropriate image based on your stability and feature requirements. For most users, `bullseye` is recommended as it provides a good balance between stability and up-to-date features. 95 | 96 | ### Dev Container Services 97 | 98 | * See [Normal Prerequisites Services Section](#services) 99 | 100 | ## Prerequisites for Performing the Exercises in a Codespaces 101 | 102 | This is a bit of a hybrid scenario. It uses the Dev Container configuration but runs the Dev Container and development tools in the cloud via [GitHub Codespaces](https://github.com/features/codespaces). It has the ease of starting similar to SAP Business Application Studio and its Dev Spaces, but allows for more customization of the environment and usage of a larger range of VSCode Extensions. 103 | 104 | ### Codespaces Hardware 105 | 106 | * None 107 | 108 | ### Codespaces Software 109 | 110 | * From GitHub choose the option to create a new codespace. 111 | ![Create Codespace](images/prereq/codespace.png) 112 | 113 | * You can then use this codespace from the browser or open it remotely in your locally VSCode installation. The codespace will be pre-configured with the correct Node.js runtime, all other development tools and already has the project cloned into it. 114 | 115 | ### Codespaces Services 116 | 117 | * See [Normal Prerequisites Services Section](#services) 118 | -------------------------------------------------------------------------------- /slides/BAS_Small.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/slides/BAS_Small.pdf -------------------------------------------------------------------------------- /slides/CAP_Small.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/slides/CAP_Small.pdf -------------------------------------------------------------------------------- /slides/HANA_Small.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cap-hana-exercises-codejam/64a9b34d9ce712901b809cd655a7fd6341d1098e/slides/HANA_Small.pdf -------------------------------------------------------------------------------- /solution/MyHANAApp/.gitignore: -------------------------------------------------------------------------------- 1 | # CAP MyHANAApp 2 | _out 3 | *.db 4 | *.sqlite 5 | connection.properties 6 | default-*.json 7 | .cdsrc-private.json 8 | gen/ 9 | node_modules/ 10 | target/ 11 | 12 | # Web IDE, App Studio 13 | .che/ 14 | .gen/ 15 | 16 | # MTA 17 | *_mta_build_tmp 18 | *.mtar 19 | mta_archives/ 20 | 21 | # Other 22 | .DS_Store 23 | *.orig 24 | *.log 25 | 26 | *.iml 27 | *.flattened-pom.xml 28 | 29 | # IDEs 30 | # .vscode 31 | # .idea 32 | 33 | # @cap-js/cds-typer 34 | @cds-models 35 | 36 | # auto generated wildcard 37 | db/.env -------------------------------------------------------------------------------- /solution/MyHANAApp/.pipeline/config.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # This file configures the project "Piper" pipeline of your project. 3 | # For a reference of the configuration concept and available options, please have a look into its documentation. 4 | # 5 | # The documentation for the most recent pipeline version can always be found at: 6 | # https://www.project-piper.io/ 7 | # 8 | # This is a YAML-file. YAML is an indentation-sensitive file format. Please make sure to properly indent changes to it. 9 | ### 10 | 11 | 12 | 13 | ### General project setup 14 | general: 15 | inferBuildTool: true 16 | 17 | ### Step-specific configuration 18 | steps: 19 | mavenExecute: 20 | dockerImage: devxci/mbtci:1.0.14 21 | 22 | artifactPrepareVersion: 23 | versioningType: cloud_noTag 24 | 25 | ### Stage-specific configuration 26 | stages: 27 | 'Confirm': 28 | manualConfirmation: false 29 | 30 | # Integration: 31 | # credentials: 32 | # - alias: 'mySystemAlias' 33 | # credentialId: 'mySystemCredentialsId' 34 | 35 | # Release: 36 | # cfTargets: 37 | # - org: 'myOrg' 38 | # space: 'mySpace' 39 | # apiEndpoint: 'https://' 40 | # appName: 'myAppName' 41 | # manifest: 'manifest.yml' 42 | # credentialsId: 'myDeploymentCredentialsId' 43 | -------------------------------------------------------------------------------- /solution/MyHANAApp/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "SAPSE.vscode-cds", 4 | "dbaeumer.vscode-eslint", 5 | "esbenp.prettier-vscode", 6 | "mechatroner.rainbow-csv", 7 | "qwtel.sqlite-viewer", 8 | "humao.rest-client" 9 | ], 10 | "unwantedRecommendations": [ 11 | 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /solution/MyHANAApp/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "cds serve", 6 | "request": "launch", 7 | "type": "node", 8 | "cwd": "${workspaceFolder}", 9 | "runtimeExecutable": "cds", 10 | "args": [ 11 | "serve", 12 | "--with-mocks", 13 | "--in-memory?" 14 | ], 15 | "skipFiles": [ 16 | "/**" 17 | ] 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /solution/MyHANAApp/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /solution/MyHANAApp/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "shell", 6 | "label": "cds watch", 7 | "command": "cds", 8 | "args": [ 9 | "watch" 10 | ], 11 | "group": { 12 | "kind": "build", 13 | "isDefault": true 14 | }, 15 | "problemMatcher": [] 16 | }, 17 | { 18 | "type": "shell", 19 | "label": "cds serve", 20 | "command": "cds", 21 | "args": [ 22 | "serve", 23 | "--with-mocks", 24 | "--in-memory?" 25 | ], 26 | "problemMatcher": [] 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /solution/MyHANAApp/Jenkinsfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | 3 | /* 4 | * This file bootstraps the codified Continuous Delivery pipeline for extensions of SAP solutions such as SAP S/4HANA. 5 | * The pipeline helps you to deliver software changes quickly and in a reliable manner. 6 | * A suitable Jenkins instance is required to run the pipeline. 7 | * More information on getting started with Continuous Delivery can be found here: https://www.project-piper.io/ 8 | */ 9 | 10 | @Library('piper-lib-os') _ 11 | 12 | piperPipeline script: this -------------------------------------------------------------------------------- /solution/MyHANAApp/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | Welcome to your new project. 4 | 5 | It contains these folders and files, following our recommended project layout: 6 | 7 | File or Folder | Purpose 8 | ---------|---------- 9 | `app/` | content for UI frontends goes here 10 | `db/` | your domain models and data go here 11 | `srv/` | your service models and code go here 12 | `package.json` | project metadata and configuration 13 | `readme.md` | this getting started guide 14 | 15 | 16 | ## Next Steps 17 | 18 | - Open a new terminal and run `cds watch` 19 | - (in VS Code simply choose _**Terminal** > Run Task > cds watch_) 20 | - Start adding content, for example, a [db/schema.cds](db/schema.cds). 21 | 22 | 23 | ## Learn More 24 | 25 | Learn more at https://cap.cloud.sap/docs/get-started/. 26 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/README.md: -------------------------------------------------------------------------------- 1 | ## Application Details 2 | | | 3 | | ------------- | 4 | |**Generation Date and Time**
Fri Dec 13 2024 16:56:57 GMT+0000 (Coordinated Universal Time)| 5 | |**App Generator**
@sap/generator-fiori-elements| 6 | |**App Generator Version**
1.15.7| 7 | |**Generation Platform**
SAP Business Application Studio| 8 | |**Template Used**
Worklist Page V4| 9 | |**Service Type**
Local Cap| 10 | |**Service URL**
http://localhost:4004/odata/v4/catalog/| 11 | |**Module Name**
interaction_items| 12 | |**Application Title**
Interaction Items List| 13 | |**Namespace**
| 14 | |**UI5 Theme**
sap_horizon| 15 | |**UI5 Version**
1.131.1| 16 | |**Enable Code Assist Libraries**
False| 17 | |**Enable TypeScript**
False| 18 | |**Add Eslint configuration**
False| 19 | |**Main Entity**
Interactions_Header| 20 | |**Navigation Entity**
items| 21 | 22 | ## interaction_items 23 | 24 | Interaction Items List 25 | 26 | ### Starting the generated app 27 | 28 | - This app has been generated using the SAP Fiori tools - App Generator, as part of the SAP Fiori tools suite. In order to launch the generated app, simply start your CAP project and navigate to the following location in your browser: 29 | 30 | http://localhost:4004/interaction_items/webapp/index.html 31 | 32 | #### Pre-requisites: 33 | 34 | 1. Active NodeJS LTS (Long Term Support) version and associated supported NPM version. (See https://nodejs.org) 35 | 36 | 37 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/annotations.cds: -------------------------------------------------------------------------------- 1 | using CatalogService as service from '../../srv/interaction_srv'; 2 | 3 | annotate service.Interactions_Header with @( 4 | UI.HeaderInfo : { 5 | Title : { 6 | $Type: 'UI.DataField', 7 | Value: partner, 8 | }, 9 | TypeName : 'Incident', 10 | TypeNamePlural: 'Incidens', 11 | Description : {Value: country.descr} 12 | }, 13 | UI.HeaderFacets : [{ 14 | $Type : 'UI.ReferenceFacet', 15 | Target : '@UI.FieldGroup#Admin' 16 | }], 17 | UI.FieldGroup #GeneratedGroup: { 18 | $Type: 'UI.FieldGroupType', 19 | Data : [ 20 | { 21 | $Type: 'UI.DataField', 22 | Label: 'Partner', 23 | Value: partner, 24 | }, 25 | { 26 | $Type: 'UI.DataField', 27 | Label: 'Country', 28 | Value: country_code, 29 | }, 30 | { 31 | $Type : 'UI.DataField', 32 | Label : 'Country', 33 | ![@Common.FieldControl]: #ReadOnly, 34 | Value : country.descr, 35 | }, 36 | ] 37 | }, 38 | UI.FieldGroup #Admin : {Data : [ 39 | { 40 | $Type : 'UI.DataField', 41 | Value : createdBy 42 | }, 43 | { 44 | $Type : 'UI.DataField', 45 | Value : modifiedBy 46 | }, 47 | { 48 | $Type : 'UI.DataField', 49 | Value : createdAt 50 | }, 51 | { 52 | $Type : 'UI.DataField', 53 | Value : modifiedAt 54 | } 55 | ] 56 | }, 57 | UI.Facets : [ 58 | { 59 | $Type : 'UI.ReferenceFacet', 60 | ID : 'GeneratedFacet1', 61 | Label : 'General Information', 62 | Target: '@UI.FieldGroup#GeneratedGroup', 63 | }, 64 | { 65 | $Type : 'UI.ReferenceFacet', 66 | Label : 'Interaction Items', 67 | Target: 'items/@UI.LineItem' 68 | } 69 | ], 70 | UI.LineItem : [ 71 | { 72 | $Type: 'UI.DataField', 73 | Label: 'Partner', 74 | Value: partner, 75 | }, 76 | { 77 | $Type : 'UI.DataField', 78 | Label : 'Country', 79 | ![@Common.FieldControl]: #ReadOnly, 80 | Value : country.name, 81 | }, 82 | ] 83 | ); 84 | 85 | annotate service.Interactions_Items with @( 86 | UI.HeaderInfo : { 87 | Title : { 88 | $Type: 'UI.DataField', 89 | Value: text, 90 | }, 91 | TypeName : 'Interaction Item', 92 | TypeNamePlural: 'Interaction Items' 93 | }, 94 | UI.FieldGroup #GeneratedGroup: { 95 | $Type: 'UI.FieldGroupType', 96 | Data : [ 97 | { 98 | $Type: 'UI.DataField', 99 | Label: 'Text', 100 | Value: text, 101 | }, 102 | { 103 | $Type: 'UI.DataField', 104 | Label: 'Date', 105 | Value: date, 106 | }, 107 | { 108 | $Type: 'UI.DataField', 109 | Label: 'Price', 110 | Value: price, 111 | }, 112 | { 113 | $Type: 'UI.DataField', 114 | Label: 'Currency', 115 | Value: currency_code, 116 | } 117 | ] 118 | }, 119 | UI.Facets : [ 120 | { 121 | $Type : 'UI.ReferenceFacet', 122 | ID : 'GeneratedFacet1', 123 | Label : 'General Information', 124 | Target: '@UI.FieldGroup#GeneratedGroup', 125 | }, 126 | { 127 | $Type : 'UI.ReferenceFacet', 128 | Label : 'Item Translations', 129 | Target: 'texts/@UI.LineItem' 130 | } 131 | ], 132 | UI.LineItem : [ 133 | { 134 | $Type: 'UI.DataField', 135 | Label: 'Text', 136 | Value: text, 137 | }, 138 | { 139 | $Type: 'UI.DataField', 140 | Label: 'Date', 141 | Value: date, 142 | }, 143 | { 144 | $Type: 'UI.DataField', 145 | Label: 'Price', 146 | Value: price, 147 | }, 148 | { 149 | $Type: 'UI.DataField', 150 | Label: 'Currency', 151 | Value: currency_code, 152 | } 153 | ] 154 | ); 155 | 156 | annotate service.Interactions_Items.texts with @(UI: { 157 | Identification : [{Value: text}], 158 | SelectionFields: [ 159 | locale, 160 | text 161 | ], 162 | LineItem : [ 163 | { 164 | Value: locale, 165 | Label: 'Locale' 166 | }, 167 | {Value: text} 168 | ] 169 | }); 170 | 171 | annotate service.Interactions_Items.texts with { 172 | ID @UI.Hidden; 173 | }; 174 | 175 | annotate service.Interactions_Items.texts { 176 | locale @( 177 | ValueList.entity: 'Languages', 178 | Common.ValueListWithFixedValues, 179 | ) 180 | } -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "interaction_items", 3 | "version": "0.0.1", 4 | "description": "Interaction Items List", 5 | "keywords": [ 6 | "ui5", 7 | "openui5", 8 | "sapui5" 9 | ], 10 | "main": "webapp/index.html", 11 | "dependencies": {}, 12 | "devDependencies": { 13 | "@ui5/cli": "^3.0.0", 14 | "@sap/ux-ui5-tooling": "1" 15 | }, 16 | "scripts": { 17 | "deploy-config": "npx -p @sap/ux-ui5-tooling fiori add deploy-config cf" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/ui5.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json 2 | 3 | specVersion: "3.1" 4 | metadata: 5 | name: interactionitems 6 | type: application 7 | server: 8 | customMiddleware: 9 | - name: fiori-tools-proxy 10 | afterMiddleware: compression 11 | configuration: 12 | ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted 13 | ui5: 14 | path: 15 | - /resources 16 | - /test-resources 17 | url: https://sapui5.hana.ondemand.com 18 | - name: fiori-tools-appreload 19 | afterMiddleware: compression 20 | configuration: 21 | port: 35729 22 | path: webapp 23 | delay: 300 24 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/Component.js: -------------------------------------------------------------------------------- 1 | sap.ui.define( 2 | ["sap/fe/core/AppComponent"], 3 | function (Component) { 4 | "use strict"; 5 | 6 | return Component.extend("interactionitems.Component", { 7 | metadata: { 8 | manifest: "json" 9 | } 10 | }); 11 | } 12 | ); -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/i18n/i18n.properties: -------------------------------------------------------------------------------- 1 | # This is the resource bundle for interactionitems 2 | 3 | #Texts for manifest.json 4 | 5 | #XTIT: Application name 6 | appTitle=Interaction Items List 7 | 8 | #YDES: Application description 9 | appDescription=Interaction Items List -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Interaction Items List 8 | 13 | 25 | 26 | 27 |
34 | 35 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "_version": "1.65.0", 3 | "sap.app": { 4 | "id": "interactionitems", 5 | "type": "application", 6 | "i18n": "i18n/i18n.properties", 7 | "applicationVersion": { 8 | "version": "0.0.1" 9 | }, 10 | "title": "{{appTitle}}", 11 | "description": "{{appDescription}}", 12 | "resources": "resources.json", 13 | "sourceTemplate": { 14 | "id": "@sap/generator-fiori:worklist", 15 | "version": "1.15.7", 16 | "toolsId": "64f88c49-5e13-468f-8bb5-b5c1cc7cc4e9" 17 | }, 18 | "dataSources": { 19 | "mainService": { 20 | "uri": "/odata/v4/catalog/", 21 | "type": "OData", 22 | "settings": { 23 | "annotations": [], 24 | "odataVersion": "4.0" 25 | } 26 | } 27 | } 28 | }, 29 | "sap.ui": { 30 | "technology": "UI5", 31 | "icons": { 32 | "icon": "", 33 | "favIcon": "", 34 | "phone": "", 35 | "phone@2": "", 36 | "tablet": "", 37 | "tablet@2": "" 38 | }, 39 | "deviceTypes": { 40 | "desktop": true, 41 | "tablet": true, 42 | "phone": true 43 | } 44 | }, 45 | "sap.ui5": { 46 | "flexEnabled": true, 47 | "dependencies": { 48 | "minUI5Version": "1.131.1", 49 | "libs": { 50 | "sap.m": {}, 51 | "sap.ui.core": {}, 52 | "sap.fe.templates": {} 53 | } 54 | }, 55 | "contentDensities": { 56 | "compact": true, 57 | "cozy": true 58 | }, 59 | "models": { 60 | "i18n": { 61 | "type": "sap.ui.model.resource.ResourceModel", 62 | "settings": { 63 | "bundleName": "interactionitems.i18n.i18n" 64 | } 65 | }, 66 | "": { 67 | "dataSource": "mainService", 68 | "preload": true, 69 | "settings": { 70 | "operationMode": "Server", 71 | "autoExpandSelect": true, 72 | "earlyRequests": true 73 | } 74 | }, 75 | "@i18n": { 76 | "type": "sap.ui.model.resource.ResourceModel", 77 | "uri": "i18n/i18n.properties" 78 | } 79 | }, 80 | "resources": { 81 | "css": [] 82 | }, 83 | "routing": { 84 | "config": {}, 85 | "routes": [ 86 | { 87 | "pattern": ":?query:", 88 | "name": "Interactions_HeaderList", 89 | "target": "Interactions_HeaderList" 90 | }, 91 | { 92 | "pattern": "Interactions_Header({key}):?query:", 93 | "name": "Interactions_HeaderObjectPage", 94 | "target": "Interactions_HeaderObjectPage" 95 | }, 96 | { 97 | "pattern": "Interactions_Header({key})/items({key2}):?query:", 98 | "name": "Interactions_ItemsObjectPage", 99 | "target": "Interactions_ItemsObjectPage" 100 | } 101 | ], 102 | "targets": { 103 | "Interactions_HeaderList": { 104 | "type": "Component", 105 | "id": "Interactions_HeaderList", 106 | "name": "sap.fe.templates.ListReport", 107 | "options": { 108 | "settings": { 109 | "contextPath": "/Interactions_Header", 110 | "variantManagement": "Page", 111 | "hideFilterBar": true, 112 | "navigation": { 113 | "Interactions_Header": { 114 | "detail": { 115 | "route": "Interactions_HeaderObjectPage" 116 | } 117 | } 118 | }, 119 | "controlConfiguration": { 120 | "@com.sap.vocabularies.UI.v1.LineItem": { 121 | "tableSettings": { 122 | "type": "ResponsiveTable" 123 | } 124 | } 125 | } 126 | } 127 | } 128 | }, 129 | "Interactions_HeaderObjectPage": { 130 | "type": "Component", 131 | "id": "Interactions_HeaderObjectPage", 132 | "name": "sap.fe.templates.ObjectPage", 133 | "options": { 134 | "settings": { 135 | "editableHeaderContent": false, 136 | "contextPath": "/Interactions_Header", 137 | "navigation": { 138 | "items": { 139 | "detail": { 140 | "route": "Interactions_ItemsObjectPage" 141 | } 142 | } 143 | } 144 | } 145 | } 146 | }, 147 | "Interactions_ItemsObjectPage": { 148 | "type": "Component", 149 | "id": "Interactions_ItemsObjectPage", 150 | "name": "sap.fe.templates.ObjectPage", 151 | "options": { 152 | "settings": { 153 | "editableHeaderContent": false, 154 | "contextPath": "/Interactions_Header/items" 155 | } 156 | } 157 | } 158 | } 159 | } 160 | }, 161 | "sap.fiori": { 162 | "registrationIds": [], 163 | "archeType": "transactional" 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/flpSandbox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{appTitle}} 9 | 10 | 25 | 57 | 58 | 59 | 60 | 72 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/integration/FirstJourney.js: -------------------------------------------------------------------------------- 1 | sap.ui.define([ 2 | "sap/ui/test/opaQunit" 3 | ], function (opaTest) { 4 | "use strict"; 5 | 6 | var Journey = { 7 | run: function() { 8 | QUnit.module("First journey"); 9 | 10 | opaTest("Start application", function (Given, When, Then) { 11 | Given.iStartMyApp(); 12 | 13 | Then.onTheInteractions_HeaderList.iSeeThisPage(); 14 | 15 | }); 16 | 17 | 18 | opaTest("Navigate to ObjectPage", function (Given, When, Then) { 19 | // Note: this test will fail if the ListReport page doesn't show any data 20 | 21 | Then.onTheInteractions_HeaderList.onTable().iCheckRows(); 22 | 23 | When.onTheInteractions_HeaderList.onTable().iPressRow(0); 24 | Then.onTheInteractions_HeaderObjectPage.iSeeThisPage(); 25 | 26 | }); 27 | 28 | opaTest("Teardown", function (Given, When, Then) { 29 | // Cleanup 30 | Given.iTearDownMyApp(); 31 | }); 32 | } 33 | } 34 | 35 | return Journey; 36 | }); -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/integration/opaTests.qunit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Integration tests 5 | 6 | 7 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 | 30 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/integration/opaTests.qunit.js: -------------------------------------------------------------------------------- 1 | sap.ui.require( 2 | [ 3 | 'sap/fe/test/JourneyRunner', 4 | 'interactionitems/test/integration/FirstJourney', 5 | 'interactionitems/test/integration/pages/Interactions_HeaderList', 6 | 'interactionitems/test/integration/pages/Interactions_HeaderObjectPage', 7 | 'interactionitems/test/integration/pages/Interactions_ItemsObjectPage' 8 | ], 9 | function(JourneyRunner, opaJourney, Interactions_HeaderList, Interactions_HeaderObjectPage, Interactions_ItemsObjectPage) { 10 | 'use strict'; 11 | var JourneyRunner = new JourneyRunner({ 12 | // start index.html in web folder 13 | launchUrl: sap.ui.require.toUrl('interactionitems') + '/index.html' 14 | }); 15 | 16 | 17 | JourneyRunner.run( 18 | { 19 | pages: { 20 | onTheInteractions_HeaderList: Interactions_HeaderList, 21 | onTheInteractions_HeaderObjectPage: Interactions_HeaderObjectPage, 22 | onTheInteractions_ItemsObjectPage: Interactions_ItemsObjectPage 23 | } 24 | }, 25 | opaJourney.run 26 | ); 27 | } 28 | ); -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/integration/pages/Interactions_HeaderList.js: -------------------------------------------------------------------------------- 1 | sap.ui.define(['sap/fe/test/ListReport'], function(ListReport) { 2 | 'use strict'; 3 | 4 | var CustomPageDefinitions = { 5 | actions: {}, 6 | assertions: {} 7 | }; 8 | 9 | return new ListReport( 10 | { 11 | appId: 'interactionitems', 12 | componentId: 'Interactions_HeaderList', 13 | contextPath: '/Interactions_Header' 14 | }, 15 | CustomPageDefinitions 16 | ); 17 | }); -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/integration/pages/Interactions_HeaderObjectPage.js: -------------------------------------------------------------------------------- 1 | sap.ui.define(['sap/fe/test/ObjectPage'], function(ObjectPage) { 2 | 'use strict'; 3 | 4 | var CustomPageDefinitions = { 5 | actions: {}, 6 | assertions: {} 7 | }; 8 | 9 | return new ObjectPage( 10 | { 11 | appId: 'interactionitems', 12 | componentId: 'Interactions_HeaderObjectPage', 13 | contextPath: '/Interactions_Header' 14 | }, 15 | CustomPageDefinitions 16 | ); 17 | }); -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/integration/pages/Interactions_ItemsObjectPage.js: -------------------------------------------------------------------------------- 1 | sap.ui.define(['sap/fe/test/ObjectPage'], function(ObjectPage) { 2 | 'use strict'; 3 | 4 | var CustomPageDefinitions = { 5 | actions: {}, 6 | assertions: {} 7 | }; 8 | 9 | return new ObjectPage( 10 | { 11 | appId: 'interactionitems', 12 | componentId: 'Interactions_ItemsObjectPage', 13 | contextPath: '/Interactions_Header/items' 14 | }, 15 | CustomPageDefinitions 16 | ); 17 | }); -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/testsuite.qunit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | QUnit test suite 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/interaction_items/webapp/test/testsuite.qunit.js: -------------------------------------------------------------------------------- 1 | window.suite = function() { 2 | 'use strict'; 3 | 4 | // eslint-disable-next-line 5 | var oSuite = new parent.jsUnitTestSuite(), 6 | 7 | sContextPath = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1); 8 | oSuite.addTestPage(sContextPath + 'integration/opaTests.qunit.html'); 9 | 10 | return oSuite; 11 | }; -------------------------------------------------------------------------------- /solution/MyHANAApp/app/router/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "approuter", 3 | "dependencies": { 4 | "@sap/approuter": "^16.0.0" 5 | }, 6 | "engines": { 7 | "node": "^22.0.0" 8 | }, 9 | "scripts": { 10 | "start": "node node_modules/@sap/approuter/approuter.js" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /solution/MyHANAApp/app/router/xs-app.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticationMethod": "route", 3 | "logout": { 4 | "logoutEndpoint": "/app-logout", 5 | "logoutPage": "/" 6 | }, 7 | "routes": [ 8 | { 9 | "source": "^/app/(.*)$", 10 | "target": "$1", 11 | "localDir": ".", 12 | "cacheControl": "no-cache, no-store, must-revalidate", 13 | "authenticationType": "xsuaa" 14 | }, 15 | { 16 | "source": "^/appconfig/", 17 | "localDir": ".", 18 | "cacheControl": "no-cache, no-store, must-revalidate" 19 | }, 20 | { 21 | "source": "^/user-api(.*)", 22 | "target": "$1", 23 | "service": "sap-approuter-userapi" 24 | }, 25 | { 26 | "source": "^/(.*)$", 27 | "target": "$1", 28 | "destination": "srv-api", 29 | "csrfProtection": true, 30 | "authenticationType": "xsuaa" 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /solution/MyHANAApp/app/services.cds: -------------------------------------------------------------------------------- 1 | 2 | using from './interaction_items/annotations'; -------------------------------------------------------------------------------- /solution/MyHANAApp/db/interactions.cds: -------------------------------------------------------------------------------- 1 | //namespace app.interactions; 2 | 3 | using { 4 | Country, 5 | Currency, 6 | cuid, 7 | managed 8 | } from '@sap/cds/common'; 9 | 10 | context app.interactions { 11 | type BusinessKey : String(10); 12 | type Price : Decimal(10, 2); 13 | type Text : String(1024); 14 | 15 | entity Headers : cuid, managed { 16 | items : Composition of many Items 17 | on items.interaction = $self; 18 | partner : BusinessKey; 19 | country : Country; 20 | }; 21 | 22 | entity Items : cuid { 23 | interaction : Association to Headers; 24 | text : localized Text; 25 | date : DateTime; 26 | 27 | @Semantics.amount.currencyCode: 'currency' 28 | price : Price; 29 | currency : Currency; 30 | }; 31 | } 32 | 33 | @cds.persistence.exists 34 | @cds.persistence.calcview 35 | Entity V_INTERACTION { 36 | key CREATEDAT: Timestamp @title: 'CREATEDAT: CREATEDAT' ; 37 | CREATEDBY: String(255) @title: 'CREATEDBY: CREATEDBY' ; 38 | MODIFIEDAT: Timestamp @title: 'MODIFIEDAT: MODIFIEDAT' ; 39 | MODIFIEDBY: String(255) @title: 'MODIFIEDBY: MODIFIEDBY' ; 40 | PARTNER: String(10) @title: 'PARTNER: PARTNER' ; 41 | COUNTRY_CODE: String(3) @title: 'COUNTRY_CODE: COUNTRY_CODE' ; 42 | TEXT: String(1024) @title: 'TEXT: TEXT' ; 43 | DATE: String @title: 'DATE: DATE' ; 44 | PRICE: Decimal(10) @title: 'PRICE: PRICE' ; 45 | CURRENCY_CODE: String(3) @title: 'CURRENCY_CODE: CURRENCY_CODE' ; 46 | } -------------------------------------------------------------------------------- /solution/MyHANAApp/db/src/.hdiconfig: -------------------------------------------------------------------------------- 1 | { 2 | "file_suffixes": { 3 | "csv": { 4 | "plugin_name": "com.sap.hana.di.tabledata.source" 5 | }, 6 | "hdbafllangprocedure": { 7 | "plugin_name": "com.sap.hana.di.afllangprocedure" 8 | }, 9 | "hdbanalyticprivilege": { 10 | "plugin_name": "com.sap.hana.di.analyticprivilege" 11 | }, 12 | "hdbcalculationview": { 13 | "plugin_name": "com.sap.hana.di.calculationview" 14 | }, 15 | "hdbcollection": { 16 | "plugin_name": "com.sap.hana.di.collection" 17 | }, 18 | "hdbconstraint": { 19 | "plugin_name": "com.sap.hana.di.constraint" 20 | }, 21 | "hdbdropcreatetable": { 22 | "plugin_name": "com.sap.hana.di.dropcreatetable" 23 | }, 24 | "hdbflowgraph": { 25 | "plugin_name": "com.sap.hana.di.flowgraph" 26 | }, 27 | "hdbfunction": { 28 | "plugin_name": "com.sap.hana.di.function" 29 | }, 30 | "hdbgraphworkspace": { 31 | "plugin_name": "com.sap.hana.di.graphworkspace" 32 | }, 33 | "hdbhadoopmrjob": { 34 | "plugin_name": "com.sap.hana.di.virtualfunctionpackage.hadoop" 35 | }, 36 | "hdbindex": { 37 | "plugin_name": "com.sap.hana.di.index" 38 | }, 39 | "hdblibrary": { 40 | "plugin_name": "com.sap.hana.di.library" 41 | }, 42 | "hdbmigrationtable": { 43 | "plugin_name": "com.sap.hana.di.table.migration" 44 | }, 45 | "hdbprocedure": { 46 | "plugin_name": "com.sap.hana.di.procedure" 47 | }, 48 | "hdbprojectionview": { 49 | "plugin_name": "com.sap.hana.di.projectionview" 50 | }, 51 | "hdbprojectionviewconfig": { 52 | "plugin_name": "com.sap.hana.di.projectionview.config" 53 | }, 54 | "hdbreptask": { 55 | "plugin_name": "com.sap.hana.di.reptask" 56 | }, 57 | "hdbresultcache": { 58 | "plugin_name": "com.sap.hana.di.resultcache" 59 | }, 60 | "hdbrole": { 61 | "plugin_name": "com.sap.hana.di.role" 62 | }, 63 | "hdbroleconfig": { 64 | "plugin_name": "com.sap.hana.di.role.config" 65 | }, 66 | "hdbsearchruleset": { 67 | "plugin_name": "com.sap.hana.di.searchruleset" 68 | }, 69 | "hdbsequence": { 70 | "plugin_name": "com.sap.hana.di.sequence" 71 | }, 72 | "hdbstatistics": { 73 | "plugin_name": "com.sap.hana.di.statistics" 74 | }, 75 | "hdbstructuredprivilege": { 76 | "plugin_name": "com.sap.hana.di.structuredprivilege" 77 | }, 78 | "hdbsynonym": { 79 | "plugin_name": "com.sap.hana.di.synonym" 80 | }, 81 | "hdbsynonymconfig": { 82 | "plugin_name": "com.sap.hana.di.synonym.config" 83 | }, 84 | "hdbsystemversioning": { 85 | "plugin_name": "com.sap.hana.di.systemversioning" 86 | }, 87 | "hdbtable": { 88 | "plugin_name": "com.sap.hana.di.table" 89 | }, 90 | "hdbtabledata": { 91 | "plugin_name": "com.sap.hana.di.tabledata" 92 | }, 93 | "hdbtabletype": { 94 | "plugin_name": "com.sap.hana.di.tabletype" 95 | }, 96 | "hdbtrigger": { 97 | "plugin_name": "com.sap.hana.di.trigger" 98 | }, 99 | "hdbview": { 100 | "plugin_name": "com.sap.hana.di.view" 101 | }, 102 | "hdbvirtualfunction": { 103 | "plugin_name": "com.sap.hana.di.virtualfunction" 104 | }, 105 | "hdbvirtualfunctionconfig": { 106 | "plugin_name": "com.sap.hana.di.virtualfunction.config" 107 | }, 108 | "hdbvirtualpackagehadoop": { 109 | "plugin_name": "com.sap.hana.di.virtualpackage.hadoop" 110 | }, 111 | "hdbvirtualpackagesparksql": { 112 | "plugin_name": "com.sap.hana.di.virtualpackage.sparksql" 113 | }, 114 | "hdbvirtualprocedure": { 115 | "plugin_name": "com.sap.hana.di.virtualprocedure" 116 | }, 117 | "hdbvirtualprocedureconfig": { 118 | "plugin_name": "com.sap.hana.di.virtualprocedure.config" 119 | }, 120 | "hdbvirtualtable": { 121 | "plugin_name": "com.sap.hana.di.virtualtable" 122 | }, 123 | "hdbvirtualtableconfig": { 124 | "plugin_name": "com.sap.hana.di.virtualtable.config" 125 | }, 126 | "properties": { 127 | "plugin_name": "com.sap.hana.di.tabledata.properties" 128 | }, 129 | "tags": { 130 | "plugin_name": "com.sap.hana.di.tabledata.properties" 131 | }, 132 | "txt": { 133 | "plugin_name": "com.sap.hana.di.copyonly" 134 | }, 135 | "hdbeshconfig": { 136 | "plugin_name": "com.sap.hana.di.eshconfig" 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /solution/MyHANAApp/db/src/V_INTERACTION.hdbcalculationview: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | APP_INTERACTIONS_HEADERS 9 | 10 | 11 | APP_INTERACTIONS_ITEMS 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /solution/MyHANAApp/db/src/sleep.hdbprocedure: -------------------------------------------------------------------------------- 1 | PROCEDURE "sleep" ( ) 2 | LANGUAGE SQLSCRIPT 3 | SQL SECURITY INVOKER 4 | READS SQL DATA AS 5 | BEGIN USING SQLSCRIPT_SYNC as SyncLib; 6 | 7 | call SyncLib:SLEEP_SECONDS(10); 8 | 9 | END 10 | -------------------------------------------------------------------------------- /solution/MyHANAApp/db/undeploy.json: -------------------------------------------------------------------------------- 1 | [ 2 | "src/gen/**/*.hdbview", 3 | "src/gen/**/*.hdbindex", 4 | "src/gen/**/*.hdbconstraint", 5 | "src/gen/**/*_drafts.hdbtable", 6 | "src/gen/**/*.hdbcalculationview" 7 | ] 8 | -------------------------------------------------------------------------------- /solution/MyHANAApp/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import cds from '@sap/cds/eslint.config.mjs' 2 | export default [ ...cds.recommended ] 3 | -------------------------------------------------------------------------------- /solution/MyHANAApp/mta.yaml: -------------------------------------------------------------------------------- 1 | _schema-version: 3.3.0 2 | ID: MyHANAApp 3 | version: 1.0.0 4 | description: "A simple CAP project." 5 | parameters: 6 | enable-parallel-deployments: true 7 | build-parameters: 8 | before-all: 9 | - builder: custom 10 | commands: 11 | - npm ci 12 | - npx cds build --production 13 | modules: 14 | - name: MyHANAApp-srv 15 | type: nodejs 16 | path: gen/srv 17 | parameters: 18 | buildpack: nodejs_buildpack 19 | readiness-health-check-type: http 20 | readiness-health-check-http-endpoint: /health 21 | build-parameters: 22 | builder: npm 23 | provides: 24 | - name: srv-api # required by consumers of CAP services (e.g. approuter) 25 | properties: 26 | srv-url: ${default-url} 27 | requires: 28 | - name: MyHANAApp-auth 29 | - name: MyHANAApp-db 30 | 31 | - name: MyHANAApp-db-deployer 32 | type: hdb 33 | path: gen/db 34 | parameters: 35 | buildpack: nodejs_buildpack 36 | requires: 37 | - name: MyHANAApp-db 38 | 39 | - name: MyHANAApp 40 | type: approuter.nodejs 41 | path: app/router 42 | parameters: 43 | keep-existing-routes: true 44 | disk-quota: 256M 45 | memory: 256M 46 | requires: 47 | - name: srv-api 48 | group: destinations 49 | properties: 50 | name: srv-api # must be used in xs-app.json as well 51 | url: ~{srv-url} 52 | forwardAuthToken: true 53 | - name: MyHANAApp-auth 54 | 55 | resources: 56 | - name: MyHANAApp-auth 57 | type: org.cloudfoundry.managed-service 58 | parameters: 59 | service: xsuaa 60 | service-plan: application 61 | path: ./xs-security.json 62 | config: 63 | xsappname: MyHANAApp-${org}-${space} 64 | tenant-mode: dedicated 65 | - name: MyHANAApp-db 66 | type: com.sap.xs.hdi-container 67 | parameters: 68 | service: hana 69 | service-plan: hdi-shared 70 | -------------------------------------------------------------------------------- /solution/MyHANAApp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MyHANAApp", 3 | "version": "1.0.0", 4 | "description": "A simple CAP project.", 5 | "repository": "", 6 | "license": "UNLICENSED", 7 | "private": true, 8 | "dependencies": { 9 | "@cap-js/hana": "^1", 10 | "@sap/cds": "^8", 11 | "@sap/cds-common-content": "^2.1.0", 12 | "@sap/xssec": "^4", 13 | "express": "^4" 14 | }, 15 | "devDependencies": { 16 | "@cap-js/cds-types": "^0.7.0", 17 | "@cap-js/sqlite": "^1", 18 | "@sap/cds-dk": "^8" 19 | }, 20 | "scripts": { 21 | "start": "cds-serve", 22 | "watch-interaction_items": "cds watch --open interaction_items/webapp/index.html?sap-ui-xx-viewCache=false" 23 | }, 24 | "cds": { 25 | "requires": { 26 | "auth": "xsuaa" 27 | }, 28 | "sql": { 29 | "native_hana_associations": false 30 | } 31 | }, 32 | "sapux": [ 33 | "app/interaction_items" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /solution/MyHANAApp/srv/interaction_srv.cds: -------------------------------------------------------------------------------- 1 | using app.interactions from '../db/interactions'; 2 | using {sap} from '@sap/cds-common-content'; 3 | using V_INTERACTION from '../db/interactions'; 4 | 5 | service CatalogService { 6 | 7 | @requires : 'authenticated-user' 8 | @cds.redirection.target 9 | @odata.draft.enabled: true 10 | entity Interactions_Header as projection on interactions.Headers; 11 | 12 | @requires: 'Admin' 13 | entity Interactions_Items as projection on interactions.Items; 14 | 15 | @readonly 16 | entity Languages as projection on sap.common.Languages; 17 | 18 | @readonly 19 | @restrict: [{ 20 | grant: 'READ', 21 | where: 'country_code = ''DE''' 22 | }] 23 | entity HeaderView as projection on interactions.Headers; 24 | 25 | function sleep() returns Boolean; 26 | 27 | @readonly 28 | entity V_Interaction as projection on V_INTERACTION; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /solution/MyHANAApp/srv/interaction_srv.js: -------------------------------------------------------------------------------- 1 | const cds = require('@sap/cds') 2 | module.exports = cds.service.impl(function () { 3 | this.on('sleep', async () => { 4 | try { 5 | let dbQuery = ' Call "sleep"( )' 6 | let result = await cds.run(dbQuery, { }) 7 | cds.log().info(result) 8 | return true 9 | } catch (error) { 10 | cds.log().error(error) 11 | return false 12 | } 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /solution/MyHANAApp/xs-security.json: -------------------------------------------------------------------------------- 1 | { 2 | "xsappname": "myhanaapp00", 3 | "tenant-mode": "dedicated", 4 | "scopes": [ 5 | { 6 | "name": "$XSAPPNAME.Admin", 7 | "description": "Admin" 8 | } 9 | ], 10 | "attributes": [], 11 | "role-templates": [ 12 | { 13 | "name": "Admin", 14 | "description": "generated", 15 | "scope-references": [ 16 | "$XSAPPNAME.Admin" 17 | ], 18 | "attribute-references": [] 19 | } 20 | ], 21 | "oauth2-configuration": { 22 | "credential-types": [ 23 | "binding-secret", 24 | "x509" 25 | ], 26 | "redirect-uris": [ 27 | "https://*.applicationstudio.cloud.sap/**" 28 | ] 29 | } 30 | } --------------------------------------------------------------------------------