├── .abapgit.xml ├── LICENSE ├── LICENSES └── Apache-2.0.txt ├── NOTICE ├── README.md ├── README_old.md ├── REUSE.toml ├── how_to_managed_uuid.md ├── images ├── 100_Start_Fiori_Elements_Preview.png ├── 110_New_rap_generator_project.png ├── 120_Set_root_entity_name_and_package.png ├── 130_Enter_project_header_data.png ├── 140_implementation_types.png ├── 150_data_source_types.png ├── 160_binding_types.png ├── 170_select_data_source.png ├── 180_Press_return.png ├── 190_select_object_id.png ├── 200_create_child.png ├── 200_press_create.png ├── 210_set_child_entity_name.png ├── 220_navigate_to_child_object_page.png ├── 230_result_for_child.png ├── 240_generate_objects.png ├── 250_job_is_scheduled.png ├── 260_job_in_progress.png ├── 270_job_finished.png ├── 280_confirm.png ├── 290_generated_objects.png ├── 295_create_service_binding.png ├── 500_RAP_Generator_Overview.png ├── 510_RAP_Generator_UI.png └── readme.md ├── images_how_to_uuid ├── 100_start_FE_preview.png ├── 110_new_project.png ├── 120_the_new_project_dialog.png ├── 130_root_entity_name.png ├── 140_select_table_for_root_entity.png ├── 150_select_package.png ├── 200_select_root_entity_definition.png ├── 300_map_field_for_object_id.png ├── 310_select_object_id_field.png ├── 320_show_other_mapped_fields.png ├── 330_show_proposed_repo_obj_names_and_field_names.png ├── 400_add_child_entity.png ├── 500_add_child_entity.png ├── 520 edit child entity.png ├── 530_maintain_fields_for_child.png ├── 540_rest_of_item_specifc_settings.png ├── 550_generate_repo_objects.png ├── 600_create_save_bo.png ├── 600_generate_objects.png ├── 610_in_process.png ├── 620_finished.png ├── 650_check_log.png ├── 700_navigate_back_1.png ├── 800 Result.png └── README.md ├── json_schemas └── RAPGenerator-schema-all.json ├── json_templates ├── RAPGenerator-sample-abstract-entities.json ├── RAPGenerator-sample-customizing-table.json ├── RAPGenerator-sample-managed-semantic.json ├── RAPGenerator-sample-managed-uuid.json ├── RAPGenerator-sample-unmanaged-abap_structure.json ├── RAPGenerator-sample-unmanaged-ddic-structure.json ├── RAPGenerator-sample-unmanaged-semantic.json └── README.md ├── optional_parameters.md └── readme_commandline.md /.abapgit.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | E 6 | /src/ 7 | PREFIX 8 | 9 | /.gitignore 10 | /LICENSE 11 | /README.md 12 | /package.json 13 | /.travis.yml 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /LICENSES/Apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2020 SAP SE or an SAP affiliate company. 2 | 3 | APIs 4 | This project may include APIs to SAP or third-party products or services. 5 | The use of these APIs, products and services may be subject to additional 6 | agreements. In no event shall the application of the Apache Software 7 | License, v.2 to this project grant any rights in or to these APIs, 8 | products or services that would alter, expand, be inconsistent with, 9 | or supersede any terms of these additional agreements. “API” means 10 | application programming interfaces, as well as their respective 11 | specifications and implementing code that allows other software 12 | products to communicate with or call on SAP or third party products 13 | or services (for example, SAP Enterprise Services, BAPIs, Idocs, RFCs 14 | and ABAP calls or other user exits) and may be made available through 15 | SAP or third party products, SDKs, documentation or other media. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/cloud-abap-rap)](https://api.reuse.software/info/github.com/SAP-samples/cloud-abap-rap) 2 | 3 | # Description 4 | 5 | The basic idea behind the *RAP Generator* is to ease the life of the developer since it helps you to create most of the boiler plate coding that is needed to implement a RAP business object using the *ABAP RESTful Application Programming Model (RAP)* so that you as a developer can start more quickly to implement the business logic. 6 | As of SAP S/4HANA 2022 and in the ABAP environements of SAP S/4HANA Cloud and SAP BTP ABAP Environment there is also an ADT-based generator available which currently only supports one table but will be optimized in future releases. 7 | 8 | **RAP generates RAP** 9 | Technically the RAP Generator consists out of a RAP business object `ZDMO_R_RAPG_ProjectTP` that is used to generate other RAP business objects. 10 | The RAP Generator works similar like the well known **Key user tools** in SAP S/4HANA and uses a Fiori Elements UI. The Fiori Elements UI can be started from within ADT by opening the service binding `ZDMO_UI_RAPG_PROJECT_O2`. There you have to double-click on the entitiy *Project* which starts the Fiori Elements UI without the need to install any additional tool. 11 | 12 | The SAP Fiori elements preview based UI provides value helps for the data that has to be entered and it provides validations and determinations that provide the heavy lifting of specifying which table field is used for which purpose (for example, a field called *local_last_changed_at* or a field based on the data element *abp_locinst_lastchange_tstmpl* will be proposed by the RAP Generator to be used as the etag of an entity). 13 | 14 | Once the repository objects are generated, the UI offers an ADT link that lets you conveniently navigate back into ADT to continue to work on your objects. 15 | 16 | ## What's New 17 | - The RAP Generator allows to generate a basic I-view layer beneath the R-view layer as being used in SAP S/4HANA 18 | - The generation and deletion process now leverages the background processing framework (BGPF) 19 | - You can now generate extensible RAP business objects 20 | - The generator generates the required additional repository objects (include structure, extension include view, ...) 21 | - The generator performs the required C0- and C1-release state 22 | - The generator creates _SAP object types_ and _SAP object node types_ 23 | 24 | # Requirements 25 | 26 | This sample code does currently work in: 27 | 28 | - SAP BTP, ABAP environment 29 | - SAP S/4HANA, ABAP environment 30 | - SAP S/4HANA 2023 31 | - SAP S/4HANA 2022 32 | - SAP S/4HANA 2021 33 | 34 | # How to Guides 35 | 36 | - [How to create a managed RAP BO based on tables with UUID based key fields](how_to_managed_uuid.md). 37 | 38 | # Download and Installation 39 | 40 | ## How to Install the RAP Generator 41 | 42 | ### SAP BTP ABAP Environment and SAP S/4HANA Cloud ABAP Environment 43 | 44 | 1. Create a package **'ZDMO_RAP_GENERATOR'**. 45 | 2. Link this package with the URL of the RAP Generator repository `https://github.com/SAP-samples/cloud-abap-rap`. 46 | 3. Use the branch `abap-environment`. 47 | 4. Pull changes. 48 | 5. Use mass activation to activate the objects that have been imported in step 3. 49 | 6. Publish the service binding `ZDMO_UI_RAPG_PROJECT_O2`. 50 | 51 | ### SAP S/4HANA 2021, 2022 or 2023 52 | 53 | 1. Create a package **'TEST_RAP_GENERATOR'**. 54 | 2. Start the report `ZABAPGIT_STANDALONE`. You might have to download the [source code](https://raw.githubusercontent.com/abapGit/build/main/zabapgit_standalone.prog.abap) of this open source tool. 55 | 3. Create an an online repository with the package and with the URL of the RAP Generator repo 56 | `https://github.com/SAP-samples/cloud-abap-rap` or create an offline repository and download the source code as a ZIP file from `https://github.com/SAP-samples/cloud-abap-rap`. Make sure that you use the appropriate branch `on-prem-2022`, `on-prem-2021` or `on-prem-2023`. 57 | 4. Pull changes. 58 | 5. Use mass activation to activate the objects that have been imported in step 3. 59 | 6. Publish Service binding `ZDMO_UI_RAPG_PROJECT_O2` 60 | 61 | # Known Issues 62 | 63 | The sample code is provided "as-is". 64 | 65 | Known issues are listed here: [Issues](../../issues) 66 | 67 | ## SAP BTP ABAP Environment, SAP S/4HANA ABAP environment and on premise releases 68 | 69 | ... 70 | 71 | ## on_premise_2021 72 | 73 | - When using the RAP Generator in on-premise systems, you have to make sure that the latest SAPUI5 libraries are installed. If you don’t have the latest version of the SAPUI5 libraries installed you will get no dialogue when choosing the **New Project** button in the RAP Generator. 74 | If the latest SAPUI5 libraries cannot be installed, you can use an implicit enhancement in method `get_sapui5core_resources_url( )` of class `CL_ADT_ODATAV4_FEAP` as described in the following [blog post](https://blogs.sap.com/2022/04/16/how-to-use-the-latest-sapui5-library-for-the-fiori-elements-preview-in-adt/). 75 | 76 | # How to Obtain Support 77 | 78 | If you have problems or questions, you can post them in the [SAP Community](https://answers.sap.com/questions/ask.html) using either the primary tag or "[ABAP RESTful Application Programming Model](https://answers.sap.com/tags/7e44126e-7b27-471d-a379-df205a12b1ff)". 79 | 80 | # Contributing 81 | 82 | You can add proposals for enhancements as issues. 83 | 84 | # License 85 | Copyright (c) 2023 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](LICENSE) file. 86 | -------------------------------------------------------------------------------- /README_old.md: -------------------------------------------------------------------------------- 1 | [![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/cloud-abap-rap)](https://api.reuse.software/info/github.com/SAP-samples/cloud-abap-rap) 2 | 3 | # Description 4 | 5 | This repository contains sample code of the *RAP Generator* that helps you to create boiler plate coding for the ABAP RESTful Application Programming Model (RAP) in 6 | - SAP BTP, ABAP environment 7 | - SAP S/4HANA ABAP Environment 8 | - SAP S/4HANA 2022 9 | - SAP S/4HANA 2021 10 | 11 | Technically it consists out of a RAP business object `ZDMO_R_RapGeneratorBO` that is used to generate other RAP business objects. For this the SAP Fiori Elements preview in ADT is used that is accessible via the service binding `ZDMO_UI_RAP_GENERATOR_O2`. 12 | 13 | ![RAP Generator Overview](images/500_RAP_Generator_Overview.png) 14 | 15 | So in order to leverage this tool you just have to create a package `ZDMO_RAP_GENERATOR` in the software component `ZLOCAL` and link and pull the branch **btp-abap**. 16 | 17 | In an on premise system you will have to create a package `TEST_RAP_GENERATOR` instead and import the content of one of the on-premise branches, either **on-prem-2021*** or **on-prem-2022**. 18 | 19 | From a usability point of view the RAP Generator works similar like a key user tool since it works with a SAP Fiori UI rather than using an Eclipse based UI. 20 | 21 | ![RAP Generator UI](images/510_RAP_Generator_UI.png) 22 | 23 | ## What's new 24 | 25 | - The objects that have been generated by the RAP Generator can now be safely deleted. This allows you to regenerate the repository objects in case you redo the generation in case there was a typo in the parameters that you provided 26 | - The generation process is visualized in a table that displays the progress of the generation or deletion alongside with detailed responses of the generation project 27 | - You can copy a RAP Generator project 28 | 29 | 30 | ## Motivation 31 | 32 | The basic idea behind the *RAP Generator* is to ease the life of the developer such that the generator helps to create the complete stack of objects that are needed to implement a RAP business object. The goal is to generate most of the boiler plate coding so that the developer can start more quickly to implement the business logic. 33 | 34 | Though there is an ADT based generator available for SAP BTP ABAP Environment and on premise as of SAP S/4HANA 2022 this generator offers some additional features and especially supports multiple nodes whereas the ADT based generator only supports 1 table. 35 | 36 | As an input the RAP Generator `zdmo_cl_rap_generator` uses a JSON file which also reflects the tree structure of a RAP business object. This way all necessary input data is entered upfront and can be reused to create similar RAP business objects, for example for testing or training purposes. 37 | 38 | Since it turned out that maintaining the JSON file is quite complex I thought how to add UI to the RAP Generator. Since building Eclipse plugins is a quite complex task I decided to build a RAP business object so that it is possible to use the FIori Elements preview to use the UI without having to deploy any additional components. 39 | 40 | The Fiori Elements preview based UI provides value helps for the data that has to be entered and it provides validations and determinations that provides the heavy lifting of specifing which table field is used for which purpose (e.g. a field called *local_last_changed_at* or a field based on the data element *abp_locinst_lastchange_tstmpl* will be used as the etag of an entity). 41 | 42 | So the RAP Generator works now similar like the well known **Key user tools**. Once the repository objects are generated the UI offers an ADT link that lets you conveniently navigate back into ADT to continue to work on your objects. 43 | 44 | As a new feature the generator now also allows you to delete the objects that have been generated. This comes handy if you have generated your objects within a package that already contained several other objects which would make it cumbersome to delete only those objects that had been generated by this tool. 45 | 46 | When using the *RAP Generator* in an on premise release (2022 or 2021) the generated objects will inherit the language version of the package that you have chosen for your RAP Generator project. 47 | 48 | ## How to use the RAP Generator 49 | 50 | Working with the RAP Genertor now works (in short) as follows: 51 | 52 | 1. Open the service binding `ZDMO_UI_RAPGENERATOR_O2` and double-click on the entity **RAPGeneratorProjects** to start the Fiori Elements preview 53 | 2. Press the button **New Project** 54 | 3. Select a **name** for the root entity and a **package** where the repository objects will be generated 55 | 4. Select the header data for your project such as whether we are dealing with a managed scenario with uuid based key fields **managed_uuid** and what kind of data source is used (**tables**, **cds views** or **abstract entities**). 56 | 5. Start to build the composition tree of your RAP BO 57 | - Enter a data source for your root entity 58 | - Specifiy which fields of your data source are used as the semantic key or as the total etag 59 | 6. To add child nodes select the parent node and press the button **Add Child** and do what has been described in step 5 for the newly added child entity. 60 | 61 | ### Start Fiori Elements Preview 62 | 63 | ![Fiori Elements Preview](images/100_Start_Fiori_Elements_Preview.png) 64 | 65 | - Press Ctrl+Shift+A to start the Open ABAP Development Object dialogue 66 | - Open the service binding `ZDMO_UI_RAPGENERATOR_O2 67 | 1. Select the entity **RAPGeneratorProjects** 68 | 2. Press the **Preview** button 69 | 70 | ### Create a new RAP Generator project 71 | 72 | ![Create new project I](images/110_New_rap_generator_project.png) 73 | ![Create new project II](images/120_Set_root_entity_name_and_package.png) 74 | 75 | - Press the **Create Project** button 76 | - Enter the following 77 | 1. The **name** of your root entity 78 | 2. Select the **package** where your RAP business object will be generated. Please note that type ahead support is present. 79 | 80 | ### Maintain header data for your RAP Generator project 81 | 82 | ![Maintain RAP Generator project header data](images/130_Enter_project_header_data.png) 83 | 84 | On the object page we see that the generator has selected **ZR_Travel04TP** a proposal for a unique name of our new RAP business object which follows the naming conventions of SAP S/4HANA. It basically uses the name of the root entity **Travel**, takes the namespace **Z**, uses the prefix **R_** for so called reuse views, uses the suffix **TP** for transactional processing and adds **04** to the root bo name since I already created several objects with the root entity name Travel. 85 | 86 | As a default the generator suggest to create a RAP business object that uses tables as data source that have **UUID based key fields** and that uses a **managed implementation**. For this in the drop down box **Implementation Type** the value **managed_uuid** is pre selected. 87 | In addition **table** is pre-selected as the **Datasource Type** and **odata_v4_ui** as the **Binding Type** and the check box **Draft enabled** is marked. 88 | 89 | **Datasources** 90 | 91 | As datasources the RAP generator supports **table**, **cds_view** and **abstract_entity**. 92 | 93 | ![Datasource types](images/150_data_source_types.png) 94 | 95 | As Implementation type the following values can be set **managed_uuid**, **managed_semantic** or **unmanaged_semantic**. 96 | 97 | ![Implementation types](images/140_implementation_types.png) 98 | 99 | For the binding type you can select one of the following values **odata_v4_ui**, **odata_v2_ui**, **odata_v4_web_api** or **odata_v2_web_api**. 100 | 101 | ![Implementation types](images/160_binding_types.png) 102 | 103 | For **green field scenarios** a developer usually will choose the implementation type managed_uuid. That means tables will be used as a data source that have uuid based keys, so that a managed scenario can be used where no code needs to be implemented for the CRUD operations and earyl numbering can be used. The only thing that is left for the developer is to implement determinations, validations and actions. 104 | 105 | For **brownfield scenarios** where existing business logic does exist to create, update and delete business data the implementation type **unmanaged_semantic** can be used. This generates an unmanaged scenario that uses tables with semantic keys. 106 | 107 | As a second data source the RAP generator supports **CDS views**. This way it is possible to create RAP business objects based on existing CDS views. 108 | 109 | As a third data source there is now support for **abstract entities**. Through the support of abstract entities you can generate a RAP BO based on the abstract entities that are generated when a service consumption model is created. Here the implementation type **unmanaged_semantic** has to be used. 110 | 111 | ### Maintain details for the root entity 112 | 113 | ![Implementation types](images/170_select_data_source.png) 114 | 115 | You first have to select the data source that shall be used by the root entity. 116 | 117 | ![Implementation types](images/180_Press_return.png) 118 | 119 | After you have selected the data source press **Return** to initiate a side effect. This works for the SAP Fiori Elements OData V2 preview on premise releases. This is why I chose to use the V2 preview. 120 | 121 | ( In cloud based systems the support for side-effects will be added once these can be added by appropriate implementations in the behavivor definition). 122 | 123 | If the side effect does not work simply press the refresh button in your browser after having entered or changed an entry in the field *data source*. 124 | 125 | As a result the generator will try to determine the names of the fields that perform certain roles such as the UUID based key field, the field used as the total etag, etc. 126 | 127 | ![Implementation types](images/190_select_object_id.png) 128 | 129 | What can not be determined automatically is which field shall be used as the **semantic key**. Therefore you have to select the same via a value help. 130 | 131 | Press **Apply** to return to the header object page. 132 | 133 | ### (optional) add one or more child or grand child entities) 134 | 135 | ![Implementation types](images/200_create_child.png) 136 | 137 | On the object page of our RAP business object we select the root entity Travel from the list of entities and used the action **Add Child**. 138 | 139 | ![Implementation types](images/210_set_child_entity_name.png) 140 | 141 | In the popup you have to enter the **entity name of the child entity** (here Booking). 142 | 143 | ![Implementation types](images/220_navigate_to_child_object_page.png) 144 | 145 | You will see a new entry in the list of entities. Select the newly created entity **Booking** to navigate to the object page for the RAP BO nodes. 146 | 147 | ![Implementation types](images/230_result_for_child.png) 148 | 149 | After having selected the table **/DMO/A_BOOKING_D** as a data source and after having pressed **return** to start the determination of most fields and after having specified **BOOKING_ID** as the semantic key. Press **Apply** to return to the (header) rap bo object page. 150 | 151 | ![Implementation types](200_press_create.png) 152 | 153 | You can now press the **Create** button. 154 | 155 | ![Implementation types](images/240_generate_objects.png) 156 | 157 | After having pressed the **Create** button the project is created and the json file that is used as an input for the RAP Generator has been created. And you will notice that a button **Generate repository objects** on the top of your page is now visible. 158 | 159 | ![Implementation types](images/250_job_is_scheduled.png) 160 | 161 | After having pressed the button to start the generation of repository objects you will see that the generation status changes to **Scheduled**. (Since RAP does not support to perform commit work statements in the interaction phase nor in the save sequence the RAP Generator is started technically in the background by running an application job). 162 | 163 | ![Implementation types](images/260_job_in_progress.png) 164 | 165 | For the same reason (no commits allowed) it might take a while (up to several seconds) before the status changes to **in progress**. 166 | 167 | ![Implementation types](images/270_job_finished.png) 168 | 169 | Finally you should see that the job has finished successfully. If this is the case you will also see an ADT link. 170 | 171 | ![Implementation types](images/290_generated_objects.png) 172 | 173 | When clicking on the same you will navigate back to ADT thereby opening the root CDS view that has just been generated. 174 | 175 | ## How to install the RAP Generator 176 | 177 | ### SAP BTP ABAP Environment and SAP S/4HANA Cloud ABAP Environment 178 | 179 | 1. Create a package **'ZDMO_RAP_GENERATOR'** 180 | 2. Link this package with the URL of the RAP Generator repo `https://github.com/SAP-samples/cloud-abap-rap` 181 | 3. Pull changes 182 | 4. Use mass activation to activate the objects that have been imported in step 3 183 | 5. Run the class `zdmo_cl_rap_generator_setup`. This class generates the following objects 184 | - Application job template `ZDMO_RAP_GEN_JOB_TEMPLATE` 185 | - Application log object `ZDMO_RAP_GEN_APPLLOG` 186 | - Service binding `ZDMO_UI_RAP_GENERATOR_O2` 187 | 6. Publish the service binding `ZDMO_UI_RAP_GENERATOR_O2` 188 | 189 | ### SAP S/4HANA 2021 or 2022 190 | 191 | 1. Create a package **'TEST_DMO_RAP_GENERATOR'**. 192 | 2. Start the report `ZABAPGIT_STANDALONE` ( you might have to download the source code of this open source tool first [here](https://raw.githubusercontent.com/abapGit/build/main/zabapgit_standalone.prog.abap) ). 193 | 3. Create an offline repository or an online repository with the package and with the URL of the RAP Generator repo 194 | `https://github.com/SAP-samples/cloud-abap-rap` 195 | 5. Pull changes 196 | 6. Use mass activation to activate the objects that have been imported in step 3 197 | 7. Run the class `zdmo_cl_rap_generator_setup`. This class generates the following objects 198 | - Application job catalog entry - ZDMO_RAP_GEN_CATATALOG_ENTRY 199 | - Application job template - ZDMO_RAP_GEN_JOB_TEMPLATE 200 | - Application log object - ZDMO_RAP_GEN_APPLLOG 201 | 8. Create an OData V2 UI service binding **ZDMO_UI_RAP_GENERATOR_O2** 202 | - Right click on the service definition **ZDMO_RAP_GENERATOR** 203 | - Choose **Create service binding** 204 | - Enter the name **ZDMO_UI_RAP_GENERATOR_O2** and choose the binding type OData V2 - UI (NOT V4) 205 | - Activate the service binding 206 | - Publish the service binding locally 207 | 208 | ![Service binding](images/295_create_service_binding.png) 209 | 210 | # Requirements 211 | 212 | This sample code does currently only work in 213 | - SAP BTP, ABAP environment 214 | - SAP S/4HANA 2022 215 | - SAP S/4HANA 2021 216 | 217 | ( I have removed the support for SAP S/4HANA 2020 for the time being since downporting it to this release is a cumbersome and especially errorprone task ) 218 | 219 | Make sure you have set the following option "Wrap and escape text when pasting into string literal" for your ABAP source code editor in your ADT preferences as described in my blog [How to wrap long strings automatically in ADT](https://blogs.sap.com/2020/07/29/how-to-wrap-long-strings-automatically-in-adt/) 220 | 221 | # Download and Installation 222 | 223 | ## SAP BTP, ABAP Environment or SAP S/4HANA Cloud, ABAP Environment 224 | 225 | When you want to install this sample code in your own ABAP Environment systems you can simply download it using the abapGIT plugin in ABAP Development Tools in Eclipse when working with *SAP BTP, ABAP environment* or *SAP S/4HANA Cloud, ABAP Environment* 226 | 227 | Use the following link to the GitHub repsitory https://github.com/SAP-samples/cloud-abap-rap. 228 | 229 | For this you have to create a package in the Z-namespace ( for example *ZDMO_RAP_GENERATOR* ) in the software component **ZLOCAL** and link it as an abapGit repository. 230 | 231 | Please make sure that you use the branch **btp-abap**. 232 | 233 | ## SAP S/4HANA 2022 or SAP S/4HANA 2021 FSP1 234 | 235 | It is also possible to install the RAP Generator in an on-premise system as of **SAP S/4HANA 2020 FSP1**. 236 | 237 | And for **on premise** systems you have to use the appropriate branch **on-premise-2021** or **on-premise-2022** 238 | 239 | # Known Issues 240 | 241 | The sample code is provided "as-is". 242 | 243 | - In SAP BTP ABAP Environment system there is currently no support for side-effects in the SAP Fiori Elements preview. You therefore have to refresh the object page yourself in the browser in order to leverage the determinations that determine the mapping between the field names and their role in the RAP business object (e.g. etag). 244 | 245 | - It is currently not possible to set the names of the repository objects used by the virtual root node that is implicitly generated by the generator when using customizing tables with multi inline edit capabilities. 246 | 247 | - When using the RAP Generator in on premise systems you have to make sure that the latest SAPUI5 libraries are installed. If you don’t have the latest version of the SAPUI5 libraries installed you will get no dialogue when pressing the **New Project** button in the RAP Generator. If the latest SAPUI5 libraries cannot be installed you can use an implicit enhancment in method `get_sapui5core_resources_url( )` of class `CL_ADT_ODATAV2_FEAP` as described in the following blog post: 248 | 249 | https://blogs.sap.com/2022/04/16/how-to-use-the-latest-sapui5-library-for-the-fiori-elements-preview-in-adt/ 250 | 251 | ## on_premise_2021 252 | 253 | - the behavior implementation class has to be generated / regenerated manually in ADT. 254 | 255 | # How to obtain support 256 | 257 | If you have problems or questions you can [post them in the SAP Community](https://answers.sap.com/questions/ask.html) using either the primary tag "[SAP BTP, ABAP environment](https://answers.sap.com/tags/73555000100800001164)" or "[ABAP RESTful Application Programming Model](https://answers.sap.com/tags/7e44126e-7b27-471d-a379-df205a12b1ff)". 258 | 259 | # Contributing 260 | You can add proposals for enhancements as issues. 261 | 262 | # License 263 | 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](LICENSE) file. 264 | -------------------------------------------------------------------------------- /REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | SPDX-PackageName = "RAP Generator" 3 | SPDX-PackageSupplier = "Andre Fischer " 4 | SPDX-PackageDownloadLocation = "https://github.com/SAP-samples/cloud-abap-rap" 5 | SPDX-PackageComment = "The code in this project may include calls to APIs (“API Calls”) of\n SAP or third-party products or services developed outside of this project\n (“External Products”).\n “APIs” means application programming interfaces, as well as their respective\n specifications and implementing code that allows software to communicate with\n other software.\n API Calls to External Products are not licensed under the open source license\n that governs this project. The use of such API Calls and related External\n Products are subject to applicable additional agreements with the relevant\n provider of the External Products. In no event shall the open source license\n that governs this project grant any rights in or to any External Products,or\n alter, expand or supersede any terms of the applicable additional agreements.\n If you have a valid license agreement with SAP for the use of a particular SAP\n External Product, then you may make use of any API Calls included in this\n project’s code for that SAP External Product, subject to the terms of such\n license agreement. If you do not have a valid license agreement for the use of\n a particular SAP External Product, then you may only make use of any API Calls\n in this project for that SAP External Product for your internal, non-productive\n and non-commercial test and evaluation of such API Calls. Nothing herein grants\n you any rights to use or access any SAP External Product, or provide any third\n parties the right to use of access any SAP External Product, through API Calls." 6 | 7 | [[annotations]] 8 | path = "**" 9 | precedence = "aggregate" 10 | SPDX-FileCopyrightText = "2020 SAP SE or an SAP affiliate company" 11 | SPDX-License-Identifier = "Apache-2.0" 12 | 13 | [[annotations]] 14 | path = "src/**" 15 | precedence = "aggregate" 16 | SPDX-FileCopyrightText = "2020 SAP SE or an SAP affiliate company" 17 | SPDX-License-Identifier = "Apache-2.0" 18 | 19 | [[annotations]] 20 | path = "json_templates/**" 21 | precedence = "aggregate" 22 | SPDX-FileCopyrightText = "2020 SAP SE or an SAP affiliate company" 23 | SPDX-License-Identifier = "Apache-2.0" 24 | -------------------------------------------------------------------------------- /how_to_managed_uuid.md: -------------------------------------------------------------------------------- 1 | 2 | # How to generate a RAP BO using table with UUID based key fields 3 | 4 | For green field scenarios tables with UUID based key fields are very convenient since the RAP framework can easily generate unique values for the key fields so that there is no need to implement a numbering as you would need it when using a semantic key layout. 5 | 6 | In the following the use of the RAP generator is shown. 7 | 8 | - In ADT open the repository object `ZDMO_UI_RAPG_PROJECT_O4` which is located in the package `ZDMO_RAP_GENERATOR` (or in `TEST_RAP_GENERATOR`) 9 | 10 | - You can now start the Fiori Elements preview of the RAP Generator business object 11 | 12 | 1. Select the entity **Project** 13 | 2. Click on **Preview** 14 | 15 | ![Start FE preview](/images_how_to_uuid/100_start_FE_preview.png) 16 | 17 | - Press **New Project** 18 | 19 | ![new project](/images_how_to_uuid/110_new_project.png) 20 | 21 | - In the **New Project** dialogue you have to specify parameters for the RAP business object 22 | 23 | | Parameter | Possible entries | Explanation | 24 | |--------------|-----------|------------| 25 | | Datasource Type | table, cds_view, abstract_entity | | 26 | | Implementation Type | managed, unmanaged | | 27 | | Binding Type | odata_v4_ui, odata_v4_api, odata_v2_ui or odata_v2_api | | 28 | | Draft enabled | Yes, No | | 29 | | (1) Root Entity Name | <EntityName> | Here you should enter a meaningful name for your root entity | 30 | | (2) Data Source Name | <Table Name> | Here you can search (with type ahead support) for an object of the type that you have selected beforehand. | 31 | | (3) Package | <Package Name> | Here you can search (with type ahead support) for a package where the repository objects will be generated | 32 | 33 | ![enter project details](/images_how_to_uuid/120_the_new_project_dialog.png) 34 | 35 | - Enter the name of the root entity 36 | 37 | ![Choose root entity name](/images_how_to_uuid/130_root_entity_name.png) 38 | 39 | - Search for the data source ( start to search with the string *UUID* ) 40 | 41 | ![select datasource](/images_how_to_uuid/140_select_table_for_root_entity.png) 42 | 43 | - Search for the package (here: enter *demo_of* ) 44 | 45 | ![select package](/images_how_to_uuid/150_select_package.png) 46 | 47 | - Press **New Project** 48 | 49 | - Based on the information that you have entered a new Project will be created that contains the information for the root entity as a starting point. 50 | 51 | The object page will be opened and you now have to maintain information that the generator needs to know in order to generate the RAP business object. 52 | 53 | Therefore you have to click on the entry of the root entity (here: **SalesOrder**) in the tab **Entities** 54 | 55 | ![root entity meta data](/images_how_to_uuid/200_select_root_entity_definition.png) 56 | 57 | - On this page you have to map the fields of your data source to their function in your RAP business object. That means you have to specify which field of your data source is used as an etag or which field is used to store the information who has created or who has changed the business object. 58 | The generator will try to suggest appropriate mappings based on information such as the underlying data elements and / or field names. 59 | Since the table that we are using in this example uses appropriate data elements for the administrative fields the generator was able to map all fields beside the semantic key automatically. 60 | When using tables with UUID based keys you have at least to specify one field that contains the semantic key. Since this cannot be retrieved automatically we have to navigate to the tab **Map fields for meta data extension**. 61 | 62 | ![map field for semantic key](/images_how_to_uuid/300_map_field_for_object_id.png) 63 | 64 | 65 | - Here you can select the field that is used as the semantic key via a drop down box (in this case the field SALESORDER_ID). 66 | 67 | 68 | ![select field for object id](/images_how_to_uuid/310_select_object_id_field.png) 69 | 70 | - You can now check the mapping of the field names and you can change this mapping if needed. Please note that the generator has also suggested names for the repository objects that will be generated. The proposals for these names are based on the VDM naming conventions that can be found in the SAP Online Help, e.g. "Z" & "R_" & "EntityName" & "TP" for the base restricted view and the behavior definition. 71 | 72 | ![other automatically mapped fields](/images_how_to_uuid/320_show_other_mapped_fields.png) 73 | 74 | - As a new feature the RAP Generator now allows you to maintain the values of the aliases for the field names of your entity. The generator will propose aliases by creating CamelCase values from the underlying ABAP field names by removing the underscores that are usually used for table field names. That means it will suggest SalesOrderID when the ABAP field name is called SALES_ORDER_ID. 75 | 76 | When you are finished with your changes you have to press the **Apply** button to save your changes. 77 | 78 | ![proposed repository object names and field names](/images_how_to_uuid/330_show_proposed_repo_obj_names_and_field_names.png) 79 | 80 | - Now we can add a child entity to our RAP generator project. To do so select the root entity **SalesOrder** and then press the button **Add Child based on tables**. 81 | 82 | ![add child entity](/images_how_to_uuid/400_add_child_entity.png) 83 | 84 | - In the dialogue that opens you have to specify the name of the child entity and you have to select the datasource that is used by the child entity. By selecting the datasource the generator can run determinations for the field mappings before the object page opens. 85 | 86 | ![add child entity 2](/images_how_to_uuid/500_add_child_entity.png) 87 | 88 | - Since we are using tables with UUID based key fields as the data source we again have to provide a mapping which field of the table is used to store the semantic key field of our child entity. 89 | In addition we have to specify a field in the child table that stores the value of the UUID based key field of the parent entity, the Parent UUID. Since the table that we are using just have one UUID based key field and one UUID based field that is not a key field the generator will suggest to use this field to store the parent UUID. 90 | 91 | ![maintain fields for child entity](/images_how_to_uuid/530_maintain_fields_for_child.png) 92 | 93 | - Since we have added a child entity the fields for root entity specific repository objects such as the service definition are read only and only names for the child entity specific repository objects will be suggested. 94 | If objects that have this name already exist in your system the generator will add a suffix (here "01") to the entity name. 95 | To avoid duplicates it is also possible to add a suffix or prefix to all repository object names on the header level of the rap generator project. 96 | 97 | ![other item specific fields](/images_how_to_uuid/540_rest_of_item_specifc_settings.png) 98 | 99 | - You now can save your probject. This will perform a final validation of your project. If this has passed successfully you can start the generation of the repository objects. 100 | 101 | ![save business object](/images_how_to_uuid/600_create_save_bo.png) 102 | 103 | - After having saved the project and after the final validations have passed you can now press the button "Generate repository objects". By pressing this button an application job will be scheduled that runs the RAP Generator class in a separate session. This workaround is necessary since the generation of repository objects will perform several commit work statements which are forbidden within the RAP interaction and save phase. 104 | 105 | ![generate_repo_objects](/images_how_to_uuid/550_generate_repo_objects.png) 106 | 107 | 108 | 109 | - The status of the application job will be shown in the object page as well as on the list page. 110 | 111 | ![Press Generate button](/images_how_to_uuid/600_generate_objects.png) 112 | 113 | 114 | ![in process](/images_how_to_uuid/610_in_process.png) 115 | 116 | - When the application job has finished successfully the status will change and a ADT URL will be displayed that lets you navigate back to ADT by opening the root entity view that has been generated. 117 | 118 | ![finished](/images_how_to_uuid/620_finished.png) 119 | 120 | - If something went wrong you can check this in the log information 121 | 122 | ![check log](/images_how_to_uuid/650_check_log.png) 123 | 124 | 125 | ![navigate back](/images_how_to_uuid/700_navigate_back_1.png) 126 | 127 | - The generated root entity view should look as follows: 128 | 129 | ![result](/images_how_to_uuid/800%20Result.png) 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /images/100_Start_Fiori_Elements_Preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/100_Start_Fiori_Elements_Preview.png -------------------------------------------------------------------------------- /images/110_New_rap_generator_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/110_New_rap_generator_project.png -------------------------------------------------------------------------------- /images/120_Set_root_entity_name_and_package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/120_Set_root_entity_name_and_package.png -------------------------------------------------------------------------------- /images/130_Enter_project_header_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/130_Enter_project_header_data.png -------------------------------------------------------------------------------- /images/140_implementation_types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/140_implementation_types.png -------------------------------------------------------------------------------- /images/150_data_source_types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/150_data_source_types.png -------------------------------------------------------------------------------- /images/160_binding_types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/160_binding_types.png -------------------------------------------------------------------------------- /images/170_select_data_source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/170_select_data_source.png -------------------------------------------------------------------------------- /images/180_Press_return.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/180_Press_return.png -------------------------------------------------------------------------------- /images/190_select_object_id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/190_select_object_id.png -------------------------------------------------------------------------------- /images/200_create_child.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/200_create_child.png -------------------------------------------------------------------------------- /images/200_press_create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/200_press_create.png -------------------------------------------------------------------------------- /images/210_set_child_entity_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/210_set_child_entity_name.png -------------------------------------------------------------------------------- /images/220_navigate_to_child_object_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/220_navigate_to_child_object_page.png -------------------------------------------------------------------------------- /images/230_result_for_child.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/230_result_for_child.png -------------------------------------------------------------------------------- /images/240_generate_objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/240_generate_objects.png -------------------------------------------------------------------------------- /images/250_job_is_scheduled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/250_job_is_scheduled.png -------------------------------------------------------------------------------- /images/260_job_in_progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/260_job_in_progress.png -------------------------------------------------------------------------------- /images/270_job_finished.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/270_job_finished.png -------------------------------------------------------------------------------- /images/280_confirm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/280_confirm.png -------------------------------------------------------------------------------- /images/290_generated_objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/290_generated_objects.png -------------------------------------------------------------------------------- /images/295_create_service_binding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/295_create_service_binding.png -------------------------------------------------------------------------------- /images/500_RAP_Generator_Overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/500_RAP_Generator_Overview.png -------------------------------------------------------------------------------- /images/510_RAP_Generator_UI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images/510_RAP_Generator_UI.png -------------------------------------------------------------------------------- /images/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /images_how_to_uuid/100_start_FE_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/100_start_FE_preview.png -------------------------------------------------------------------------------- /images_how_to_uuid/110_new_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/110_new_project.png -------------------------------------------------------------------------------- /images_how_to_uuid/120_the_new_project_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/120_the_new_project_dialog.png -------------------------------------------------------------------------------- /images_how_to_uuid/130_root_entity_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/130_root_entity_name.png -------------------------------------------------------------------------------- /images_how_to_uuid/140_select_table_for_root_entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/140_select_table_for_root_entity.png -------------------------------------------------------------------------------- /images_how_to_uuid/150_select_package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/150_select_package.png -------------------------------------------------------------------------------- /images_how_to_uuid/200_select_root_entity_definition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/200_select_root_entity_definition.png -------------------------------------------------------------------------------- /images_how_to_uuid/300_map_field_for_object_id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/300_map_field_for_object_id.png -------------------------------------------------------------------------------- /images_how_to_uuid/310_select_object_id_field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/310_select_object_id_field.png -------------------------------------------------------------------------------- /images_how_to_uuid/320_show_other_mapped_fields.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/320_show_other_mapped_fields.png -------------------------------------------------------------------------------- /images_how_to_uuid/330_show_proposed_repo_obj_names_and_field_names.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/330_show_proposed_repo_obj_names_and_field_names.png -------------------------------------------------------------------------------- /images_how_to_uuid/400_add_child_entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/400_add_child_entity.png -------------------------------------------------------------------------------- /images_how_to_uuid/500_add_child_entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/500_add_child_entity.png -------------------------------------------------------------------------------- /images_how_to_uuid/520 edit child entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/520 edit child entity.png -------------------------------------------------------------------------------- /images_how_to_uuid/530_maintain_fields_for_child.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/530_maintain_fields_for_child.png -------------------------------------------------------------------------------- /images_how_to_uuid/540_rest_of_item_specifc_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/540_rest_of_item_specifc_settings.png -------------------------------------------------------------------------------- /images_how_to_uuid/550_generate_repo_objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/550_generate_repo_objects.png -------------------------------------------------------------------------------- /images_how_to_uuid/600_create_save_bo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/600_create_save_bo.png -------------------------------------------------------------------------------- /images_how_to_uuid/600_generate_objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/600_generate_objects.png -------------------------------------------------------------------------------- /images_how_to_uuid/610_in_process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/610_in_process.png -------------------------------------------------------------------------------- /images_how_to_uuid/620_finished.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/620_finished.png -------------------------------------------------------------------------------- /images_how_to_uuid/650_check_log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/650_check_log.png -------------------------------------------------------------------------------- /images_how_to_uuid/700_navigate_back_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/700_navigate_back_1.png -------------------------------------------------------------------------------- /images_how_to_uuid/800 Result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/a77c63180847b95ab05631d84d24aead98d6b8ae/images_how_to_uuid/800 Result.png -------------------------------------------------------------------------------- /images_how_to_uuid/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /json_schemas/RAPGenerator-schema-all.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "properties": { 4 | "$schema": { 5 | "type": "string" 6 | }, 7 | "implementationtype": { 8 | "$ref": "#/definitions/implementationtype-schema", 9 | "default": "managed_uuid" 10 | }, 11 | "namespace": { 12 | "type": "string", 13 | "minLength": 1, 14 | "default": "Z", 15 | "description": "The namespace will be added to the names of the repository objects of your RAP business object. The name of the CDS interface view and the behavior definition is generated using the following string template:\n|{ namespace }I_{ prefix }{ entityname }{ suffix }|." 16 | }, 17 | "package": { 18 | "type": "string", 19 | "minLength": 1, 20 | "description": "Enter the name of an existing package which fits to the namespace that you have chosen." 21 | }, 22 | "bindingType": { 23 | "$ref": "#/definitions/bindingtype-schema", 24 | "default": "odata_v4_ui" 25 | }, 26 | "dataSourceType": { 27 | "$ref": "#/definitions/datasourceType-schema", 28 | "default": "table" 29 | }, 30 | "draftenabled": { 31 | "type": "boolean", 32 | "default": true, 33 | "description": "When set to true the generator will genrate a draft table as well. If you want to determine the name of the draft table you can do so by setting the property draftTableName in each entity." 34 | }, 35 | "prefix": { 36 | "type": "string", 37 | "description": "The prefix will be added to the names of the repository objects of your RAP business object. The name of the CDS interface view and the behavior definition is generated using the following string template:\n|{ namespace }I_{ prefix }{ entityname }{ suffix }|." 38 | }, 39 | "suffix": { 40 | "type": "string", 41 | "description": "The suffix will be added to the names of the repository objects of your RAP business object. The name of the CDS interface view and the behavior definition is generated using the following string template:\n|{ namespace }I_{ prefix }{ entityname }{ suffix }|." 42 | }, 43 | "transportrequest": { 44 | "type": "string", 45 | "description": "You can specifiy a modifiable transport request to be used. If no transport request is specified the generator will try to reuse an open transport request. If no transport request can be found a new transport request will be generated." 46 | }, 47 | "multiInlineEdit": { 48 | "type": "boolean", 49 | "default": false, 50 | "description": "If set to true the generator will add a technical root entity with just one instance. This singleton instance then allows to leverage the multi inline edit capabilies of the SAP Fiori Elements object page. \nWhen set to true requires the following settings:\n\"bindingType\" : \"odata_v4_ui\"\n\"draftenabled\" : true" 51 | }, 52 | "isCustomizingTable": { 53 | "type": "boolean", 54 | "default": false, 55 | "description": "Business configuration content can be recorded in customizing transport requests.\nWhen set to true requires the following settings:\n\"bindingType\" : \"odata_v4_ui\"\n\"draftenabled\" : true\n\"addBusinessConfigurationRegistration\" : true" 56 | }, 57 | "addBusinessConfigurationRegistration": { 58 | "type": "boolean", 59 | "default": false, 60 | "description": "If set to true your business object will be listed in the Maintain Business Configurations App. Please note that the Maintain Business Configurations API only supports one level of sub nodes, i.e. your root entity can have associations to an arbitrary amount of entities but these sub entities cannot have associations to further sub entities. The data model must consist only of client-dependent tables.\n When set to true requires the following settings:\n\"bindingType\" : \"odata_v4_ui\"\n\"draftenabled\" : true" 61 | }, 62 | "generateOnlyNodeHierachy": { 63 | "type": "boolean", 64 | "default": false, 65 | "description": "Parameter for testing purposes. If set to true the method generate_bo will not be executed." 66 | }, 67 | "hierarchy": { 68 | "$ref": "#/definitions/rootNode-schema" 69 | } 70 | }, 71 | "required": [ 72 | "implementationtype", 73 | "namespace", 74 | "package", 75 | "bindingType", 76 | "dataSourceType", 77 | "draftenabled", 78 | "hierarchy" 79 | ], 80 | "additionalProperties": false, 81 | "definitions": { 82 | "rootNode-schema": { 83 | "properties": { 84 | "entityName": { 85 | "type": "string", 86 | "minLength": 1 87 | }, 88 | "dataSource": { 89 | "type": "string", 90 | "minLength": 1 91 | }, 92 | "objectId": { 93 | "type": "string", 94 | "minLength": 1 95 | }, 96 | "uuid": { 97 | "type": "string", 98 | "default": "uuid", 99 | "minLength": 1 100 | }, 101 | "etagMaster": { 102 | "type": "string", 103 | "default": "local_last_changed_at", 104 | "minLength": 1, 105 | "description": "Since eTags are required for each entity when consuming the RAP BO via OData this schema enforces you to specify the field of the datasource that contains a timestamp, a hash value, or any other versioning that precisely identifies the version of the data set." 106 | }, 107 | "totalEtag": { 108 | "type": "string", 109 | "default": "last_changed_at", 110 | "minLength": 1, 111 | "description": "A total etag field is mandatory the root entity when using draft. It must be different from the field that is defined as an etag." 112 | }, 113 | "createdBy": { 114 | "type": "string", 115 | "default": "created_by", 116 | "minLength": 1 117 | }, 118 | "createdAt": { 119 | "type": "string", 120 | "default": "created_at", 121 | "minLength": 1 122 | }, 123 | "lastChangedBy": { 124 | "type": "string", 125 | "default": "last_changed_by", 126 | "minLength": 1 127 | }, 128 | "lastChangedAt": { 129 | "type": "string", 130 | "default": "last_changed_at", 131 | "minLength": 1 132 | }, 133 | "localInstanceLastChangedAt": { 134 | "type": "string", 135 | "default": "local_last_changed_at", 136 | "minLength": 1 137 | }, 138 | "draftTable": { 139 | "type": "string", 140 | "minLength": 1 141 | }, 142 | "cdsInterfaceView": { 143 | "type": "string", 144 | "minLength": 1 145 | }, 146 | "cdsProjectionView": { 147 | "type": "string", 148 | "minLength": 1 149 | }, 150 | "metadataExtensionView": { 151 | "type": "string", 152 | "minLength": 1 153 | }, 154 | "behaviorImplementationClass": { 155 | "type": "string", 156 | "minLength": 1 157 | }, 158 | "serviceDefinition": { 159 | "type": "string", 160 | "minLength": 1 161 | }, 162 | "serviceBinding": { 163 | "type": "string", 164 | "minLength": 1 165 | }, 166 | "controlStructure": { 167 | "type": "string", 168 | "minLength": 1 169 | }, 170 | "customQueryImplementationClass": { 171 | "type": "string", 172 | "minLength": 1 173 | }, 174 | "keys": { 175 | "type": "array", 176 | "items": { 177 | "type": "string" 178 | } 179 | }, 180 | "children": { 181 | "type": "array", 182 | "items": { 183 | "$ref": "#/definitions/childNode-schema" 184 | } 185 | } 186 | }, 187 | "required": [ 188 | "entityName", 189 | "dataSource", 190 | "objectId", 191 | "etagMaster" 192 | ], 193 | "additionalProperties": false 194 | }, 195 | "childNode-schema": { 196 | "properties": { 197 | "entityName": { 198 | "type": "string", 199 | "minLength": 1 200 | }, 201 | "dataSource": { 202 | "type": "string", 203 | "minLength": 1 204 | }, 205 | "objectId": { 206 | "type": "string", 207 | "minLength": 1 208 | }, 209 | "etagMaster": { 210 | "type": "string", 211 | "default": "local_last_changed_at", 212 | "minLength": 1, 213 | "description": "Since eTags are required for each entity when consuming the RAP BO via OData this schema enforces you to specify the field of the datasource that contains a timestamp, a hash value, or any other versioning that precisely identifies the version of the data set." 214 | }, 215 | "uuid": { 216 | "type": "string", 217 | "default": "uuid", 218 | "minLength": 1 219 | }, 220 | "parentUuid": { 221 | "type": "string", 222 | "default": "parent_uuid", 223 | "minLength": 1 224 | }, 225 | "rootUuid": { 226 | "type": "string", 227 | "default": "root_uuid", 228 | "minLength": 1 229 | }, 230 | "localInstanceLastChangedAt": { 231 | "type": "string", 232 | "default": "local_last_changed_at", 233 | "minLength": 1 234 | }, 235 | "draftTable": { 236 | "type": "string", 237 | "minLength": 1 238 | }, 239 | "cdsInterfaceView": { 240 | "type": "string", 241 | "minLength": 1 242 | }, 243 | "cdsProjectionView": { 244 | "type": "string", 245 | "minLength": 1 246 | }, 247 | "metadataExtensionView": { 248 | "type": "string", 249 | "minLength": 1 250 | }, 251 | "keys": { 252 | "type": "array", 253 | "items": { 254 | "type": "string" 255 | } 256 | }, 257 | "children": { 258 | "type": "array", 259 | "items": { 260 | "$ref": "#/definitions/childNode-schema" 261 | } 262 | } 263 | }, 264 | "required": [ 265 | "entityName", 266 | "dataSource", 267 | "objectId", 268 | "etagMaster" 269 | ], 270 | "additionalProperties": false 271 | }, 272 | "implementationtype-schema": { 273 | "enum": [ 274 | "managed_uuid", 275 | "managed_semantic", 276 | "unmanaged_semantic" 277 | ] 278 | }, 279 | "bindingtype-schema": { 280 | "enum": [ 281 | "odata_v4_ui", 282 | "odata_v2_ui", 283 | "odata_v4_web_api", 284 | "odata_v2_web_api" 285 | ] 286 | }, 287 | "datasourceType-schema": { 288 | "enum": [ 289 | "table", 290 | "cds_view", 291 | "abap_type", 292 | "structure" 293 | ] 294 | } 295 | } 296 | } 297 | -------------------------------------------------------------------------------- /json_templates/RAPGenerator-sample-abstract-entities.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json", 3 | "namespace": "Z", 4 | "bindingType": "odata_v2_ui", 5 | "dataSourceType": "cds_view", 6 | "implementationtype": "unmanaged_semantic", 7 | "package": "ZAF_GWSAMPLE_BASIC", 8 | "draftenabled": false, 9 | "prefix": "AF_", 10 | "suffix": "_01", 11 | "hierarchy": { 12 | "entityName": "SalesOrder", 13 | "dataSource": "ZAF_SALESORDERSET", 14 | "objectId": "SalesOrderID", 15 | "etagMaster": "changedat", 16 | "children": [ 17 | { 18 | "entityName": "SalesOrderItem", 19 | "dataSource": "ZAF_SALESORDERLINEITEMSET", 20 | "objectId": "ItemPosition", 21 | "etagMaster": "changedat" 22 | } 23 | ] 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /json_templates/RAPGenerator-sample-customizing-table.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json", 3 | "namespace": "Z", 4 | "package": "Z_###_YOUR_PACKAGE", 5 | "dataSourceType": "table", 6 | "multiInlineEdit": true, 7 | "isCustomizingTable": true, 8 | "addBusinessConfigurationRegistration": true, 9 | "implementationtype": "managed_semantic", 10 | "bindingType": "odata_v4_ui", 11 | "prefix": "AFME", 12 | "suffix": "_##", 13 | "draftenabled": true, 14 | "hierarchy": { 15 | "entityName": "Holiday", 16 | "dataSource": "/dmo/fcal_holi", 17 | "objectId": "holiday_id", 18 | "localInstanceLastChangedAt": "local_last_changed_at", 19 | "etagMaster": "local_last_changed_at", 20 | "children": [ 21 | { 22 | "entityName": "HolidayText", 23 | "dataSource": "/dmo/fcal_holi_t", 24 | "objectId": "holiday_id", 25 | "localInstanceLastChangedAt": "local_last_changed_at", 26 | "etagMaster": "local_last_changed_at" 27 | } 28 | ] 29 | } 30 | } -------------------------------------------------------------------------------- /json_templates/RAPGenerator-sample-managed-semantic.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json", 3 | "namespace":"Z", 4 | "dataSourceType": "table", 5 | "implementationtype": "managed_semantic", 6 | "bindingType": "odata_v4_ui", 7 | "package": "Z_###_YOUR_PACKAGE", 8 | "draftenabled":false, 9 | "prefix": "", 10 | "suffix": "", 11 | "hierarchy": { 12 | "entityName": "Travel", 13 | "dataSource": "/dmo/travel_m", 14 | "objectId": "travel_id", 15 | "localInstanceLastChangedAt": "last_changed_at", 16 | "etagMaster": "last_changed_at", 17 | "children": [ 18 | { 19 | "entityName": "Booking", 20 | "dataSource": "/dmo/booking_m", 21 | "objectId": "booking_id", 22 | "localInstanceLastChangedAt": "last_changed_at", 23 | "etagMaster": "last_changed_at", 24 | "children": [ 25 | { 26 | "entityName": "Supplements", 27 | "dataSource": "/dmo/booksuppl_m", 28 | "objectId": "booking_supplement_id", 29 | "localInstanceLastChangedAt": "last_changed_at", 30 | "etagMaster": "last_changed_at" 31 | } 32 | ] 33 | } 34 | ] 35 | } 36 | 37 | 38 | } -------------------------------------------------------------------------------- /json_templates/RAPGenerator-sample-managed-uuid.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json", 3 | "namespace": "Z", 4 | "dataSourceType": "table", 5 | "implementationtype": "managed_uuid", 6 | "bindingType": "odata_v4_ui", 7 | "package": "Z_###_YOUR_PACKAGE", 8 | "draftenabled": true, 9 | "prefix": "", 10 | "suffix": "", 11 | "hierarchy": { 12 | "entityName": "Travel", 13 | "dataSource": "/dmo/a_travel_d", 14 | "objectId": "travel_id", 15 | "uuid": "travel_uuid", 16 | "etagMaster": "local_last_changed_at", 17 | "lastChangedAt": "last_changed_at", 18 | "lastChangedBy": "last_changed_by", 19 | "localInstanceLastChangedAt": "local_last_changed_at", 20 | "createdAt": "created_at", 21 | "createdBy": "created_by", 22 | "children": [ 23 | { 24 | "entityName": "Booking", 25 | "dataSource": "/dmo/a_booking_d", 26 | "objectId": "booking_id", 27 | "uuid": "booking_uuid", 28 | "parentUuid": "parent_uuid", 29 | "etagMaster": "local_last_changed_at", 30 | "localInstanceLastChangedAt": "local_last_changed_at", 31 | "children": [ 32 | { 33 | "entityName": "Supplements", 34 | "dataSource": "/dmo/a_bksuppl_d", 35 | "objectId": "booking_supplement_id", 36 | "uuid": "booksuppl_uuid", 37 | "parentUuid": "parent_uuid", 38 | "etagMaster": "local_last_changed_at", 39 | "localInstanceLastChangedAt": "local_last_changed_at" 40 | 41 | } 42 | ] 43 | } 44 | ] 45 | } 46 | } -------------------------------------------------------------------------------- /json_templates/RAPGenerator-sample-unmanaged-abap_structure.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json", 3 | "namespace": "Z", 4 | "dataSourceType": "abap_type", 5 | "implementationtype": "unmanaged_semantic", 6 | "bindingType": "odata_v2_ui", 7 | "package": "Z_###_YOUR_PACKAGE", 8 | "draftenabled": false, 9 | "prefix": "", 10 | "suffix": "", 11 | "hierarchy": { 12 | "entityName": "FactoryCal", 13 | "dataSource": "cl_scal_api=>scals_factory_calendar", 14 | "objectId": "ident", 15 | "keys": [ 16 | "ident", 17 | "spras" 18 | ] 19 | } 20 | } -------------------------------------------------------------------------------- /json_templates/RAPGenerator-sample-unmanaged-ddic-structure.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json", 3 | "namespace": "Z", 4 | "dataSourceType": "structure", 5 | "implementationtype": "unmanaged_semantic", 6 | "bindingType": "odata_v2_ui", 7 | "package": "$TMP", 8 | "draftenabled":false, 9 | "prefix": "AF_", 10 | "suffix": "_01", 11 | "hierarchy": { 12 | "entityName": "Product", 13 | "dataSource": "BAPI_EPM_PRODUCT_HEADER", 14 | "objectId": "PRODUCT_ID", 15 | "etagMaster": "changed_at", 16 | "keys": ["Product_id"] 17 | } 18 | } -------------------------------------------------------------------------------- /json_templates/RAPGenerator-sample-unmanaged-semantic.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./RAPGenerator-schema-all.json", 3 | "namespace": "Z", 4 | "dataSourceType": "table", 5 | "implementationtype": "unmanaged_semantic", 6 | "bindingType": "odata_v2_ui", 7 | "package": "Z_###_YOUR_PACKAGE", 8 | "draftenabled": false, 9 | "prefix": "", 10 | "suffix": "", 11 | "hierarchy": { 12 | "entityName": "Travel", 13 | "dataSource": "/dmo/travel", 14 | "objectId": "travel_id", 15 | "etagMaster": "lastchangedat", 16 | "children": [ 17 | { 18 | "entityName": "Booking", 19 | "dataSource": "/dmo/booking", 20 | "objectId": "booking_id", 21 | "etagMaster": "lastchangedat", 22 | "children": [ 23 | { 24 | "entityName": "Supplements", 25 | "dataSource": "/dmo/book_suppl", 26 | "objectId": "booking_supplement_id" 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | } -------------------------------------------------------------------------------- /json_templates/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /optional_parameters.md: -------------------------------------------------------------------------------- 1 | # Optional parameters for workshops or other advanced scenarios 2 | 3 | The follwoing parameters have been implemented so that it is possible to create RAP business objects including a mapping (if CDS views are used as a data source) and including assocations and value helps. 4 | 5 | This is usefull if identical objects shall be created for trainings. 6 | 7 | The RAP Generator has and is used for SAP events such as the openSAP courses about RAP and SAP Fiori as well as for hands on sessions in SAP user group events or SAP TechEd. 8 | 9 | Here I got the following requirements: 10 | 11 | - Add additional fields to the generated CDS views (e.g. fields based on an association such as '_Travel.Customer' ) 12 | - Change the field names of the generated artefacts (e.g. use the field name 'Customer' instead of 'PartnerID' which would be used if the field of the database table would be 'PARTNER_ID'. 13 | 14 | When using this parameters the json files will become more complicated. As a result the use of these parameters is not recommended if you want to develop a single RAP object. As said they will typically be used in workshops such as TechEd sessions, CodeJams or OpenSAP courses where there is the need to provide participants with complete RAP business objects as a starting point. 15 | 16 | **Please note** 17 | When creating JSON files in general and complicated JSON files in particular it is strongly recommended to use an appropriate JSON editor of your choice. 18 | 19 | I personally can recommend Visual Studio Code. 20 | 21 | #### mapping 22 | Using this parameter you can provide the mapping between the field names of the CDS view and the field names used by the legacy business logic if CDS views are used as a data source. 23 | When using tables as data sources this mapping is generated by the generator. 24 | When CDS views are used as a data source such a mapping has be created manually by the developer if it has not been set. 25 | 26 |
 27 | {
 28 |   "implementationType": "unmanaged_semantic",
 29 |   "namespace": "Z",
 30 |   "suffix": "_####",
 31 |   "prefix": "RAP_",
 32 |   "package": "ZRAP_####",
 33 |   "datasourcetype": "cds_view",
 34 |   "hierarchy": {
 35 |     "entityName": "Travel",
 36 |     "dataSource": "/DMO/I_Travel_U",
 37 |     "objectId": "TravelID",
 38 |     "persistenttable": "/dmo/travel",    
 39 |     "lastchangedat": "lastchangedat", 
 40 |     "mapping": [
 41 |       {
 42 |         "dbtable_field": "TRAVEL_ID",
 43 |         "cds_view_field": "TravelID"
 44 |       },
 45 |       {
 46 |         "dbtable_field": "AGENCY_ID",
 47 |         "cds_view_field": "AgencyID"
 48 |       },
 49 |       {
 50 |         "dbtable_field": "CUSTOMER_ID",
 51 |         "cds_view_field": "CustomerID"
 52 |       },
 53 |       {
 54 |         "dbtable_field": "BEGIN_DATE",
 55 |         "cds_view_field": "BeginDate"
 56 |       },
 57 |       {
 58 |         "dbtable_field": "BOOKING_FEE",
 59 |         "cds_view_field": "BookingFee"
 60 |       },
 61 |       {
 62 |         "dbtable_field": "TOTAL_PRICE",
 63 |         "cds_view_field": "TotalPrice"
 64 |       },
 65 |       {
 66 |         "dbtable_field": "CURRENCY_CODE",
 67 |         "cds_view_field": "CurrencyCode"
 68 |       },
 69 |       {
 70 |         "dbtable_field": "DESCRIPTION",
 71 |         "cds_view_field": "Description"
 72 |       },
 73 |       {
 74 |         "dbtable_field": "STATUS",
 75 |         "cds_view_field": "Status"
 76 |       },
 77 |       {
 78 |         "dbtable_field": "LASTCHANGEDAT",
 79 |         "cds_view_field": "Lastchangedat"
 80 |       }
 81 |     ],   
 82 |     "children": [
 83 |       {
 84 |         "entityName": "Booking",
 85 |         "dataSource": "/DMO/I_Booking_U",
 86 |         "objectId": "BookingID",
 87 |         "persistenttable": "/dmo/booking"      
 88 |       }
 89 |     ]
 90 |   }
 91 | }
 92 | 
93 | 94 | #### “associations” and “valuehelps” 95 | On node level it is also possible to set information to generate valuehelps and associations. 96 | These properties have been introduced mainly for setups in courses where one would like to be able that participants can generate a business object that contain exactly those associations and value help definitions that are required for the course. 97 | Though it might also be useful for other scenarios as well, you see that the complexity of your JSON file will grow and it might be simpler to code this manually in the CDS views that are generated by the RAP generator. 98 | 99 | ##### “associations” 100 | 101 | Associations is an array of objects where each object represents one association. 102 | An association needs the several properties 103 | - "name" is the name of the association and its name must start with an underscore '_'. 104 | - "target" is the name of the CDS view that is the target of your associaton 105 | - "cardinality" here you can enter one of the following values 106 | - "zero_to_one" [0..1] 107 | - "one" [1] 108 | - "zero_to_n" [0..n] 109 | - "one_to_n" [1..n] 110 | - "one_to_one" [1..1] 111 | - "conditions" is again an array of objects with two properties 112 | - "projectionField" this is the field ´"$projection.*AgencyID* = _Agency.AgencyID"´ 113 | - "associationField" this is the field ´"$projection.AgencyID = _Agency.*AgencyID*"´ 114 | 115 | 116 | ``` 117 | "associations": [ 118 | { 119 | "name": "_Agency", 120 | "target": "/DMO/I_Agency", 121 | "cardinality": "zero_to_n", 122 | "conditions": [ 123 | { 124 | "projectionField": "AgencyID", 125 | "associationField": "AgencyID" 126 | } 127 | ] 128 | }, 129 | { 130 | "name": "_Customer", 131 | "target": "/DMO/I_Customer", 132 | "cardinality": "zero_to_n", 133 | "conditions": [ 134 | { 135 | "projectionField": "CustomerID", 136 | "associationField": "CustomerID" 137 | } 138 | ] 139 | } 140 | ] 141 | 142 | ``` 143 | 144 | ##### valueHelps 145 | 146 | Valuehelps is also an array of objects where each object represents a value help. Each object may contain an addiitional array that contains the information for the additional binding. 147 | 148 | - "alias" is the alias of the value help used in the service definition. 149 | - "name" is the name of the CDS view used as a value help 150 | - "localelement" this denotes the field name in your projection view. Since this is already the CDS field name you have to be aware about the naming convertions that are used by the generator when it creates cds fields from the underlying ABAP field names, namely by using the conversion into camelCase notation. 151 | 152 |
153 |       @Consumption.valueHelpDefinition: [{ entity : {name: '/DMO/I_Agency', element: 'AgencyID'  } }]
154 |       AgencyID,
155 | 
156 | 157 | - "element" this is the field name in the CDS view that is used as a value help. 158 | 159 |
160 |       @Consumption.valueHelpDefinition: [{ entity : {name: '/DMO/I_Agency', element: 'AgencyID'  } }]
161 |       AgencyID,
162 | 
163 | 164 | - "additionalBinding" is again an array of objects with two properties 165 | - "localElement" these are the following fields 166 | 167 |
168 |       @Consumption.valueHelpDefinition: [ {entity: {name: '/DMO/I_Flight', element: 'ConnectionID'},
169 |                                                  additionalBinding: [ { localElement: 'FlightDate',   element: 'FlightDate'},
170 |                                                                       { localElement: 'AirlineID',    element: 'AirlineID'},
171 |                                                                       { localElement: 'FlightPrice',  element: 'Price', usage: #RESULT},
172 |                                                                       { localElement: 'CurrencyCode', element: 'CurrencyCode' } ] } ]
173 | 
174 | 175 | - "element" these are the following fields 176 | 177 |
178 |       @Consumption.valueHelpDefinition: [ {entity: {name: '/DMO/I_Flight', element: 'ConnectionID'},
179 |                                                  additionalBinding: [ { localElement: 'FlightDate',   element: 'FlightDate'},
180 |                                                                       { localElement: 'AirlineID',    element: 'AirlineID'},
181 |                                                                       { localElement: 'FlightPrice',  element: 'Price', usage: #RESULT},
182 |                                                                       { localElement: 'CurrencyCode', element: 'CurrencyCode' } ] } ]
183 |                                                                       
184 | 
185 | 186 | - "usage" these are the following (optinonal) fields in a valuehelp 187 | 188 |
189 |       @Consumption.valueHelpDefinition: [ {entity: {name: '/DMO/I_Flight', element: 'ConnectionID'},
190 |                                                  additionalBinding: [ { localElement: 'FlightDate',   element: 'FlightDate'},
191 |                                                                       { localElement: 'AirlineID',    element: 'AirlineID'},
192 |                                                                       { localElement: 'FlightPrice',  element: 'Price', usage: #RESULT},
193 |                                                                       { localElement: 'CurrencyCode', element: 'CurrencyCode' } ] } ]
194 |                                                                       
195 | 
196 | 197 | In order to generate a value help as mentioned above the following entry would have to be added to a node object, here the booking entity. 198 | 199 |
      
200 |     "valueHelps": [
201 |           {
202 |             "alias": "Flight",
203 |             "name": "/DMO/I_Flight",
204 |             "localElement": "ConnectionID",
205 |             "element": "ConnectionID",
206 |             "additionalBinding": [
207 |               {
208 |                 "localElement": "ConnectionID",
209 |                 "element": "ConnectionID"
210 |               },
211 |               {
212 |                 "localElement": "CarrierID",
213 |                 "element": "AirlineID"
214 |               },
215 |               {
216 |                 "localElement": "ConnectionID",
217 |                 "element": "ConnectionID",
218 |                 "usage": "RESULT"
219 |               }
220 |             ]
221 |           },
222 |           {
223 |             "alias": "Currency",
224 |             "name": "I_Currency",
225 |             "localElement": "CurrencyCode",
226 |             "element": "Currency"
227 |           }
228 |         ]
229 |       }
230 |     ]
231 | 
232 | 
233 | 234 | #### objectswithadditionalfields 235 | 236 | When using the RAP Generator in workshops it turned out that CDS views should also contain fields that are not part of the underlying data source such as fields that are retrieved via an association. 237 | 238 |
239 | _Customer.LastName as CustomerName,
240 | 
241 | 242 | If additional fields are added this has to be done at various locations namely 243 | 244 | - cds_interface_view 245 | - cds_projection_view 246 | - draft_table 247 | 248 | One has to specifiy the field name, the alias and optionally the key word *localized*. 249 | 250 | So the JSON file must contain an array **objectswithadditionalfields**. 251 | For each object type an additional array called "additionalfields" has to be filled that contains the additional fields for each object. 252 | 253 | Please note that the field names for additional fields in the draft table must match the field name (or the alias name) of the field in the interface view. 254 | 255 |
256 | 
257 |  "objectswithadditionalfields": [
258 |       {
259 |         "object": "cds_projection_view",
260 |         "additionalfields": [
261 |           {
262 |             "fieldname": "_HolidayTxt.HolidayDescription",
263 |             "alias": "HolidayDescription",
264 |             "localized": true
265 |           },
266 |           {
267 |             "fieldname": "_DeprecationText.ConfignDeprecationCodeName",
268 |             "alias": "DeprecationDescription",
269 |             "localized": true
270 |           },
271 |           {
272 |             "fieldname": "Criticality",
273 |             "alias": "Criticality"
274 |           }
275 |         ]
276 |       },
277 |       {
278 |         "object": "cds_interface_view",
279 |         "additionalfields": [
280 |           {
281 |             "fieldname": "case overall_status when ' ' then 2  when 'N' then 2  when 'I' then 0   when 'P' then 0   when 'D' then 3   when 'X' then 1   else 0    end",
282 |             "alias": "Criticality"
283 |           }
284 |         ]
285 |       },
286 |       {
287 |         "object": "draft_table",
288 |         "additionalfields": [
289 |           {
290 |             "fieldname": "Criticality",
291 |             "builtintype": "int1"
292 |           }
293 |         ]
294 |       }
295 |     ],
296 | 
297 | 
298 | -------------------------------------------------------------------------------- /readme_commandline.md: -------------------------------------------------------------------------------- 1 | 2 | **JSON schemas** 3 | 4 | In this folder [json_schemas](../../tree/master/json_schemas) JSON schemas are provided that can be used when using an appropriate JSON editor such as Visual Studio Code. Right now there is just one schema that contains all properties that can be used for the most common scenarios. 5 | 6 | It is planned to add additional schemas that make some or more fields and their values mandatory, e.g. a JSON schema for the scenario where a RAP BO shall be generated as a maintenace UI for a customizing table. 7 | 8 | **JSON templates** 9 | 10 | In this folder [json_templates](../../tree/master/json_templates) you will find sample JSON files for different scenarios that should help you to create your own json files that are needed as an input of the RAP Generator. 11 | 12 | ## Sample JSON file - managed scenario with semantic keys 13 | 14 | A simple sample of such a JSON file that would generate a managed business object based on the two tables **/dmo/a_travel_d** and **/dmo/a_booking_d** would look like follows. 15 | 16 |
 17 | {
 18 |     "$schema": "https://raw.githubusercontent.com/SAP-samples/cloud-abap-rap/main/json_schemas/RAPGenerator-schema-all.json",
 19 |     "namespace": "Z",
 20 |     "dataSourceType": "table",
 21 |     "implementationtype": "managed_uuid",
 22 |     "bindingType": "odata_v4_ui",
 23 |     "package": "Z_###_YOUR_PACKAGE",
 24 |     "draftenabled": true,
 25 |     "prefix": "",
 26 |     "suffix": "",
 27 |     "hierarchy": {
 28 |         "entityName": "Travel",
 29 |         "dataSource": "/dmo/a_travel_d",
 30 |         "objectId": "travel_id",
 31 |         "uuid": "travel_uuid",
 32 |         "etagMaster": "local_last_changed_at",
 33 |         "lastChangedAt": "last_changed_at",
 34 |         "lastChangedBy": "last_changed_by",
 35 |         "localInstanceLastChangedAt": "local_last_changed_at",
 36 |         "createdAt": "created_at",
 37 |         "createdBy": "created_by",
 38 |         "children": [
 39 |             {
 40 |                 "entityName": "Booking",
 41 |                 "dataSource": "/dmo/a_booking_d",
 42 |                 "objectId": "booking_id",
 43 |                 "uuid": "booking_uuid",
 44 |                 "parentUuid": "parent_uuid",
 45 |                 "etagMaster": "local_last_changed_at",
 46 |                 "localInstanceLastChangedAt": "local_last_changed_at",
 47 |                 "children": [
 48 |                     {
 49 |                         "entityName": "Supplements",
 50 |                         "dataSource": "/dmo/a_bksuppl_d",
 51 |                         "objectId": "booking_supplement_id",
 52 |                         "uuid": "booksuppl_uuid",
 53 |                         "parentUuid": "parent_uuid",
 54 |                         "etagMaster": "local_last_changed_at",
 55 |                         "localInstanceLastChangedAt": "local_last_changed_at"
 56 |                        
 57 |                     }
 58 |                 ]
 59 |             }
 60 |         ]
 61 |     }
 62 | }
 63 | 
64 | 65 | ## Run the RAP Generator using a JSON input file 66 | 67 | This is a short description how the RAP Generator can be used. 68 | 69 | 1. Make sure you have set the following option **Wrap and escape text when pasting into string literal** for your ABAP source code editor in your ADT preferences as described in my blog [How to wrap long strings automatically in ADT](https://blogs.sap.com/2020/07/29/how-to-wrap-long-strings-automatically-in-adt/) 70 | 2. Create an class **zcl_rap_generator_console_####** in your package using the following code as a template. You can duplicate the class **`/dmo/cl_rap_generator_console`** for that. 71 | 72 |
 73 | CLASS zcl_rap_generator_console_## DEFINITION
 74 |   PUBLIC
 75 |   INHERITING FROM cl_xco_cp_adt_simple_classrun
 76 |   FINAL
 77 |   CREATE PUBLIC .
 78 | 
 79 |   PUBLIC SECTION.
 80 | 
 81 |   PROTECTED SECTION.
 82 |     METHODS main REDEFINITION.
 83 |     METHODS get_json_string
 84 |       RETURNING VALUE(json_string) TYPE string.
 85 |   PRIVATE SECTION.
 86 | 
 87 | ENDCLASS.
 88 | 
 89 | 
 90 | 
 91 | CLASS zcl_rap_generator_console_## IMPLEMENTATION.
 92 | 
 93 |   METHOD main.
 94 |     TRY.
 95 |         DATA(json_string) = get_json_string(  ).
 96 |         DATA(rap_generator) = /dmo/cl_rap_generator=>create_for_cloud_development( json_string ).
 97 |         "DATA(rap_generator) = /dmo/cl_rap_generator=>create_for_S4_2020_development( json_string ).
 98 |         DATA(framework_messages) = rap_generator->generate_bo( ).
 99 |         IF rap_generator->exception_occured( ).
100 |           out->write( |Caution: Exception occured | ) .
101 |           out->write( |Check repository objects of RAP BO { rap_generator->get_rap_bo_name(  ) }.| ) .
102 |         ELSE.
103 |           out->write( |RAP BO { rap_generator->get_rap_bo_name(  ) }  generated successfully| ) .
104 |         ENDIF.
105 |         out->write( |Messages from framework:| ) .
106 |         LOOP AT framework_messages INTO DATA(framework_message).
107 |           out->write( framework_message ).
108 |         ENDLOOP.
109 |       CATCH /dmo/cx_rap_generator INTO DATA(rap_generator_exception).
110 |         out->write( 'RAP Generator has raised the following exception:' ) .
111 |         out->write( rap_generator_exception->get_text(  ) ).
112 |     ENDTRY.
113 |   ENDMETHOD.
114 | 
115 |   METHOD get_json_string.
116 |     json_string = '{ "Info" : "to be replaced with your JSON string" }' .
117 |   ENDMETHOD.
118 | 
119 | ENDCLASS.
120 | 
121 | 122 | 4. Copy the json string shown above or one of the json strings for the different scenarios, that you can find in the folder [json_templates](../../tree/master/json_templates) 123 | between the two single quotes 124 |
DATA(json_string) = ''.
125 | 5. Adapt the value for the parameter "package" : "Z_###_YOUR_PACKAGE" 126 | that is used as a placeholder so that it fits to the name of your package. You can choose to use a suffixand the suffix that you want to use. 127 | 6. Run the class using F9 128 | 129 | The class inherits from the class **cl_xco_cp_adt_simple_classrun** which is provided by the XCO framework. This class will catch all exceptions that are not chatched by the RAP Generator. The generator provides a list of warnings and messages that you will also see when you check the generated reposiotry objects in ADT. When an exception occurs that is not chatched by the generator the class will show the call stack as you are used to it by ADT. 130 | 131 | A much more detailed description (including screen shots and a video) can be found in my following blog posts: 132 | 133 | - [How to use the RAP Generator?](https://blogs.sap.com/2020/09/11/how-to-use-the-rap-generator/) 134 | - [How to use the RAP Generator in SAP S/4HANA on premise?](https://blogs.sap.com/2021/06/16/how-to-use-the-rap-generator-in-sap-s-4hana-on-premise/) 135 | 136 | The description of the technical details of this tool I have moved to this readme.md file instead. 137 | 138 | ## Supported scenarios 139 | 140 | The generator supports various implementation type ("implementationtype") 141 | 142 | - "managed_uuid" 143 | - "managed_semantic" 144 | - "unmanaged_semantic" 145 | 146 | in combination with the various supported data sources types ("dataSourceType"). 147 | 148 | - "table" 149 | - "cds_view" 150 | - "structure" 151 | - "abap_type" 152 | 153 | Some of them also support draft. 154 | 155 | 156 | ## JSON file parameters 157 | 158 | The JSON file contains some mandatory properties that are needed for the generation of the repository objects. 159 | The node has a schema that contains an array called children, each of which are also node instances. 160 | This way we can model a root node including its child and grand child nodes in a way that is readable and reusable by the developer. 161 | Let’s start with the explanation of the (mandatory) properties of the business object itself. 162 | 163 | ### Mandatory parameters of the root node 164 | 165 | #### "implementationType" 166 | 167 | The generator currently supports three implementation types 168 | - managed_uuid 169 | - managed_semantic_key 170 | - unmanaged_semantic_key 171 | 172 | ##### "managed_uuid" 173 | 174 | If the implementation type **managed_uuid** is used, the generator will generate a managed business object that uses internal numbering. It is thus required that the key fields of the nodes and therefore also the key fields of the underlying tables are of type raw(16) (UUID). 175 | 176 |
177 | key client      : abap.clnt not null;
178 | key uuid        : sysuuid_x16 not null;
179 | 
180 | 181 | ##### "managed_semantic" and "unmanaged_semantic" 182 | 183 | If one of the scenarios **"managed_semantic"** or **"unmanaged_semantic"** is used, the generator expects that there is a hierarchy of tables where the header table always contains all key fields of the item table. 184 | 185 | - Travel 186 |
187 | key client                : abap.clnt not null;
188 | key travel_id             : /dmo/travel_id not null;
189 | 
190 | - Booking 191 |
192 | key client                : abap.clnt not null;
193 | key travel_id             : /dmo/travel_id not null;
194 | key booking_id            : /dmo/booking_id not null;
195 | 
196 | - BookingSupplements 197 |
198 | key client                : abap.clnt not null;
199 | key travel_id             : /dmo/travel_id not null;
200 | key booking_id            : /dmo/booking_id not null;
201 | key booking_supplement_id : /dmo/booking_supplement_id not null;
202 | 
203 | 204 | When the implementation type **managed_semantic** is chosen, the generator will generate a business object that uses a managed implementation that requires external numbering whereas **unmanaged_semantic** will generate a business object that uses an unmanaged implementation. 205 | 206 | #### “namespace” 207 | Here you have to specify the namespace of the repository objects. This would typically be the value **“Z”** or your own namespace **"/namespace/"** if you have registered one. 208 | 209 | #### "package" 210 | With the parameter **“package”** you have to provide the name of a package where all repository objects of your RAP business object will be generated in. 211 | Please note that in on premise systems the ABAP language version of the package must match static method being used for creating the RAP Generator object. 212 | 213 | #### "datasourcetype" 214 | The generator supports tables and CDS views as a data source. 215 | Please note that when starting from tables the generator will be able to also generate a mapping whereas a mapping has to be created manually by the developer when starting with CDS views as data sources. You have to provide one of the following values here: 216 | - table 217 | - cds_view 218 | 219 | ### Optional parameters of the root node 220 | 221 | #### "draftenabled" 222 | 223 | Using the boolean parameter **"draftenabled"** you can specify that the generated RAP object supports draft. 224 | 225 | New in the 2108 release is the feature that the generator will automatically generated appropriate draft tables whithout the need to specifiy the names of the draft tables beforehand. Please note that you can nevertheless specifiy the names of the draft tables for each node of the compostion tree using the parameter **"draftTable"**. 226 | 227 | #### "transportrequest" 228 | 229 | You can now provide the name of a transport request that shall be used for all objects that are being generated. If no transport request is specified the RAP Generator will first search for any modifiable transport that fits to the transport layer of the package which belongs to the developer. 230 | 231 | If not such transport is found a new transport request is being created. 232 | 233 | #### “suffix” and “prefix” 234 | These are optional parameters that can be used to tweak the names of the repository objects. 235 | 236 | The naming convention used by the generator follows the naming conventions propsed by the Virtual Data Model (VDM) used in SAP S/4 HANA. 237 | For example the name of a CDS interface view would be generated from the above mentioned properties as follows: 238 | `DATA(lv_name) = |{ namespace }I_{ prefix }{ entityname }{ suffix }|.` 239 | The name of the entity which is part of the repository object name is set by the property **“entityName”** on node level (see below). 240 | 241 | ### Mandatory properties of node objects 242 | For each node object must specify the following mandatory properties 243 | 244 | #### “entityName” 245 | Here you have to specify the name of your entity (e.g. “Travel” or “Booking”). The name of the entity becomes part of the names of the repository objects that will be generated and it is used as the name of associations (e.g. "_Travel"). 246 | Please note, that the value of “entityName” must be unique within a business object. 247 | 248 | #### “dataSource” and “dataSourceType” 249 | The generator supports the data source types **“table”**, **"cds_view"** (views, view entities, abstract entities and custom entities), **structure** or **abap_type** 250 | The name of the data source is the name of the underlying table, the name of the underlying cds view, the name of the underlying DDIC structure or the name of the ABAP type. The latter uses the format (myclass_my_type_name=>mytype_name) 251 | 252 | #### “objectId” 253 | With **objectId** we denote a semantic key field that is part of the data source (table, cds view, structure or ABAP type). 254 | In our travel/booking scenario this would be the field **travel_id** for the Travel entity and **booking_id** for the Booking entity if the data source are tables and it would be **travelid** and **bookingid** if the CDS views of flight demo scenario are used. 255 | For managed scenarios the generator will generate a determination for each objectid. 256 | You also have to specify an **objectid** for semantic scenarios. 257 | 258 | #### “uuid”, “parent_uuid”, “root_uuid” 259 | In a managed scenario that uses keys of type **uuid** the tables of a child node must contain a field where the key of the parent entity is stored. 260 | Grandchild nodes and their children must in addition store the values of the key fields of the parent and the root entity. 261 | This is needed amongst others for the locking mechanism. 262 | The generator by default expects the following naming conventions for those fields 263 | - uuid 264 | - parent_uuid 265 | - root_uuid 266 |
267 | If you don’t want to use the same field names in all tables and prefer more descriptive names, such as 268 |
269 | key travel_uuid       : sysuuid_x16 not null;
270 | 
271 | and 272 |
273 | key booking_uuid      : sysuuid_x16 not null;
274 |     travel_uuid       : sysuuid_x16 not null;
275 | 
276 | you have to specify these field names in the definition of the node by providing values for `uuid` and `parentUuid` in the definition of the child entity and for `uuid` in the definition of the root entity. 277 | 278 |
279 | ...
280 |   "node": {
281 |     "entityName": "Travel",
282 |     "dataSource": "zrap_atrav_0002",
283 |     "dataSourceType" : "table",
284 |     "objectId": "TRAVEL_ID",
285 |     "uuid": "travel_uuid",
286 |     "children": [
287 |       {
288 |         "entityName": "Booking",
289 |         "dataSource": "zrap_abook_0002",
290 |         "dataSourceType" : "table",
291 |         "objectId": "BOOKING_ID",
292 |         "uuid": "booking_uuid",
293 |         "parentUuid": "travel_uuid"
294 |       }
295 |     ]
296 |   }
297 | ...
298 | 
299 | 300 | #### etag support 301 | 302 | OData services need to have etags in order to support optimistic locking. In addition the RAP framework supports to update automatically administrative fields that contain the information when an entity has been created, updated and by whom these actions have been performed. For this appropriate annoations have to be set in the CDS interface views. 303 | In addition to set these annotions in the CDS views it is required to specify which field plays the role of an etag in the behavior definition of your RAP business object. So we have to provide both informations: 304 | - fields that contain administrative information (for managed scenarios) 305 | - fields that act as etag for an entity ("etagMaster") 306 | - field that acts as the etag for the whole business object ("totalEtag") in case you are using a draft scenario 307 | 308 | ##### etagMaster 309 | 310 | Since eTags are required for each entity when consuming the RAP BO via OData this schema enforces you to specify the field of the datasource that contains a timestamp, a hash value, or any other versioning that precisely identifies the version of the data set. 311 | 312 | ##### totalEtag ( only needed for the root entity) 313 | 314 | A total etag field is mandatory for the root entity when using draft. It must be different from the field that is defined as the etagMaster. 315 | 316 | ##### "lastChangedAt", "lastChangedBy", "createdAt", "createdBy" and "localInstanceLastChangedAt" 317 | 318 | In a managed scenario it is required that the root entity provides fields to store administrative data when an entity was created and changed and by whom these actions have been performed. 319 | 320 | Again the generator assumes some default values for these field names, namely: 321 | - “last_changed_at", 322 | - "last_changed_by", 323 | - "created_at" and 324 | - "created_by" 325 | 326 |
327 | If the tables that you are using do not follow this naming convention it is possible to tell the generator about the actual field names by setting these optional properties. 328 | 329 | A good example is the table which is used in the Flight reference draft scenario where we need the following mapping 330 | 331 |
332 |     "lastChangedAt": "last_changed_at",
333 |     "lastChangedBy": "local_last_changed_by",
334 |     "createdAt": "local_created_at",
335 |     "createdBy": "local_created_by",
336 |     "localInstanceLastChangedAt": "local_last_changed_at",
337 | 
338 | 339 | In draft scenarios the fields used as etagMaster and totalEtag will be mapped as follows 340 | 341 | ### Optional parameters for node 342 | 343 | #### drafttable 344 | 345 | When you specify that a RAP business object shall support draft using the parameter **"draftenabled" : true** you can specifiy the name of the draft table that is being generated for each node using the following syntax 346 | 347 |
348 | "drafttable": "zd_book_0000",
349 | 
350 | 351 | If no name is provided upfront the generator will generate a valid draft table name using the following string template: 352 | 353 | `to_upper( namespace ) && to_upper( prefix ) && to_upper( lv_entityname ) && hex_number && 'D' && to_upper( suffix ).` 354 | 355 | where the a hexadecimal number is calculated to get a unique repository object name that has not been used so far. 356 | 357 | # Changing the repository object names of the generated objects 358 | 359 | The names of the repository objects that are generated by the RAP Generator try to follow the naming conventions used in SAP S/4 HANA development and the naming conventions that you are used to when working with ADT. 360 | 361 | The generator uses string templates that contain the *namespace*, the *prefix* the *entityname* and the **suffix** together with naming conventions such as "I_" for interface views. 362 | 363 | **"draftTable"** 364 |
|{ namespace }{ prefix }{ lv_entityname }{ unique_hex_number }D{ suffix }|.
365 | **"cdsInterfaceView"** 366 |
|{ namespace }I_{ prefix }{ entityname }{ suffix }|.
367 | **"cdsProjectionView"** 368 |
|{ namespace }C_{ prefix }{ entityname }{ suffix }|.
369 | **"metadataExtensionView"** 370 |
|{ namespace }C_{ prefix }{ entityname }{ suffix }|.
371 | **"behaviorImplementationClass"** 372 |
|{ namespace }BP_I_{ prefix }{ entityname }{ suffix }|.
373 | **"serviceDefinition"** 374 |
|{ namespace }{ prefix }{ entityname }{ suffix }|.
375 | **"serviceBinding"** 376 |
|{ namespace }{ binding }{ prefix }{ entityname }{ suffix }{ protocol_version }|.
377 | **"controlStructure"** 378 |
|{ namespace }S{ prefix }{ entityname }_X{ suffix }|.
379 | **"customQueryImplementationClass"** 380 |
|{ namespace }CL_CE_{ prefix }{ entityname }{ suffix }|.
381 | 382 | If you are not happy with these proposals you can override these settings by providing appropriate proposals in your JSON configuration file. 383 | 384 | So it would be technically possible to set the following names for the repository objects: 385 |
386 |         "entityName": "Travel",
387 |         "dataSource": "/dmo/a_travel_d",
388 |         "objectId": "travel_id",
389 |         "uuid": "travel_uuid",
390 |         "etagMaster": "local_last_changed_at",
391 |         "lastChangedAt": "last_changed_at",
392 |         "lastChangedBy": "last_changed_by",
393 |         "localInstanceLastChangedAt": "local_last_changed_at",
394 |         "createdAt": "created_at",
395 |         "createdBy": "created_by",
396 |         "draftTable": "ZH34HJ4545",
397 |         "cdsInterfaceView": "ZI_H34HJ4545",
398 |         "cdsProjectionView": "ZP_H34HJ4545",
399 |         "metadataExtensionView": "ZP_H34HJ4545",
400 |         "behaviorImplementationClass": "ZCL_P_H34HJ4545",
401 |         "serviceDefinition": "ZSD_H34HJ4545",
402 |         "serviceBinding": "ZSD_H34HJ4545_O4",
403 |         "controlStructure": "ZX_H34HJ454d",
404 |         "customQueryImplementationClass": "ZCL_CE_H34HJ454d",
405 | 
406 | Please note: 407 | There is no setting available for some repository object names such as the behavior definition since the name of the behavior definition must match the name of the CDS interface view of your root entity. The same is true for the name of the behvarior projection that must match the name of the projection view of your root entity. 408 | 409 | 410 | # Additional parameters for workshops and enhanced scenarios 411 | 412 | The RAP Generator has been used to generate repository objects for various hands-on sessions at SAP TechEd and in the openSAP courses that have been offered recently for the ABAP RESTful Programming Model and for SAP Fiori. 413 | 414 | Here additional requirements had to be met such as creating repository objects with additional fields that are not part of the data source or adding additional value helps and association upfront. These requirements meant to offer the option to add this additional information in the configuration JSON file as well. 415 | 416 | As a result the JSON files used in such scenarios become more complex and it would not be helpful to offer all these options to the developer that just wants to create a RAP business object as a starter object. 417 | 418 | So I have decided to provide the information about these advanced features that are quite valuable if you have the need for them in a separate readme file that you can find here: 419 | 420 | [Additional parameters for workshops](optional_parameters.md). 421 | --------------------------------------------------------------------------------