├── .github └── workflows │ └── reuse-compliance.yml ├── .gitignore ├── .markdownlint.json ├── .reuse └── dep5 ├── LICENSE ├── LICENSES └── Apache-2.0.txt ├── README.md ├── exercises ├── ex0 │ ├── README.md │ └── images │ │ ├── 00_00_0010.png │ │ ├── 01-01 SCP Subscriptions_.jpg │ │ ├── 3_2.png │ │ ├── AppStudio Dev Space Manager_.jpg │ │ ├── advanced_settings.png │ │ ├── api_endpoint.png │ │ ├── api_endpoint_from_subaccount.png │ │ ├── cf_not_set.png │ │ ├── create_dev_space.png │ │ ├── dev_space_running.png │ │ ├── dev_space_starting.png │ │ ├── email.png │ │ ├── ex0.png │ │ ├── fully_running.png │ │ ├── go_to_application.png │ │ ├── instance-settings.png │ │ ├── manage_hana_cloud.png │ │ ├── optional_tools.png │ │ ├── org_space_set_correctly.png │ │ ├── organization.png │ │ ├── password.png │ │ ├── press_create_dev_space.png │ │ ├── settings_edit.png │ │ ├── space.png │ │ ├── space_select.png │ │ ├── start_me.png │ │ ├── status_stopped.png │ │ ├── subaccount.png │ │ └── trial-instance-stopped-1.png ├── ex1 │ ├── README.md │ ├── code │ │ ├── .cdsrc.json │ │ ├── .eslintrc │ │ ├── .pipeline │ │ │ └── config.yml │ │ ├── Jenkinsfile │ │ ├── README.md │ │ ├── db │ │ │ ├── data-model.cds │ │ │ ├── data │ │ │ │ └── my.bookshop-Books.csv │ │ │ └── src │ │ │ │ └── .hdiconfig │ │ ├── mta.yaml │ │ ├── package.json │ │ └── srv │ │ │ └── cat-service.cds │ └── images │ │ ├── 01_01_0010.png │ │ ├── 01_02_0010.png │ │ ├── bind_container.png │ │ ├── cds_build.png │ │ ├── choose_cap_project.png │ │ ├── complete_package_json.png │ │ ├── create_new_service_instance.png │ │ ├── create_project_from_template.png │ │ ├── dbexplorer_add_database.png │ │ ├── dbexplorer_tables.png │ │ ├── dbexplorer_view_data.png │ │ ├── deploy_to_hana.png │ │ ├── gen_folder.png │ │ ├── hana_cli_systemInfo.png │ │ ├── hana_cli_tables.png │ │ ├── hana_deploy_results.png │ │ ├── initial_db_explorer.png │ │ ├── install_hana_cli.png │ │ ├── new_cap_project_review.png │ │ ├── new_terminal.png │ │ ├── npm_install.png │ │ ├── open_db_explorer.png │ │ ├── package_json_hana_client.png │ │ ├── project_details.png │ │ ├── project_generated.png │ │ └── switch_editor.png ├── ex2 │ ├── README.md │ ├── code │ │ ├── .cdsrc.json │ │ ├── .eslintrc │ │ ├── .pipeline │ │ │ └── config.yml │ │ ├── Jenkinsfile │ │ ├── README.md │ │ ├── _i18n │ │ │ └── i18n.properties │ │ ├── db │ │ │ ├── data-model.cds │ │ │ ├── data │ │ │ │ ├── sap.common-Currencies.csv │ │ │ │ ├── sap.common-Currencies_texts.csv │ │ │ │ ├── teched.PurchaseOrder-Headers.csv │ │ │ │ └── teched.PurchaseOrder-Items.csv │ │ │ ├── po-annotations.cds │ │ │ └── src │ │ │ │ └── .hdiconfig │ │ ├── mta.yaml │ │ ├── package.json │ │ └── srv │ │ │ └── cat-service.cds │ └── images │ │ ├── 02_01_0010.png │ │ ├── 02_02_0010.png │ │ ├── cds_build_initial_data_model.png │ │ ├── csv_new_file.png │ │ ├── data_loaded.png │ │ ├── database_explorer_data_model.png │ │ ├── delete_data_model.png │ │ ├── delete_sample_csv.png │ │ ├── localized_view.png │ │ ├── new_file.png │ │ ├── new_i18n.png │ │ ├── remove_service_entity.png │ │ └── switch_to_raw.png ├── ex3 │ ├── README.md │ ├── code │ │ ├── .cdsrc.json │ │ ├── .eslintrc │ │ ├── .pipeline │ │ │ └── config.yml │ │ ├── Jenkinsfile │ │ ├── README.md │ │ ├── _i18n │ │ │ └── i18n.properties │ │ ├── db │ │ │ ├── data-model.cds │ │ │ ├── data │ │ │ │ ├── sap.common-Currencies.csv │ │ │ │ ├── sap.common-Currencies_texts.csv │ │ │ │ ├── teched.PurchaseOrder-Headers.csv │ │ │ │ └── teched.PurchaseOrder-Items.csv │ │ │ ├── po-annotations.cds │ │ │ └── src │ │ │ │ └── .hdiconfig │ │ ├── mta.yaml │ │ ├── package.json │ │ └── srv │ │ │ ├── cat-service.cds │ │ │ ├── cat-service.js │ │ │ └── server.js │ └── images │ │ ├── 1.txt │ │ ├── cat_service_js.png │ │ ├── cds_preview.png │ │ ├── cds_run.png │ │ ├── change_browser_lang.png │ │ ├── console_log_for_pos_read.png │ │ ├── create_server_js.png │ │ ├── currencies.png │ │ ├── currencies_german_desc.png │ │ ├── currencies_v2.png │ │ ├── expose_description.png │ │ ├── fiori_preview_running.png │ │ ├── goto_fiori_preview.png │ │ ├── log_proxy_created.png │ │ ├── log_with_exit_handler.png │ │ ├── metadata1.png │ │ ├── metadata_annotations.png │ │ ├── metadata_v2.png │ │ ├── package_json_odatav2.png │ │ ├── po_with_top_2.png │ │ ├── port_exposed.png │ │ ├── ports_preview.png │ │ ├── preview_no_v2.png │ │ ├── read_po_with_top_2_again.png │ │ └── stop_running_service.png ├── ex4 │ ├── README.md │ ├── code │ │ ├── .cdsrc.json │ │ ├── .eslintrc │ │ ├── .pipeline │ │ │ └── config.yml │ │ ├── Jenkinsfile │ │ ├── README.md │ │ ├── _i18n │ │ │ └── i18n.properties │ │ ├── app │ │ │ └── resources │ │ │ │ ├── index.html │ │ │ │ └── pofiori │ │ │ │ ├── .gitignore │ │ │ │ ├── .npmrc │ │ │ │ ├── README.md │ │ │ │ ├── package.json │ │ │ │ ├── ui5-local.yaml │ │ │ │ ├── ui5.yaml │ │ │ │ └── webapp │ │ │ │ ├── Component.js │ │ │ │ ├── annotations │ │ │ │ └── annotation.xml │ │ │ │ ├── i18n │ │ │ │ └── i18n.properties │ │ │ │ ├── localService │ │ │ │ ├── metadata.xml │ │ │ │ └── mockserver.js │ │ │ │ ├── manifest.json │ │ │ │ └── test │ │ │ │ ├── changes_loader.js │ │ │ │ ├── changes_preview.js │ │ │ │ ├── flpSandbox.html │ │ │ │ └── flpSandboxMockServer.html │ │ ├── db │ │ │ ├── data-model.cds │ │ │ ├── data │ │ │ │ ├── sap.common-Currencies.csv │ │ │ │ ├── sap.common-Currencies_texts.csv │ │ │ │ ├── teched.PurchaseOrder-Headers.csv │ │ │ │ └── teched.PurchaseOrder-Items.csv │ │ │ ├── po-annotations.cds │ │ │ └── src │ │ │ │ └── .hdiconfig │ │ ├── mta.yaml │ │ ├── package.json │ │ └── srv │ │ │ ├── cat-service.cds │ │ │ ├── cat-service.js │ │ │ ├── po-header-fiori.cds │ │ │ ├── po-item-fiori.cds │ │ │ └── server.js │ └── images │ │ ├── 1.txt │ │ ├── Detail_View.png │ │ ├── NewFeature.png │ │ ├── Preview_works.png │ │ ├── add_tiles_to_flp_sandbox.png │ │ ├── cds_preview_flp_sandbox.png │ │ ├── choose_fiori_elements.png │ │ ├── datasource_selection.png │ │ ├── draft_support.png │ │ ├── edit_launchpad_add_fiori_tile.png │ │ ├── edit_manifest1.png │ │ ├── edit_manifest2.png │ │ ├── edit_net_amount.png │ │ ├── emit_event.png │ │ ├── entity_selection.png │ │ ├── explorer_install_yeoman.png │ │ ├── features_of_list_view.png │ │ ├── fiori_preview_po_header.png │ │ ├── full_application.png │ │ ├── install_fiori_elements.png │ │ ├── list_report_object_page.png │ │ ├── new_tile.png │ │ ├── open_command_pallet.png │ │ ├── press_go_to_run_query.png │ │ ├── project_attributes.png │ │ ├── project_attributes_bigger.png │ │ ├── run_fiori_generator.png │ │ ├── sandbox_flp.png │ │ ├── save_metadata.png │ │ ├── upload_metadata.png │ │ └── yeoman_ui.png └── ex5 │ ├── README.md │ ├── code │ ├── .cdsrc.json │ ├── .eslintrc │ ├── .pipeline │ │ └── config.yml │ ├── Jenkinsfile │ ├── README.md │ ├── _i18n │ │ └── i18n.properties │ ├── app │ │ └── resources │ │ │ ├── index.html │ │ │ └── pofiori │ │ │ ├── .gitignore │ │ │ ├── .npmrc │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ ├── ui5-local.yaml │ │ │ ├── ui5.yaml │ │ │ └── webapp │ │ │ ├── Component.js │ │ │ ├── annotations │ │ │ └── annotation.xml │ │ │ ├── i18n │ │ │ └── i18n.properties │ │ │ ├── localService │ │ │ ├── metadata.xml │ │ │ └── mockserver.js │ │ │ ├── manifest.json │ │ │ └── test │ │ │ ├── changes_loader.js │ │ │ ├── changes_preview.js │ │ │ ├── flpSandbox.html │ │ │ └── flpSandboxMockServer.html │ ├── db │ │ ├── data-model.cds │ │ ├── data │ │ │ ├── sap.common-Currencies.csv │ │ │ ├── sap.common-Currencies_texts.csv │ │ │ ├── teched.PurchaseOrder-Headers.csv │ │ │ └── teched.PurchaseOrder-Items.csv │ │ ├── po-annotations.cds │ │ └── src │ │ │ ├── .hdiconfig │ │ │ └── sleep.hdbprocedure │ ├── mta.yaml │ ├── package.json │ └── srv │ │ ├── cat-service.cds │ │ ├── cat-service.js │ │ ├── po-header-fiori.cds │ │ ├── po-item-fiori.cds │ │ └── server.js │ └── images │ ├── 1.txt │ ├── add_function.png │ ├── build_contains_procedure.png │ ├── call_stored_procedure.png │ ├── click_on_catalog.png │ ├── deploy_creates_procedure.png │ ├── extend_package_json.png │ ├── sleep_procedure.png │ ├── sleep_true.png │ ├── test_sleep1.png │ └── test_sleep2.png └── requirements ├── guided_tour1.png └── trial-counter.png /.github/workflows/reuse-compliance.yml: -------------------------------------------------------------------------------- 1 | name: REUSE Compliance Check 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - name: REUSE Compliance Check 11 | uses: fsfe/reuse-action@v1.1 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # CAP teched2020-DAT160 2 | _out 3 | *.db 4 | connection.properties 5 | default-*.json 6 | gen/ 7 | node_modules/ 8 | package-lock.json 9 | target/ 10 | 11 | # Web IDE, App Studio 12 | .che/ 13 | .gen/ 14 | 15 | # MTA 16 | *_mta_build_tmp 17 | *.mtar 18 | mta_archives/ 19 | 20 | # Other 21 | .DS_Store 22 | *.orig 23 | *.log 24 | 25 | *.iml 26 | *.flattened-pom.xml 27 | 28 | # IDEs 29 | .vscode 30 | .idea -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "MD033": false, 3 | "MD013": false, 4 | "MD026": false, 5 | "MD029": false, 6 | "MD010": false, 7 | "MD009": false 8 | } -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: teched2020-DAT160 3 | Upstream-Contact: Thomas Jung (thomas.jung@sap.com) 4 | Source: https://github.com/sap-samples/teched2020-DAT160 5 | Disclaimer: The code in this project may include calls to APIs (“API Calls”) of 6 | SAP or third-party products or services developed outside of this project 7 | (“External Products”). 8 | “APIs” means application programming interfaces, as well as their respective 9 | specifications and implementing code that allows software to communicate with 10 | other software. 11 | API Calls to External Products are not licensed under the open source license 12 | that governs this project. The use of such API Calls and related External 13 | Products are subject to applicable additional agreements with the relevant 14 | provider of the External Products. In no event shall the open source license 15 | that governs this project grant any rights in or to any External Products,or 16 | alter, expand or supersede any terms of the applicable additional agreements. 17 | If you have a valid license agreement with SAP for the use of a particular SAP 18 | External Product, then you may make use of any API Calls included in this 19 | project’s code for that SAP External Product, subject to the terms of such 20 | license agreement. If you do not have a valid license agreement for the use of 21 | a particular SAP External Product, then you may only make use of any API Calls 22 | in this project for that SAP External Product for your internal, non-productive 23 | and non-commercial test and evaluation of such API Calls. Nothing herein grants 24 | you any rights to use or access any SAP External Product, or provide any third 25 | parties the right to use of access any SAP External Product, through API Calls. 26 | 27 | Files: * 28 | Copyright: 2020 SAP SE or an SAP affiliate company and teched2020-DAT160 contributors 29 | License: Apache-2.0 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DAT160 - Cloud Native Development with SAP HANA 2 | 3 | [![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/teched2020-DAT160)](https://api.reuse.software/info/github.com/SAP-samples/teched2020-DAT160) 4 | 5 | ## Description 6 | 7 | This repository contains the material for the SAP TechEd 2020 session called DAT160 - Cloud-Native Development with SAP HANA. 8 | 9 | ## Overview 10 | 11 | [Lecture Opening Video](https://youtu.be/Ugt_my8BK_4)
12 | Learn the basics of developing with SAP HANA Cloud combined with other cloud native frameworks and tools. During this session, we discuss how to use the latest capabilities of SAP Cloud Application Programming Model and SAP Business Application Studio to perform state-of-the-art development with SAP HANA. 13 | 14 | ## Requirements 15 | 16 | * Get a free SAP Business Technology Platform trial account (if you don't already have one): 17 | * [video](https://youtu.be/n5luSQKYvQQ) 18 | * [tutorial](https://developers.sap.com/tutorials/hcp-create-trial-account.html) 19 | 20 | * Set Up SAP Business Application Studio for development (if you've never used Business Application Studio): 21 | * [video](https://youtu.be/WW6z4AnYriw) 22 | * [tutorial](https://developers.sap.com/tutorials/appstudio-onboarding.html) 23 | 24 | * Create an instance of the SAP HANA Cloud in your trial account (if you don't already have an instance): 25 | * [video](https://youtu.be/Lv_40d1ZtsM) 26 | * [tutorial](https://developers.sap.com/tutorials/hana-trial-advanced-analytics.html#b2b892a4-5efa-4498-854d-b8b1417a455a) - ONLY Step 3 is required 27 | * Please make sure, in the "Advanced Settings" part of the wizard, that you select "Allow all IP addresses" in the "Allowed connections" setting. 28 | 29 | ## Exercises 30 | 31 | [YouTube Playlist With All Exercises](https://www.youtube.com/playlist?list=PL6RpkC85SLQALP9z-q5-vNBFNIy1EEc1q) 32 | 33 | * [Getting Started](exercises/ex0/) 34 | * [Is HANA running?](exercises/ex0#is-hana-running) 35 | * [Creating Business Application Studio Dev Space](exercises/ex0#creating-business-application-studio-dev-space) 36 | * [Configuring Business Application Studio Dev Space](exercises/ex0#configuring-business-application-studio-dev-space) 37 | * [Exercise 1 - Create CAP Project](exercises/ex1/) 38 | * [Exercise 1.1 - Create Project From Template](exercises/ex1#exercise-11-create-project-from-template) 39 | * [Exercise 1.2 - Adjust package.json](exercises/ex1#exercise-12-adjust-packagejson) 40 | * [Exercise 1.3 - Build Sample Project Into HANA](exercises/ex1#exercise-13-build-sample-project-into-hana) 41 | * [Exercise 2 - Building the Data Model](exercises/ex2/) 42 | * [Exercise 2.1 - Cleanup and Preparations for New Data Model](exercises/ex2#exercise-21-cleanup-and-preparations-fo-new-data-model) 43 | * [Exercise 2.2 - Create Data Model](exercises/ex2#exercise-22-create-data-model) 44 | * [Exercise 2.3 - Load Initial Data From CSV](exercises/ex2#exercise-23-load-initial-data-from-csv) 45 | * [Exercise 3 - Service Layer](exercises/ex3/) 46 | * [Exercise 3.1 - Create Service](exercises/ex3#exercise-31-create-service) 47 | * [Exercise 3.2 - Add OData V2 Support](exercises/ex3#exercise-32-add-odata-v2-support) 48 | * [Exercise 3.3 - Custom Handlers](exercises/ex3#exercise-33-custom-handlers) 49 | * [Exercise 4 - User Interface](exercises/ex4/) 50 | * [Exercise 4.1 - Add Fiori Annotations](exercises/ex4#exercise-41-add-fiori-annotations) 51 | * [Exercise 4.2 - Setup a Fiori Launchpad Sandbox](exercises/ex4#exercise-42-setup-a-fiori-launchpad-sandbox) 52 | * [Exercise 4.3 - Generate a Fiori Application](exercises/ex4#exercise-43-generate-a-fiori-application) 53 | * [Exercise 5 - Function Implemented as Stored Procedure](exercises/ex5/) 54 | * [Exercise 5.1 - Add Stored Procedure and Use it to Implement a CAP Function](exercises/ex5#exercise-51-add-stored-procedure-and-use-it-to-implement-a-cap-function) 55 | 56 | ## How to obtain support 57 | 58 | Support for the content in this repository is available during the actual time of the online session for which this content has been designed. Otherwise, you may request support via the [Issues](../../issues) tab. 59 | 60 | ## License 61 | 62 | Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](LICENSES/Apache-2.0.txt) file. 63 | -------------------------------------------------------------------------------- /exercises/ex0/images/00_00_0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/00_00_0010.png -------------------------------------------------------------------------------- /exercises/ex0/images/01-01 SCP Subscriptions_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/01-01 SCP Subscriptions_.jpg -------------------------------------------------------------------------------- /exercises/ex0/images/3_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/3_2.png -------------------------------------------------------------------------------- /exercises/ex0/images/AppStudio Dev Space Manager_.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/AppStudio Dev Space Manager_.jpg -------------------------------------------------------------------------------- /exercises/ex0/images/advanced_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/advanced_settings.png -------------------------------------------------------------------------------- /exercises/ex0/images/api_endpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/api_endpoint.png -------------------------------------------------------------------------------- /exercises/ex0/images/api_endpoint_from_subaccount.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/api_endpoint_from_subaccount.png -------------------------------------------------------------------------------- /exercises/ex0/images/cf_not_set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/cf_not_set.png -------------------------------------------------------------------------------- /exercises/ex0/images/create_dev_space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/create_dev_space.png -------------------------------------------------------------------------------- /exercises/ex0/images/dev_space_running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/dev_space_running.png -------------------------------------------------------------------------------- /exercises/ex0/images/dev_space_starting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/dev_space_starting.png -------------------------------------------------------------------------------- /exercises/ex0/images/email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/email.png -------------------------------------------------------------------------------- /exercises/ex0/images/ex0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/ex0.png -------------------------------------------------------------------------------- /exercises/ex0/images/fully_running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/fully_running.png -------------------------------------------------------------------------------- /exercises/ex0/images/go_to_application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/go_to_application.png -------------------------------------------------------------------------------- /exercises/ex0/images/instance-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/instance-settings.png -------------------------------------------------------------------------------- /exercises/ex0/images/manage_hana_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/manage_hana_cloud.png -------------------------------------------------------------------------------- /exercises/ex0/images/optional_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/optional_tools.png -------------------------------------------------------------------------------- /exercises/ex0/images/org_space_set_correctly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/org_space_set_correctly.png -------------------------------------------------------------------------------- /exercises/ex0/images/organization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/organization.png -------------------------------------------------------------------------------- /exercises/ex0/images/password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/password.png -------------------------------------------------------------------------------- /exercises/ex0/images/press_create_dev_space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/press_create_dev_space.png -------------------------------------------------------------------------------- /exercises/ex0/images/settings_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/settings_edit.png -------------------------------------------------------------------------------- /exercises/ex0/images/space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/space.png -------------------------------------------------------------------------------- /exercises/ex0/images/space_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/space_select.png -------------------------------------------------------------------------------- /exercises/ex0/images/start_me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/start_me.png -------------------------------------------------------------------------------- /exercises/ex0/images/status_stopped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/status_stopped.png -------------------------------------------------------------------------------- /exercises/ex0/images/subaccount.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/subaccount.png -------------------------------------------------------------------------------- /exercises/ex0/images/trial-instance-stopped-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex0/images/trial-instance-stopped-1.png -------------------------------------------------------------------------------- /exercises/ex1/code/.cdsrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /exercises/ex1/code/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "node": true, 5 | "es6": true, 6 | "jest": true 7 | }, 8 | "parserOptions": { 9 | "ecmaVersion": 2017 10 | }, 11 | "globals": { 12 | "SELECT": true, 13 | "INSERT": true, 14 | "UPDATE": true, 15 | "DELETE": true, 16 | "CREATE": true, 17 | "DROP": true, 18 | "cds": true 19 | }, 20 | "rules": { 21 | "no-console": "off", 22 | "require-atomic-updates": "off" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /exercises/ex1/code/.pipeline/config.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # This file configures the SAP Cloud SDK Continuous Delivery 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://github.com/SAP/cloud-s4-sdk-pipeline/blob/master/configuration.md 7 | # If you are using a fixed version of the pipeline, please make sure to view the corresponding version from the tag 8 | # list of GitHub (e.g. "v15" when you configured pipelineVersion = "v15" in the Jenkinsfile). 9 | # 10 | # For general information on how to get started with Continuous Delivery, visit: 11 | # https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | # 13 | # We aim to keep the pipeline configuration as stable as possible. However, major changes might also imply breaking 14 | # changes in the configuration. Before doing an update, please check the the release notes of all intermediate releases 15 | # and adapt this file if necessary. 16 | # 17 | # This is a YAML-file. YAML is a indentation-sensitive file format. Please make sure to properly indent changes to it. 18 | ### 19 | 20 | 21 | 22 | ### General project setup 23 | general: 24 | 25 | ### Step-specific configuration 26 | steps: 27 | mavenExecute: 28 | dockerImage: devxci/mbtci:1.0.14 29 | 30 | 31 | ### Stage-specific configuration 32 | stages: 33 | 34 | # This exclude is required for the example project to be successful in the pipeline 35 | # Remove it when you have added your first test 36 | s4SdkQualityChecks: 37 | jacocoExcludes: 38 | - '**/gen/**' 39 | - '**/Application.class' 40 | 41 | # npmAudit: 42 | # auditedAdvisories: 43 | 44 | # integrationTests: 45 | # credentials: 46 | # - alias: 'mySystemAlias' 47 | # credentialId: 'mySystemCredentialsId' 48 | 49 | # s4SdkQualityChecks: 50 | # nonErpDestinations: 51 | # - 'myCustomDestination' 52 | 53 | # productionDeployment: 54 | # cfTargets: 55 | # - org: 'myOrg' 56 | # space: 'mySpace' 57 | # apiEndpoint: 'https://' 58 | # appName: 'myAppName' 59 | # manifest: 'manifest.yml' 60 | # credentialsId: 'myDeploymentCredentialsId' 61 | -------------------------------------------------------------------------------- /exercises/ex1/code/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 | * The Jenkins can easily be bootstraped using the life-cycle script located inside the 'cx-server' directory. 8 | * 9 | * More information on getting started with Continuous Delivery can be found in the following places: 10 | * - GitHub repository: https://github.com/SAP/cloud-s4-sdk-pipeline 11 | * - Blog Post: https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | */ 13 | 14 | /* 15 | * Set pipelineVersion to a fixed released version (e.g. "v35") when running in a productive environment. 16 | * To find out about available versions and release notes, visit: https://github.com/SAP/cloud-s4-sdk-pipeline/releases 17 | */ 18 | String pipelineVersion = "master" 19 | 20 | library "s4sdk-pipeline-library@${pipelineVersion}" 21 | cloudSdkPipeline(script: this) 22 | -------------------------------------------------------------------------------- /exercises/ex1/code/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 / Folder | Purpose 8 | ---------|---------- 9 | `app/` | content for UI frontends go 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 VSCode simply choose _**Terminal** > Run Task > cds watch_ ) 20 | - Start adding content, e.g. 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 | -------------------------------------------------------------------------------- /exercises/ex1/code/db/data-model.cds: -------------------------------------------------------------------------------- 1 | namespace my.bookshop; 2 | 3 | entity Books { 4 | key ID : Integer; 5 | title : String; 6 | stock : Integer; 7 | } -------------------------------------------------------------------------------- /exercises/ex1/code/db/data/my.bookshop-Books.csv: -------------------------------------------------------------------------------- 1 | ID;title;stock 2 | 1;Wuthering Heights;100 3 | 2;Jane Eyre;500 4 | -------------------------------------------------------------------------------- /exercises/ex1/code/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 | } 136 | } -------------------------------------------------------------------------------- /exercises/ex1/code/mta.yaml: -------------------------------------------------------------------------------- 1 | ## Generated mta.yaml based on template version 0.3.0 2 | ## appName = dat160 3 | ## language=nodejs; multiTenant=false 4 | ## approuter= 5 | _schema-version: '3.1' 6 | ID: dat160 7 | version: 1.0.0 8 | description: "A simple CAP project." 9 | parameters: 10 | enable-parallel-deployments: true 11 | 12 | build-parameters: 13 | before-all: 14 | - builder: custom 15 | commands: 16 | - npm install --production 17 | - npx -p @sap/cds-dk cds build --production 18 | 19 | modules: 20 | # --------------------- SERVER MODULE ------------------------ 21 | - name: dat160-srv 22 | # ------------------------------------------------------------ 23 | type: nodejs 24 | path: gen/srv 25 | provides: 26 | - name: srv-api # required by consumers of CAP services (e.g. approuter) 27 | properties: 28 | srv-url: ${default-url} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /exercises/ex1/code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dat160", 3 | "version": "1.0.0", 4 | "description": "A simple CAP project.", 5 | "repository": "", 6 | "license": "UNLICENSED", 7 | "private": true, 8 | "dependencies": { 9 | "@sap/cds": "^4", 10 | "express": "^4", 11 | "@sap/hana-client": "^2.7" 12 | }, 13 | "devDependencies": { 14 | "sqlite3": "^5" 15 | }, 16 | "scripts": { 17 | "hana": "cds deploy --to hana:dat160 --auto-undeploy", 18 | "start": "cds run", 19 | "build": "cds build" 20 | }, 21 | "cds": { 22 | "hana": { 23 | "deploy-format": "hdbtable" 24 | }, 25 | "requires": { 26 | "db": { 27 | "kind": "hana" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /exercises/ex1/code/srv/cat-service.cds: -------------------------------------------------------------------------------- 1 | using my.bookshop as my from '../db/data-model'; 2 | 3 | service CatalogService { 4 | @readonly entity Books as projection on my.Books; 5 | } -------------------------------------------------------------------------------- /exercises/ex1/images/01_01_0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/01_01_0010.png -------------------------------------------------------------------------------- /exercises/ex1/images/01_02_0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/01_02_0010.png -------------------------------------------------------------------------------- /exercises/ex1/images/bind_container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/bind_container.png -------------------------------------------------------------------------------- /exercises/ex1/images/cds_build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/cds_build.png -------------------------------------------------------------------------------- /exercises/ex1/images/choose_cap_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/choose_cap_project.png -------------------------------------------------------------------------------- /exercises/ex1/images/complete_package_json.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/complete_package_json.png -------------------------------------------------------------------------------- /exercises/ex1/images/create_new_service_instance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/create_new_service_instance.png -------------------------------------------------------------------------------- /exercises/ex1/images/create_project_from_template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/create_project_from_template.png -------------------------------------------------------------------------------- /exercises/ex1/images/dbexplorer_add_database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/dbexplorer_add_database.png -------------------------------------------------------------------------------- /exercises/ex1/images/dbexplorer_tables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/dbexplorer_tables.png -------------------------------------------------------------------------------- /exercises/ex1/images/dbexplorer_view_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/dbexplorer_view_data.png -------------------------------------------------------------------------------- /exercises/ex1/images/deploy_to_hana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/deploy_to_hana.png -------------------------------------------------------------------------------- /exercises/ex1/images/gen_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/gen_folder.png -------------------------------------------------------------------------------- /exercises/ex1/images/hana_cli_systemInfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/hana_cli_systemInfo.png -------------------------------------------------------------------------------- /exercises/ex1/images/hana_cli_tables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/hana_cli_tables.png -------------------------------------------------------------------------------- /exercises/ex1/images/hana_deploy_results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/hana_deploy_results.png -------------------------------------------------------------------------------- /exercises/ex1/images/initial_db_explorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/initial_db_explorer.png -------------------------------------------------------------------------------- /exercises/ex1/images/install_hana_cli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/install_hana_cli.png -------------------------------------------------------------------------------- /exercises/ex1/images/new_cap_project_review.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/new_cap_project_review.png -------------------------------------------------------------------------------- /exercises/ex1/images/new_terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/new_terminal.png -------------------------------------------------------------------------------- /exercises/ex1/images/npm_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/npm_install.png -------------------------------------------------------------------------------- /exercises/ex1/images/open_db_explorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/open_db_explorer.png -------------------------------------------------------------------------------- /exercises/ex1/images/package_json_hana_client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/package_json_hana_client.png -------------------------------------------------------------------------------- /exercises/ex1/images/project_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/project_details.png -------------------------------------------------------------------------------- /exercises/ex1/images/project_generated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/project_generated.png -------------------------------------------------------------------------------- /exercises/ex1/images/switch_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex1/images/switch_editor.png -------------------------------------------------------------------------------- /exercises/ex2/code/.cdsrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /exercises/ex2/code/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "node": true, 5 | "es6": true, 6 | "jest": true 7 | }, 8 | "parserOptions": { 9 | "ecmaVersion": 2017 10 | }, 11 | "globals": { 12 | "SELECT": true, 13 | "INSERT": true, 14 | "UPDATE": true, 15 | "DELETE": true, 16 | "CREATE": true, 17 | "DROP": true, 18 | "cds": true 19 | }, 20 | "rules": { 21 | "no-console": "off", 22 | "require-atomic-updates": "off" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /exercises/ex2/code/.pipeline/config.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # This file configures the SAP Cloud SDK Continuous Delivery 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://github.com/SAP/cloud-s4-sdk-pipeline/blob/master/configuration.md 7 | # If you are using a fixed version of the pipeline, please make sure to view the corresponding version from the tag 8 | # list of GitHub (e.g. "v15" when you configured pipelineVersion = "v15" in the Jenkinsfile). 9 | # 10 | # For general information on how to get started with Continuous Delivery, visit: 11 | # https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | # 13 | # We aim to keep the pipeline configuration as stable as possible. However, major changes might also imply breaking 14 | # changes in the configuration. Before doing an update, please check the the release notes of all intermediate releases 15 | # and adapt this file if necessary. 16 | # 17 | # This is a YAML-file. YAML is a indentation-sensitive file format. Please make sure to properly indent changes to it. 18 | ### 19 | 20 | 21 | 22 | ### General project setup 23 | general: 24 | 25 | ### Step-specific configuration 26 | steps: 27 | mavenExecute: 28 | dockerImage: devxci/mbtci:1.0.14 29 | 30 | 31 | ### Stage-specific configuration 32 | stages: 33 | 34 | # This exclude is required for the example project to be successful in the pipeline 35 | # Remove it when you have added your first test 36 | s4SdkQualityChecks: 37 | jacocoExcludes: 38 | - '**/gen/**' 39 | - '**/Application.class' 40 | 41 | # npmAudit: 42 | # auditedAdvisories: 43 | 44 | # integrationTests: 45 | # credentials: 46 | # - alias: 'mySystemAlias' 47 | # credentialId: 'mySystemCredentialsId' 48 | 49 | # s4SdkQualityChecks: 50 | # nonErpDestinations: 51 | # - 'myCustomDestination' 52 | 53 | # productionDeployment: 54 | # cfTargets: 55 | # - org: 'myOrg' 56 | # space: 'mySpace' 57 | # apiEndpoint: 'https://' 58 | # appName: 'myAppName' 59 | # manifest: 'manifest.yml' 60 | # credentialsId: 'myDeploymentCredentialsId' 61 | -------------------------------------------------------------------------------- /exercises/ex2/code/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 | * The Jenkins can easily be bootstraped using the life-cycle script located inside the 'cx-server' directory. 8 | * 9 | * More information on getting started with Continuous Delivery can be found in the following places: 10 | * - GitHub repository: https://github.com/SAP/cloud-s4-sdk-pipeline 11 | * - Blog Post: https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | */ 13 | 14 | /* 15 | * Set pipelineVersion to a fixed released version (e.g. "v35") when running in a productive environment. 16 | * To find out about available versions and release notes, visit: https://github.com/SAP/cloud-s4-sdk-pipeline/releases 17 | */ 18 | String pipelineVersion = "master" 19 | 20 | library "s4sdk-pipeline-library@${pipelineVersion}" 21 | cloudSdkPipeline(script: this) 22 | -------------------------------------------------------------------------------- /exercises/ex2/code/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 / Folder | Purpose 8 | ---------|---------- 9 | `app/` | content for UI frontends go 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 VSCode simply choose _**Terminal** > Run Task > cds watch_ ) 20 | - Start adding content, e.g. 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 | -------------------------------------------------------------------------------- /exercises/ex2/code/_i18n/i18n.properties: -------------------------------------------------------------------------------- 1 | po_id=Purchase Order ID 2 | po_items=Purchase Order Items 3 | poService=Purchase Order 4 | poServices==Purchase Orders 5 | buyerService=Buyer Details 6 | userService=User Details 7 | currencyService=Currency Code 8 | CreateBy=Created By 9 | CreateAt=Created Date 10 | ChangedBy=Last Updated By 11 | ChangedAt=Last Update Date 12 | currency=Currency 13 | partner_id=Partner ID 14 | quantity=Quantity 15 | quantityUnit=Quantity Unit 16 | product=Product 17 | products=Products 18 | notes=Notes 19 | grossAmount=Gross Amount 20 | netAmount=Net Amount 21 | taxAmount=Tax Amount 22 | lifecycle=Lifecycle Status 23 | approval=Approval Status 24 | confirmation=Confirmation Status 25 | ordering=Ordering Status 26 | invoicing=Invoicing Status 27 | note=Note 28 | deliveryDate=Delivery Date 29 | partnerId=Partner ID 30 | partnerRole=Partner Role - Customer or Supplier 31 | email=Email Address 32 | phone=Phone Number 33 | fax=Fax Number 34 | web=Web Site Address 35 | address=Address Association 36 | company=Company Name 37 | legal=Legal Form 38 | building=Building Number 39 | city=City 40 | country=Country 41 | region=Region Otherwise Known as State in some countries 42 | addressType=Address Type 43 | postalCode=Postal Code 44 | street=Street 45 | fname=Given Name 46 | lname=Family Name 47 | mname=Middel Name 48 | userId=User Id 49 | currCode=Currency Code 50 | currDesc=Currency Description 51 | internal_id=Internal ID 52 | details=Details 53 | code1=Country Code 54 | alpha3=Three Character Country Code 55 | iso=ISO 3166-2 Code 56 | region=Region 57 | sub_region=Sub Region 58 | region_code=Region Code 59 | sub_region_code=Sub Region Code 60 | country=Country 61 | sub_code=Subdivision Code 62 | name=Subdivision Name 63 | type=Subdivision Type 64 | poServices=Purchase Order Services 65 | gender=Gender 66 | latitude=Geo Latitude 67 | longitude=Geo Longitude 68 | validFrom=Valid From 69 | validTo=Valid To 70 | addressId=Address Internal ID 71 | employeeId=Employee Internal ID 72 | initials=Initials 73 | sex=Gender 74 | language=Primary Spoken Language 75 | phoneNumber=Primary Phone Number 76 | email=Email Address 77 | loginName=Login Username 78 | accountNumber=Bank Account Number 79 | salaryAmount=Salary Amount 80 | bankId=Bank ID 81 | bankName=Bank Name 82 | employeePicUrl=Employee Picture URL 83 | businessParnters=Business Partners 84 | typeCode=Type Code 85 | category=Product Category 86 | name=Product Name 87 | desc=Product Description 88 | supplier=Supplier 89 | weightMeasure=Weight Measure 90 | weightUnit=Weight Unit 91 | price=Price 92 | picUrl=Product Picture URL 93 | width=Width 94 | depth=Depth 95 | height=Height 96 | dimensionUnit=Dimension Unit 97 | addrService=Address 98 | addrServices=Addresses 99 | userService=User 100 | userServices=Users 101 | user_id=User ID 102 | productImage=Product Image 103 | productImageType=Product Image Typ -------------------------------------------------------------------------------- /exercises/ex2/code/db/data-model.cds: -------------------------------------------------------------------------------- 1 | using { 2 | Currency, 3 | managed, 4 | sap, 5 | cuid 6 | } from '@sap/cds/common'; 7 | 8 | extend sap.common.Currencies with { 9 | numcode : Integer; 10 | exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent 11 | minor : String; //> e.g. 'Cent' 12 | } 13 | 14 | context teched.common { 15 | type BusinessKey : String(10); 16 | type SDate : DateTime; 17 | 18 | @assert.range : true 19 | type StatusT : String(1) enum { 20 | New = 'N'; 21 | Incomplete = 'I'; 22 | Approved = 'A'; 23 | Rejected = 'R'; 24 | Confirmed = 'C'; 25 | Saved = 'S'; 26 | Delivered = 'D'; 27 | Cancelled = 'X'; 28 | } 29 | 30 | type AmountT : Decimal(15, 2)@( 31 | Semantics.amount.currencyCode : 'CURRENCY_code', 32 | sap.unit : 'CURRENCY_code' 33 | ); 34 | 35 | abstract entity Amount { 36 | currency : Currency; 37 | grossAmount : AmountT; 38 | netAmount : AmountT; 39 | taxAmount : AmountT; 40 | } 41 | 42 | annotate Amount with { 43 | grossAmount @(title : '{i18n>grossAmount}'); 44 | netAmount @(title : '{i18n>netAmount}'); 45 | taxAmount @(title : '{i18n>taxAmount}'); 46 | } 47 | 48 | type QuantityT : Decimal(13, 3)@(title : '{i18n>quantity}'); 49 | type UnitT : String(3)@title : '{i18n>quantityUnit}'; 50 | 51 | abstract entity Quantity { 52 | quantity : QuantityT; 53 | quantityUnit : UnitT; 54 | } 55 | } 56 | 57 | context teched.PurchaseOrder { 58 | entity Headers : managed, cuid, teched.common.Amount { 59 | @cascade : {all} 60 | item : Composition of many Items 61 | on item.poHeader = $self; 62 | noteId : teched.common.BusinessKey null; 63 | partner : UUID; 64 | lifecycleStatus : teched.common.StatusT default 'N'; 65 | approvalStatus : teched.common.StatusT; 66 | confirmStatus : teched.common.StatusT; 67 | orderingStatus : teched.common.StatusT; 68 | invoicingStatus : teched.common.StatusT; 69 | } 70 | 71 | entity Items : cuid, teched.common.Amount, teched.common.Quantity { 72 | poHeader : Association to Headers; 73 | product : teched.common.BusinessKey; 74 | noteId : teched.common.BusinessKey null; 75 | deliveryDate : teched.common.SDate; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /exercises/ex2/code/db/data/sap.common-Currencies.csv: -------------------------------------------------------------------------------- 1 | code;symbol;name;descr;numcode;minor;exponent 2 | EUR;€;Euro;European Euro;978;Cent;2 3 | USD;$;US Dollar;United States Dollar;840;Cent;2 4 | CAD;$;Canadian Dollar;Canadian Dollar;124;Cent;2 5 | AUD;$;Australian Dollar;Canadian Dollar;036;Cent;2 6 | GBP;£;British Pound;Great Britain Pound;826;Penny;2 7 | ILS;₪;Shekel;Israeli New Shekel;376;Agorat;2 8 | INR;₹;Rupee;Indian Rupee;356;Paise;2 9 | QAR;﷼;Riyal;Katar Riyal;356;Dirham;2 10 | SAR;﷼;Riyal;Saudi Riyal;682;Halala;2 11 | JPY;¥;Yen;Japanese Yen;392;Sen;2 12 | CNY;¥;Yuan;Chinese Yuan Renminbi;156;Jiao;1 -------------------------------------------------------------------------------- /exercises/ex2/code/db/data/sap.common-Currencies_texts.csv: -------------------------------------------------------------------------------- 1 | code;locale;name;descr 2 | EUR;de;Euro;European Euro 3 | USD;de;US-Dollar;United States Dollar 4 | CAD;de;Kanadischer Dollar;Kanadischer Dollar 5 | AUD;de;Australischer Dollar;Australischer Dollar 6 | GBP;de;Pfund;Britische Pfund 7 | ILS;de;Schekel;Israelische Schekel 8 | EUR;fr;euro;de la Zone euro 9 | USD;fr;dollar;dollar des États-Unis 10 | CAD;fr;dollar canadien;dollar canadien 11 | AUD;fr;dollar australien;dollar australien 12 | GBP;fr;livre sterling;pound sterling 13 | ILS;fr;Shekel;shekel israelien -------------------------------------------------------------------------------- /exercises/ex2/code/db/po-annotations.cds: -------------------------------------------------------------------------------- 1 | using teched.PurchaseOrder as PO from './data-model'; 2 | 3 | annotate PO.Headers with @( 4 | title : '{i18n>poService}', 5 | description : '{i18n>poService}' 6 | ) { 7 | ID @( 8 | title : '{i18n>po_id}', 9 | description : '{i18n>po_id}', 10 | ); 11 | 12 | items @( 13 | title : '{i18n>po_items}', 14 | description : '{i18n>po_items}' 15 | ); 16 | 17 | partner @( 18 | title : '{i18n>partner_id}', 19 | description : '{i18n>partner_id}' 20 | ); 21 | 22 | lifecycleStatus @( 23 | title : '{i18n>lifecycle}', 24 | description : '{i18n>lifecycle}', 25 | Common.FieldControl : #ReadOnly 26 | ); 27 | 28 | approvalStatus @( 29 | title : '{i18n>approval}', 30 | description : '{i18n>approval}', 31 | Common.FieldControl : #ReadOnly 32 | ); 33 | 34 | confirmStatus @( 35 | title : '{i18n>confirmation}', 36 | description : '{i18n>confirmation}', 37 | Common.FieldControl : #ReadOnly 38 | ); 39 | 40 | orderingStatus @( 41 | title : '{i18n>ordering}', 42 | description : '{i18n>ordering}', 43 | Common.FieldControl : #ReadOnly 44 | ); 45 | 46 | invoicingStatus @( 47 | title : '{i18n>invoicing}', 48 | description : '{i18n>invoicing}', 49 | Common.FieldControl : #ReadOnly 50 | ); 51 | }; 52 | -------------------------------------------------------------------------------- /exercises/ex2/code/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 | } 136 | } -------------------------------------------------------------------------------- /exercises/ex2/code/mta.yaml: -------------------------------------------------------------------------------- 1 | ## Generated mta.yaml based on template version 0.3.0 2 | ## appName = dat160 3 | ## language=nodejs; multiTenant=false 4 | ## approuter= 5 | _schema-version: '3.1' 6 | ID: dat160 7 | version: 1.0.0 8 | description: "A simple CAP project." 9 | parameters: 10 | enable-parallel-deployments: true 11 | 12 | build-parameters: 13 | before-all: 14 | - builder: custom 15 | commands: 16 | - npm install --production 17 | - npx -p @sap/cds-dk cds build --production 18 | 19 | modules: 20 | # --------------------- SERVER MODULE ------------------------ 21 | - name: dat160-srv 22 | # ------------------------------------------------------------ 23 | type: nodejs 24 | path: gen/srv 25 | provides: 26 | - name: srv-api # required by consumers of CAP services (e.g. approuter) 27 | properties: 28 | srv-url: ${default-url} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /exercises/ex2/code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dat160", 3 | "version": "1.0.0", 4 | "description": "A simple CAP project.", 5 | "repository": "", 6 | "license": "UNLICENSED", 7 | "private": true, 8 | "dependencies": { 9 | "@sap/cds": "^4", 10 | "express": "^4", 11 | "@sap/hana-client": "^2.7" 12 | }, 13 | "devDependencies": { 14 | "sqlite3": "^5" 15 | }, 16 | "scripts": { 17 | "hana": "cds deploy --to hana:dat160 --auto-undeploy", 18 | "start": "cds run", 19 | "build": "cds build" 20 | }, 21 | "cds": { 22 | "hana": { 23 | "deploy-format": "hdbtable" 24 | }, 25 | "requires": { 26 | "db": { 27 | "kind": "hana" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /exercises/ex2/code/srv/cat-service.cds: -------------------------------------------------------------------------------- 1 | using teched.PurchaseOrder as PO from '../db/data-model'; 2 | 3 | service CatalogService { 4 | entity POHeaders as projection on PO.Headers; 5 | } -------------------------------------------------------------------------------- /exercises/ex2/images/02_01_0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/02_01_0010.png -------------------------------------------------------------------------------- /exercises/ex2/images/02_02_0010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/02_02_0010.png -------------------------------------------------------------------------------- /exercises/ex2/images/cds_build_initial_data_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/cds_build_initial_data_model.png -------------------------------------------------------------------------------- /exercises/ex2/images/csv_new_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/csv_new_file.png -------------------------------------------------------------------------------- /exercises/ex2/images/data_loaded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/data_loaded.png -------------------------------------------------------------------------------- /exercises/ex2/images/database_explorer_data_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/database_explorer_data_model.png -------------------------------------------------------------------------------- /exercises/ex2/images/delete_data_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/delete_data_model.png -------------------------------------------------------------------------------- /exercises/ex2/images/delete_sample_csv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/delete_sample_csv.png -------------------------------------------------------------------------------- /exercises/ex2/images/localized_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/localized_view.png -------------------------------------------------------------------------------- /exercises/ex2/images/new_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/new_file.png -------------------------------------------------------------------------------- /exercises/ex2/images/new_i18n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/new_i18n.png -------------------------------------------------------------------------------- /exercises/ex2/images/remove_service_entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/remove_service_entity.png -------------------------------------------------------------------------------- /exercises/ex2/images/switch_to_raw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex2/images/switch_to_raw.png -------------------------------------------------------------------------------- /exercises/ex3/code/.cdsrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /exercises/ex3/code/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "node": true, 5 | "es6": true, 6 | "jest": true 7 | }, 8 | "parserOptions": { 9 | "ecmaVersion": 2017 10 | }, 11 | "globals": { 12 | "SELECT": true, 13 | "INSERT": true, 14 | "UPDATE": true, 15 | "DELETE": true, 16 | "CREATE": true, 17 | "DROP": true, 18 | "cds": true 19 | }, 20 | "rules": { 21 | "no-console": "off", 22 | "require-atomic-updates": "off" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /exercises/ex3/code/.pipeline/config.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # This file configures the SAP Cloud SDK Continuous Delivery 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://github.com/SAP/cloud-s4-sdk-pipeline/blob/master/configuration.md 7 | # If you are using a fixed version of the pipeline, please make sure to view the corresponding version from the tag 8 | # list of GitHub (e.g. "v15" when you configured pipelineVersion = "v15" in the Jenkinsfile). 9 | # 10 | # For general information on how to get started with Continuous Delivery, visit: 11 | # https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | # 13 | # We aim to keep the pipeline configuration as stable as possible. However, major changes might also imply breaking 14 | # changes in the configuration. Before doing an update, please check the the release notes of all intermediate releases 15 | # and adapt this file if necessary. 16 | # 17 | # This is a YAML-file. YAML is a indentation-sensitive file format. Please make sure to properly indent changes to it. 18 | ### 19 | 20 | 21 | 22 | ### General project setup 23 | general: 24 | 25 | ### Step-specific configuration 26 | steps: 27 | mavenExecute: 28 | dockerImage: devxci/mbtci:1.0.14 29 | 30 | 31 | ### Stage-specific configuration 32 | stages: 33 | 34 | # This exclude is required for the example project to be successful in the pipeline 35 | # Remove it when you have added your first test 36 | s4SdkQualityChecks: 37 | jacocoExcludes: 38 | - '**/gen/**' 39 | - '**/Application.class' 40 | 41 | # npmAudit: 42 | # auditedAdvisories: 43 | 44 | # integrationTests: 45 | # credentials: 46 | # - alias: 'mySystemAlias' 47 | # credentialId: 'mySystemCredentialsId' 48 | 49 | # s4SdkQualityChecks: 50 | # nonErpDestinations: 51 | # - 'myCustomDestination' 52 | 53 | # productionDeployment: 54 | # cfTargets: 55 | # - org: 'myOrg' 56 | # space: 'mySpace' 57 | # apiEndpoint: 'https://' 58 | # appName: 'myAppName' 59 | # manifest: 'manifest.yml' 60 | # credentialsId: 'myDeploymentCredentialsId' 61 | -------------------------------------------------------------------------------- /exercises/ex3/code/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 | * The Jenkins can easily be bootstraped using the life-cycle script located inside the 'cx-server' directory. 8 | * 9 | * More information on getting started with Continuous Delivery can be found in the following places: 10 | * - GitHub repository: https://github.com/SAP/cloud-s4-sdk-pipeline 11 | * - Blog Post: https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | */ 13 | 14 | /* 15 | * Set pipelineVersion to a fixed released version (e.g. "v35") when running in a productive environment. 16 | * To find out about available versions and release notes, visit: https://github.com/SAP/cloud-s4-sdk-pipeline/releases 17 | */ 18 | String pipelineVersion = "master" 19 | 20 | library "s4sdk-pipeline-library@${pipelineVersion}" 21 | cloudSdkPipeline(script: this) 22 | -------------------------------------------------------------------------------- /exercises/ex3/code/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 / Folder | Purpose 8 | ---------|---------- 9 | `app/` | content for UI frontends go 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 VSCode simply choose _**Terminal** > Run Task > cds watch_ ) 20 | - Start adding content, e.g. 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 | -------------------------------------------------------------------------------- /exercises/ex3/code/_i18n/i18n.properties: -------------------------------------------------------------------------------- 1 | po_id=Purchase Order ID 2 | po_items=Purchase Order Items 3 | poService=Purchase Order 4 | poServices==Purchase Orders 5 | buyerService=Buyer Details 6 | userService=User Details 7 | currencyService=Currency Code 8 | CreateBy=Created By 9 | CreateAt=Created Date 10 | ChangedBy=Last Updated By 11 | ChangedAt=Last Update Date 12 | currency=Currency 13 | partner_id=Partner ID 14 | quantity=Quantity 15 | quantityUnit=Quantity Unit 16 | product=Product 17 | products=Products 18 | notes=Notes 19 | grossAmount=Gross Amount 20 | netAmount=Net Amount 21 | taxAmount=Tax Amount 22 | lifecycle=Lifecycle Status 23 | approval=Approval Status 24 | confirmation=Confirmation Status 25 | ordering=Ordering Status 26 | invoicing=Invoicing Status 27 | note=Note 28 | deliveryDate=Delivery Date 29 | partnerId=Partner ID 30 | partnerRole=Partner Role - Customer or Supplier 31 | email=Email Address 32 | phone=Phone Number 33 | fax=Fax Number 34 | web=Web Site Address 35 | address=Address Association 36 | company=Company Name 37 | legal=Legal Form 38 | building=Building Number 39 | city=City 40 | country=Country 41 | region=Region Otherwise Known as State in some countries 42 | addressType=Address Type 43 | postalCode=Postal Code 44 | street=Street 45 | fname=Given Name 46 | lname=Family Name 47 | mname=Middel Name 48 | userId=User Id 49 | currCode=Currency Code 50 | currDesc=Currency Description 51 | internal_id=Internal ID 52 | details=Details 53 | code1=Country Code 54 | alpha3=Three Character Country Code 55 | iso=ISO 3166-2 Code 56 | region=Region 57 | sub_region=Sub Region 58 | region_code=Region Code 59 | sub_region_code=Sub Region Code 60 | country=Country 61 | sub_code=Subdivision Code 62 | name=Subdivision Name 63 | type=Subdivision Type 64 | poServices=Purchase Order Services 65 | gender=Gender 66 | latitude=Geo Latitude 67 | longitude=Geo Longitude 68 | validFrom=Valid From 69 | validTo=Valid To 70 | addressId=Address Internal ID 71 | employeeId=Employee Internal ID 72 | initials=Initials 73 | sex=Gender 74 | language=Primary Spoken Language 75 | phoneNumber=Primary Phone Number 76 | email=Email Address 77 | loginName=Login Username 78 | accountNumber=Bank Account Number 79 | salaryAmount=Salary Amount 80 | bankId=Bank ID 81 | bankName=Bank Name 82 | employeePicUrl=Employee Picture URL 83 | businessParnters=Business Partners 84 | typeCode=Type Code 85 | category=Product Category 86 | name=Product Name 87 | desc=Product Description 88 | supplier=Supplier 89 | weightMeasure=Weight Measure 90 | weightUnit=Weight Unit 91 | price=Price 92 | picUrl=Product Picture URL 93 | width=Width 94 | depth=Depth 95 | height=Height 96 | dimensionUnit=Dimension Unit 97 | addrService=Address 98 | addrServices=Addresses 99 | userService=User 100 | userServices=Users 101 | user_id=User ID 102 | productImage=Product Image 103 | productImageType=Product Image Typ -------------------------------------------------------------------------------- /exercises/ex3/code/db/data-model.cds: -------------------------------------------------------------------------------- 1 | using { 2 | Currency, 3 | managed, 4 | sap, 5 | cuid 6 | } from '@sap/cds/common'; 7 | 8 | extend sap.common.Currencies with { 9 | numcode : Integer; 10 | exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent 11 | minor : String; //> e.g. 'Cent' 12 | } 13 | 14 | context teched.common { 15 | type BusinessKey : String(10); 16 | type SDate : DateTime; 17 | 18 | @assert.range : true 19 | type StatusT : String(1) enum { 20 | New = 'N'; 21 | Incomplete = 'I'; 22 | Approved = 'A'; 23 | Rejected = 'R'; 24 | Confirmed = 'C'; 25 | Saved = 'S'; 26 | Delivered = 'D'; 27 | Cancelled = 'X'; 28 | } 29 | 30 | type AmountT : Decimal(15, 2)@( 31 | Semantics.amount.currencyCode : 'CURRENCY_code', 32 | sap.unit : 'CURRENCY_code' 33 | ); 34 | 35 | abstract entity Amount { 36 | currency : Currency; 37 | grossAmount : AmountT; 38 | netAmount : AmountT; 39 | taxAmount : AmountT; 40 | } 41 | 42 | annotate Amount with { 43 | grossAmount @(title : '{i18n>grossAmount}'); 44 | netAmount @(title : '{i18n>netAmount}'); 45 | taxAmount @(title : '{i18n>taxAmount}'); 46 | } 47 | 48 | type QuantityT : Decimal(13, 3)@(title : '{i18n>quantity}'); 49 | type UnitT : String(3)@title : '{i18n>quantityUnit}'; 50 | 51 | abstract entity Quantity { 52 | quantity : QuantityT; 53 | quantityUnit : UnitT; 54 | } 55 | } 56 | 57 | context teched.PurchaseOrder { 58 | entity Headers : managed, cuid, teched.common.Amount { 59 | @cascade : {all} 60 | item : Composition of many Items 61 | on item.poHeader = $self; 62 | noteId : teched.common.BusinessKey null; 63 | partner : UUID; 64 | lifecycleStatus : teched.common.StatusT default 'N'; 65 | approvalStatus : teched.common.StatusT; 66 | confirmStatus : teched.common.StatusT; 67 | orderingStatus : teched.common.StatusT; 68 | invoicingStatus : teched.common.StatusT; 69 | } 70 | 71 | entity Items : cuid, teched.common.Amount, teched.common.Quantity { 72 | poHeader : Association to Headers; 73 | product : teched.common.BusinessKey; 74 | noteId : teched.common.BusinessKey null; 75 | deliveryDate : teched.common.SDate; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /exercises/ex3/code/db/data/sap.common-Currencies.csv: -------------------------------------------------------------------------------- 1 | code;symbol;name;descr;numcode;minor;exponent 2 | EUR;€;Euro;European Euro;978;Cent;2 3 | USD;$;US Dollar;United States Dollar;840;Cent;2 4 | CAD;$;Canadian Dollar;Canadian Dollar;124;Cent;2 5 | AUD;$;Australian Dollar;Canadian Dollar;036;Cent;2 6 | GBP;£;British Pound;Great Britain Pound;826;Penny;2 7 | ILS;₪;Shekel;Israeli New Shekel;376;Agorat;2 8 | INR;₹;Rupee;Indian Rupee;356;Paise;2 9 | QAR;﷼;Riyal;Katar Riyal;356;Dirham;2 10 | SAR;﷼;Riyal;Saudi Riyal;682;Halala;2 11 | JPY;¥;Yen;Japanese Yen;392;Sen;2 12 | CNY;¥;Yuan;Chinese Yuan Renminbi;156;Jiao;1 -------------------------------------------------------------------------------- /exercises/ex3/code/db/data/sap.common-Currencies_texts.csv: -------------------------------------------------------------------------------- 1 | code;locale;name;descr 2 | EUR;de;Euro;European Euro 3 | USD;de;US-Dollar;United States Dollar 4 | CAD;de;Kanadischer Dollar;Kanadischer Dollar 5 | AUD;de;Australischer Dollar;Australischer Dollar 6 | GBP;de;Pfund;Britische Pfund 7 | ILS;de;Schekel;Israelische Schekel 8 | EUR;fr;euro;de la Zone euro 9 | USD;fr;dollar;dollar des États-Unis 10 | CAD;fr;dollar canadien;dollar canadien 11 | AUD;fr;dollar australien;dollar australien 12 | GBP;fr;livre sterling;pound sterling 13 | ILS;fr;Shekel;shekel israelien -------------------------------------------------------------------------------- /exercises/ex3/code/db/po-annotations.cds: -------------------------------------------------------------------------------- 1 | using teched.PurchaseOrder as PO from './data-model'; 2 | 3 | annotate PO.Headers with @( 4 | title : '{i18n>poService}', 5 | description : '{i18n>poService}' 6 | ) { 7 | ID @( 8 | title : '{i18n>po_id}', 9 | description : '{i18n>po_id}', 10 | ); 11 | 12 | items @( 13 | title : '{i18n>po_items}', 14 | description : '{i18n>po_items}' 15 | ); 16 | 17 | partner @( 18 | title : '{i18n>partner_id}', 19 | description : '{i18n>partner_id}' 20 | ); 21 | 22 | lifecycleStatus @( 23 | title : '{i18n>lifecycle}', 24 | description : '{i18n>lifecycle}', 25 | Common.FieldControl : #ReadOnly 26 | ); 27 | 28 | approvalStatus @( 29 | title : '{i18n>approval}', 30 | description : '{i18n>approval}', 31 | Common.FieldControl : #ReadOnly 32 | ); 33 | 34 | confirmStatus @( 35 | title : '{i18n>confirmation}', 36 | description : '{i18n>confirmation}', 37 | Common.FieldControl : #ReadOnly 38 | ); 39 | 40 | orderingStatus @( 41 | title : '{i18n>ordering}', 42 | description : '{i18n>ordering}', 43 | Common.FieldControl : #ReadOnly 44 | ); 45 | 46 | invoicingStatus @( 47 | title : '{i18n>invoicing}', 48 | description : '{i18n>invoicing}', 49 | Common.FieldControl : #ReadOnly 50 | ); 51 | }; 52 | 53 | annotate Items with { 54 | ID @( 55 | title : '{i18n>internal_id}', 56 | description : '{i18n>internal_id}', 57 | ); 58 | 59 | product @( 60 | title : '{i18n>product}', 61 | description : '{i18n>product}', 62 | Common.FieldControl : #Mandatory, 63 | Search.defaultSearchElement 64 | ); 65 | 66 | deliveryDate @( 67 | title : '{i18n>deliveryDate}', 68 | description : '{i18n>deliveryDate}' 69 | ) 70 | } -------------------------------------------------------------------------------- /exercises/ex3/code/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 | } 136 | } -------------------------------------------------------------------------------- /exercises/ex3/code/mta.yaml: -------------------------------------------------------------------------------- 1 | ## Generated mta.yaml based on template version 0.3.0 2 | ## appName = dat160 3 | ## language=nodejs; multiTenant=false 4 | ## approuter= 5 | _schema-version: '3.1' 6 | ID: dat160 7 | version: 1.0.0 8 | description: "A simple CAP project." 9 | parameters: 10 | enable-parallel-deployments: true 11 | 12 | build-parameters: 13 | before-all: 14 | - builder: custom 15 | commands: 16 | - npm install --production 17 | - npx -p @sap/cds-dk cds build --production 18 | 19 | modules: 20 | # --------------------- SERVER MODULE ------------------------ 21 | - name: dat160-srv 22 | # ------------------------------------------------------------ 23 | type: nodejs 24 | path: gen/srv 25 | provides: 26 | - name: srv-api # required by consumers of CAP services (e.g. approuter) 27 | properties: 28 | srv-url: ${default-url} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /exercises/ex3/code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dat160", 3 | "version": "1.0.0", 4 | "description": "A simple CAP project.", 5 | "repository": "", 6 | "license": "UNLICENSED", 7 | "private": true, 8 | "dependencies": { 9 | "@sap/cds": "^4", 10 | "express": "^4", 11 | "@sap/hana-client": "^2.7", 12 | "@sap/cds-odata-v2-adapter-proxy": "^1.5.1" 13 | }, 14 | "devDependencies": { 15 | "sqlite3": "^5" 16 | }, 17 | "scripts": { 18 | "hana": "cds deploy --to hana:dat160 --auto-undeploy", 19 | "start": "cds run", 20 | "build": "cds build" 21 | }, 22 | "cds": { 23 | "hana": { 24 | "deploy-format": "hdbtable" 25 | }, 26 | "requires": { 27 | "db": { 28 | "kind": "hana" 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /exercises/ex3/code/srv/cat-service.cds: -------------------------------------------------------------------------------- 1 | using teched.PurchaseOrder as PO from '../db/data-model'; 2 | 3 | service CatalogService { 4 | entity POHeaders @( 5 | title : '{i18n>poService}', 6 | odata.draft.enabled : true 7 | ) as projection on PO.Headers; 8 | 9 | entity POItems @( 10 | title : '{i18n>poService}', 11 | ) as projection on PO.Items; 12 | } 13 | -------------------------------------------------------------------------------- /exercises/ex3/code/srv/cat-service.js: -------------------------------------------------------------------------------- 1 | const cds = require('@sap/cds') 2 | module.exports = cds.service.impl(function () { 3 | 4 | const { POHeaders } = this.entities() 5 | 6 | this.after('each', POHeaders, row =>{ 7 | console.log(`Read PO: ${row.ID}`) 8 | }) 9 | 10 | this.after(['CREATE', 'UPDATE', 'DELETE'], [POHeaders], async (po, req) => { 11 | const header = req.data 12 | req.on('succeeded', () => { 13 | global.it || console.log(`< emitting: poChanged ${header.ID}`) 14 | this.emit('poChange', header) 15 | }) 16 | }) 17 | }) -------------------------------------------------------------------------------- /exercises/ex3/code/srv/server.js: -------------------------------------------------------------------------------- 1 | const cds = require('@sap/cds') 2 | const proxy = require('@sap/cds-odata-v2-adapter-proxy') 3 | 4 | cds.on('bootstrap', app => app.use(proxy())) 5 | module.exports = cds.server -------------------------------------------------------------------------------- /exercises/ex3/images/1.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /exercises/ex3/images/cat_service_js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/cat_service_js.png -------------------------------------------------------------------------------- /exercises/ex3/images/cds_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/cds_preview.png -------------------------------------------------------------------------------- /exercises/ex3/images/cds_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/cds_run.png -------------------------------------------------------------------------------- /exercises/ex3/images/change_browser_lang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/change_browser_lang.png -------------------------------------------------------------------------------- /exercises/ex3/images/console_log_for_pos_read.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/console_log_for_pos_read.png -------------------------------------------------------------------------------- /exercises/ex3/images/create_server_js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/create_server_js.png -------------------------------------------------------------------------------- /exercises/ex3/images/currencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/currencies.png -------------------------------------------------------------------------------- /exercises/ex3/images/currencies_german_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/currencies_german_desc.png -------------------------------------------------------------------------------- /exercises/ex3/images/currencies_v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/currencies_v2.png -------------------------------------------------------------------------------- /exercises/ex3/images/expose_description.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/expose_description.png -------------------------------------------------------------------------------- /exercises/ex3/images/fiori_preview_running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/fiori_preview_running.png -------------------------------------------------------------------------------- /exercises/ex3/images/goto_fiori_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/goto_fiori_preview.png -------------------------------------------------------------------------------- /exercises/ex3/images/log_proxy_created.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/log_proxy_created.png -------------------------------------------------------------------------------- /exercises/ex3/images/log_with_exit_handler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/log_with_exit_handler.png -------------------------------------------------------------------------------- /exercises/ex3/images/metadata1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/metadata1.png -------------------------------------------------------------------------------- /exercises/ex3/images/metadata_annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/metadata_annotations.png -------------------------------------------------------------------------------- /exercises/ex3/images/metadata_v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/metadata_v2.png -------------------------------------------------------------------------------- /exercises/ex3/images/package_json_odatav2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/package_json_odatav2.png -------------------------------------------------------------------------------- /exercises/ex3/images/po_with_top_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/po_with_top_2.png -------------------------------------------------------------------------------- /exercises/ex3/images/port_exposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/port_exposed.png -------------------------------------------------------------------------------- /exercises/ex3/images/ports_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/ports_preview.png -------------------------------------------------------------------------------- /exercises/ex3/images/preview_no_v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/preview_no_v2.png -------------------------------------------------------------------------------- /exercises/ex3/images/read_po_with_top_2_again.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/read_po_with_top_2_again.png -------------------------------------------------------------------------------- /exercises/ex3/images/stop_running_service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex3/images/stop_running_service.png -------------------------------------------------------------------------------- /exercises/ex4/code/.cdsrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /exercises/ex4/code/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "node": true, 5 | "es6": true, 6 | "jest": true 7 | }, 8 | "parserOptions": { 9 | "ecmaVersion": 2017 10 | }, 11 | "globals": { 12 | "SELECT": true, 13 | "INSERT": true, 14 | "UPDATE": true, 15 | "DELETE": true, 16 | "CREATE": true, 17 | "DROP": true, 18 | "cds": true 19 | }, 20 | "rules": { 21 | "no-console": "off", 22 | "require-atomic-updates": "off" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /exercises/ex4/code/.pipeline/config.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # This file configures the SAP Cloud SDK Continuous Delivery 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://github.com/SAP/cloud-s4-sdk-pipeline/blob/master/configuration.md 7 | # If you are using a fixed version of the pipeline, please make sure to view the corresponding version from the tag 8 | # list of GitHub (e.g. "v15" when you configured pipelineVersion = "v15" in the Jenkinsfile). 9 | # 10 | # For general information on how to get started with Continuous Delivery, visit: 11 | # https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | # 13 | # We aim to keep the pipeline configuration as stable as possible. However, major changes might also imply breaking 14 | # changes in the configuration. Before doing an update, please check the the release notes of all intermediate releases 15 | # and adapt this file if necessary. 16 | # 17 | # This is a YAML-file. YAML is a indentation-sensitive file format. Please make sure to properly indent changes to it. 18 | ### 19 | 20 | 21 | 22 | ### General project setup 23 | general: 24 | 25 | ### Step-specific configuration 26 | steps: 27 | mavenExecute: 28 | dockerImage: devxci/mbtci:1.0.14 29 | 30 | 31 | ### Stage-specific configuration 32 | stages: 33 | 34 | # This exclude is required for the example project to be successful in the pipeline 35 | # Remove it when you have added your first test 36 | s4SdkQualityChecks: 37 | jacocoExcludes: 38 | - '**/gen/**' 39 | - '**/Application.class' 40 | 41 | # npmAudit: 42 | # auditedAdvisories: 43 | 44 | # integrationTests: 45 | # credentials: 46 | # - alias: 'mySystemAlias' 47 | # credentialId: 'mySystemCredentialsId' 48 | 49 | # s4SdkQualityChecks: 50 | # nonErpDestinations: 51 | # - 'myCustomDestination' 52 | 53 | # productionDeployment: 54 | # cfTargets: 55 | # - org: 'myOrg' 56 | # space: 'mySpace' 57 | # apiEndpoint: 'https://' 58 | # appName: 'myAppName' 59 | # manifest: 'manifest.yml' 60 | # credentialsId: 'myDeploymentCredentialsId' 61 | -------------------------------------------------------------------------------- /exercises/ex4/code/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 | * The Jenkins can easily be bootstraped using the life-cycle script located inside the 'cx-server' directory. 8 | * 9 | * More information on getting started with Continuous Delivery can be found in the following places: 10 | * - GitHub repository: https://github.com/SAP/cloud-s4-sdk-pipeline 11 | * - Blog Post: https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | */ 13 | 14 | /* 15 | * Set pipelineVersion to a fixed released version (e.g. "v35") when running in a productive environment. 16 | * To find out about available versions and release notes, visit: https://github.com/SAP/cloud-s4-sdk-pipeline/releases 17 | */ 18 | String pipelineVersion = "master" 19 | 20 | library "s4sdk-pipeline-library@${pipelineVersion}" 21 | cloudSdkPipeline(script: this) 22 | -------------------------------------------------------------------------------- /exercises/ex4/code/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 / Folder | Purpose 8 | ---------|---------- 9 | `app/` | content for UI frontends go 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 VSCode simply choose _**Terminal** > Run Task > cds watch_ ) 20 | - Start adding content, e.g. 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 | -------------------------------------------------------------------------------- /exercises/ex4/code/_i18n/i18n.properties: -------------------------------------------------------------------------------- 1 | po_id=Purchase Order ID 2 | po_items=Purchase Order Items 3 | poService=Purchase Order 4 | poServices==Purchase Orders 5 | buyerService=Buyer Details 6 | userService=User Details 7 | currencyService=Currency Code 8 | CreateBy=Created By 9 | CreateAt=Created Date 10 | ChangedBy=Last Updated By 11 | ChangedAt=Last Update Date 12 | currency=Currency 13 | partner_id=Partner ID 14 | quantity=Quantity 15 | quantityUnit=Quantity Unit 16 | product=Product 17 | products=Products 18 | notes=Notes 19 | grossAmount=Gross Amount 20 | netAmount=Net Amount 21 | taxAmount=Tax Amount 22 | lifecycle=Lifecycle Status 23 | approval=Approval Status 24 | confirmation=Confirmation Status 25 | ordering=Ordering Status 26 | invoicing=Invoicing Status 27 | note=Note 28 | deliveryDate=Delivery Date 29 | partnerId=Partner ID 30 | partnerRole=Partner Role - Customer or Supplier 31 | email=Email Address 32 | phone=Phone Number 33 | fax=Fax Number 34 | web=Web Site Address 35 | address=Address Association 36 | company=Company Name 37 | legal=Legal Form 38 | building=Building Number 39 | city=City 40 | country=Country 41 | region=Region Otherwise Known as State in some countries 42 | addressType=Address Type 43 | postalCode=Postal Code 44 | street=Street 45 | fname=Given Name 46 | lname=Family Name 47 | mname=Middel Name 48 | userId=User Id 49 | currCode=Currency Code 50 | currDesc=Currency Description 51 | internal_id=Internal ID 52 | details=Details 53 | code1=Country Code 54 | alpha3=Three Character Country Code 55 | iso=ISO 3166-2 Code 56 | region=Region 57 | sub_region=Sub Region 58 | region_code=Region Code 59 | sub_region_code=Sub Region Code 60 | country=Country 61 | sub_code=Subdivision Code 62 | name=Subdivision Name 63 | type=Subdivision Type 64 | poServices=Purchase Order Services 65 | gender=Gender 66 | latitude=Geo Latitude 67 | longitude=Geo Longitude 68 | validFrom=Valid From 69 | validTo=Valid To 70 | addressId=Address Internal ID 71 | employeeId=Employee Internal ID 72 | initials=Initials 73 | sex=Gender 74 | language=Primary Spoken Language 75 | phoneNumber=Primary Phone Number 76 | email=Email Address 77 | loginName=Login Username 78 | accountNumber=Bank Account Number 79 | salaryAmount=Salary Amount 80 | bankId=Bank ID 81 | bankName=Bank Name 82 | employeePicUrl=Employee Picture URL 83 | businessParnters=Business Partners 84 | typeCode=Type Code 85 | category=Product Category 86 | name=Product Name 87 | desc=Product Description 88 | supplier=Supplier 89 | weightMeasure=Weight Measure 90 | weightUnit=Weight Unit 91 | price=Price 92 | picUrl=Product Picture URL 93 | width=Width 94 | depth=Depth 95 | height=Height 96 | dimensionUnit=Dimension Unit 97 | addrService=Address 98 | addrServices=Addresses 99 | userService=User 100 | userServices=Users 101 | user_id=User ID 102 | productImage=Product Image 103 | productImageType=Product Image Typ -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | TechEd DAT160 9 | 43 | 44 | 45 | 51 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/.gitignore: -------------------------------------------------------------------------------- 1 | src/ 2 | node_modules/ 3 | dist/ 4 | .scp/ -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/.npmrc: -------------------------------------------------------------------------------- 1 | @ui5:registry=https://registry.npmjs.org 2 | @sap:registry=https://registry.npmjs.org 3 | save = true 4 | save-exact = true 5 | strict-ssl = false 6 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/README.md: -------------------------------------------------------------------------------- 1 | ## Application Details 2 | | | 3 | | ------------- | 4 | |**Generation Date and Time**
Sat Sep 26 2020 20:19:27 GMT+0000 (Coordinated Universal Time)| 5 | |**App Generator Version**
1.0.17| 6 | |**Generation Platform**
SAP Business Application Studio| 7 | |**Template Used**
LABEL_PROJECT_TYPE_V2_LIST_REPORT| 8 | |**Service Type**
File| 9 | |**Metadata File**
teched_metadata.xml| 10 | |**Main Entity**
POHeaders| 11 | |**Navigation Entity**
item| 12 | |**Module Name**
pofiori| 13 | |**Application Title**
Purchase Orders| 14 | |**Namespace**
sap.teched| 15 | |**UI5 Theme**
sap_fiori_3_dark| 16 | |**UI5 Version**
Latest | 17 | |**Enable Telemetry**
True | 18 | 19 | ## pofiori 20 | 21 | A Fiori application. 22 | 23 | ### Starting the generated app 24 | 25 | - 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 run the following from the generated app root folder: 26 | 27 | ``` 28 | npm start 29 | ``` 30 | 31 | - It is also possible to run the application using mock data that reflects the OData Service URL supplied during application generation. In order to run the application with Mock Data, run the following from the generated app root folder: 32 | 33 | ``` 34 | npm run start-mock 35 | ``` 36 | 37 | 38 | #### Pre-requisites: 39 | 40 | 1. Active NodeJS LTS (Long Term Support) version and associated supported NPM version. (See https://nodejs.org) 41 | 42 | 43 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pofiori", 3 | "version": "0.0.1", 4 | "private": true, 5 | "sapux": true, 6 | "description": "A Fiori application.", 7 | "keywords": [ 8 | "ui5", 9 | "openui5", 10 | "sapui5" 11 | ], 12 | "main": "webapp/index.html", 13 | "scripts": { 14 | "postinstall": "npm i @sap/ux-ui5-tooling@\"^1.0.0\" @sap/ux-specification@\"^1.76.12\" --save-dev --save-exact=false", 15 | "start": " echo \"\\033[33mThis application was generated with a local metadata file and does not reference a live server. Please start this application with mock data using the target: npm run start-mock\"", 16 | "start-mock": "fiori run --open test/flpSandboxMockServer.html#masterDetail-display", 17 | "start-local": "", 18 | "build": "rimraf dist && ui5 build -a --include-task=generateManifestBundle generateCachebusterInfo", 19 | "deploy": "fiori add deploy-config" 20 | }, 21 | "remarkConfig": { 22 | "plugins": [ 23 | "remark-preset-lint-consistent" 24 | ] 25 | }, 26 | "devDependencies": { 27 | "@sap/ux-specification": "^1.78.9", 28 | "@sap/ux-ui5-tooling": "^1.0.18", 29 | "@ui5/cli": "2.3.2", 30 | "@ui5/fs": "2.0.1", 31 | "@ui5/logger": "2.0.0", 32 | "rimraf": "3.0.0" 33 | }, 34 | "optionalDependencies": { 35 | "fsevents": "1.2.9" 36 | }, 37 | "ui5": { 38 | "dependencies": [ 39 | "@sap/ux-ui5-tooling" 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/ui5-local.yaml: -------------------------------------------------------------------------------- 1 | specVersion: '2.0' 2 | metadata: 3 | name: 'pofiori' 4 | type: application 5 | framework: 6 | name: SAPUI5 7 | version: "1.82.0" 8 | libraries: 9 | - name: sap.m 10 | - name: sap.ushell 11 | - name: sap.ui.core 12 | - name: sap.f 13 | - name: sap.ui.comp 14 | - name: sap.ui.table 15 | - name: sap.suite.ui.generic.template 16 | - name: sap.ui.generic.app 17 | - name: themelib_sap_fiori_3 18 | server: 19 | customMiddleware: 20 | - name: fiori-tools-proxy 21 | afterMiddleware: compression 22 | configuration: 23 | backend: 24 | - path: /sap/opu/odata 25 | url: http://localhost 26 | - name: fiori-tools-appreload 27 | afterMiddleware: compression 28 | configuration: 29 | port: 35729 30 | path: webapp 31 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/ui5.yaml: -------------------------------------------------------------------------------- 1 | specVersion: '1.0' 2 | metadata: 3 | name: 'pofiori' 4 | type: application 5 | ui5Theme: sap_fiori_3_dark 6 | server: 7 | customMiddleware: 8 | - name: fiori-tools-proxy 9 | afterMiddleware: compression 10 | configuration: 11 | ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted 12 | backend: 13 | - path: /sap/opu/odata 14 | url: http://localhost 15 | ui5: 16 | path: 17 | - /resources 18 | - /test-resources 19 | url: https://ui5.sap.com 20 | version: # The UI5 version, for instance, 1.78.1. Empty means latest version 21 | - name: fiori-tools-appreload 22 | afterMiddleware: compression 23 | configuration: 24 | port: 35729 25 | path: webapp 26 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/webapp/Component.js: -------------------------------------------------------------------------------- 1 | sap.ui.define(['sap/suite/ui/generic/template/lib/AppComponent'], function(AppComponent) { 2 | return AppComponent.extend('sap.teched.pofiori.Component', { 3 | metadata: { 4 | manifest: 'json' 5 | } 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/webapp/annotations/annotation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/webapp/i18n/i18n.properties: -------------------------------------------------------------------------------- 1 | # This is the resource bundle for pofiori 2 | 3 | #Texts for manifest.json 4 | 5 | #XTIT: Application name 6 | appTitle=Purchase Orders 7 | 8 | #YDES: Application description 9 | appDescription=A Fiori application. -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/webapp/localService/mockserver.js: -------------------------------------------------------------------------------- 1 | sap.ui.define(['sap/ui/core/util/MockServer'], function(MockServer) { 2 | 'use strict'; 3 | var oMockServer, 4 | _sAppModulePath = 'sap.teched.pofiori/', 5 | _sJsonFilesModulePath = _sAppModulePath + 'localService/mockdata'; 6 | 7 | return { 8 | /** 9 | * Initializes the mock server. 10 | * You can configure the delay with the URL parameter "serverDelay". 11 | * The local mock data in this folder is returned instead of the real data for testing. 12 | * @public 13 | */ 14 | 15 | init: function() { 16 | var oUriParameters = jQuery.sap.getUriParameters(), 17 | sJsonFilesUrl = jQuery.sap.getModulePath(_sJsonFilesModulePath), 18 | sManifestUrl = jQuery.sap.getModulePath(_sAppModulePath + 'manifest', '.json'), 19 | sEntity = 'POHeaders', 20 | sErrorParam = oUriParameters.get('errorType'), 21 | iErrorCode = sErrorParam === 'badRequest' ? 400 : 500, 22 | oManifest = jQuery.sap.syncGetJSON(sManifestUrl).data, 23 | oDataSource = oManifest['sap.app'].dataSources, 24 | oMainDataSource = oDataSource.mainService, 25 | sMetadataUrl = jQuery.sap.getModulePath( 26 | _sAppModulePath + oMainDataSource.settings.localUri.replace('.xml', ''), 27 | '.xml' 28 | ), 29 | // ensure there is a trailing slash 30 | sMockServerUrl = /.*\/$/.test(oMainDataSource.uri) ? oMainDataSource.uri : oMainDataSource.uri + '/', 31 | aAnnotations = oMainDataSource.settings.annotations; 32 | 33 | oMockServer = new MockServer({ 34 | rootUri: sMockServerUrl 35 | }); 36 | 37 | // configure mock server with a delay of 1s 38 | MockServer.config({ 39 | autoRespond: true, 40 | autoRespondAfter: oUriParameters.get('serverDelay') || 1000 41 | }); 42 | 43 | // load local mock data 44 | oMockServer.simulate(sMetadataUrl, { 45 | sMockdataBaseUrl: sJsonFilesUrl, 46 | bGenerateMissingMockData: true 47 | }); 48 | 49 | var aRequests = oMockServer.getRequests(), 50 | fnResponse = function(iErrCode, sMessage, aRequest) { 51 | aRequest.response = function(oXhr) { 52 | oXhr.respond( 53 | iErrCode, 54 | { 55 | 'Content-Type': 'text/plain;charset=utf-8' 56 | }, 57 | sMessage 58 | ); 59 | }; 60 | }; 61 | 62 | // handling the metadata error test 63 | if (oUriParameters.get('metadataError')) { 64 | aRequests.forEach(function(aEntry) { 65 | if (aEntry.path.toString().indexOf('$metadata') > -1) { 66 | fnResponse(500, 'metadata Error', aEntry); 67 | } 68 | }); 69 | } 70 | 71 | // Handling request errors 72 | if (sErrorParam) { 73 | aRequests.forEach(function(aEntry) { 74 | if (aEntry.path.toString().indexOf(sEntity) > -1) { 75 | fnResponse(iErrorCode, sErrorParam, aEntry); 76 | } 77 | }); 78 | } 79 | oMockServer.start(); 80 | 81 | jQuery.sap.log.info('Running the app with mock data'); 82 | 83 | if (aAnnotations && aAnnotations.length > 0) { 84 | aAnnotations.forEach(function(sAnnotationName) { 85 | var oAnnotation = oDataSource[sAnnotationName], 86 | sUri = oAnnotation.uri, 87 | sLocalUri = jQuery.sap.getModulePath( 88 | _sAppModulePath + oAnnotation.settings.localUri.replace('.xml', ''), 89 | '.xml' 90 | ); 91 | 92 | // backend annotations 93 | new MockServer({ 94 | rootUri: sUri, 95 | requests: [ 96 | { 97 | method: 'GET', 98 | path: new RegExp('([?#].*)?'), 99 | response: function(oXhr) { 100 | jQuery.sap.require('jquery.sap.xml'); 101 | 102 | var oAnnotations = jQuery.sap.sjax({ 103 | url: sLocalUri, 104 | dataType: 'xml' 105 | }).data; 106 | 107 | oXhr.respondXML(200, {}, jQuery.sap.serializeXML(oAnnotations)); 108 | return true; 109 | } 110 | } 111 | ] 112 | }).start(); 113 | }); 114 | } 115 | }, 116 | 117 | /** 118 | * @public returns the mockserver of the app, should be used in integration tests 119 | * @returns {sap.ui.core.util.MockServer} 120 | */ 121 | getMockServer: function() { 122 | return oMockServer; 123 | } 124 | }; 125 | }); 126 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/webapp/test/changes_loader.js: -------------------------------------------------------------------------------- 1 | //This file used only for loading the changes in the preview and not required to be checked in. 2 | //Loads and extends the openui5 FileListBaseConnector 3 | 4 | //For UI5 version >= 1.80, the location of the FileListBaseConnector is different 5 | const connectorPath = 6 | parseFloat(sap.ui.version) >= 1.8 7 | ? 'sap/ui/fl/write/api/connectors/FileListBaseConnector' 8 | : 'sap/ui/fl/initial/api/connectors/FileListBaseConnector'; 9 | 10 | sap.ui.define(['sap/base/util/merge', connectorPath], function(merge, FileListBaseConnector) { 11 | var aPromises = []; 12 | var trustedHosts = [/^localhost$/, /^.*.applicationstudio.cloud.sap$/]; 13 | var url = new URL(window.location.toString()); 14 | var isValidHost = trustedHosts.some((host) => { 15 | return host.test(url.hostname); 16 | }); 17 | return merge({}, FileListBaseConnector, { 18 | getFileList: function() { 19 | return new Promise(function(resolve, reject) { 20 | // If no changes found, maybe because the app was executed without doing a build. 21 | // Check for changes folder and load the changes, if any. 22 | if (!isValidHost) reject(console.log('cannot load flex changes: invalid host')); 23 | $.ajax({ 24 | url: url.origin + '/changes/', 25 | type: 'GET', 26 | cache: false 27 | }) 28 | .then(function(sChangesFolderContent) { 29 | var regex = /(\/changes\/id_[^"]*)/g; 30 | var result = regex.exec(sChangesFolderContent); 31 | var aChanges = []; 32 | while (result !== null) { 33 | aChanges.push(result[1]); 34 | result = regex.exec(sChangesFolderContent); 35 | } 36 | resolve(aChanges); 37 | }) 38 | .fail(function(obj) { 39 | // No changes folder, then just resolve 40 | resolve(); 41 | }); 42 | }); 43 | } 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/webapp/test/flpSandbox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{appTitle}} 9 | 10 | 25 | 56 | 57 | 58 | 59 | 60 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /exercises/ex4/code/app/resources/pofiori/webapp/test/flpSandboxMockServer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{appTitle}} 9 | 10 | 25 | 56 | 57 | 58 | 59 | 60 | 70 | 71 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /exercises/ex4/code/db/data-model.cds: -------------------------------------------------------------------------------- 1 | using { 2 | Currency, 3 | managed, 4 | sap, 5 | cuid 6 | } from '@sap/cds/common'; 7 | 8 | extend sap.common.Currencies with { 9 | numcode : Integer; 10 | exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent 11 | minor : String; //> e.g. 'Cent' 12 | } 13 | 14 | context teched.common { 15 | type BusinessKey : String(10); 16 | type SDate : DateTime; 17 | 18 | @assert.range : true 19 | type StatusT : String(1) enum { 20 | New = 'N'; 21 | Incomplete = 'I'; 22 | Approved = 'A'; 23 | Rejected = 'R'; 24 | Confirmed = 'C'; 25 | Saved = 'S'; 26 | Delivered = 'D'; 27 | Cancelled = 'X'; 28 | } 29 | 30 | type AmountT : Decimal(15, 2)@( 31 | Semantics.amount.currencyCode : 'CURRENCY_code', 32 | sap.unit : 'CURRENCY_code' 33 | ); 34 | 35 | abstract entity Amount { 36 | currency : Currency; 37 | grossAmount : AmountT; 38 | netAmount : AmountT; 39 | taxAmount : AmountT; 40 | } 41 | 42 | annotate Amount with { 43 | grossAmount @(title : '{i18n>grossAmount}'); 44 | netAmount @(title : '{i18n>netAmount}'); 45 | taxAmount @(title : '{i18n>taxAmount}'); 46 | } 47 | 48 | type QuantityT : Decimal(13, 3)@(title : '{i18n>quantity}'); 49 | type UnitT : String(3)@title : '{i18n>quantityUnit}'; 50 | 51 | abstract entity Quantity { 52 | quantity : QuantityT; 53 | quantityUnit : UnitT; 54 | } 55 | } 56 | 57 | context teched.PurchaseOrder { 58 | entity Headers : managed, cuid, teched.common.Amount { 59 | @cascade : {all} 60 | item : Composition of many Items 61 | on item.poHeader = $self; 62 | noteId : teched.common.BusinessKey null; 63 | partner : UUID; 64 | lifecycleStatus : teched.common.StatusT default 'N'; 65 | approvalStatus : teched.common.StatusT; 66 | confirmStatus : teched.common.StatusT; 67 | orderingStatus : teched.common.StatusT; 68 | invoicingStatus : teched.common.StatusT; 69 | } 70 | 71 | entity Items : cuid, teched.common.Amount, teched.common.Quantity { 72 | poHeader : Association to Headers; 73 | product : teched.common.BusinessKey; 74 | noteId : teched.common.BusinessKey null; 75 | deliveryDate : teched.common.SDate; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /exercises/ex4/code/db/data/sap.common-Currencies.csv: -------------------------------------------------------------------------------- 1 | code;symbol;name;descr;numcode;minor;exponent 2 | EUR;€;Euro;European Euro;978;Cent;2 3 | USD;$;US Dollar;United States Dollar;840;Cent;2 4 | CAD;$;Canadian Dollar;Canadian Dollar;124;Cent;2 5 | AUD;$;Australian Dollar;Canadian Dollar;036;Cent;2 6 | GBP;£;British Pound;Great Britain Pound;826;Penny;2 7 | ILS;₪;Shekel;Israeli New Shekel;376;Agorat;2 8 | INR;₹;Rupee;Indian Rupee;356;Paise;2 9 | QAR;﷼;Riyal;Katar Riyal;356;Dirham;2 10 | SAR;﷼;Riyal;Saudi Riyal;682;Halala;2 11 | JPY;¥;Yen;Japanese Yen;392;Sen;2 12 | CNY;¥;Yuan;Chinese Yuan Renminbi;156;Jiao;1 -------------------------------------------------------------------------------- /exercises/ex4/code/db/data/sap.common-Currencies_texts.csv: -------------------------------------------------------------------------------- 1 | code;locale;name;descr 2 | EUR;de;Euro;European Euro 3 | USD;de;US-Dollar;United States Dollar 4 | CAD;de;Kanadischer Dollar;Kanadischer Dollar 5 | AUD;de;Australischer Dollar;Australischer Dollar 6 | GBP;de;Pfund;Britische Pfund 7 | ILS;de;Schekel;Israelische Schekel 8 | EUR;fr;euro;de la Zone euro 9 | USD;fr;dollar;dollar des États-Unis 10 | CAD;fr;dollar canadien;dollar canadien 11 | AUD;fr;dollar australien;dollar australien 12 | GBP;fr;livre sterling;pound sterling 13 | ILS;fr;Shekel;shekel israelien -------------------------------------------------------------------------------- /exercises/ex4/code/db/po-annotations.cds: -------------------------------------------------------------------------------- 1 | using teched.PurchaseOrder as PO from './data-model'; 2 | 3 | annotate PO.Headers with @( 4 | title : '{i18n>poService}', 5 | description : '{i18n>poService}' 6 | ) { 7 | ID @( 8 | title : '{i18n>po_id}', 9 | description : '{i18n>po_id}', 10 | ); 11 | 12 | items @( 13 | title : '{i18n>po_items}', 14 | description : '{i18n>po_items}' 15 | ); 16 | 17 | partner @( 18 | title : '{i18n>partner_id}', 19 | description : '{i18n>partner_id}' 20 | ); 21 | 22 | lifecycleStatus @( 23 | title : '{i18n>lifecycle}', 24 | description : '{i18n>lifecycle}', 25 | Common.FieldControl : #ReadOnly 26 | ); 27 | 28 | approvalStatus @( 29 | title : '{i18n>approval}', 30 | description : '{i18n>approval}', 31 | Common.FieldControl : #ReadOnly 32 | ); 33 | 34 | confirmStatus @( 35 | title : '{i18n>confirmation}', 36 | description : '{i18n>confirmation}', 37 | Common.FieldControl : #ReadOnly 38 | ); 39 | 40 | orderingStatus @( 41 | title : '{i18n>ordering}', 42 | description : '{i18n>ordering}', 43 | Common.FieldControl : #ReadOnly 44 | ); 45 | 46 | invoicingStatus @( 47 | title : '{i18n>invoicing}', 48 | description : '{i18n>invoicing}', 49 | Common.FieldControl : #ReadOnly 50 | ); 51 | }; 52 | 53 | annotate Items with { 54 | ID @( 55 | title : '{i18n>internal_id}', 56 | description : '{i18n>internal_id}', 57 | ); 58 | 59 | product @( 60 | title : '{i18n>product}', 61 | description : '{i18n>product}', 62 | Common.FieldControl : #Mandatory, 63 | Search.defaultSearchElement 64 | ); 65 | 66 | deliveryDate @( 67 | title : '{i18n>deliveryDate}', 68 | description : '{i18n>deliveryDate}' 69 | ) 70 | } -------------------------------------------------------------------------------- /exercises/ex4/code/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 | } 136 | } -------------------------------------------------------------------------------- /exercises/ex4/code/mta.yaml: -------------------------------------------------------------------------------- 1 | ## Generated mta.yaml based on template version 0.3.0 2 | ## appName = dat160 3 | ## language=nodejs; multiTenant=false 4 | ## approuter= 5 | _schema-version: '3.1' 6 | ID: dat160 7 | version: 1.0.0 8 | description: "A simple CAP project." 9 | parameters: 10 | enable-parallel-deployments: true 11 | 12 | build-parameters: 13 | before-all: 14 | - builder: custom 15 | commands: 16 | - npm install --production 17 | - npx -p @sap/cds-dk cds build --production 18 | 19 | modules: 20 | # --------------------- SERVER MODULE ------------------------ 21 | - name: dat160-srv 22 | # ------------------------------------------------------------ 23 | type: nodejs 24 | path: gen/srv 25 | provides: 26 | - name: srv-api # required by consumers of CAP services (e.g. approuter) 27 | properties: 28 | srv-url: ${default-url} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /exercises/ex4/code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dat160", 3 | "version": "1.0.0", 4 | "description": "A simple CAP project.", 5 | "repository": "", 6 | "license": "UNLICENSED", 7 | "private": true, 8 | "dependencies": { 9 | "@sap/cds": "^4", 10 | "express": "^4", 11 | "@sap/hana-client": "^2.7", 12 | "@sap/cds-odata-v2-adapter-proxy": "^1.5.1" 13 | }, 14 | "devDependencies": { 15 | "@sap/ux-specification": "^1.84.0", 16 | "sqlite3": "^5" 17 | }, 18 | "scripts": { 19 | "hana": "cds deploy --to hana:dat160 --auto-undeploy", 20 | "start": "cds run", 21 | "build": "cds build" 22 | }, 23 | "cds": { 24 | "hana": { 25 | "deploy-format": "hdbtable" 26 | }, 27 | "requires": { 28 | "db": { 29 | "kind": "hana" 30 | } 31 | } 32 | }, 33 | "sapux": [ 34 | "app/pofiori" 35 | ] 36 | } 37 | 38 | -------------------------------------------------------------------------------- /exercises/ex4/code/srv/cat-service.cds: -------------------------------------------------------------------------------- 1 | using teched.PurchaseOrder as PO from '../db/data-model'; 2 | 3 | service CatalogService { 4 | entity POHeaders @( 5 | title : '{i18n>poService}', 6 | odata.draft.enabled : true 7 | ) as projection on PO.Headers; 8 | 9 | entity POItems @( 10 | title : '{i18n>poService}', 11 | ) as projection on PO.Items; 12 | } 13 | -------------------------------------------------------------------------------- /exercises/ex4/code/srv/cat-service.js: -------------------------------------------------------------------------------- 1 | const cds = require('@sap/cds') 2 | module.exports = cds.service.impl(function () { 3 | 4 | const { POHeaders } = this.entities() 5 | 6 | this.after('each', POHeaders, row =>{ 7 | console.log(`Read PO: ${row.ID}`) 8 | }) 9 | 10 | this.after(['CREATE', 'UPDATE', 'DELETE'], [POHeaders], async (po, req) => { 11 | const header = req.data 12 | req.on('succeeded', () => { 13 | global.it || console.log(`< emitting: poChanged ${header.ID}`) 14 | this.emit('poChange', header) 15 | }) 16 | }) 17 | }) -------------------------------------------------------------------------------- /exercises/ex4/code/srv/po-header-fiori.cds: -------------------------------------------------------------------------------- 1 | using CatalogService as pos from './cat-service'; 2 | 3 | 4 | annotate pos.POHeaders with @( // header-level annotations 5 | // --------------------------------------------------------------------------- 6 | // List Report 7 | // --------------------------------------------------------------------------- 8 | // POs List 9 | UI : { 10 | LineItem : [ 11 | { 12 | $Type : 'UI.DataField', 13 | Value : ID, 14 | ![@UI.Importance] : #High 15 | }, 16 | { 17 | $Type : 'UI.DataField', 18 | Value : grossAmount, 19 | ![@UI.Importance] : #High 20 | }, 21 | { 22 | $Type : 'UI.DataField', 23 | Value : currency_code, 24 | ![@UI.Importance] : #Medium 25 | }, 26 | { 27 | $Type : 'UI.DataField', 28 | Value : currency.symbol 29 | }, 30 | ], 31 | PresentationVariant : {SortOrder : [ 32 | { 33 | $Type : 'Common.SortOrderType', 34 | Property : ID, 35 | Descending : false 36 | }, 37 | { 38 | $Type : 'Common.SortOrderType', 39 | Property : partner, 40 | Descending : false 41 | } 42 | ]} 43 | }, 44 | 45 | // --------------------------------------------------------------------------- 46 | // Object Page 47 | // --------------------------------------------------------------------------- 48 | // Page Header 49 | UI : { 50 | HeaderInfo : { 51 | TypeName : '{i18n>poService}', 52 | TypeNamePlural : '{i18n>poServices}', 53 | Title : {Value : ID}, 54 | }, 55 | HeaderFacets : [ 56 | { 57 | $Type : 'UI.ReferenceFacet', 58 | Target : '@UI.FieldGroup#Description', 59 | ![@UI.Importance] : #Medium 60 | }, 61 | { 62 | $Type : 'UI.ReferenceFacet', 63 | Target : '@UI.FieldGroup#AdministrativeData', 64 | ![@UI.Importance] : #Medium 65 | } 66 | ], 67 | FieldGroup #Description : {Data : [ 68 | { 69 | $Type : 'UI.DataField', 70 | Value : ID 71 | } 72 | ]}, 73 | FieldGroup #Details : {Data : [ 74 | { 75 | $Type : 'UI.DataField', 76 | Value : partner 77 | }, 78 | { 79 | $Type : 'UI.DataField', 80 | Value : noteId, 81 | ![@UI.Importance] : #Medium 82 | }, 83 | { 84 | $Type : 'UI.DataField', 85 | Value : grossAmount 86 | }, 87 | { 88 | $Type : 'UI.DataField', 89 | Value : netAmount 90 | }, 91 | { 92 | $Type : 'UI.DataField', 93 | Value : taxAmount 94 | }, 95 | { 96 | $Type : 'UI.DataField', 97 | Value : currency_code 98 | }, 99 | { 100 | $Type : 'UI.DataField', 101 | Value : currency.symbol, 102 | ![@Common.FieldControl] : #ReadOnly 103 | }, 104 | { 105 | $Type : 'UI.DataField', 106 | Value : currency.name, 107 | ![@Common.FieldControl] : #ReadOnly 108 | }, 109 | ]}, 110 | FieldGroup #AdministrativeData : {Data : [ 111 | { 112 | $Type : 'UI.DataField', 113 | Value : createdBy 114 | }, 115 | { 116 | $Type : 'UI.DataField', 117 | Value : createdAt 118 | }, 119 | { 120 | $Type : 'UI.DataField', 121 | Value : modifiedBy 122 | }, 123 | { 124 | $Type : 'UI.DataField', 125 | Value : modifiedAt 126 | } 127 | ]} 128 | }, 129 | // Page Facets 130 | UI.Facets : [ 131 | { 132 | $Type : 'UI.CollectionFacet', 133 | ID : 'PODetails', 134 | Label : '{i18n>details}', 135 | Facets : [{ 136 | $Type : 'UI.ReferenceFacet', 137 | Label : '{i18n>details}', 138 | Target : '@UI.FieldGroup#Details' 139 | }] 140 | }, 141 | { 142 | $Type : 'UI.ReferenceFacet', 143 | Label : '{i18n>po_items}', 144 | Target : 'item/@UI.LineItem' 145 | } 146 | ] 147 | ); -------------------------------------------------------------------------------- /exercises/ex4/code/srv/po-item-fiori.cds: -------------------------------------------------------------------------------- 1 | using CatalogService as pos from './cat-service'; 2 | 3 | 4 | annotate pos.POItems with @( // header-level annotations 5 | // --------------------------------------------------------------------------- 6 | // List Report 7 | // --------------------------------------------------------------------------- 8 | // PO Items List 9 | UI : { 10 | LineItem : [ 11 | { 12 | $Type : 'UI.DataField', 13 | Value : product, 14 | ![@UI.Importance] : #High 15 | }, 16 | { 17 | $Type : 'UI.DataField', 18 | Value : deliveryDate, 19 | ![@UI.Importance] : #High 20 | }, 21 | { 22 | $Type : 'UI.DataField', 23 | Value : quantity, 24 | ![@UI.Importance] : #High 25 | }, 26 | { 27 | $Type : 'UI.DataField', 28 | Value : quantityUnit, 29 | ![@UI.Importance] : #High 30 | } 31 | ], 32 | PresentationVariant : {SortOrder : [{ 33 | $Type : 'Common.SortOrderType', 34 | Property : product, 35 | Descending : false 36 | }]} 37 | }, 38 | // --------------------------------------------------------------------------- 39 | // Object Page 40 | // --------------------------------------------------------------------------- 41 | // Page Header 42 | UI : { 43 | HeaderInfo : { 44 | TypeName : '{i18n>poService}', 45 | TypeNamePlural : '{i18n>poServices}', 46 | Title : {Value : ID}, 47 | }, 48 | HeaderFacets : [{ 49 | $Type : 'UI.ReferenceFacet', 50 | Target : '@UI.FieldGroup#Description', 51 | ![@UI.Importance] : #Medium 52 | }], 53 | FieldGroup #Description : {Data : [ 54 | { 55 | $Type : 'UI.DataField', 56 | Value : ID 57 | }, 58 | { 59 | $Type : 'UI.DataField', 60 | Value : product 61 | } 62 | ]}, 63 | FieldGroup #Details : {Data : [ 64 | { 65 | $Type : 'UI.DataField', 66 | Value : product 67 | }, 68 | { 69 | $Type : 'UI.DataField', 70 | Value : deliveryDate, 71 | ![@UI.Importance] : #High 72 | }, 73 | { 74 | $Type : 'UI.DataField', 75 | Value : quantity, 76 | ![@UI.Importance] : #High 77 | }, 78 | { 79 | $Type : 'UI.DataField', 80 | Value : quantityUnit, 81 | ![@UI.Importance] : #High 82 | } 83 | ]} 84 | }, 85 | // Page Facets 86 | UI.Facets : [{ 87 | $Type : 'UI.CollectionFacet', 88 | ID : 'POItemsDetails', 89 | Label : '{i18n>details}', 90 | Facets : [{ 91 | $Type : 'UI.ReferenceFacet', 92 | Label : '{i18n>details}', 93 | Target : '@UI.FieldGroup#Details' 94 | }] 95 | }] 96 | ); -------------------------------------------------------------------------------- /exercises/ex4/code/srv/server.js: -------------------------------------------------------------------------------- 1 | const cds = require('@sap/cds') 2 | const proxy = require('@sap/cds-odata-v2-adapter-proxy') 3 | 4 | cds.on('bootstrap', app => app.use(proxy())) 5 | module.exports = cds.server -------------------------------------------------------------------------------- /exercises/ex4/images/1.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /exercises/ex4/images/Detail_View.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/Detail_View.png -------------------------------------------------------------------------------- /exercises/ex4/images/NewFeature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/NewFeature.png -------------------------------------------------------------------------------- /exercises/ex4/images/Preview_works.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/Preview_works.png -------------------------------------------------------------------------------- /exercises/ex4/images/add_tiles_to_flp_sandbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/add_tiles_to_flp_sandbox.png -------------------------------------------------------------------------------- /exercises/ex4/images/cds_preview_flp_sandbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/cds_preview_flp_sandbox.png -------------------------------------------------------------------------------- /exercises/ex4/images/choose_fiori_elements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/choose_fiori_elements.png -------------------------------------------------------------------------------- /exercises/ex4/images/datasource_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/datasource_selection.png -------------------------------------------------------------------------------- /exercises/ex4/images/draft_support.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/draft_support.png -------------------------------------------------------------------------------- /exercises/ex4/images/edit_launchpad_add_fiori_tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/edit_launchpad_add_fiori_tile.png -------------------------------------------------------------------------------- /exercises/ex4/images/edit_manifest1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/edit_manifest1.png -------------------------------------------------------------------------------- /exercises/ex4/images/edit_manifest2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/edit_manifest2.png -------------------------------------------------------------------------------- /exercises/ex4/images/edit_net_amount.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/edit_net_amount.png -------------------------------------------------------------------------------- /exercises/ex4/images/emit_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/emit_event.png -------------------------------------------------------------------------------- /exercises/ex4/images/entity_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/entity_selection.png -------------------------------------------------------------------------------- /exercises/ex4/images/explorer_install_yeoman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/explorer_install_yeoman.png -------------------------------------------------------------------------------- /exercises/ex4/images/features_of_list_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/features_of_list_view.png -------------------------------------------------------------------------------- /exercises/ex4/images/fiori_preview_po_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/fiori_preview_po_header.png -------------------------------------------------------------------------------- /exercises/ex4/images/full_application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/full_application.png -------------------------------------------------------------------------------- /exercises/ex4/images/install_fiori_elements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/install_fiori_elements.png -------------------------------------------------------------------------------- /exercises/ex4/images/list_report_object_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/list_report_object_page.png -------------------------------------------------------------------------------- /exercises/ex4/images/new_tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/new_tile.png -------------------------------------------------------------------------------- /exercises/ex4/images/open_command_pallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/open_command_pallet.png -------------------------------------------------------------------------------- /exercises/ex4/images/press_go_to_run_query.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/press_go_to_run_query.png -------------------------------------------------------------------------------- /exercises/ex4/images/project_attributes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/project_attributes.png -------------------------------------------------------------------------------- /exercises/ex4/images/project_attributes_bigger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/project_attributes_bigger.png -------------------------------------------------------------------------------- /exercises/ex4/images/run_fiori_generator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/run_fiori_generator.png -------------------------------------------------------------------------------- /exercises/ex4/images/sandbox_flp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/sandbox_flp.png -------------------------------------------------------------------------------- /exercises/ex4/images/save_metadata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/save_metadata.png -------------------------------------------------------------------------------- /exercises/ex4/images/upload_metadata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/upload_metadata.png -------------------------------------------------------------------------------- /exercises/ex4/images/yeoman_ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex4/images/yeoman_ui.png -------------------------------------------------------------------------------- /exercises/ex5/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 5 - Function Implemented as Stored Procedure 2 | 3 | [![code](https://flat.badgen.net/badge/code/available/green?icon=github)](./code/) 4 | 5 | In this exercise, we will create a service function which is implemented via an SAP HANA SQLScript Stored Procedure. 6 | 7 | ## Exercise 5.1 Add Stored Procedure and Use it to Implement a CAP Function 8 | 9 | [Video Link](https://youtu.be/0gQ58BTtQ9Q)
10 | 11 | 1. In the **/db/src** folder create a new file named **sleep.hdbprocedure**. This is a very simple SAP HANA Stored Procedure that calls the built-in SYNC library to put processing to sleep for 10 seconds. It's a nice tool to be able to test the impact of long running queries without actually putting unnecessary load on the system.
![sleep](images/sleep_procedure.png) 12 | 13 | ```SQL 14 | PROCEDURE "sleep" ( ) 15 | LANGUAGE SQLSCRIPT 16 | SQL SECURITY INVOKER 17 | READS SQL DATA AS 18 | BEGIN USING SQLSCRIPT_SYNC as SyncLib; 19 | 20 | call SyncLib:SLEEP_SECONDS(10); 21 | 22 | END 23 | ``` 24 | 25 | 2. Save. Run ```npm run build``` from the terminal. Although this new stored procedure isn't part of CAP, the build will still copy it into the **/gen/db** folder.
![Build with Procedure](images/build_contains_procedure.png) 26 | 27 | 3. Run ```npm run hana```. Likewise the CDS deploy to HANA will also deploy native SAP HANA artifacts as well. Not everything in your project has to be implemented via CAP. You can also mix in HANA native development as well.
![Deploy also works for HANA Native content](images/deploy_creates_procedure.png) 28 | 29 | 4. If you wish you can return to the Database Explorer. This new Procedure is there now and can be tested.
![View sleep in DB Explorer](images/test_sleep1.png)

![Test Run sleep](images/test_sleep2.png) 30 | 31 | 5. But now we want to add this Procedure to the CAP service as a function. Edit **/srv/cat-service.cds**.
Add: ```function sleep() returns Boolean;``` to the service definition. This will expose an OData Function as part of the service interface.
![Add Function](images/add_function.png) 32 | 33 | 6. Just adding the function doesn't do anything. We need to use the service handler exit in **cat-service.js** again to implement the call to the Stored Procedure. This logic will implement the exit handler for this function which in turn uses the standard @sap/hdbext module to call the Stored Procedure from HANA.
![Call Stored Procedure](images/call_stored_procedure.png) 34 | 35 | ```JavaScript 36 | this.on('sleep', async () => { 37 | try { 38 | const db = await cds.connect.to('db') 39 | const dbClass = require("sap-hdbext-promisfied") 40 | let dbConn = new dbClass(await dbClass.createConnection(db.options.credentials)) 41 | const hdbext = require("@sap/hdbext") 42 | const sp = await dbConn.loadProcedurePromisified(hdbext, null, 'sleep') 43 | const output = await dbConn.callProcedurePromisified(sp, []) 44 | console.log(output.results) 45 | return true 46 | } catch (error) { 47 | console.error(error) 48 | return false 49 | } 50 | }) 51 | ``` 52 | 53 | 7. But since we used two additional HANA modules in our code, we need to add those to our root **package.json**. Please add **sap-hdbext-promisfied** and **@sap/hdbext** as shown.
![Extend package.json](images/extend_package_json.png) 54 | 55 | 8. Save your open files and Run the ```npm install``` from the Terminal. 56 | 57 | 9. Run ```npm run build``` then ```npm start```. The CAP preview UI doesn't list functions or actions, however. Just click on the **/catalog** link for the entire service
![Cick on Catalog](images/click_on_catalog.png) 58 | 59 | 10. Manually add **/sleep()** to the end of the URL. If it works correctly it should take 10 seconds to respond since the procedure is running a sleep operation for that long.
![Sleep Function](images/sleep_true.png) 60 | 61 | ## Summary 62 | 63 | You've now added an OData function to your service layer which in turn is implemented as an SAP HANA Stored Procedure 64 | 65 | All Done - Congratulations you've completed this course workshop 66 | -------------------------------------------------------------------------------- /exercises/ex5/code/.cdsrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /exercises/ex5/code/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "node": true, 5 | "es6": true, 6 | "jest": true 7 | }, 8 | "parserOptions": { 9 | "ecmaVersion": 2017 10 | }, 11 | "globals": { 12 | "SELECT": true, 13 | "INSERT": true, 14 | "UPDATE": true, 15 | "DELETE": true, 16 | "CREATE": true, 17 | "DROP": true, 18 | "cds": true 19 | }, 20 | "rules": { 21 | "no-console": "off", 22 | "require-atomic-updates": "off" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /exercises/ex5/code/.pipeline/config.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # This file configures the SAP Cloud SDK Continuous Delivery 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://github.com/SAP/cloud-s4-sdk-pipeline/blob/master/configuration.md 7 | # If you are using a fixed version of the pipeline, please make sure to view the corresponding version from the tag 8 | # list of GitHub (e.g. "v15" when you configured pipelineVersion = "v15" in the Jenkinsfile). 9 | # 10 | # For general information on how to get started with Continuous Delivery, visit: 11 | # https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | # 13 | # We aim to keep the pipeline configuration as stable as possible. However, major changes might also imply breaking 14 | # changes in the configuration. Before doing an update, please check the the release notes of all intermediate releases 15 | # and adapt this file if necessary. 16 | # 17 | # This is a YAML-file. YAML is a indentation-sensitive file format. Please make sure to properly indent changes to it. 18 | ### 19 | 20 | 21 | 22 | ### General project setup 23 | general: 24 | 25 | ### Step-specific configuration 26 | steps: 27 | mavenExecute: 28 | dockerImage: devxci/mbtci:1.0.14 29 | 30 | 31 | ### Stage-specific configuration 32 | stages: 33 | 34 | # This exclude is required for the example project to be successful in the pipeline 35 | # Remove it when you have added your first test 36 | s4SdkQualityChecks: 37 | jacocoExcludes: 38 | - '**/gen/**' 39 | - '**/Application.class' 40 | 41 | # npmAudit: 42 | # auditedAdvisories: 43 | 44 | # integrationTests: 45 | # credentials: 46 | # - alias: 'mySystemAlias' 47 | # credentialId: 'mySystemCredentialsId' 48 | 49 | # s4SdkQualityChecks: 50 | # nonErpDestinations: 51 | # - 'myCustomDestination' 52 | 53 | # productionDeployment: 54 | # cfTargets: 55 | # - org: 'myOrg' 56 | # space: 'mySpace' 57 | # apiEndpoint: 'https://' 58 | # appName: 'myAppName' 59 | # manifest: 'manifest.yml' 60 | # credentialsId: 'myDeploymentCredentialsId' 61 | -------------------------------------------------------------------------------- /exercises/ex5/code/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 | * The Jenkins can easily be bootstraped using the life-cycle script located inside the 'cx-server' directory. 8 | * 9 | * More information on getting started with Continuous Delivery can be found in the following places: 10 | * - GitHub repository: https://github.com/SAP/cloud-s4-sdk-pipeline 11 | * - Blog Post: https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery 12 | */ 13 | 14 | /* 15 | * Set pipelineVersion to a fixed released version (e.g. "v35") when running in a productive environment. 16 | * To find out about available versions and release notes, visit: https://github.com/SAP/cloud-s4-sdk-pipeline/releases 17 | */ 18 | String pipelineVersion = "master" 19 | 20 | library "s4sdk-pipeline-library@${pipelineVersion}" 21 | cloudSdkPipeline(script: this) 22 | -------------------------------------------------------------------------------- /exercises/ex5/code/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 / Folder | Purpose 8 | ---------|---------- 9 | `app/` | content for UI frontends go 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 VSCode simply choose _**Terminal** > Run Task > cds watch_ ) 20 | - Start adding content, e.g. 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 | -------------------------------------------------------------------------------- /exercises/ex5/code/_i18n/i18n.properties: -------------------------------------------------------------------------------- 1 | po_id=Purchase Order ID 2 | po_items=Purchase Order Items 3 | poService=Purchase Order 4 | poServices==Purchase Orders 5 | buyerService=Buyer Details 6 | userService=User Details 7 | currencyService=Currency Code 8 | CreateBy=Created By 9 | CreateAt=Created Date 10 | ChangedBy=Last Updated By 11 | ChangedAt=Last Update Date 12 | currency=Currency 13 | partner_id=Partner ID 14 | quantity=Quantity 15 | quantityUnit=Quantity Unit 16 | product=Product 17 | products=Products 18 | notes=Notes 19 | grossAmount=Gross Amount 20 | netAmount=Net Amount 21 | taxAmount=Tax Amount 22 | lifecycle=Lifecycle Status 23 | approval=Approval Status 24 | confirmation=Confirmation Status 25 | ordering=Ordering Status 26 | invoicing=Invoicing Status 27 | note=Note 28 | deliveryDate=Delivery Date 29 | partnerId=Partner ID 30 | partnerRole=Partner Role - Customer or Supplier 31 | email=Email Address 32 | phone=Phone Number 33 | fax=Fax Number 34 | web=Web Site Address 35 | address=Address Association 36 | company=Company Name 37 | legal=Legal Form 38 | building=Building Number 39 | city=City 40 | country=Country 41 | region=Region Otherwise Known as State in some countries 42 | addressType=Address Type 43 | postalCode=Postal Code 44 | street=Street 45 | fname=Given Name 46 | lname=Family Name 47 | mname=Middel Name 48 | userId=User Id 49 | currCode=Currency Code 50 | currDesc=Currency Description 51 | internal_id=Internal ID 52 | details=Details 53 | code1=Country Code 54 | alpha3=Three Character Country Code 55 | iso=ISO 3166-2 Code 56 | region=Region 57 | sub_region=Sub Region 58 | region_code=Region Code 59 | sub_region_code=Sub Region Code 60 | country=Country 61 | sub_code=Subdivision Code 62 | name=Subdivision Name 63 | type=Subdivision Type 64 | poServices=Purchase Order Services 65 | gender=Gender 66 | latitude=Geo Latitude 67 | longitude=Geo Longitude 68 | validFrom=Valid From 69 | validTo=Valid To 70 | addressId=Address Internal ID 71 | employeeId=Employee Internal ID 72 | initials=Initials 73 | sex=Gender 74 | language=Primary Spoken Language 75 | phoneNumber=Primary Phone Number 76 | email=Email Address 77 | loginName=Login Username 78 | accountNumber=Bank Account Number 79 | salaryAmount=Salary Amount 80 | bankId=Bank ID 81 | bankName=Bank Name 82 | employeePicUrl=Employee Picture URL 83 | businessParnters=Business Partners 84 | typeCode=Type Code 85 | category=Product Category 86 | name=Product Name 87 | desc=Product Description 88 | supplier=Supplier 89 | weightMeasure=Weight Measure 90 | weightUnit=Weight Unit 91 | price=Price 92 | picUrl=Product Picture URL 93 | width=Width 94 | depth=Depth 95 | height=Height 96 | dimensionUnit=Dimension Unit 97 | addrService=Address 98 | addrServices=Addresses 99 | userService=User 100 | userServices=Users 101 | user_id=User ID 102 | productImage=Product Image 103 | productImageType=Product Image Typ -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | TechEd DAT160 9 | 43 | 44 | 45 | 51 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/.gitignore: -------------------------------------------------------------------------------- 1 | src/ 2 | node_modules/ 3 | dist/ 4 | .scp/ -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/.npmrc: -------------------------------------------------------------------------------- 1 | @ui5:registry=https://registry.npmjs.org 2 | @sap:registry=https://registry.npmjs.org 3 | save = true 4 | save-exact = true 5 | strict-ssl = false 6 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/README.md: -------------------------------------------------------------------------------- 1 | ## Application Details 2 | | | 3 | | ------------- | 4 | |**Generation Date and Time**
Sat Sep 26 2020 20:19:27 GMT+0000 (Coordinated Universal Time)| 5 | |**App Generator Version**
1.0.17| 6 | |**Generation Platform**
SAP Business Application Studio| 7 | |**Template Used**
LABEL_PROJECT_TYPE_V2_LIST_REPORT| 8 | |**Service Type**
File| 9 | |**Metadata File**
teched_metadata.xml| 10 | |**Main Entity**
POHeaders| 11 | |**Navigation Entity**
item| 12 | |**Module Name**
pofiori| 13 | |**Application Title**
Purchase Orders| 14 | |**Namespace**
sap.teched| 15 | |**UI5 Theme**
sap_fiori_3_dark| 16 | |**UI5 Version**
Latest | 17 | |**Enable Telemetry**
True | 18 | 19 | ## pofiori 20 | 21 | A Fiori application. 22 | 23 | ### Starting the generated app 24 | 25 | - 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 run the following from the generated app root folder: 26 | 27 | ``` 28 | npm start 29 | ``` 30 | 31 | - It is also possible to run the application using mock data that reflects the OData Service URL supplied during application generation. In order to run the application with Mock Data, run the following from the generated app root folder: 32 | 33 | ``` 34 | npm run start-mock 35 | ``` 36 | 37 | 38 | #### Pre-requisites: 39 | 40 | 1. Active NodeJS LTS (Long Term Support) version and associated supported NPM version. (See https://nodejs.org) 41 | 42 | 43 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pofiori", 3 | "version": "0.0.1", 4 | "private": true, 5 | "sapux": true, 6 | "description": "A Fiori application.", 7 | "keywords": [ 8 | "ui5", 9 | "openui5", 10 | "sapui5" 11 | ], 12 | "main": "webapp/index.html", 13 | "scripts": { 14 | "postinstall": "npm i @sap/ux-ui5-tooling@\"^1.0.0\" @sap/ux-specification@\"^1.76.12\" --save-dev --save-exact=false", 15 | "start": " echo \"\\033[33mThis application was generated with a local metadata file and does not reference a live server. Please start this application with mock data using the target: npm run start-mock\"", 16 | "start-mock": "fiori run --open test/flpSandboxMockServer.html#masterDetail-display", 17 | "start-local": "", 18 | "build": "rimraf dist && ui5 build -a --include-task=generateManifestBundle generateCachebusterInfo", 19 | "deploy": "fiori add deploy-config" 20 | }, 21 | "remarkConfig": { 22 | "plugins": [ 23 | "remark-preset-lint-consistent" 24 | ] 25 | }, 26 | "devDependencies": { 27 | "@sap/ux-specification": "^1.78.9", 28 | "@sap/ux-ui5-tooling": "^1.0.18", 29 | "@ui5/cli": "2.3.2", 30 | "@ui5/fs": "2.0.1", 31 | "@ui5/logger": "2.0.0", 32 | "rimraf": "3.0.0" 33 | }, 34 | "optionalDependencies": { 35 | "fsevents": "1.2.9" 36 | }, 37 | "ui5": { 38 | "dependencies": [ 39 | "@sap/ux-ui5-tooling" 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/ui5-local.yaml: -------------------------------------------------------------------------------- 1 | specVersion: '2.0' 2 | metadata: 3 | name: 'pofiori' 4 | type: application 5 | framework: 6 | name: SAPUI5 7 | version: "1.82.0" 8 | libraries: 9 | - name: sap.m 10 | - name: sap.ushell 11 | - name: sap.ui.core 12 | - name: sap.f 13 | - name: sap.ui.comp 14 | - name: sap.ui.table 15 | - name: sap.suite.ui.generic.template 16 | - name: sap.ui.generic.app 17 | - name: themelib_sap_fiori_3 18 | server: 19 | customMiddleware: 20 | - name: fiori-tools-proxy 21 | afterMiddleware: compression 22 | configuration: 23 | backend: 24 | - path: /sap/opu/odata 25 | url: http://localhost 26 | - name: fiori-tools-appreload 27 | afterMiddleware: compression 28 | configuration: 29 | port: 35729 30 | path: webapp 31 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/ui5.yaml: -------------------------------------------------------------------------------- 1 | specVersion: '1.0' 2 | metadata: 3 | name: 'pofiori' 4 | type: application 5 | ui5Theme: sap_fiori_3_dark 6 | server: 7 | customMiddleware: 8 | - name: fiori-tools-proxy 9 | afterMiddleware: compression 10 | configuration: 11 | ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted 12 | backend: 13 | - path: /sap/opu/odata 14 | url: http://localhost 15 | ui5: 16 | path: 17 | - /resources 18 | - /test-resources 19 | url: https://ui5.sap.com 20 | version: # The UI5 version, for instance, 1.78.1. Empty means latest version 21 | - name: fiori-tools-appreload 22 | afterMiddleware: compression 23 | configuration: 24 | port: 35729 25 | path: webapp 26 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/webapp/Component.js: -------------------------------------------------------------------------------- 1 | sap.ui.define(['sap/suite/ui/generic/template/lib/AppComponent'], function(AppComponent) { 2 | return AppComponent.extend('sap.teched.pofiori.Component', { 3 | metadata: { 4 | manifest: 'json' 5 | } 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/webapp/annotations/annotation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/webapp/i18n/i18n.properties: -------------------------------------------------------------------------------- 1 | # This is the resource bundle for pofiori 2 | 3 | #Texts for manifest.json 4 | 5 | #XTIT: Application name 6 | appTitle=Purchase Orders 7 | 8 | #YDES: Application description 9 | appDescription=A Fiori application. -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/webapp/localService/mockserver.js: -------------------------------------------------------------------------------- 1 | sap.ui.define(['sap/ui/core/util/MockServer'], function(MockServer) { 2 | 'use strict'; 3 | var oMockServer, 4 | _sAppModulePath = 'sap.teched.pofiori/', 5 | _sJsonFilesModulePath = _sAppModulePath + 'localService/mockdata'; 6 | 7 | return { 8 | /** 9 | * Initializes the mock server. 10 | * You can configure the delay with the URL parameter "serverDelay". 11 | * The local mock data in this folder is returned instead of the real data for testing. 12 | * @public 13 | */ 14 | 15 | init: function() { 16 | var oUriParameters = jQuery.sap.getUriParameters(), 17 | sJsonFilesUrl = jQuery.sap.getModulePath(_sJsonFilesModulePath), 18 | sManifestUrl = jQuery.sap.getModulePath(_sAppModulePath + 'manifest', '.json'), 19 | sEntity = 'POHeaders', 20 | sErrorParam = oUriParameters.get('errorType'), 21 | iErrorCode = sErrorParam === 'badRequest' ? 400 : 500, 22 | oManifest = jQuery.sap.syncGetJSON(sManifestUrl).data, 23 | oDataSource = oManifest['sap.app'].dataSources, 24 | oMainDataSource = oDataSource.mainService, 25 | sMetadataUrl = jQuery.sap.getModulePath( 26 | _sAppModulePath + oMainDataSource.settings.localUri.replace('.xml', ''), 27 | '.xml' 28 | ), 29 | // ensure there is a trailing slash 30 | sMockServerUrl = /.*\/$/.test(oMainDataSource.uri) ? oMainDataSource.uri : oMainDataSource.uri + '/', 31 | aAnnotations = oMainDataSource.settings.annotations; 32 | 33 | oMockServer = new MockServer({ 34 | rootUri: sMockServerUrl 35 | }); 36 | 37 | // configure mock server with a delay of 1s 38 | MockServer.config({ 39 | autoRespond: true, 40 | autoRespondAfter: oUriParameters.get('serverDelay') || 1000 41 | }); 42 | 43 | // load local mock data 44 | oMockServer.simulate(sMetadataUrl, { 45 | sMockdataBaseUrl: sJsonFilesUrl, 46 | bGenerateMissingMockData: true 47 | }); 48 | 49 | var aRequests = oMockServer.getRequests(), 50 | fnResponse = function(iErrCode, sMessage, aRequest) { 51 | aRequest.response = function(oXhr) { 52 | oXhr.respond( 53 | iErrCode, 54 | { 55 | 'Content-Type': 'text/plain;charset=utf-8' 56 | }, 57 | sMessage 58 | ); 59 | }; 60 | }; 61 | 62 | // handling the metadata error test 63 | if (oUriParameters.get('metadataError')) { 64 | aRequests.forEach(function(aEntry) { 65 | if (aEntry.path.toString().indexOf('$metadata') > -1) { 66 | fnResponse(500, 'metadata Error', aEntry); 67 | } 68 | }); 69 | } 70 | 71 | // Handling request errors 72 | if (sErrorParam) { 73 | aRequests.forEach(function(aEntry) { 74 | if (aEntry.path.toString().indexOf(sEntity) > -1) { 75 | fnResponse(iErrorCode, sErrorParam, aEntry); 76 | } 77 | }); 78 | } 79 | oMockServer.start(); 80 | 81 | jQuery.sap.log.info('Running the app with mock data'); 82 | 83 | if (aAnnotations && aAnnotations.length > 0) { 84 | aAnnotations.forEach(function(sAnnotationName) { 85 | var oAnnotation = oDataSource[sAnnotationName], 86 | sUri = oAnnotation.uri, 87 | sLocalUri = jQuery.sap.getModulePath( 88 | _sAppModulePath + oAnnotation.settings.localUri.replace('.xml', ''), 89 | '.xml' 90 | ); 91 | 92 | // backend annotations 93 | new MockServer({ 94 | rootUri: sUri, 95 | requests: [ 96 | { 97 | method: 'GET', 98 | path: new RegExp('([?#].*)?'), 99 | response: function(oXhr) { 100 | jQuery.sap.require('jquery.sap.xml'); 101 | 102 | var oAnnotations = jQuery.sap.sjax({ 103 | url: sLocalUri, 104 | dataType: 'xml' 105 | }).data; 106 | 107 | oXhr.respondXML(200, {}, jQuery.sap.serializeXML(oAnnotations)); 108 | return true; 109 | } 110 | } 111 | ] 112 | }).start(); 113 | }); 114 | } 115 | }, 116 | 117 | /** 118 | * @public returns the mockserver of the app, should be used in integration tests 119 | * @returns {sap.ui.core.util.MockServer} 120 | */ 121 | getMockServer: function() { 122 | return oMockServer; 123 | } 124 | }; 125 | }); 126 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/webapp/test/changes_loader.js: -------------------------------------------------------------------------------- 1 | //This file used only for loading the changes in the preview and not required to be checked in. 2 | //Loads and extends the openui5 FileListBaseConnector 3 | 4 | //For UI5 version >= 1.80, the location of the FileListBaseConnector is different 5 | const connectorPath = 6 | parseFloat(sap.ui.version) >= 1.8 7 | ? 'sap/ui/fl/write/api/connectors/FileListBaseConnector' 8 | : 'sap/ui/fl/initial/api/connectors/FileListBaseConnector'; 9 | 10 | sap.ui.define(['sap/base/util/merge', connectorPath], function(merge, FileListBaseConnector) { 11 | var aPromises = []; 12 | var trustedHosts = [/^localhost$/, /^.*.applicationstudio.cloud.sap$/]; 13 | var url = new URL(window.location.toString()); 14 | var isValidHost = trustedHosts.some((host) => { 15 | return host.test(url.hostname); 16 | }); 17 | return merge({}, FileListBaseConnector, { 18 | getFileList: function() { 19 | return new Promise(function(resolve, reject) { 20 | // If no changes found, maybe because the app was executed without doing a build. 21 | // Check for changes folder and load the changes, if any. 22 | if (!isValidHost) reject(console.log('cannot load flex changes: invalid host')); 23 | $.ajax({ 24 | url: url.origin + '/changes/', 25 | type: 'GET', 26 | cache: false 27 | }) 28 | .then(function(sChangesFolderContent) { 29 | var regex = /(\/changes\/id_[^"]*)/g; 30 | var result = regex.exec(sChangesFolderContent); 31 | var aChanges = []; 32 | while (result !== null) { 33 | aChanges.push(result[1]); 34 | result = regex.exec(sChangesFolderContent); 35 | } 36 | resolve(aChanges); 37 | }) 38 | .fail(function(obj) { 39 | // No changes folder, then just resolve 40 | resolve(); 41 | }); 42 | }); 43 | } 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/webapp/test/flpSandbox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{appTitle}} 9 | 10 | 25 | 56 | 57 | 58 | 59 | 60 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /exercises/ex5/code/app/resources/pofiori/webapp/test/flpSandboxMockServer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{appTitle}} 9 | 10 | 25 | 56 | 57 | 58 | 59 | 60 | 70 | 71 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /exercises/ex5/code/db/data-model.cds: -------------------------------------------------------------------------------- 1 | using { 2 | Currency, 3 | managed, 4 | sap, 5 | cuid 6 | } from '@sap/cds/common'; 7 | 8 | extend sap.common.Currencies with { 9 | numcode : Integer; 10 | exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent 11 | minor : String; //> e.g. 'Cent' 12 | } 13 | 14 | context teched.common { 15 | type BusinessKey : String(10); 16 | type SDate : DateTime; 17 | 18 | @assert.range : true 19 | type StatusT : String(1) enum { 20 | New = 'N'; 21 | Incomplete = 'I'; 22 | Approved = 'A'; 23 | Rejected = 'R'; 24 | Confirmed = 'C'; 25 | Saved = 'S'; 26 | Delivered = 'D'; 27 | Cancelled = 'X'; 28 | } 29 | 30 | type AmountT : Decimal(15, 2)@( 31 | Semantics.amount.currencyCode : 'CURRENCY_code', 32 | sap.unit : 'CURRENCY_code' 33 | ); 34 | 35 | abstract entity Amount { 36 | currency : Currency; 37 | grossAmount : AmountT; 38 | netAmount : AmountT; 39 | taxAmount : AmountT; 40 | } 41 | 42 | annotate Amount with { 43 | grossAmount @(title : '{i18n>grossAmount}'); 44 | netAmount @(title : '{i18n>netAmount}'); 45 | taxAmount @(title : '{i18n>taxAmount}'); 46 | } 47 | 48 | type QuantityT : Decimal(13, 3)@(title : '{i18n>quantity}'); 49 | type UnitT : String(3)@title : '{i18n>quantityUnit}'; 50 | 51 | abstract entity Quantity { 52 | quantity : QuantityT; 53 | quantityUnit : UnitT; 54 | } 55 | } 56 | 57 | context teched.PurchaseOrder { 58 | entity Headers : managed, cuid, teched.common.Amount { 59 | @cascade : {all} 60 | item : Composition of many Items 61 | on item.poHeader = $self; 62 | noteId : teched.common.BusinessKey null; 63 | partner : UUID; 64 | lifecycleStatus : teched.common.StatusT default 'N'; 65 | approvalStatus : teched.common.StatusT; 66 | confirmStatus : teched.common.StatusT; 67 | orderingStatus : teched.common.StatusT; 68 | invoicingStatus : teched.common.StatusT; 69 | } 70 | 71 | entity Items : cuid, teched.common.Amount, teched.common.Quantity { 72 | poHeader : Association to Headers; 73 | product : teched.common.BusinessKey; 74 | noteId : teched.common.BusinessKey null; 75 | deliveryDate : teched.common.SDate; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /exercises/ex5/code/db/data/sap.common-Currencies.csv: -------------------------------------------------------------------------------- 1 | code;symbol;name;descr;numcode;minor;exponent 2 | EUR;€;Euro;European Euro;978;Cent;2 3 | USD;$;US Dollar;United States Dollar;840;Cent;2 4 | CAD;$;Canadian Dollar;Canadian Dollar;124;Cent;2 5 | AUD;$;Australian Dollar;Canadian Dollar;036;Cent;2 6 | GBP;£;British Pound;Great Britain Pound;826;Penny;2 7 | ILS;₪;Shekel;Israeli New Shekel;376;Agorat;2 8 | INR;₹;Rupee;Indian Rupee;356;Paise;2 9 | QAR;﷼;Riyal;Katar Riyal;356;Dirham;2 10 | SAR;﷼;Riyal;Saudi Riyal;682;Halala;2 11 | JPY;¥;Yen;Japanese Yen;392;Sen;2 12 | CNY;¥;Yuan;Chinese Yuan Renminbi;156;Jiao;1 -------------------------------------------------------------------------------- /exercises/ex5/code/db/data/sap.common-Currencies_texts.csv: -------------------------------------------------------------------------------- 1 | code;locale;name;descr 2 | EUR;de;Euro;European Euro 3 | USD;de;US-Dollar;United States Dollar 4 | CAD;de;Kanadischer Dollar;Kanadischer Dollar 5 | AUD;de;Australischer Dollar;Australischer Dollar 6 | GBP;de;Pfund;Britische Pfund 7 | ILS;de;Schekel;Israelische Schekel 8 | EUR;fr;euro;de la Zone euro 9 | USD;fr;dollar;dollar des États-Unis 10 | CAD;fr;dollar canadien;dollar canadien 11 | AUD;fr;dollar australien;dollar australien 12 | GBP;fr;livre sterling;pound sterling 13 | ILS;fr;Shekel;shekel israelien -------------------------------------------------------------------------------- /exercises/ex5/code/db/po-annotations.cds: -------------------------------------------------------------------------------- 1 | using teched.PurchaseOrder as PO from './data-model'; 2 | 3 | annotate PO.Headers with @( 4 | title : '{i18n>poService}', 5 | description : '{i18n>poService}' 6 | ) { 7 | ID @( 8 | title : '{i18n>po_id}', 9 | description : '{i18n>po_id}', 10 | ); 11 | 12 | items @( 13 | title : '{i18n>po_items}', 14 | description : '{i18n>po_items}' 15 | ); 16 | 17 | partner @( 18 | title : '{i18n>partner_id}', 19 | description : '{i18n>partner_id}' 20 | ); 21 | 22 | lifecycleStatus @( 23 | title : '{i18n>lifecycle}', 24 | description : '{i18n>lifecycle}', 25 | Common.FieldControl : #ReadOnly 26 | ); 27 | 28 | approvalStatus @( 29 | title : '{i18n>approval}', 30 | description : '{i18n>approval}', 31 | Common.FieldControl : #ReadOnly 32 | ); 33 | 34 | confirmStatus @( 35 | title : '{i18n>confirmation}', 36 | description : '{i18n>confirmation}', 37 | Common.FieldControl : #ReadOnly 38 | ); 39 | 40 | orderingStatus @( 41 | title : '{i18n>ordering}', 42 | description : '{i18n>ordering}', 43 | Common.FieldControl : #ReadOnly 44 | ); 45 | 46 | invoicingStatus @( 47 | title : '{i18n>invoicing}', 48 | description : '{i18n>invoicing}', 49 | Common.FieldControl : #ReadOnly 50 | ); 51 | }; 52 | 53 | annotate Items with { 54 | ID @( 55 | title : '{i18n>internal_id}', 56 | description : '{i18n>internal_id}', 57 | ); 58 | 59 | product @( 60 | title : '{i18n>product}', 61 | description : '{i18n>product}', 62 | Common.FieldControl : #Mandatory, 63 | Search.defaultSearchElement 64 | ); 65 | 66 | deliveryDate @( 67 | title : '{i18n>deliveryDate}', 68 | description : '{i18n>deliveryDate}' 69 | ) 70 | } -------------------------------------------------------------------------------- /exercises/ex5/code/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 | } 136 | } -------------------------------------------------------------------------------- /exercises/ex5/code/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 -------------------------------------------------------------------------------- /exercises/ex5/code/mta.yaml: -------------------------------------------------------------------------------- 1 | ## Generated mta.yaml based on template version 0.3.0 2 | ## appName = dat160 3 | ## language=nodejs; multiTenant=false 4 | ## approuter= 5 | _schema-version: '3.1' 6 | ID: dat160 7 | version: 1.0.0 8 | description: "A simple CAP project." 9 | parameters: 10 | enable-parallel-deployments: true 11 | 12 | build-parameters: 13 | before-all: 14 | - builder: custom 15 | commands: 16 | - npm install --production 17 | - npx -p @sap/cds-dk cds build --production 18 | 19 | modules: 20 | # --------------------- SERVER MODULE ------------------------ 21 | - name: dat160-srv 22 | # ------------------------------------------------------------ 23 | type: nodejs 24 | path: gen/srv 25 | provides: 26 | - name: srv-api # required by consumers of CAP services (e.g. approuter) 27 | properties: 28 | srv-url: ${default-url} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /exercises/ex5/code/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dat160", 3 | "version": "1.0.0", 4 | "description": "A simple CAP project.", 5 | "repository": "", 6 | "license": "UNLICENSED", 7 | "private": true, 8 | "dependencies": { 9 | "@sap/cds": "^4", 10 | "express": "^4", 11 | "@sap/hana-client": "^2.7", 12 | "@sap/cds-odata-v2-adapter-proxy": "^1.5.1", 13 | "@sap/hdbext": "^7.1.0", 14 | "sap-hdbext-promisfied": "^2.202010.3" 15 | }, 16 | "devDependencies": { 17 | "@sap/ux-specification": "^1.84.0", 18 | "sqlite3": "^5" 19 | }, 20 | "scripts": { 21 | "hana": "cds deploy --to hana:dat160 --auto-undeploy", 22 | "start": "cds run", 23 | "build": "cds build" 24 | }, 25 | "cds": { 26 | "hana": { 27 | "deploy-format": "hdbtable" 28 | }, 29 | "requires": { 30 | "db": { 31 | "kind": "hana" 32 | } 33 | } 34 | }, 35 | "sapux": [ 36 | "app/pofiori" 37 | ] 38 | } 39 | 40 | -------------------------------------------------------------------------------- /exercises/ex5/code/srv/cat-service.cds: -------------------------------------------------------------------------------- 1 | using teched.PurchaseOrder as PO from '../db/data-model'; 2 | 3 | service CatalogService { 4 | entity POHeaders @( 5 | title : '{i18n>poService}', 6 | odata.draft.enabled : true 7 | ) as projection on PO.Headers; 8 | 9 | entity POItems @( 10 | title : '{i18n>poService}', 11 | ) as projection on PO.Items; 12 | 13 | function sleep() returns Boolean; 14 | } 15 | -------------------------------------------------------------------------------- /exercises/ex5/code/srv/cat-service.js: -------------------------------------------------------------------------------- 1 | const cds = require('@sap/cds') 2 | module.exports = cds.service.impl(function () { 3 | 4 | const { POHeaders } = this.entities() 5 | 6 | this.after('each', POHeaders, row => { 7 | console.log(`Read PO: ${row.ID}`) 8 | }) 9 | 10 | this.after(['CREATE', 'UPDATE', 'DELETE'], [POHeaders], async (po, req) => { 11 | const header = req.data 12 | req.on('succeeded', () => { 13 | global.it || console.log(`< emitting: poChanged ${header.ID}`) 14 | this.emit('poChange', header) 15 | }) 16 | }) 17 | 18 | this.on('sleep', async () => { 19 | try { 20 | const db = await cds.connect.to('db') 21 | const dbClass = require("sap-hdbext-promisfied") 22 | let dbConn = new dbClass(await dbClass.createConnection(db.options.credentials)) 23 | const hdbext = require("@sap/hdbext") 24 | const sp = await dbConn.loadProcedurePromisified(hdbext, null, 'sleep') 25 | const output = await dbConn.callProcedurePromisified(sp, []) 26 | console.log(output.results) 27 | return true 28 | } catch (error) { 29 | console.error(error) 30 | return false 31 | } 32 | }) 33 | }) -------------------------------------------------------------------------------- /exercises/ex5/code/srv/po-header-fiori.cds: -------------------------------------------------------------------------------- 1 | using CatalogService as pos from './cat-service'; 2 | 3 | 4 | annotate pos.POHeaders with @( // header-level annotations 5 | // --------------------------------------------------------------------------- 6 | // List Report 7 | // --------------------------------------------------------------------------- 8 | // POs List 9 | UI : { 10 | LineItem : [ 11 | { 12 | $Type : 'UI.DataField', 13 | Value : ID, 14 | ![@UI.Importance] : #High 15 | }, 16 | { 17 | $Type : 'UI.DataField', 18 | Value : grossAmount, 19 | ![@UI.Importance] : #High 20 | }, 21 | { 22 | $Type : 'UI.DataField', 23 | Value : currency_code, 24 | ![@UI.Importance] : #Medium 25 | }, 26 | { 27 | $Type : 'UI.DataField', 28 | Value : currency.symbol 29 | }, 30 | ], 31 | PresentationVariant : {SortOrder : [ 32 | { 33 | $Type : 'Common.SortOrderType', 34 | Property : ID, 35 | Descending : false 36 | }, 37 | { 38 | $Type : 'Common.SortOrderType', 39 | Property : partner, 40 | Descending : false 41 | } 42 | ]} 43 | }, 44 | 45 | // --------------------------------------------------------------------------- 46 | // Object Page 47 | // --------------------------------------------------------------------------- 48 | // Page Header 49 | UI : { 50 | HeaderInfo : { 51 | TypeName : '{i18n>poService}', 52 | TypeNamePlural : '{i18n>poServices}', 53 | Title : {Value : ID}, 54 | }, 55 | HeaderFacets : [ 56 | { 57 | $Type : 'UI.ReferenceFacet', 58 | Target : '@UI.FieldGroup#Description', 59 | ![@UI.Importance] : #Medium 60 | }, 61 | { 62 | $Type : 'UI.ReferenceFacet', 63 | Target : '@UI.FieldGroup#AdministrativeData', 64 | ![@UI.Importance] : #Medium 65 | } 66 | ], 67 | FieldGroup #Description : {Data : [ 68 | { 69 | $Type : 'UI.DataField', 70 | Value : ID 71 | } 72 | ]}, 73 | FieldGroup #Details : {Data : [ 74 | { 75 | $Type : 'UI.DataField', 76 | Value : partner 77 | }, 78 | { 79 | $Type : 'UI.DataField', 80 | Value : noteId, 81 | ![@UI.Importance] : #Medium 82 | }, 83 | { 84 | $Type : 'UI.DataField', 85 | Value : grossAmount 86 | }, 87 | { 88 | $Type : 'UI.DataField', 89 | Value : netAmount 90 | }, 91 | { 92 | $Type : 'UI.DataField', 93 | Value : taxAmount 94 | }, 95 | { 96 | $Type : 'UI.DataField', 97 | Value : currency_code 98 | }, 99 | { 100 | $Type : 'UI.DataField', 101 | Value : currency.symbol, 102 | ![@Common.FieldControl] : #ReadOnly 103 | }, 104 | { 105 | $Type : 'UI.DataField', 106 | Value : currency.name, 107 | ![@Common.FieldControl] : #ReadOnly 108 | }, 109 | ]}, 110 | FieldGroup #AdministrativeData : {Data : [ 111 | { 112 | $Type : 'UI.DataField', 113 | Value : createdBy 114 | }, 115 | { 116 | $Type : 'UI.DataField', 117 | Value : createdAt 118 | }, 119 | { 120 | $Type : 'UI.DataField', 121 | Value : modifiedBy 122 | }, 123 | { 124 | $Type : 'UI.DataField', 125 | Value : modifiedAt 126 | } 127 | ]} 128 | }, 129 | // Page Facets 130 | UI.Facets : [ 131 | { 132 | $Type : 'UI.CollectionFacet', 133 | ID : 'PODetails', 134 | Label : '{i18n>details}', 135 | Facets : [{ 136 | $Type : 'UI.ReferenceFacet', 137 | Label : '{i18n>details}', 138 | Target : '@UI.FieldGroup#Details' 139 | }] 140 | }, 141 | { 142 | $Type : 'UI.ReferenceFacet', 143 | Label : '{i18n>po_items}', 144 | Target : 'item/@UI.LineItem' 145 | } 146 | ] 147 | ); -------------------------------------------------------------------------------- /exercises/ex5/code/srv/po-item-fiori.cds: -------------------------------------------------------------------------------- 1 | using CatalogService as pos from './cat-service'; 2 | 3 | 4 | annotate pos.POItems with @( // header-level annotations 5 | // --------------------------------------------------------------------------- 6 | // List Report 7 | // --------------------------------------------------------------------------- 8 | // PO Items List 9 | UI : { 10 | LineItem : [ 11 | { 12 | $Type : 'UI.DataField', 13 | Value : product, 14 | ![@UI.Importance] : #High 15 | }, 16 | { 17 | $Type : 'UI.DataField', 18 | Value : deliveryDate, 19 | ![@UI.Importance] : #High 20 | }, 21 | { 22 | $Type : 'UI.DataField', 23 | Value : quantity, 24 | ![@UI.Importance] : #High 25 | }, 26 | { 27 | $Type : 'UI.DataField', 28 | Value : quantityUnit, 29 | ![@UI.Importance] : #High 30 | } 31 | ], 32 | PresentationVariant : {SortOrder : [{ 33 | $Type : 'Common.SortOrderType', 34 | Property : product, 35 | Descending : false 36 | }]} 37 | }, 38 | // --------------------------------------------------------------------------- 39 | // Object Page 40 | // --------------------------------------------------------------------------- 41 | // Page Header 42 | UI : { 43 | HeaderInfo : { 44 | TypeName : '{i18n>poService}', 45 | TypeNamePlural : '{i18n>poServices}', 46 | Title : {Value : ID}, 47 | }, 48 | HeaderFacets : [{ 49 | $Type : 'UI.ReferenceFacet', 50 | Target : '@UI.FieldGroup#Description', 51 | ![@UI.Importance] : #Medium 52 | }], 53 | FieldGroup #Description : {Data : [ 54 | { 55 | $Type : 'UI.DataField', 56 | Value : ID 57 | }, 58 | { 59 | $Type : 'UI.DataField', 60 | Value : product 61 | } 62 | ]}, 63 | FieldGroup #Details : {Data : [ 64 | { 65 | $Type : 'UI.DataField', 66 | Value : product 67 | }, 68 | { 69 | $Type : 'UI.DataField', 70 | Value : deliveryDate, 71 | ![@UI.Importance] : #High 72 | }, 73 | { 74 | $Type : 'UI.DataField', 75 | Value : quantity, 76 | ![@UI.Importance] : #High 77 | }, 78 | { 79 | $Type : 'UI.DataField', 80 | Value : quantityUnit, 81 | ![@UI.Importance] : #High 82 | } 83 | ]} 84 | }, 85 | // Page Facets 86 | UI.Facets : [{ 87 | $Type : 'UI.CollectionFacet', 88 | ID : 'POItemsDetails', 89 | Label : '{i18n>details}', 90 | Facets : [{ 91 | $Type : 'UI.ReferenceFacet', 92 | Label : '{i18n>details}', 93 | Target : '@UI.FieldGroup#Details' 94 | }] 95 | }] 96 | ); -------------------------------------------------------------------------------- /exercises/ex5/code/srv/server.js: -------------------------------------------------------------------------------- 1 | const cds = require('@sap/cds') 2 | const proxy = require('@sap/cds-odata-v2-adapter-proxy') 3 | 4 | cds.on('bootstrap', app => app.use(proxy())) 5 | module.exports = cds.server -------------------------------------------------------------------------------- /exercises/ex5/images/1.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /exercises/ex5/images/add_function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/add_function.png -------------------------------------------------------------------------------- /exercises/ex5/images/build_contains_procedure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/build_contains_procedure.png -------------------------------------------------------------------------------- /exercises/ex5/images/call_stored_procedure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/call_stored_procedure.png -------------------------------------------------------------------------------- /exercises/ex5/images/click_on_catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/click_on_catalog.png -------------------------------------------------------------------------------- /exercises/ex5/images/deploy_creates_procedure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/deploy_creates_procedure.png -------------------------------------------------------------------------------- /exercises/ex5/images/extend_package_json.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/extend_package_json.png -------------------------------------------------------------------------------- /exercises/ex5/images/sleep_procedure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/sleep_procedure.png -------------------------------------------------------------------------------- /exercises/ex5/images/sleep_true.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/sleep_true.png -------------------------------------------------------------------------------- /exercises/ex5/images/test_sleep1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/test_sleep1.png -------------------------------------------------------------------------------- /exercises/ex5/images/test_sleep2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/exercises/ex5/images/test_sleep2.png -------------------------------------------------------------------------------- /requirements/guided_tour1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/requirements/guided_tour1.png -------------------------------------------------------------------------------- /requirements/trial-counter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-archive/teched2020-DAT160/303a0989d065927ada224bc0fa0b46757f7bc4c4/requirements/trial-counter.png --------------------------------------------------------------------------------