├── .abapgit.xml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── line_of_business ├── LineofBusiness.html └── README.md ├── solution_syntax ├── README.md └── solution_syntax.html └── src ├── LargeObjectHandling ├── README.md ├── zblob_test.tabl.xml ├── zc_blob_test.bdef.asbdef ├── zc_blob_test.bdef.xml ├── zc_blob_test.ddls.asddls ├── zc_blob_test.ddls.baseinfo ├── zc_blob_test.ddls.xml ├── zc_blob_test.ddlx.asddlxs ├── zc_blob_test.ddlx.xml ├── zcl_blob_test.clas.abap ├── zcl_blob_test.clas.locals_imp.abap ├── zcl_blob_test.clas.xml ├── zi_blob_test.bdef.asbdef ├── zi_blob_test.bdef.xml ├── zi_blob_test.ddls.asddls ├── zi_blob_test.ddls.baseinfo ├── zi_blob_test.ddls.xml ├── ziblob_test_d.tabl.xml ├── zsrv_b_blob_test.srvb.xml ├── zsrv_b_blob_test_0001_g4ba.sco2.xml ├── zsrv_d_blob_test.srvd.srvdsrv └── zsrv_d_blob_test.srvd.xml ├── package.devc.xml ├── zabap_memory.clas.abap ├── zabap_memory.clas.xml ├── zattachment.dtel.xml ├── zcalendar.clas.abap ├── zcalendar.clas.xml ├── zchange_document.clas.abap ├── zchange_document.clas.xml ├── zcl_job_schedule_apj.clas.abap ├── zcl_job_schedule_apj.clas.xml ├── zcl_job_template_apj.clas.abap ├── zcl_job_template_apj.clas.xml ├── zcl_paralell1.clas.abap ├── zcl_paralell1.clas.xml ├── zcl_paralell2.clas.abap ├── zcl_paralell2.clas.xml ├── zcl_zobj_cd_test_chdo.clas.abap ├── zcl_zobj_cd_test_chdo.clas.xml ├── zexcel_itab.clas.abap ├── zexcel_itab.clas.xml ├── zprint_ads.clas.abap ├── zprint_ads.clas.xml ├── zprint_queue.clas.abap ├── zprint_queue.clas.xml ├── ztrigger_parallel.clas.abap └── ztrigger_parallel.clas.xml /.abapgit.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | E 6 | /src/ 7 | FULL 8 | 9 | /.gitignore 10 | /LICENSE 11 | /README.md 12 | /package.json 13 | /.travis.yml 14 | /.gitlab-ci.yml 15 | /abaplint.json 16 | /azure-pipelines.yml 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution 2 | You are welcome to contribute if you can expand and improve the contents. Good contribution would, for example, adding areas/concepts that are missing or improve the existing contents. 3 | 4 | To contribute, Git pull request flow must be followed. Please fork the repo, crete your branch locally and add your changes. Upon committing, in the "Commit message" field, type a short, meaningful commit message that describes the change you made to the file. 5 | 6 | Review process may take a day, few days or a week, depending on the author's workload. If it takes longer, you're welcome to contact me directly. 7 | 8 | In case of conflict in the change, the author will resolve it by contacting the contributors. 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Abap-for-Cloud-Development-CheatSheet 2 | Original blog https://blogs.sap.com/2023/08/15/smooth-transition-to-abap-for-cloud-developmentcheat-sheet/ 3 | 4 | More and more organizations are coming across the term **ABAP on Cloud**. Whether they are considering **Side-by-Side Extension** with SAP Business Technology Platform or **On-stack Extension** in S4 HANA, I’m certain that this is discussed in your strategy meeting at least once. 5 | 6 | ABAP on Cloud(aka **ABAP for Cloud Development** language version) is similar yet different from standard ABAP in many ways. Even if your organization holds in-house ABAP developers, the transition path to ABAP on Cloud may not be easy. This is due to the fact that certain APIs(table, function module, tcode, etc.) exist in your system built with standard ABAP language are not functional in ABAP on Cloud. On the front-end level, the major factor of not being able to use SAP GUI changes certain ABAP based solutions. In addition, there are changes in ABAP syntax as well. 7 | 8 | This blogs is a **one-stop shop** for developers and IT strategist who like to make smooth transition from standard ABAP to ABAP for Cloud Development. It consists of three parts: 9 | 10 | Cheat sheet on [LoB(Line of Business)](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/tree/main/line_of_business#readme) level 11 | Cheat sheet on [Solution & Syntax](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/tree/main/solution_syntax) level 12 | Solution overview & hint based on ABAP for Cloud Development 13 | You can choose to just refer to the cheat sheet, or you can deep dive into each solution at later half of this blog. 14 | 15 | Diagram 16 | 17 | # Disclaimer 18 | - Availability of ABAP object for cloud development may differ between ABAP Platform for S4 HANA and BTP ABAP Environment 19 | - ABAP object for cloud development may be renewed and deprecated over time 20 | - The list covers the most common ABAP topics and Line of Business(from personal perspective) but certain areas of your interest may be missing. You are welcome to comment these areas and I maybe able to add them later on. 21 | # Contribution 22 | Please refer to [CONTRIBUTING.md](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/CONTRIBUTING.md) 23 | # Open points 24 | ABAP Profiling 25 | Debug background job class 26 | -------------------------------------------------------------------------------- /line_of_business/LineofBusiness.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 |

LoB(Line of Business)

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 31 | 40 | 41 | 42 | 43 | 44 | 45 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 74 | 86 | 87 | 88 | 89 | 90 | 91 | 96 | 104 | 105 | 106 | 107 | 108 | 109 | 133 | 158 | 159 | 160 | 161 | 162 | 163 | 168 | 173 | 174 | 175 | 176 | 177 | 178 | 193 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 243 | 244 | 245 | 246 | 247 | 248 | 256 | 264 | 265 | 266 | 267 | 268 | 269 | 294 | 310 | 311 | 312 |
Standard ABAP object/ based solutionPublic local API to use instead in ABAP for Cloud Development
Business Partner
Table:
23 | KNA1
24 | KNB1
25 | KNVK
26 | KNVP
27 | KNVV
28 | LFA1
29 | LFB1
30 | LFM1
CDS view:
32 | i_customer
33 | i_customercompany
34 | i_contactperson
35 | i_custsalespartnerfunc
36 | i_customersalesarea
37 | i_supplier
38 | i_suppliercompany
39 | i_supplierpurchasingorg
Delivery
Table:
46 | LIKP
47 | LIPS
48 | TVST
CDS view:
50 | i_deliverydocument
51 | i_deliverydocumentitem
52 | i_shippingpoint
Finance
Table:
59 | BKPF
60 | BSEG
61 | ACDOCA
62 | SKA1
63 | SKB1
64 | T001
65 | T003
66 | CEPC
67 | Function Module:
68 | BAPI_ACC_EMPLOYEE_EXP_POST
69 | BAPI_ACC_INVOICE_RECEIPT_CHECK
70 | BAPI_ACC_INVOICE_RECEIPT_POST
71 | BAPI_ACC_DOCUMENT_CHECK
72 | BAPI_ACC_DOCUMENT_POST
73 | BAPI_ACC_ACT_POSTINGS_REVERSE
CDS view:
75 | i_journalentry
76 | i_operationalacctgdocitem
77 | i_journalentryitem
78 | i_glaccountlineitem
79 | i_glaccountlineitemrawdata
80 | i_glaccountinchartofaccounts
81 | i_glaccountincompanycode
82 | i_companycode
83 | i_profitcenter
84 | Behavior Definition:
85 | i_journalentrytp
Finance(Hierarchy)
Table:
92 | SETHEADER
93 | SETHEADERT
94 | SETLEAF
95 | SETNODE
CDS view:
97 | i_costcenterhierarchy
98 | i_costcenterhierarchynode
99 | i_costctractivitytypehiernode
100 | i_functionalareahierarchy
101 | i_functionalareahiernode
102 | i_profitcenterhierarchy
103 | i_profitcenterhierarchynode
Manufacturing
Table:
110 | MARA
111 | MARC
112 | MARD
113 | MARM
114 | AFKO
115 | AFPO
116 | AFRU
117 | AFVC
118 | AFVU
119 | AFVV
120 | MKAL
121 | PLKO
122 | PLPO
123 | Function Module:
124 | BAPI_MATERIAL_MAINTAINDATA_RT
125 | BAPI_MATERIAL_SAVEREPLICA
126 | BAPI_MATERIAL_SAVEDATA
127 | BAPI_PLANNEDORDER_GET_DETAIL
128 | BAPI_PRODORD_CHANGE
129 | BAPI_PRODORD_COMPLETE_TECH
130 | BAPI_PRODORD_CREATE
131 | BAPI_PRODORD_RELEASE
132 | BAPI_MATERIAL_STOCK_REQ_LIST
CDS view:
134 | i_product
135 | i_productqm
136 | i_productsales
137 | i_productprocurement
138 | i_productplantbasic
139 | i_productsupplyplanning
140 | i_productstoragelocationbasic
141 | i_productunitsofmeasure
142 | i_manufacturingorder
143 | i_manufacturingorderitem
144 | i_mfgorderconfirmation
145 | i_manufacturingorderoperation
146 | i_manufacturingorderoperation
147 | i_manufacturingorderoperation
148 | i_productionversion
149 | i_billofoperationsgroup
150 | i_mfgbillofoperationsoperation
151 | Behavior Definition:
152 | i_producttp_2
153 | i_plannedordertp
154 | i_productionordertp
155 | i_productionordconfirmationtp
156 | i_plndindeprqmttp
157 | i_supplydemanditemtp
Payment
Table:
164 | REGUH
165 | REGUP
166 | REGUV
167 | REGUT
CDS view:
169 | i_paymentprogramcontrol
170 | i_paymentproposalpayment
171 | i_paymentproposalitem
172 | i_paymentproposalcontrol
Physical Inventory Management
Table:
179 | IKPF
180 | ISEG
181 | T001L
182 | T001W
183 | MSEG
184 | MKPF
185 | Function Module:
186 | MB_CREATE_GOODS_MOVEMENT
187 | MB_POST_GOODS_MOVEMENT
188 | BAPI_GOODSMVT_CANCEL
189 | BAPI_GOODSMVT_CREATE
190 | BAPI_MATPHYSINV_CHANGECOUNT
191 | BAPI_MATPHYSINV_COUNT
192 | BAPI_MATPHYSINV_CREATE
CDS view:
194 | i_physinvtrydocheader
195 | i_physinvtrydocitem
196 | i_storagelocation
197 | i_plant
198 | i_materialdocumentitem_2
199 | i_materialdocumentheader_2
200 | Behavior Definition:
201 | i_materialdocumenttp
202 | i_physicalinventorydocumenttp
Sales
Table:
209 | VBAK
210 | VBAP
211 | VBEP
212 | VBFA
213 | VBKD
214 | VBRK
215 | VBRP
216 | TVGRT
217 | TVKBT
218 | TVKBZ
219 | TVKGR
220 | TVKO
221 | TVTA
222 | TVTW
223 | Function Module:
224 | BAPISDORDER_GETDETAILEDLIST
225 | BAPI_SALESORDER_CREATEFROMDAT2
CDS view:
227 | i_salesdocument
228 | i_salesdocumentitem
229 | i_salesdocumentscheduleline
230 | i_sddocumentmultilevelprocflow
231 | i_salesdocument
232 | i_billingdocumentbasic
233 | i_billingdocumentitembasic
234 | i_salesgroup
235 | i_salesoffice
236 | i_salesareasalesoffice
237 | i_salesgroup
238 | i_salesorganization
239 | i_salesarea
240 | i_distributionchannel
241 | Behavior Definition:
242 | i_salesordertp
Sales (Pricing)
Table:
249 | KONH
250 | KONM
251 | KONP
252 | KONV
253 | PRCD_ELEMENTS
254 | T685
255 | T685A
CDS view:
257 | i_slsprcgconditionrecord
258 | i_slsprcgcndnrecordscale
259 | i_slsprcgconditionrecord
260 | i_slsprcgconditionrecord
261 | i_slsprcgconditionrecord
262 | i_conditiontype
263 | i_pricingconditiontype
Sourcing and Procurement
Table:
270 | EKKO
271 | EKPO
272 | RBKP
273 | RSEG
274 | MATDOC
275 | EBAN
276 | EBKN
277 | EINA
278 | EINE
279 | MSKA
280 | MSKU
281 | MSLB
282 | MSLBH
283 | Function Module:
284 | BAPI_PO_CHANGE
285 | BAPI_PO_CREATE1
286 | BAPI_PR_CHANGE
287 | BAPI_PR_CREATE
288 | BAPI_REQUISITION_CHANGE
289 | BAPI_REQUISITION_CREATE
290 | BAPI_REQUISITION_GETDETAIL
291 | BAPI_INCOMINGINVOICE_CREATE
292 | BAPI_INCOMINGINVOICE_POST
293 | BAPI_INCOMINGINVOICE_RELEASE
CDS view:
295 | i_purchaseorderapi01
296 | i_purchaseorderitemapi01
297 | i_supplierinvoiceapi01
298 | i_suplrinvcitempurordrefapi01
299 | i_materialdocumentheader_2
300 | i_purchaserequisitionitemapi01
301 | i_purreqnacctassgmtapi01
302 | i_purchasinginforecordapi01
303 | i_purchasinginforecordapi01
304 | i_materialstock
305 | Behavior Definition:
306 | i_purchaseordertp_2
307 | i_purchaserequisitiontp
308 | i_purchasecontracttp
309 | i_supplierinvoicetp
313 | 314 | 315 | -------------------------------------------------------------------------------- /line_of_business/README.md: -------------------------------------------------------------------------------- 1 | Access complete cheatsheet donw [here](https://htmlpreview.github.io/?https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/line_of_business/LineofBusiness.html) 2 | 3 | Lineof Buisiness 4 | -------------------------------------------------------------------------------- /solution_syntax/README.md: -------------------------------------------------------------------------------- 1 | Access complete cheatsheet [here](https://htmlpreview.github.io/?https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/solution_syntax/solution_syntax.html) 2 | 3 | Solution 4 | 5 | # ABAP memory 6 | You may use BUFFER or INTERNAL TABLE to exchange ABAP memory but former is much simpler to use. BUFFER transfers to cluster data the buffer data object which is in xstring format. 7 | The main difference is that passing data using MEMORY ID is not supported anymore. Therefore only these 2 options are available. 8 | 9 | Find demo objects for ABAP Memory [here](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zabap_memory.clas.abap) 10 | 11 | # Access management 12 | Note that below example demonstrates how to restrict access inside IAM app. In addition, you may choose to implement Access Control on your CDS Data Definition. 13 | AccessManagement 14 | 15 | Similar to in SAP on-premise access management, Authorization Object and Role are still relevant in ABAP for Cloud development. The big difference is that User Profiles is not used anymore and instead, IAM App and Business Catalog are used to map Authorization Object and Business Role. User Profile is where the fine-grained access control is setup, so that some users have display access to certain table objects, while some users don’t. This is in turn done by IAM App and Access Control Object in the ABAP for Cloud development. 16 | 17 | The actual authorization check uses the same ABAP syntax, AUTHORITY-CHECK OBJECT. This checks the authorization object and activity value, which hasn’t changed from standard ABAP. 18 | 19 | In my below example, I created Authorization Field “ZTABLE”, Authorization Object “ZAUTH_OBJ”. In the IAM app, set the authorization object and restrict the table name and activity. 20 | AccessManagement1 21 | 22 | 23 | In the Behavior Definition, implement global authorization instance. Reference [zi_blob_test.bdef](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/LargeObjectHandling/zi_blob_test.bdef.asbdef). 24 | 25 | 26 | In the Behavior Handler class, implement the authorization check in method “get_global_authorizations”. Set a debug on this logic so that we see what is going on. Reference [zcl_blob_test.clas.locals_imp.abap](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/LargeObjectHandling/zcl_blob_test.clas.locals_imp.abap). 27 | 28 | Now go to the Fiori application generated from the Odata service and go to the item to edit the record. The debugger should start and you can see that the result of authorization check for update(sy-subrc = 0) is OK. This is because in IAM app, 02(change) is allowed. 29 | 30 | AccessManagement2 31 | 32 | Now let’s create a new record. This time, the authority check fails because IAM app does not allow 01(create). 33 | 34 | AccessManagement3 35 | 36 | # Calendar 37 | find demo object for Calendar [here](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zcalendar.clas.abap) 38 | 39 | # Change document logging 40 | 1. Create a table where you want to log the document change. Create data element for the field and check on Change Document Logging. 41 | 42 | DocChangLog1 43 | 44 | 2. Create Change Document Object and set your Z table. Check how you want to log your Z table 45 | **Log Field values for insert** – Create log entry record for each field value that’s entered. 46 | **Log Initial values for insert** – Create log entry record for each field value even if they are empty. This created high volumn of change doucment records. Use with caution. 47 | **Log Field values for deletion** – When object is deleted, create log entry record for each field value that’s entered. 48 | **Log Initial values for deletion** – When object is deleted, create log entry record for each field value even if they are empty. This created high volumn of change doucment records. Use with caution. 49 | 50 | DocChangLog2 51 | 52 | 3. Creating change document entry. Use the generated class to write change document logging. In the below example, it’s logging update of table field 53 | 54 | 4. Reading the change document entry. In the generated class, add method implementation “if_chdo_enhancements~authority_check” and put below code inside. This method is for implementing your own autheority check, but in the below example, it is simply returning rv_is_authorized = ‘X’, meaning the authroity check is succesfull. 55 | 56 | 5. Use class method cl_chdo_read_tools=>changedocument_read to read the change log. 57 | DocChangLog3 58 | 59 | find demo object for Change document logging [here](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zchange_document.clas.abap) 60 | 61 | # Excel upload to itab 62 | **The upload data** 63 | 64 | Excel1 65 | 66 | Step1. Upload excel file by RAP Odata service described in “Large object handing(storing as MIME)”. This way, the excel data is transformed to XSTRING. 67 | 68 | Step2. Read the XSTRING to with xco_cp_xlsx. This class will read worksheet specified. Prepare an internal table that matches the file structure of excel. Use IF_XCO_XLSX_RA_WORKSHEET to select the range of the worksheet. Finally, use write_to method in if_xco_xlsx_ra_rs_operation_fc to write the values in internal table. 69 | 70 | find demo object for Excel upload to itab [here](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zexcel_itab.clas.abap) 71 | 72 | Excel2 73 | 74 | # Exchange rate 75 | The released API cl_exchange_rates performs currency conversion and exchange rate update, but it does not have method to read the list of exchange rate. To workaround this, we can use standard app “Upload Business Configuration” from Fiori Launchpad. Role “SAP_CA_BC_IC_LND_PC” is required to access this, or assign role template “SAP_BR_BPC_EXPERT”. 76 | 77 | This app is meant to maintain your custom Z customizing table but by default, SAP has generously allowed the maintenance of below standard currency tables. 78 | 79 | Exchange rate 80 | 81 | # Forms and printing 82 | *The below setup is for Business Technology Platform. Connecting Forms Service by Adobe with ABAP Environment in S4 may require different setup. 83 | 84 | **Preparation** 85 | 86 | Forms Service by Adobe and Forms Service by Adobe API are required in Business Technology Platform. On the service instance of Forms Service by Adobe API, create a service key. Finally, create destination for Forms Service by Adobe instance. 87 | 88 | Print1 89 | 90 | **Build Form template** 91 | 92 | Since there is no SAP Script or Smartforms, Adobe LiveCycle Designer must be used to create form layout. Follow note 2187332 to install it to your local PC. 93 | 94 | Once the template is created, download in Adobe XML Form (*xdp), then upload this to Forms Template Store. 95 | 96 | Print2 97 | 98 | **Rendering Forms** 99 | 100 | Rendering forms requies Forms Service by Adobe. Follow my blog below to set it up and consume from ABAP. https://blogs.sap.com/2022/12/14/get-started-with-forms-service-by-adobe-rest-api-in-btp/ 101 | 102 | Create client for Forms Service by Adobe template store. 103 | ```abap 104 | mo_http_destination = cl_http_destination_provider=>create_by_cloud_destination( 105 | i_service_instance_name = CONV #( iv_service_instance_name ) 106 | i_name = 'ADS_SRV' 107 | i_authn_mode = if_a4c_cp_service=>service_specific 108 | ). 109 | mv_client = cl_web_http_client_manager=>create_by_http_destination( mo_http_destination ). 110 | ``` 111 | Render PDF by calling Forms Service by Adobe API URI “/v1/adsRender/pdf”. You can find the complete list of supported URI of this API here. https://adsrestapi-formsprocessing.cfapps.eu10.hana.ondemand.com/swagger 112 | 113 | The rendering will return the PDF content result with base64 encoded string. 114 | 115 | Print3 116 | 117 | **Viewing PDF** 118 | 119 | To view the content, we must first convert base64 encoded content to xstring. Then upload this xstring as mime object in your Ztable. This Z table can be created following “Excel upload to itab” part of this blog. 120 | 121 | ```abap 122 | "Get the base64 encoded PDF content 123 | DATA(lo_json) = /ui2/cl_json=>generate( json = lv_rendered_pdf ). 124 | IF lo_json IS BOUND. 125 | ASSIGN lo_json->* TO FIELD-SYMBOL(). 126 | ASSIGN COMPONENT `fileContent` OF STRUCTURE TO FIELD-SYMBOL(). 127 | ASSIGN ->* TO FIELD-SYMBOL(). 128 | ENDIF. 129 | 130 | "Upload the xstring to z table, so the content can be viewed with RAP generated report 131 | DATA: lt_input TYPE STANDARD TABLE OF zblob_test. 132 | lt_input = VALUE #( ( docnum = '1000000001' filename = 'test.pdf' attachment = lv_pdf_xstring mimetype = 133 | 'application/pdf' ) 134 | ). 135 | INSERT zblob_test FROM TABLE @lt_input. 136 | ``` 137 | Go to the RAP service and the inserted record is disaplayed. Click on the attachment and the generated PDF from Form Service by Adobe will open. 138 | 139 | Print4 140 | Print5 141 | 142 | find demo object for Forms and printing [here](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zprint_ads.clas.abap) 143 | 144 | **Print Queue** 145 | 146 | Create a print queue by using cl_print_queue_utils. The below examples sends data from table zcd_test and send it to print queue. 147 | 148 | find demo object for Print Queue [here](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zprint_ads.clas.abap) 149 | 150 | The print queue can be viewed in Fiori app Maintain Print Queue. 151 | 152 | Print6 153 | 154 | If you want to integrate physical printer to ABAP Environment, follow this blog that guides you from setting up communication scnerio and installing Cloud Print Manager. https://blogs.sap.com/2017/08/07/cloud-print-manager-installation-and-configuration/ 155 | 156 | # Job scheduling 157 | Required roles: Application Jobs(SAP_CORE_BC_APJ_JCE), Application Job Templates(SAP_CORE_BC_APJ_TPL), Maintain Job Users(SAP_CORE_BC_APJ_USR_PC) 158 | 159 | JobSchedule1 160 | 161 | 1. There are predefined job template to schedule your job from. If none of them meet your need, you must create your custom job template. 162 | 163 | 2. To create your custom template, first define your job entry by creating below class. This defines design time information on your job. 164 | 165 | Refenrece class [zcl_job_schedule_apj](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zcl_job_schedule_apj.clas.abap) 166 | 167 | 3. Then create another class to create the job catalog and job template from the job you defined. Note that you need package and transport request. 168 | 169 | Refenrece class [zcl_job_template_apj](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zcl_job_template_apj.clas.abap) 170 | 171 | 4. After successful execution, go to Fiori app maintain Application Job Template and the new job template is created. 172 | 173 | JobSchedule2 174 | 175 | 5. Use Fiori app Application jobs to create a job with the job template. 176 | 177 | JobSchedule3 178 | 179 | 6. The method if_apj_rt_exec_object~execute in class zcl_job_schedule_apjs is executed. Whatever business logic you implemented there will be processed. 180 | 181 | 7. If you want to start, change, delete jobs programmatically, use class cl_apj_rt_api. 182 | 183 | # Large object handling 184 | The completely guide to storing large object in database table can be found in [Streams in RAP : Uploading PDF , Excel and Other Files in RAP Application](https://blogs.sap.com/2022/08/26/streams-in-rap-uploading-pdf-excel-and-other-files-in-rap-application/) 185 | 186 | Find demo objects for Large object handling [here](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/tree/main/src/LargeObjectHandling) 187 | 188 | # Parallel processing 189 | Find demo objects for Parallel processing [zcl_paralell1](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zcl_paralell1.clas.abap), [zcl_paralell2](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/zcl_paralell2.clas.abap) and trigger class [ztrigger_parallel](https://github.com/Yoloyoda/abap-for-cloud-development-cheatsheet/blob/main/src/ztrigger_parallel.clas.abap) 190 | 191 | # Translation 192 | Since there is no GUI, the GUI based translation maintenance is no longer available. For this purpose, Maintain Translations app is used. 193 | 194 | Translation1 195 | 196 | List of all objects that are translatable. 197 | 198 | - Application Log Object 199 | - Business Configuration Object 200 | - CDS Type Definition 201 | - Data Definition 202 | - Data Element 203 | - Domain 204 | - IAM Business Catalog 205 | - Message Class 206 | - Metadata Extension 207 | 208 | Define the source language and target language. Demonstrate translation for metadata extension for RAP based application. 209 | 210 | Translation3 211 | 212 | XLF file is downloaded and this is the file that defines the translation. Add target translation of Japanese. Upload the same file back in the Maintain Translation app and don’t forget to publish the translation. 213 | 214 | Translation4 215 | 216 | Start the application in Japanese and English. The field names are translated based on the uploaded XLF file. 217 | 218 | Translation5 219 | Translation6 220 | 221 | # UI 222 | **ABAP Development Tool output console** 223 | 224 | Since there is no SAP GUI, write statement or ALV output is not possible. The easiest way in ABAP for Cloud Development is to use output console in ADT. Wrap IF_OO_ADT_CLASSRUN into your class and use it’s Write method to output data. 225 | 226 | This output is only suited for simple string output. It is not meant only for developer, and not for generating report for business application user. 227 | ```abap 228 | CLASS ztest_class DEFINITION 229 | PUBLIC 230 | FINAL 231 | CREATE PUBLIC . 232 | PUBLIC SECTION. 233 | INTERFACES: if_oo_adt_classrun. 234 | PROTECTED SECTION. 235 | PRIVATE SECTION. 236 | ENDCLASS. 237 | 238 | CLASS ztest_class IMPLEMENTATION. 239 | METHOD if_oo_adt_classrun~main. 240 | out->write( 'Hello world!' ). 241 | ENDMETHOD. 242 | ENDCLASS. 243 | ``` 244 | 245 | **Fiori app generate by ABAP UI service** 246 | 247 | This is the primary approach to generate UI for report applications. It is part of ABAP RAP framework and no front end development is needed to generate Fiori application. It is completely different framework from SAP GUI. Instead of creating dynpro and controlling logic in PBO, PAI, ABAP RAP uses CDS view as base and expose Odata service. Fiori launchpad consumes UI service part of Odata and generates a Fiori list report based on the data from CDS view and metadata definition of it. 248 | 249 | Supported feature: 250 | 251 | - List page, object page to display data 252 | - Search, filter, variant 253 | - CRUD operation for backend database 254 | - Visualization(graph, chart) 255 | - Screen logic(Validation, conversion, user event) 256 | - Draft & Copy capabilitties 257 | - Inline edit 258 | - Locking mechanism 259 | 260 | Limitation: 261 | 262 | - All limitation with Fiori Element apply(No flexibility in UI, limitation in screen control, etc.) 263 | - Must be deployed outside of ABAP Environment, using WebEDI such as Business Application Studio or Visual Studio. 264 | 265 | UI 266 | 267 | **Fiori app generate by ABAP2UI5(open source)** 268 | 269 | This is open source project that allows developer to create Fiori UI5 application with pure ABAP. It is the closest approach to built free-style UI5 application in ABAP Environment. https://github.com/abap2UI5/abap2UI5 270 | 271 | Highlights: 272 | 273 | - Avaialble for ABAP releases (from NW 7.02 to ABAP 2305) 274 | - Avaialble for both ABAP for Cloud and Standard ABAP language version 275 | - Supports Selection Screens, Tables, Lists, Popups, F4-Helps, MIME Editor, File Upload/download, Chart/Graph, Side Effects, etc.. 276 | - Supports all Fiori Elements floorplan 277 | 278 | If you want to create more flexible UI with ABAP, consider using ABAP2UI5 instead of ABAP RAP(below is a sample UI I created with ABAP2UI5). 279 | 280 | UI2 281 | -------------------------------------------------------------------------------- /solution_syntax/solution_syntax.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 |

12 |

Solution & Syntax

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 39 | 40 | 41 | 42 | 43 | 44 | 50 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 86 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 103 | 104 | 105 | 106 | 107 | 108 | 118 | 125 | 126 | 127 | 128 | 129 | 130 | 134 | 136 | 137 | 138 | 139 | 140 | 141 | 150 | 157 | 158 | 159 | 160 | 161 | 162 | 165 | 167 | 168 | 169 | 170 | 171 | 172 | 179 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 203 | 207 | 208 | 209 | 210 | 211 | 212 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 232 | 239 | 240 | 241 | 242 | 243 | 244 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 261 | 267 | 268 | 269 | 270 | 271 | 272 | 275 | 279 | 280 | 281 | 282 | 283 | 284 | 295 | 305 | 306 | 307 | 308 | 309 | 310 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 322 | 324 | 325 | 326 | 327 | 328 | 329 | 337 | 349 | 350 | 351 | 352 | 353 | 354 | 361 | 367 | 368 | 369 | 370 | 371 | 372 | 382 | 391 | 392 | 393 | 394 | 395 | 396 | 407 | 412 | 413 | 414 | 415 | 416 | 417 | 421 | 423 | 424 | 425 | 426 | 427 | 428 | 432 | 436 | 437 | 438 | 439 | 440 | 441 | 448 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 462 | 463 | 464 | 465 | 466 | 467 | 471 | 480 | 481 | 482 | 483 | 484 | 485 | 488 | 499 | 500 | 501 | 502 | 503 | 504 | 506 | 508 | 509 | 510 | 511 | 512 | 513 | 517 | 523 | 524 | 525 | 526 | 527 | 528 | 531 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 554 | 555 | 556 | 557 | 558 | 559 | 562 | 565 | 566 | 567 | 568 | 569 | 570 | 574 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 587 | 588 | 589 | 590 | 591 | 592 | 601 | 607 | 608 | 609 |
Standard ABAP syntax/ based solutionSyntax/API to use instead in ABAP for Cloud Development
ABAP memory
24 | 25 | EXPORT <input variable> TO MEMORY ID <ID name>.
26 | 27 | IMPORT <parameter name> TO <output variable> FROM MEMORY ID <ID name>.
28 | 29 |  
31 | 32 | EXPORT <parameter name> = <input variable> 33 | 34 | TO INTERNAL TABLE / DATA BUFFER.
35 | 36 | IMPORT <parameter name> = <output variable> 37 | 38 | FROM INTERNAL TABLE / DATA BUFFER.
ABAP Object
Table:
45 | DD01L
46 | DD02L
47 | DD02V
48 | DD03L
49 | DD04L
Class:
51 | xco_cp_abap_dictionary
52 | xco_cp_database_table
53 | xco_cp_cds
54 | xco_cp_data_element
55 | xco_cp_domain
Access management
SAP Role x Profiles based access management 63 | 64 | Access Control based on Authority Object/Field, Restriction Type/Field, IAM app, CDS Access Control Object and Business Catalog/Role 65 |   66 |
67 | For the detailed solution , scroll down below to "Access management"
Application log
Tcode:
74 | SLG0
75 | SLG1
76 | Function module:
77 | BAL_LOG_CREATE
78 | BAL_LOG_MSG_ADD
79 | BAL_DB_SAVE
80 | BAL_DB_SEARCH
81 | BAL_LOG_MSG_READ
82 | BAL_DSP_TXT_MSG_READ
83 | Table:
84 | BALHDR
85 | BALDAT
Class:
87 | cl_bali_object_handler(CRUD application log object)
88 | cl_bali_log / cl_bali_header_setter(Write log)
89 | cl_bali_log_db/cl_bali_log_filter(Read log)
90 | xco_cp_bal
91 | Fiori app:
92 | Application logs
Calculation
ADD, SUBTRACT, MULTIPLY, DIVIDEADD-> + or += 100 | SUBTRACT->   – or –= 101 | MULTIPLY-> * or *= 102 | DIVIDE-> / or /=
Calendar(Factory calendar)
Tcode:
109 | SCAL
110 | Function module:
111 | FACTORYDATE_CONVERT_TO_DATE
112 | DATE_CONVERT_TO_FACTORYDATE
113 | CALCULATE_DATE
114 | RKE_SELECT_FACTDAYS_FOR_PERIOD
115 | Table:
116 | TFACD
117 | TFACS
Class:
119 | CL_FHC_CALENDAR_RUNTIME
120 | CDS views:
121 | I_FactoryCalendarBasic
122 | I_FactoryCalendarBasicText
123 | ....
124 | For the detailed solution , scroll down below to "Calendar(Factory calendar)"
Calendar(General)
Function module:
131 | MONTH_NAMES_GET
132 | WEEK_GET_FIRST_DAY
133 | DATE_GET_WEEK
Class:
135 | CL_SCAL_UTILS
Calendar(Public holidays)
Tcode:
142 | SCAL
143 | Function module:
144 | HOLIDAY_CHECK_AND_GET_INFO
145 | HOLIDAY_GET
146 | HOLIDAY_CALENDAR_GET
147 | Table:
148 | THOC
149 | THOCD
Class:
151 | CL_FHC_CALENDAR_RUNTIME
152 | CDS views:
153 | I_PublicHolidayCalendarBasic
154 | I_PublHolidayCalendarBasicText
155 | ...
156 | For the detailed solution , scroll down below to "Calendar(Public holidays)"
Call stack
Function module:
163 | SYSTEM_CALLSTACK
164 | SYSTEM_CALLSTACK_OF_PROCESS
Class: 166 | xco_cp_call_stack
Conversion(XSTRING, Binary, BASE64)
Function module:
173 | SCMS_BINARY_TO_XSTRING
174 | SCMS_BINARY_TO_STRING
175 | SCMS_XSTRING_TO_BINARY
176 | SCMS_STRING_TO_XSTRING
177 | SCMS_BASE64_ENCODE_STR
178 | SCMS_BASE64_DECODE_STR
Class:
180 | xco_cp=>xstring
181 | xco_cp_binary
Count itab rows
DESCRIBE TABLE lt_table line DATA(lv_count)DATA(lv_count) = lines( lt_table )
Date handling
Function module:
195 | CONVERT_DATE_TO_EXTERNAL
196 | CONVERT_DATE_TO_INTERNAL
197 | DATE_CONV_EXT_TO_INT
198 | DATE_CHECK_PLAUSIBILITY
199 | Class:
200 | cl_demo_date_time
201 | With write:
202 | WRITE sy-datum TO date.
Class:
204 | cl_abap_datfm
205 | cl_abap_timefm
206 | cl_abap_tstmp
Debugging
213 | 214 | SAP GUI based debugging
215 | 216 | Synatax:
217 | break-point
ABAP Development Tools based debugging
Documents change logs
Table:
225 | CDHDR
226 | CDPOS
227 | Tcode:
228 | SCDO
229 | Function module:
230 | CHANGEDOCUMENT_READ_HEADERS
231 | CHANGEDOCUMENT_READ_HEADERS
233 | Change Document Object
234 | Class:
235 | <name space>CL_<change document object name>_CHDO
236 | cl_chdo_read_tools
237 | ...
238 | For the detailed solution , scroll down below to "Change document logging"
Event Blocks
245 | LOAD-OF-PROGRAM
246 | INITIALIZATION
247 | AT SELECTION-SCREEN
248 | START-OF-SELECTION, etc..
Not allowed because 1. Program object is not allowed to be created 2. No dynpro allowed therefore no selection screen.
Excel upload to itab
Function module:
256 | GUI UPLOAD
257 | TEXT_CONVERT_XLS_TO_SAP
258 | ALSM_EXCEL_TO_INTERNAL_TABLE
259 | Class:
260 | cl_fdt_xl_spreadsheet
Class:
262 | xco_cp_xlsx
263 | xco_cp_xlsx_selection
264 | xco_cp_xlsx_read_access
265 | ...
266 | For the detailed solution , scroll down below to "Excel upload to itab"
Exchange rate
Table:
273 | TCURR
274 | V_TCURR
Class:
276 | cl_exchange_rates(only update and conversion)
277 | ...
278 | For reading the exchange rate, scroll down below to "Exchange rate"
Forms and printing
Tcode:
285 | SE71~SE77(SAP Script)
286 | SMARTFORMS, SMARTSTYLES(Smartforms)
287 | SFP(Adobe forms)
288 | Function module:
289 | OPEN_FORM
290 | START_FORM
291 | WRITE_FORM
292 | END_FORM
293 | CLOSE_FORM
294 | Call Function '<Smartform/Adobe form FM>'
Tool:
296 | Adobe LiveCycle Designer(for designing form layout)
297 | Services:
298 | Forms Service by Adobe(for rendering PDF forms built with Adobe LiveCycle Designer)
299 | Class:
300 | cl_print_queue_utils(writing print queues)
301 | Fiori app:
302 | Maintain print queues
303 | ...
304 | For the detailed solution , scroll down below to "Forms and printing"
Fiori programming model 
Gateway service builder SEGW 311 | BOPF frameworkRESTful ABAP Programming model (RAP)
HTTP Service
Tcode:
319 | SICF
320 | Interface:
321 | IF_HTTP_EXTENSION
ABAP object: 323 | Create HTTP service and implement logic in underlying ABAP class
Identity  Management
Table:
330 | AGR_USERS
331 | USR01
332 | USR03
333 | Tcode:
334 | PFCG
335 | SU01
336 | SU10
CDS View:
338 | I_IAMBusinessUserBusinessRole(Business Role assignment to Business User)
339 | I_IAMBusinessRole(Business Role)
340 | I_IAMBusinessUserLogonDetails (Business user login info)
341 | I_BusinessPartner(Employee general data)
342 | I_WorkplaceAddress(Employee address data)
343 | Class:
344 | cl_iam_business_role_factory
345 | cl_iam_business_user_factory
346 | Fiori app:
347 | Maintain Business User
348 | Maintain Business Roles
XML handling
Function module:
355 | SMUM_XML_PARSE
356 | SMUM_XML_CREATE
357 | SMUM_XML_CREATE_X
358 | TEXT_CONVERT_XML_TO_SAP
359 | Tcode:
360 | XSLT_TOOL
Class:
362 | cl_demo_xml_access
363 | cl_sxml_string_reader
364 | cl_sxml_string_writer
365 | cl_sxml_table_reader
366 | cl_sxml_table_writer
Job scheduling
Tcode:
373 | SM36
374 | SM37
375 | Function module:
376 | JOB_OPEN
377 | JOB_CLOSE
378 | JOB_SUBMIT
379 | BP_JOB_DELETE
380 | BP_JOB_READ
381 | SHOW_JOBSTATE
Fiori app:
383 | Application Jobs
384 | Application Job Templates
385 | Maintain Job Users
386 | Class:
387 | cl_apj_dt_create_content(Creating job catalog and template)
388 | cl_apj_rt_api(Start, change, delete job programmatically)
389 | ...
390 | For the detailed solution , scroll down below to "Job scheduling"
Large object handing(storing as MIME)
1.Use MIME Repository:
397 | Tcode:
398 | SMW0
399 | Class:
400 | CL_MIME_REPOSITORY_API
401 | CL_WB_MIME_REPOSITORY
402 | 2.Store as XSTRING in custom table:
403 | OPEN DATASET, TRANSFER, CLOSE DATAET(from application server)
404 | Function module:
405 | GUI_UPLOAD(upload from local)
406 | SCMS_BINARY_TO_XSTRING(conversion to xstring)
ABAP RAP with Large object handing CDS annotations:
408 | @Semantics.largeObject
409 | @Semantics.mimeType
410 | ...
411 | For the detailed solution , scroll down below to "Large object handling"
Lock object
Function module:
418 | ENQUEUE_E_TABLE
419 | DEQUEUE_E_TABLE
420 | DEQUEUE_ALL
Class: 422 | cl_abap_lock_object_factory
Loop group level processing
LOOP AT lt_tab ASSIGNING FIELD-SYMBOL(<tab>).
429 | AT NEW field1.
430 | ENDAT.
431 | ENDLOOP.
LOOP AT lt_table ASSIGNING FIELD-SYMBOL(<lw_table>)
433 | GROUP BY ( field1 = <lw_table>-field1 ).
434 | LOOP AT GROUP <lw_table> ASSIGNING FIELD-SYMBOL(<lw_field1>).ENDLOOP.
435 | ENDLOOP.
Number range
Tcode:
442 | SNRO
443 | Table:
444 | NRIV
445 | Function module:
446 | NUMBER_GET_NEXT
447 | NUMBER_CHECK
Class:
449 | cl_numberrange_objects(maintain number range object)
450 | cl_numberrange_intervals(maintain number range interval)
451 | cl_numberrange_runtime(get next number, check number)Fiori app:
452 | Manage number range intervals
Parallel processing
CALL FUNCTION … STARTING NEW TASKClass:
460 | cl_abap_parallel
461 | For the detailed solution , scroll down below to "Parallel processing"
Regex
DATA:lv_input TYPE string VALUE 'ABCDE12345'.
468 | REPLACE ALL OCCURRENCES OF
469 | REGEX '[A-Z]' IN lv_input
470 | WITH space.
Class:
472 | cl_abap_matcher
473 | cl_abap_regex
474 | xco_cp_regular_expression
475 | or
476 | DATA:lv_input TYPE string VALUE 'ABCDE12345'.
477 | REPLACE ALL OCCURRENCES OF
478 | PCRE '[A-Z]' IN lv_input
479 | WITH space.
RFC
Tcode:
486 | SE37
487 | SM59
ABAP object:
489 | For Outbound
490 | - Create outbound service with service type RFC
491 | - Create communication scenario for this outbound service
492 | For Inbound
493 | - Create function module and set the processing type as RFC
494 | - Create Communication Scenario and set the created RFC there as inbound service
495 | - Create Communication Arrangement for the Communication Scenario.
496 | - Client can now trigger the API created by Communication Arrangement to process the logic inside the function module.
497 | Class:
498 | cl_rfc_destination_provider(create instance of RFC destination)
Search string
DATA: text TYPE string VALUE `ABCDEFG`.
505 | SEARCH text FOR 'CD' IN CHARACTER MODE.
DATA: text TYPE string VALUE `ABCDEFG`.
507 | FIND 'CD' IN text IN CHARACTER MODE.
SOAP Service
Tcode:
514 | SOAMANAGER
515 | SPROXY
516 | Function module based web service creation
ABAP object:
518 | Create outbound service with service type SOAP
519 | Create communication scenario for this outbound service
520 | Class:
521 | cl_soap_destination_provider(create instance of SOAP destination)
522 | *Inbound SOAP service creation is not supported
System date, time, timezone
sy-datum
529 | sy-uzeit
530 | sy-zonlo
cl_abap_context_info=>get_system_date( )
532 | cl_abap_context_info=>get_system_time( )
533 | cl_abap_context_info=>get_user_time_zone(  )
System fields
Everything else than those specified on the rightsy-batch,  sy-dbcnt, sy-fdpos, sy-index, sy-index , sy-mandt, sy-mandt, sy-msgno, 541 | sy-msgty, sy-msgv1234, sy-subrc, sy-sysid, sy-tabix, sy-uname
Translation
SAP GUI based translation maintenanceClass:
549 | xco_cp_i18n
550 | Fiori app:
551 | Maintain translations
552 | ...
553 | For the detailed solution , scroll down below to "Translation"
Transport request
Table:
560 | E070
561 | E071
Class:
563 | xco_cp_cts
564 | xco_cp_transport
UI
571 | SAP GUI/WebGUI
572 | Write statement
573 | ALV
ADT output console
575 | Fiori app generate by ABAP UI service
576 | Fiori app generate by ABAP2UI5(open source)
577 | ...
578 | For the detailed solution , scroll down below to "UI"
UNIX timestamp
No easy way to convert UNIX timestamps without calculations.Class:
586 | xco_cp=>sy->unix_timestamp( )
Units of Measurement
Table:
593 | T006*
594 | Function Module:
595 | UNIT_CONVERSION_SIMPLE
596 | UNIT_GET
597 | MC_UNIT_CONVERSION
598 | CONVERSION_EXIT_CUNIT_INPUT
599 | Tcode:
600 | CUNI
Class:
602 | cl_uom_maintenance(Units of Measurement)
603 | cl_uom_dim_maintenance(Dimension)
604 | cl_uom_conversion
605 | CDS View:
606 | I_UnitOfMeasure
610 | 611 | 612 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/README.md: -------------------------------------------------------------------------------- 1 | # Large Object Handling in ABAP for Cloud Development 2 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zblob_test.tabl.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZBLOB_TEST 7 | E 8 | TRANSP 9 | X 10 | test large object 11 | E 12 | A 13 | 1 14 | 15 | 16 | ZBLOB_TEST 17 | A 18 | 0 19 | APPL0 20 | N 21 | 22 | 23 | 24 | CLIENT 25 | X 26 | 0 27 | C 28 | 000006 29 | X 30 | CLNT 31 | 000003 32 | CLNT 33 | 34 | 35 | DOCNUM 36 | X 37 | 0 38 | C 39 | 000020 40 | X 41 | CHAR 42 | 000010 43 | CHAR 44 | 45 | 46 | ATTACHMENT 47 | ZATTACHMENT 48 | 0 49 | E 50 | 51 | 52 | MIMETYPE 53 | 0 54 | C 55 | 000256 56 | CHAR 57 | 000128 58 | CHAR 59 | 60 | 61 | FILENAME 62 | 0 63 | C 64 | 000256 65 | CHAR 66 | 000128 67 | CHAR 68 | 69 | 70 | LOCAL_LAST_CHANGED_AT 71 | ABP_LOCINST_LASTCHANGE_TSTMPL 72 | 0 73 | E 74 | 75 | 76 | LAST_CHANGED_AT 77 | ABP_LASTCHANGE_TSTMPL 78 | 0 79 | E 80 | 81 | 82 | 83 | 84 | ZBLOB_TEST 85 | CUS_DEV_SUP_DA 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zc_blob_test.bdef.asbdef: -------------------------------------------------------------------------------- 1 | projection; 2 | strict ( 1 ); 3 | use draft; 4 | 5 | define behavior for ZC_BLOB_TEST alias BLOB_TEST 6 | use etag 7 | 8 | { 9 | use create; 10 | use update; 11 | use delete; 12 | 13 | use action Edit; 14 | use action Activate; 15 | use action Discard; 16 | use action Resume; 17 | use action Prepare; 18 | } -------------------------------------------------------------------------------- /src/LargeObjectHandling/zc_blob_test.bdef.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZC_BLOB_TEST 7 | BDEF/BDO 8 | ##GENERATED Large Object Test 9 | 60 10 | EN 11 | 12 | 13 | ./zc_blob_test/source/main/versions 14 | http://www.sap.com/adt/relations/versions 15 | Historic versions 16 | 17 | 18 | ./zc_blob_test/source/main 19 | http://www.sap.com/adt/relations/source 20 | text/plain 21 | Source Content 22 | 23 | 24 | ./zc_blob_test/source/main 25 | http://www.sap.com/adt/relations/source 26 | text/html 27 | Source Content (HTML) 28 | 29 | 30 | EN 31 | 5 32 | ./zc_blob_test/source/main 33 | ABAP_SOURCE 34 | true 35 | true 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zc_blob_test.ddls.asddls: -------------------------------------------------------------------------------- 1 | @AccessControl.authorizationCheck: #CHECK 2 | @Metadata.allowExtensions: true 3 | @EndUserText.label: 'Projection View for ZI_BLOB_TEST' 4 | @ObjectModel.semanticKey: [ 'Docnum' ] 5 | define root view entity ZC_BLOB_TEST 6 | provider contract transactional_query 7 | as projection on ZI_BLOB_TEST 8 | { 9 | key Docnum, 10 | Attachment, 11 | Mimetype, 12 | Filename, 13 | LocalLastChangedAt 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zc_blob_test.ddls.baseinfo: -------------------------------------------------------------------------------- 1 | { 2 | "BASEINFO": 3 | { 4 | "FROM": 5 | [ 6 | "ZI_BLOB_TEST" 7 | ], 8 | "ASSOCIATED": 9 | [], 10 | "BASE": 11 | [], 12 | "ANNO_REF": 13 | [], 14 | "SCALAR_FUNCTION": 15 | [], 16 | "VERSION":0, 17 | "ANNOREF_EVALUATION_ERROR":"" 18 | } 19 | } -------------------------------------------------------------------------------- /src/LargeObjectHandling/zc_blob_test.ddls.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZC_BLOB_TEST 7 | E 8 | ##GENERATED Large Object Test 9 | P 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zc_blob_test.ddlx.asddlxs: -------------------------------------------------------------------------------- 1 | @Metadata.layer: #CORE 2 | @UI: { 3 | headerInfo: { 4 | typeName: 'BLOB_TEST', 5 | typeNamePlural: 'BLOB_TESTs' 6 | } 7 | } 8 | annotate view ZC_BLOB_TEST with 9 | { 10 | @UI.facet: [ { 11 | id: 'idIdentification', 12 | type: #IDENTIFICATION_REFERENCE, 13 | label: 'BLOB_TEST', 14 | position: 10 15 | } 16 | 17 | ] 18 | @UI.lineItem: [ { 19 | position: 10 , 20 | importance: #MEDIUM, 21 | label: 'Docnum' 22 | } ] 23 | @UI.identification: [ { 24 | position: 10 , 25 | label: 'Docnum' 26 | } ] 27 | @EndUserText: { 28 | label: 'Document number' 29 | } 30 | Docnum; 31 | 32 | @UI.lineItem: [ { 33 | position: 20 , 34 | importance: #MEDIUM, 35 | label: '' 36 | } ] 37 | @UI.identification: [ { 38 | position: 20 , 39 | label: '' 40 | } ] 41 | @UI: 42 | { fieldGroup: [ { position: 50, qualifier: 'Upload' , label: 'Attachment'} ]} 43 | @EndUserText: { 44 | label: 'Attachment' 45 | } 46 | Attachment; 47 | 48 | @UI.lineItem: [ { 49 | position: 30 , 50 | importance: #MEDIUM, 51 | label: 'Mimetype' 52 | } ] 53 | @UI.identification: [ { 54 | position: 30 , 55 | label: 'Mimetype' 56 | } ] 57 | @EndUserText: { 58 | label: 'Mimetype' 59 | } 60 | Mimetype; 61 | 62 | @UI.lineItem: [ { 63 | position: 40 , 64 | importance: #MEDIUM, 65 | label: 'Filename' 66 | } ] 67 | @UI.identification: [ { 68 | position: 40 , 69 | label: 'Filename' 70 | } ] 71 | @EndUserText: { 72 | label: 'Filename' 73 | } 74 | Filename; 75 | 76 | @UI.hidden: true 77 | LocalLastChangedAt; 78 | } -------------------------------------------------------------------------------- /src/LargeObjectHandling/zc_blob_test.ddlx.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | ZC_BLOB_TEST 8 | ##GENERATED Large Object Test 9 | EN 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zcl_blob_test.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_blob_test DEFINITION 2 | PUBLIC 3 | ABSTRACT 4 | FINAL 5 | FOR BEHAVIOR OF zi_blob_test . 6 | 7 | PUBLIC SECTION. 8 | PROTECTED SECTION. 9 | PRIVATE SECTION. 10 | ENDCLASS. 11 | 12 | 13 | 14 | CLASS ZCL_BLOB_TEST IMPLEMENTATION. 15 | ENDCLASS. 16 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zcl_blob_test.clas.locals_imp.abap: -------------------------------------------------------------------------------- 1 | CLASS lhc_blob_test DEFINITION INHERITING FROM cl_abap_behavior_handler. 2 | PRIVATE SECTION. 3 | METHODS: 4 | get_global_authorizations FOR GLOBAL AUTHORIZATION 5 | IMPORTING 6 | REQUEST requested_authorizations FOR blob_test 7 | RESULT result. 8 | ENDCLASS. 9 | 10 | CLASS lhc_blob_test IMPLEMENTATION. 11 | METHOD get_global_authorizations. 12 | IF requested_authorizations-%create EQ if_abap_behv=>mk-on. 13 | * check create authorization 14 | AUTHORITY-CHECK OBJECT 'ZAUTH_OBJ' ID 'ACTVT' FIELD '01'. 15 | result-%create = COND #( WHEN sy-subrc = 0 THEN 16 | if_abap_behv=>auth-allowed ELSE 17 | if_abap_behv=>auth-unauthorized ). 18 | ENDIF. 19 | 20 | IF requested_authorizations-%update EQ if_abap_behv=>mk-on. 21 | * check update authorization 22 | AUTHORITY-CHECK OBJECT 'ZAUTH_OBJ' ID 'ACTVT' FIELD '02'. 23 | result-%update = COND #( WHEN sy-subrc = 0 THEN 24 | if_abap_behv=>auth-allowed ELSE 25 | if_abap_behv=>auth-unauthorized ). 26 | ENDIF. 27 | ENDMETHOD. 28 | ENDCLASS. 29 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zcl_blob_test.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_BLOB_TEST 7 | E 8 | ##GENERATED Behavior implementation 9 | 06 10 | 1 11 | X 12 | X 13 | X 14 | ZI_BLOB_TEST 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zi_blob_test.bdef.asbdef: -------------------------------------------------------------------------------- 1 | managed implementation in class ZCL_BLOB_TEST unique; 2 | strict ( 1 ); 3 | with draft; 4 | 5 | define own authorization context 6 | { 7 | 'ZAUTH_OBJ'; 8 | } 9 | 10 | define behavior for ZI_BLOB_TEST alias BLOB_TEST 11 | persistent table zblob_test 12 | draft table ziblob_test_d 13 | etag master LocalLastChangedAt 14 | lock master total etag LastChangedAt 15 | authorization master ( global ) 16 | 17 | { 18 | field ( mandatory : create ) 19 | Docnum; 20 | 21 | field ( readonly ) 22 | LastChangedAt, 23 | LocalLastChangedAt; 24 | 25 | field ( readonly : update ) 26 | Docnum; 27 | 28 | 29 | create; 30 | update; 31 | delete; 32 | 33 | draft action Edit; 34 | draft action Activate; 35 | draft action Discard; 36 | draft action Resume; 37 | draft determine action Prepare; 38 | mapping for zblob_test 39 | { 40 | Docnum = docnum; 41 | Attachment = attachment; 42 | Mimetype = mimetype; 43 | Filename = filename; 44 | LocalLastChangedAt = local_last_changed_at; 45 | LastChangedAt = last_changed_at; 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/LargeObjectHandling/zi_blob_test.bdef.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZI_BLOB_TEST 7 | BDEF/BDO 8 | ##GENERATED Large Object Test 9 | 60 10 | EN 11 | 12 | 13 | ./zi_blob_test/source/main/versions 14 | http://www.sap.com/adt/relations/versions 15 | Historic versions 16 | 17 | 18 | ./zi_blob_test/source/main 19 | http://www.sap.com/adt/relations/source 20 | text/plain 21 | Source Content 22 | 23 | 24 | ./zi_blob_test/source/main 25 | http://www.sap.com/adt/relations/source 26 | text/html 27 | Source Content (HTML) 28 | 29 | 30 | EN 31 | 5 32 | ./zi_blob_test/source/main 33 | ABAP_SOURCE 34 | true 35 | true 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zi_blob_test.ddls.asddls: -------------------------------------------------------------------------------- 1 | @AccessControl.authorizationCheck: #CHECK 2 | @EndUserText.label: '##GENERATED Large Object Test' 3 | define root view entity ZI_BLOB_TEST 4 | as select from zblob_test as BLOB_TEST 5 | { 6 | key docnum as Docnum, 7 | @Semantics.largeObject: 8 | { mimeType: 'Mimetype', 9 | fileName: 'Filename', 10 | contentDispositionPreference: #INLINE } 11 | attachment as Attachment, 12 | @Semantics.mimeType: true 13 | mimetype as Mimetype, 14 | filename as Filename, 15 | @Semantics.systemDateTime.localInstanceLastChangedAt: true 16 | local_last_changed_at as LocalLastChangedAt, 17 | @Semantics.systemDateTime.lastChangedAt: true 18 | last_changed_at as LastChangedAt 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zi_blob_test.ddls.baseinfo: -------------------------------------------------------------------------------- 1 | { 2 | "BASEINFO": 3 | { 4 | "FROM": 5 | [ 6 | "ZBLOB_TEST" 7 | ], 8 | "ASSOCIATED": 9 | [], 10 | "BASE": 11 | [], 12 | "ANNO_REF": 13 | [], 14 | "SCALAR_FUNCTION": 15 | [], 16 | "VERSION":0, 17 | "ANNOREF_EVALUATION_ERROR":"" 18 | } 19 | } -------------------------------------------------------------------------------- /src/LargeObjectHandling/zi_blob_test.ddls.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZI_BLOB_TEST 7 | E 8 | ##GENERATED Large Object Test 9 | W 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/ziblob_test_d.tabl.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZIBLOB_TEST_D 7 | E 8 | TRANSP 9 | X 10 | X 11 | ##GENERATED Large Object Test 12 | E 13 | A 14 | 4 15 | 16 | 17 | ZIBLOB_TEST_D 18 | A 19 | 0 20 | APPL0 21 | N 22 | 23 | 24 | 25 | MANDT 26 | X 27 | MANDT 28 | 0 29 | X 30 | E 31 | 32 | 33 | DOCNUM 34 | X 35 | 0 36 | C 37 | 000020 38 | X 39 | CHAR 40 | 000010 41 | CHAR 42 | 43 | 44 | ATTACHMENT 45 | ZATTACHMENT 46 | 0 47 | E 48 | 49 | 50 | MIMETYPE 51 | 0 52 | C 53 | 000256 54 | CHAR 55 | 000128 56 | CHAR 57 | 58 | 59 | FILENAME 60 | 0 61 | C 62 | 000256 63 | CHAR 64 | 000128 65 | CHAR 66 | 67 | 68 | LOCALLASTCHANGEDAT 69 | ABP_LOCINST_LASTCHANGE_TSTMPL 70 | 0 71 | E 72 | 73 | 74 | LASTCHANGEDAT 75 | ABP_LASTCHANGE_TSTMPL 76 | 0 77 | E 78 | 79 | 80 | .INCLUDE 81 | 0 82 | SYCH_BDL_DRAFT_ADMIN_INC 83 | S 84 | Standard Include for Draft Administration (BDL Syntax Check) 85 | S 86 | %ADMIN 87 | 88 | 89 | 90 | 91 | ZIBLOB_TEST_D 92 | CUS_DEV_SUP_DA 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zsrv_b_blob_test.srvb.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | ZSRV_B_BLOB_TEST 8 | SRVB/SVB 9 | ##GENERATED Large Object Test 10 | EN 11 | 12 | 13 | versions 14 | http://www.sap.com/adt/relations/versions 15 | Historic versions 16 | 17 | 18 | /sap/bc/adt/businessservices/odatav4/ZSRV_B_BLOB_TEST 19 | http://www.sap.com/categories/odatav4 20 | application/vnd.sap.adt.businessservices.odatav4.v1+xml 21 | ODATAV4 22 | 23 | 24 | /sap/bc/adt/businessservices/testclass 25 | http://www.sap.com/categories/testclass 26 | application/vnd.sap.adt.businessservices.testclass.v1+xml 27 | TESTCLASS 28 | 29 | 30 | /sap/bc/adt/businessservices/testclass 31 | http://www.sap.com/categories/testclass 32 | application/vnd.sap.adt.businessservices.testclassv4.v1+xml 33 | TESTCLASSV4 34 | 35 | 36 | /sap/bc/adt/businessservices/semanticversion 37 | http://www.sap.com/categories/semanticversion 38 | application/vnd.sap.adt.businessservices.semanticversion.v1+xml 39 | SemanticVersion 40 | 41 | 42 | EN 43 | 5 44 | 45 | 46 | 47 | ZSRV_B_BLOB_TEST 48 | 49 | ODATA 50 | V4 51 | 52 | 53 | ZSRV_D_BLOB_TEST 54 | 55 | 56 | 0001 57 | NOT_RELEASED 58 | 59 | /sap/bc/adt/ddic/srvd/sources/zsrv_d_blob_test 60 | SRVD/SRV 61 | ZSRV_D_BLOB_TEST 62 | 63 | 64 | 65 | base64 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | C1 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zsrv_b_blob_test_0001_g4ba.sco2.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZSRV_B_BLOB_TEST_0001_G4BA 7 | G4BA 8 | ZSRV_B_BLOB_TEST 9 | X 10 | 5 11 | ZSRV_B_BLOB_TEST_0001_G4BA 12 | ZSRV_B_BLOB_TEST 13 | 5 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/LargeObjectHandling/zsrv_d_blob_test.srvd.srvdsrv: -------------------------------------------------------------------------------- 1 | @EndUserText.label: 'Service definition forZC_BLOB_TEST' 2 | define service ZSRV_D_BLOB_TEST { 3 | expose ZC_BLOB_TEST as BLOB_TEST; 4 | } -------------------------------------------------------------------------------- /src/LargeObjectHandling/zsrv_d_blob_test.srvd.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZSRV_D_BLOB_TEST 7 | SRVD/SRV 8 | ##GENERATED Large Object Test 9 | EN 10 | EN 11 | ./zsrv_d_blob_test/source/main 12 | ABAP_SOURCE 13 | ABAP Development Tools 14 | S 15 | Definition 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/package.devc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ABAP Cloud cheat sheet 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/zabap_memory.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zabap_memory DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | INTERFACES: if_oo_adt_classrun. 8 | PROTECTED SECTION. 9 | PRIVATE SECTION. 10 | ENDCLASS. 11 | 12 | CLASS zabap_memory IMPLEMENTATION. 13 | 14 | METHOD if_oo_adt_classrun~main. 15 | 16 | "ABAP memory using internal table 17 | TYPES: 18 | BEGIN OF bline, 19 | id TYPE i, 20 | clstr TYPE x LENGTH 100, 21 | END OF bline. 22 | DATA: lt_input_b TYPE TABLE OF bline WITH EMPTY KEY, 23 | lt_input TYPE STANDARD TABLE OF I_UnitOfMeasure, 24 | lt_output TYPE STANDARD TABLE OF I_UnitOfMeasure. 25 | 26 | SELECT * FROM I_UnitOfMeasure INTO TABLE @lt_input. 27 | EXPORT input = lt_input TO INTERNAL TABLE lt_input_b. 28 | IMPORT input = lt_output FROM INTERNAL TABLE lt_input_b. 29 | 30 | "ABAP memory using buffer 31 | DATA:buffer TYPE xstring, 32 | lt_input_bf TYPE STANDARD TABLE OF I_UnitOfMeasure, 33 | lt_output_bf TYPE STANDARD TABLE OF I_UnitOfMeasure. 34 | 35 | SELECT * FROM I_UnitOfMeasure INTO TABLE @lt_input_bf. 36 | EXPORT input = lt_input_bf TO DATA BUFFER buffer. 37 | IMPORT input = lt_output_bf FROM DATA BUFFER buffer. 38 | 39 | ENDMETHOD. 40 | ENDCLASS. 41 | -------------------------------------------------------------------------------- /src/zabap_memory.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZABAP_MEMORY 7 | E 8 | Test class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | I 17 | 001 18 | Max length 23 19 | 23 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/zattachment.dtel.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZATTACHMENT 7 | E 8 | 55 9 | 10 10 | 20 11 | 40 12 | attachment data element 13 | Attachment 14 | Attachment 15 | Attachment 16 | Attachment 17 | E 18 | RSTR 19 | 5 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/zcalendar.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcalendar DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | PUBLIC SECTION. 6 | INTERFACES: if_oo_adt_classrun. 7 | PROTECTED SECTION. 8 | PRIVATE SECTION. 9 | ENDCLASS. 10 | 11 | CLASS zcalendar IMPLEMENTATION. 12 | 13 | METHOD if_oo_adt_classrun~main. 14 | 15 | "Factory Canlendar 16 | "Add 2 days from a date considering factory calendar 17 | DATA(lo_factorycalendar) = cl_fhc_calendar_runtime=>create_factorycalendar_runtime( iv_factorycalendar_id = 'SAP_CA' ). "Canada 18 | lo_factorycalendar->add_workingdays_to_date( 19 | EXPORTING 20 | iv_start = '20221230' 21 | iv_number_of_workingdays = 2 22 | RECEIVING 23 | rv_end = DATA(lv_end) "Result is 20230103 24 | ). 25 | 26 | " Holiday Canlendar 27 | DATA(lo_holidaycalendar) = cl_fhc_calendar_runtime=>create_holidaycalendar_runtime( 28 | EXPORTING 29 | iv_holidaycalendar_id = 'SAP_CA' ). "Canada 30 | 31 | "Check if the data is a holiday in Canada 32 | lo_holidaycalendar->is_holiday( 33 | EXPORTING 34 | iv_date = '20230101' 35 | RECEIVING 36 | rv_holiday = DATA(lv_result) 37 | ). 38 | 39 | "Get holiday information for 20230101 40 | DATA: lv_date TYPE lo_holidaycalendar->ty_fhc_date VALUE '20230101'. 41 | DATA(lo_holidays) = lo_holidaycalendar->get_holiday( 42 | EXPORTING 43 | iv_date = lv_date 44 | ). 45 | 46 | lo_holidays->get_text( 47 | EXPORTING 48 | iv_language = sy-langu 49 | RECEIVING 50 | rs_text = DATA(ls_text) 51 | ). 52 | 53 | ENDMETHOD. 54 | ENDCLASS. 55 | -------------------------------------------------------------------------------- /src/zcalendar.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCALENDAR 7 | E 8 | Test class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | I 17 | 001 18 | Max length 23 19 | 23 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/zchange_document.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zchange_document DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | PUBLIC SECTION. 6 | INTERFACES: if_oo_adt_classrun. 7 | PROTECTED SECTION. 8 | PRIVATE SECTION. 9 | ENDCLASS. 10 | 11 | CLASS zchange_document IMPLEMENTATION. 12 | METHOD if_oo_adt_classrun~main. 13 | "Change document 14 | DATA:lt_xzcd_test TYPE zcl_zobj_cd_test_chdo=>tt_zcd_test, 15 | lt_yzcd_test TYPE zcl_zobj_cd_test_chdo=>tt_zcd_test, 16 | lv_username TYPE if_chdo_object_tools_rel=>ty_cdusername. 17 | 18 | DATA(lv_sys_datum) = cl_abap_context_info=>get_system_date( ). 19 | DATA(lv_sys_time) = cl_abap_context_info=>get_system_time( ). 20 | DATA(lv_user) = cl_abap_context_info=>get_user_formatted_name( ). 21 | lv_username = lv_user. 22 | 23 | APPEND INITIAL LINE TO lt_xzcd_test ASSIGNING FIELD-SYMBOL(). 24 | -employeeid = '0000000001'. 25 | -role = 'Developer'. "New value 26 | APPEND INITIAL LINE TO lt_yzcd_test ASSIGNING FIELD-SYMBOL(). 27 | -employeeid = '0000000001'. 28 | -role = 'Solution designer'. "Old value 29 | 30 | zcl_zobj_cd_test_chdo=>write( 31 | EXPORTING 32 | objectid = 'ZOBJ_CD_TEST' 33 | utime = lv_sys_time 34 | udate = lv_sys_datum 35 | username = lv_username 36 | * planned_change_number = 37 | object_change_indicator = 'U' 38 | * planned_or_real_changes = 39 | * no_change_pointers = 40 | xzcd_test = lt_xzcd_test 41 | yzcd_test = lt_yzcd_test 42 | upd_zcd_test = 'U' 43 | IMPORTING 44 | changenumber = DATA(lv_changenumbner) 45 | ). 46 | 47 | cl_chdo_read_tools=>changedocument_read( 48 | EXPORTING 49 | i_objectclass = 'ZOBJ_CD_TEST' 50 | IMPORTING 51 | et_cdredadd_tab = DATA(lt_cdredadd_tab) 52 | ). 53 | 54 | ENDMETHOD. 55 | ENDCLASS. 56 | -------------------------------------------------------------------------------- /src/zchange_document.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCHANGE_DOCUMENT 7 | E 8 | Test class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | I 17 | 001 18 | Max length 23 19 | 23 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/zcl_job_schedule_apj.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_job_schedule_apj DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | INTERFACES if_apj_dt_exec_object. 8 | INTERFACES if_apj_rt_exec_object. 9 | PROTECTED SECTION. 10 | PRIVATE SECTION. 11 | ENDCLASS. 12 | 13 | 14 | 15 | CLASS ZCL_JOB_SCHEDULE_APJ IMPLEMENTATION. 16 | 17 | 18 | METHOD if_apj_dt_exec_object~get_parameters. 19 | 20 | " Return the supported selection parameters here 21 | et_parameter_def = VALUE #( 22 | ( selname = 'S_ID' kind = if_apj_dt_exec_object=>select_option datatype = 'C' length = 10 param_text = 'ID' changeable_ind = abap_true ) 23 | ( selname = 'P_DESCR' kind = if_apj_dt_exec_object=>parameter datatype = 'C' length = 80 param_text = 'Description' lowercase_ind = abap_true changeable_ind = abap_true ) 24 | ( selname = 'P_SIMUL' kind = if_apj_dt_exec_object=>parameter datatype = 'C' length = 1 param_text = 'Simulate Only' checkbox_ind = abap_true changeable_ind = abap_true ) 25 | ). 26 | 27 | " Return the default parameters values here 28 | et_parameter_val = VALUE #( 29 | ( selname = 'S_ID' kind = if_apj_dt_exec_object=>select_option sign = 'I' option = 'EQ' low = '1001' ) 30 | ( selname = 'P_DESCR' kind = if_apj_dt_exec_object=>parameter sign = 'I' option = 'EQ' low = 'Application Job Description' ) 31 | ( selname = 'P_SIMUL' kind = if_apj_dt_exec_object=>parameter sign = 'I' option = 'EQ' low = abap_true ) 32 | ). 33 | 34 | ENDMETHOD. 35 | 36 | 37 | METHOD if_apj_rt_exec_object~execute. 38 | "Execution logic when the job is started 39 | TYPES ty_id TYPE c LENGTH 10. 40 | 41 | DATA s_id TYPE RANGE OF ty_id. 42 | DATA p_descr TYPE c LENGTH 80. 43 | DATA p_count TYPE i. 44 | DATA p_simul TYPE abap_boolean. 45 | 46 | " Getting the actual parameter values(Just for show. Not needed for the logic below) 47 | LOOP AT it_parameters INTO DATA(ls_parameter). 48 | CASE ls_parameter-selname. 49 | WHEN 'S_ID'. 50 | APPEND VALUE #( sign = ls_parameter-sign 51 | option = ls_parameter-option 52 | low = ls_parameter-low 53 | high = ls_parameter-high ) TO s_id. 54 | WHEN 'P_DESCR'. 55 | p_descr = ls_parameter-low. 56 | WHEN 'P_SIMUL'. 57 | p_simul = ls_parameter-low. 58 | ENDCASE. 59 | ENDLOOP. 60 | 61 | "Implement the job execution 62 | DATA: lt_input TYPE STANDARD TABLE OF zcd_test. 63 | lt_input = VALUE #( ( employeeid = '0000000001' 64 | firstname = 'Aocheng' 65 | lastname = 'Yang' 66 | role = 'Solution designer2' ) ). 67 | 68 | MODIFY zcd_test FROM TABLE @lt_input. 69 | ENDMETHOD. 70 | ENDCLASS. 71 | -------------------------------------------------------------------------------- /src/zcl_job_schedule_apj.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_JOB_SCHEDULE_APJ 7 | E 8 | Schedule job APJ 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zcl_job_template_apj.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_job_template_apj DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | INTERFACES if_oo_adt_classrun. 8 | PROTECTED SECTION. 9 | PRIVATE SECTION. 10 | ENDCLASS. 11 | 12 | 13 | 14 | CLASS ZCL_JOB_TEMPLATE_APJ IMPLEMENTATION. 15 | 16 | 17 | METHOD if_oo_adt_classrun~main. 18 | DATA(lo_apj_create) = cl_apj_dt_create_content=>get_instance( ). 19 | " Create job catalog 20 | lo_apj_create->create_job_cat_entry( 21 | iv_catalog_name = 'Z_TESTJOB_CATALOG' 22 | iv_class_name = 'zcl_job_schedule_apj' 23 | iv_text = 'Job catalog text' 24 | iv_catalog_entry_type = cl_apj_dt_create_content=>class_based 25 | iv_transport_request = 'H01K900008' 26 | iv_package = 'ZSANDBOX' 27 | ). 28 | out->write( |Job catalog entry created successfully| ). 29 | 30 | " Create job template 31 | DATA lt_parameters TYPE if_apj_dt_exec_object=>tt_templ_val. 32 | 33 | NEW zcl_job_schedule_apj( )->if_apj_dt_exec_object~get_parameters( 34 | IMPORTING 35 | et_parameter_val = lt_parameters 36 | ). 37 | 38 | lo_apj_create->create_job_template_entry( 39 | iv_template_name = 'Z_TESTJOB_TEMPLATE' 40 | iv_catalog_name = 'Z_TESTJOB_CATALOG' 41 | iv_text = 'Job template text' 42 | it_parameters = lt_parameters 43 | iv_transport_request = 'H01K900008' 44 | iv_package = 'ZSANDBOX' 45 | ). 46 | out->write( |Job template created successfully| ). 47 | 48 | ENDMETHOD. 49 | ENDCLASS. 50 | -------------------------------------------------------------------------------- /src/zcl_job_template_apj.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_JOB_TEMPLATE_APJ 7 | E 8 | Create application job template 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zcl_paralell1.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_paralell1 DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | TYPES ty_t_time TYPE STANDARD TABLE OF cl_abap_context_info=>ty_system_time WITH DEFAULT KEY. 8 | INTERFACES if_abap_parallel. 9 | METHODS get_time RETURNING VALUE(rt_time) TYPE ty_t_time. 10 | METHODS get_wp_number RETURNING VALUE(rv_wp_number) TYPE char3. 11 | 12 | PROTECTED SECTION. 13 | PRIVATE SECTION. 14 | DATA gt_time_1 TYPE TABLE OF cl_abap_context_info=>ty_system_time. 15 | DATA gv_wp_number TYPE char3. 16 | ENDCLASS. 17 | 18 | 19 | 20 | CLASS ZCL_PARALELL1 IMPLEMENTATION. 21 | 22 | 23 | METHOD get_wp_number. 24 | rv_wp_number = gv_wp_number. 25 | ENDMETHOD. 26 | 27 | 28 | METHOD get_time. 29 | rt_time = gt_time_1. 30 | ENDMETHOD. 31 | 32 | 33 | METHOD if_abap_parallel~do. 34 | DO 3 TIMES. 35 | WAIT UP TO 2 SECONDS. 36 | DATA(lv_system_time) = cl_abap_context_info=>get_system_time( ). 37 | APPEND lv_system_time TO gt_time_1. 38 | ENDDO. 39 | 40 | gv_wp_number = '001'. 41 | ENDMETHOD. 42 | ENDCLASS. 43 | -------------------------------------------------------------------------------- /src/zcl_paralell1.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PARALELL1 7 | E 8 | Paralell class 1 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zcl_paralell2.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_paralell2 DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | TYPES ty_t_time TYPE STANDARD TABLE OF cl_abap_context_info=>ty_system_time WITH DEFAULT KEY. 8 | INTERFACES if_abap_parallel. 9 | METHODS get_time RETURNING VALUE(rt_time) TYPE ty_t_time. 10 | METHODS get_wp_number RETURNING VALUE(rv_wp_number) TYPE char3. 11 | PROTECTED SECTION. 12 | PRIVATE SECTION. 13 | DATA gt_time_2 TYPE TABLE OF cl_abap_context_info=>ty_system_time. 14 | DATA gv_wp_number TYPE char3. 15 | ENDCLASS. 16 | 17 | 18 | 19 | CLASS ZCL_PARALELL2 IMPLEMENTATION. 20 | 21 | 22 | METHOD get_wp_number. 23 | rv_wp_number = gv_wp_number. 24 | ENDMETHOD. 25 | 26 | 27 | METHOD get_time. 28 | rt_time = gt_time_2. 29 | ENDMETHOD. 30 | 31 | 32 | METHOD if_abap_parallel~do. 33 | DO 3 TIMES. 34 | WAIT UP TO 2 SECONDS. 35 | DATA(lv_system_time) = cl_abap_context_info=>get_system_time( ). 36 | APPEND lv_system_time TO gt_time_2. 37 | 38 | ENDDO. 39 | gv_wp_number = '002'. 40 | ENDMETHOD. 41 | ENDCLASS. 42 | -------------------------------------------------------------------------------- /src/zcl_paralell2.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_PARALELL2 7 | E 8 | Paralell class 1 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zcl_zobj_cd_test_chdo.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zcl_zobj_cd_test_chdo DEFINITION 2 | PUBLIC 3 | CREATE PUBLIC . 4 | 5 | PUBLIC SECTION. 6 | 7 | INTERFACES if_chdo_enhancements . 8 | 9 | TYPES: 10 | BEGIN OF ty_zcd_test . 11 | INCLUDE TYPE zcd_test. 12 | INCLUDE TYPE if_chdo_object_tools_rel=>ty_icdind. 13 | TYPES END OF ty_zcd_test . 14 | TYPES: 15 | tt_zcd_test TYPE STANDARD TABLE OF ty_zcd_test . 16 | 17 | CLASS-DATA objectclass TYPE if_chdo_object_tools_rel=>ty_cdobjectcl READ-ONLY VALUE 'ZOBJ_CD_TEST' ##NO_TEXT. 18 | 19 | CLASS-METHODS write 20 | IMPORTING 21 | !objectid TYPE if_chdo_object_tools_rel=>ty_cdobjectv 22 | !utime TYPE if_chdo_object_tools_rel=>ty_cduzeit 23 | !udate TYPE if_chdo_object_tools_rel=>ty_cddatum 24 | !username TYPE if_chdo_object_tools_rel=>ty_cdusername 25 | !planned_change_number TYPE if_chdo_object_tools_rel=>ty_planchngnr DEFAULT space 26 | !object_change_indicator TYPE if_chdo_object_tools_rel=>ty_cdchngindh DEFAULT 'U' 27 | !planned_or_real_changes TYPE if_chdo_object_tools_rel=>ty_cdflag DEFAULT space 28 | !no_change_pointers TYPE if_chdo_object_tools_rel=>ty_cdflag DEFAULT space 29 | !xzcd_test TYPE tt_zcd_test OPTIONAL 30 | !yzcd_test TYPE tt_zcd_test OPTIONAL 31 | !upd_zcd_test TYPE if_chdo_object_tools_rel=>ty_cdchngindh DEFAULT space 32 | EXPORTING 33 | VALUE(changenumber) TYPE if_chdo_object_tools_rel=>ty_cdchangenr 34 | RAISING 35 | cx_chdo_write_error . 36 | PROTECTED SECTION. 37 | PRIVATE SECTION. 38 | ENDCLASS. 39 | 40 | 41 | 42 | CLASS ZCL_ZOBJ_CD_TEST_CHDO IMPLEMENTATION. 43 | 44 | 45 | METHOD write. 46 | *"---------------------------------------------------------------------- 47 | *" this WRITE method is generated for object ZOBJ_CD_TEST 48 | *" never change it manually, please! :07/31/2023 49 | *" All changes will be overwritten without a warning! 50 | *" 51 | *" CX_CHDO_WRITE_ERROR is used for error handling 52 | *"---------------------------------------------------------------------- 53 | 54 | DATA: l_upd TYPE if_chdo_object_tools_rel=>ty_cdchngind. 55 | 56 | CALL METHOD cl_chdo_write_tools=>changedocument_open 57 | EXPORTING 58 | objectclass = objectclass 59 | objectid = objectid 60 | planned_change_number = planned_change_number 61 | planned_or_real_changes = planned_or_real_changes. 62 | 63 | IF ( yzcd_test IS INITIAL ) AND 64 | ( xzcd_test IS INITIAL ). 65 | l_upd = space. 66 | ELSE. 67 | l_upd = upd_zcd_test. 68 | ENDIF. 69 | 70 | IF l_upd NE space. 71 | CALL METHOD cl_chdo_write_tools=>changedocument_multiple_case 72 | EXPORTING 73 | tablename = 'ZCD_TEST' 74 | change_indicator = upd_zcd_test 75 | docu_delete = 'X' 76 | docu_insert = 'X' 77 | docu_delete_if = '' 78 | docu_insert_if = '' 79 | table_old = yzcd_test 80 | table_new = xzcd_test. 81 | ENDIF. 82 | 83 | CALL METHOD cl_chdo_write_tools=>changedocument_close 84 | EXPORTING 85 | objectclass = objectclass 86 | objectid = objectid 87 | date_of_change = udate 88 | time_of_change = utime 89 | username = username 90 | object_change_indicator = object_change_indicator 91 | no_change_pointers = no_change_pointers 92 | IMPORTING 93 | changenumber = changenumber. 94 | 95 | ENDMETHOD. 96 | 97 | 98 | METHOD if_chdo_enhancements~authority_check. 99 | "No Auth check performed. Allow all 100 | rv_is_authorized = 'X'. 101 | ENDMETHOD. 102 | ENDCLASS. 103 | -------------------------------------------------------------------------------- /src/zcl_zobj_cd_test_chdo.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZCL_ZOBJ_CD_TEST_CHDO 7 | E 8 | Generated class for object:ZOBJ_CD_TEST 9 | 1 10 | X 11 | X 12 | 13 | 14 | 15 | ZCL_ZOBJ_CD_TEST_CHDO 16 | OBJECTCLASS 17 | E 18 | Object Class 19 | 20 | 21 | ZCL_ZOBJ_CD_TEST_CHDO 22 | TT_ZCD_TEST 23 | E 24 | Generated Table Type: ZCD_TEST 25 | 26 | 27 | ZCL_ZOBJ_CD_TEST_CHDO 28 | TY_ZCD_TEST 29 | E 30 | Generated Row Type:ZCD_TEST 31 | 32 | 33 | ZCL_ZOBJ_CD_TEST_CHDO 34 | WRITE 35 | E 36 | Write method for object:ZOBJ_CD_TEST 37 | 38 | 39 | 40 | 41 | WRITE 42 | CHANGENUMBER 43 | E 44 | Change Document Number 45 | 46 | 47 | WRITE 48 | CX_CHDO_WRITE_ERROR 49 | E 50 | Exception Class for WRITE Method 51 | 52 | 53 | WRITE 54 | NO_CHANGE_POINTERS 55 | E 56 | Flag: No documents written 57 | 58 | 59 | WRITE 60 | OBJECTID 61 | E 62 | Object value ID 63 | 64 | 65 | WRITE 66 | OBJECT_CHANGE_INDICATOR 67 | E 68 | Flag: Object inserted, changed or deleted 69 | 70 | 71 | WRITE 72 | PLANNED_CHANGE_NUMBER 73 | E 74 | Plan Number 75 | 76 | 77 | WRITE 78 | PLANNED_OR_REAL_CHANGES 79 | E 80 | Flag whether changes are actual or planned 81 | 82 | 83 | WRITE 84 | UDATE 85 | E 86 | Changed On 87 | 88 | 89 | WRITE 90 | UPD_ZCD_TEST 91 | E 92 | Type of Change 93 | 94 | 95 | WRITE 96 | USERNAME 97 | E 98 | Changed By 99 | 100 | 101 | WRITE 102 | UTIME 103 | E 104 | Changed At 105 | 106 | 107 | WRITE 108 | XZCD_TEST 109 | E 110 | Table contains the changed data 111 | 112 | 113 | WRITE 114 | YZCD_TEST 115 | E 116 | Table contains unchanged data 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /src/zexcel_itab.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zexcel_itab DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | 8 | TYPES: 9 | BEGIN OF ty_shop_item, 10 | name TYPE string, 11 | price(10) TYPE p DECIMALS 2, 12 | END OF ty_shop_item, 13 | 14 | ty_shop_item_tt TYPE STANDARD TABLE OF ty_shop_item WITH EMPTY KEY, 15 | 16 | BEGIN OF ty_shop, 17 | shop_name TYPE string, 18 | items TYPE ty_shop_item_tt, 19 | END OF ty_shop. 20 | 21 | CONSTANTS: 22 | cns_nl TYPE string VALUE cl_abap_char_utilities=>newline. 23 | 24 | INTERFACES: if_oo_adt_classrun. 25 | PROTECTED SECTION. 26 | PRIVATE SECTION. 27 | ENDCLASS. 28 | 29 | 30 | 31 | CLASS ZEXCEL_ITAB IMPLEMENTATION. 32 | 33 | 34 | METHOD if_oo_adt_classrun~main. 35 | "Excel to itab 36 | SELECT SINGLE * 37 | FROM zblob_test 38 | WHERE docnum = '1000000000' 39 | INTO @DATA(lw_data). 40 | 41 | "For flat file 42 | * DATA(lv_string) = xco_cp=>xstring( lw_data-attachment 43 | * )->as_string( xco_cp_character=>code_page->utf_8 44 | * )->value. 45 | 46 | * For excel 47 | TYPES: 48 | BEGIN OF ts_row, 49 | Column1 TYPE string, 50 | Column2 TYPE string, 51 | END OF ts_row, 52 | 53 | tt_row TYPE STANDARD TABLE OF ts_row WITH DEFAULT KEY. 54 | DATA:lt_rows TYPE tt_row. 55 | 56 | "Create instance of excel document based on the xstring formatted excel content 57 | DATA(lo_xlsx) = xco_cp_xlsx=>document->for_file_content( iv_file_content = lw_data-attachment )->read_access( ). 58 | "Instance of worksheet 59 | DATA(lo_worksheet) = lo_xlsx->get_workbook( )->worksheet->for_name( iv_name = 'Sheet1' ). 60 | 61 | "Create pattern. Not specifying meaning read the whole sheet 62 | DATA(lo_selection_pattern) = xco_cp_xlsx_selection=>pattern_builder->simple_from_to( )->get_pattern( ). 63 | 64 | "Extract data and store in lt_rows 65 | lo_worksheet->select( lo_selection_pattern 66 | )->row_stream( 67 | )->operation->write_to( REF #( lt_rows ) 68 | )->if_xco_xlsx_ra_operation~execute( ). 69 | 70 | ENDMETHOD. 71 | ENDCLASS. 72 | -------------------------------------------------------------------------------- /src/zexcel_itab.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZEXCEL_ITAB 7 | E 8 | Test class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | I 17 | 001 18 | Max length 23 19 | 23 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/zprint_ads.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zprint_ads DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | CONSTANTS: 8 | cns_nl TYPE string VALUE cl_abap_char_utilities=>newline. 9 | 10 | INTERFACES: if_oo_adt_classrun. 11 | PROTECTED SECTION. 12 | PRIVATE SECTION. 13 | ENDCLASS. 14 | 15 | 16 | 17 | CLASS zprint_ads IMPLEMENTATION. 18 | 19 | 20 | METHOD if_oo_adt_classrun~main. 21 | "Print with ADS 22 | TRY. 23 | "Initialize Template Store Client 24 | DATA(lo_client) = NEW zcl_fp_client( 25 | iv_name = 'ADS_SRV' 26 | ). 27 | 28 | "create xml string 29 | DATA(lv_xml_raw) = || && 30 | |Ego ille| && 31 | |20040606T101010| && 32 | |Si manu vacuas| && 33 | |Apros tres et quidem| && 34 | || && 'My company ABCDE' && || && 35 | |
| && '1234 Ice cream street' && |
| && 36 | || && 'Alaska' && || && 37 | |Am undique| && 38 | || && '1234567' && || && 39 | |Vale| && 40 | |Ego ille| && 41 | || && 'ICE111' && || && 42 | || && 'Vanilla ice cream' && || && 43 | || && '1' && || && 44 | || && '10' && || && 45 | || && '10' && || && 46 | || && || && || && || && || && 47 | || && || && || && || && || && 48 | || && || && || && || && || && 49 | || && || && || && || && || && 50 | || && || && || && || && || && 51 | || && || && || && || && || && 52 | || && || && || && || && || && 53 | || && || && || && || && || && 54 | || && || && || && || && || && 55 | || && || && || && || && || && 56 | || && || && || && || && || && 57 | || && || && || && || && || && 58 | || && || && || && || && || && 59 | || && || && || && || && || && 60 | || && 61 | || && 62 | || && 63 | || && 64 | || && 65 | || && 66 | || && 67 | || && 68 | || && 69 | || && 70 | || && 71 | |
|. 72 | DATA(lv_xml) = cl_web_http_utility=>encode_base64( lv_xml_raw ). 73 | 74 | 75 | "Render PDF by caling REST API 76 | DATA(lv_rendered_pdf) = lo_client->reder_pdf( iv_xml = lv_xml ). 77 | 78 | "Get the base64 encoded PDF content 79 | DATA(lo_json) = /ui2/cl_json=>generate( json = lv_rendered_pdf ). 80 | IF lo_json IS BOUND. 81 | ASSIGN lo_json->* TO FIELD-SYMBOL(). 82 | ASSIGN COMPONENT `fileContent` OF STRUCTURE TO FIELD-SYMBOL(). 83 | ASSIGN ->* TO FIELD-SYMBOL(). 84 | ENDIF. 85 | ENDTRY. 86 | 87 | "Convert base64 to xstring 88 | DATA(lv_pdf_xstring) = xco_cp=>string( 89 | )->as_xstring( xco_cp_binary=>text_encoding->base64 90 | )->value. 91 | 92 | "Upload the xstring to z table, so the content can be viewed with RAP generated report 93 | DATA: lt_input TYPE STANDARD TABLE OF zblob_test. 94 | lt_input = VALUE #( ( docnum = '1000000001' filename = 'test.pdf' attachment = lv_pdf_xstring mimetype = 'application/pdf' ) 95 | ). 96 | INSERT zblob_test FROM TABLE @lt_input. 97 | 98 | ENDMETHOD. 99 | ENDCLASS. 100 | -------------------------------------------------------------------------------- /src/zprint_ads.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZPRINT_ADS 7 | E 8 | Test class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | I 17 | 001 18 | Max length 23 19 | 23 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/zprint_queue.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS zprint_queue DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC . 5 | 6 | PUBLIC SECTION. 7 | 8 | TYPES: 9 | BEGIN OF ty_shop_item, 10 | name TYPE string, 11 | price(10) TYPE p DECIMALS 2, 12 | END OF ty_shop_item, 13 | 14 | ty_shop_item_tt TYPE STANDARD TABLE OF ty_shop_item WITH EMPTY KEY, 15 | 16 | BEGIN OF ty_shop, 17 | shop_name TYPE string, 18 | items TYPE ty_shop_item_tt, 19 | END OF ty_shop. 20 | 21 | CONSTANTS: 22 | cns_nl TYPE string VALUE cl_abap_char_utilities=>newline. 23 | 24 | INTERFACES: if_oo_adt_classrun. 25 | PROTECTED SECTION. 26 | PRIVATE SECTION. 27 | ENDCLASS. 28 | 29 | 30 | 31 | CLASS zprint_queue IMPLEMENTATION. 32 | 33 | 34 | METHOD if_oo_adt_classrun~main. 35 | "Print queue 36 | DATA: lv_print_data TYPE xstring, 37 | lv_err_msg TYPE string. 38 | 39 | SELECT * FROM zcd_test INTO TABLE @DATA(lt_table). 40 | CALL TRANSFORMATION id SOURCE root = lt_table RESULT XML DATA(lv_xstring). 41 | lv_print_data = lv_xstring. 42 | DATA(lv_qitem_id) = cl_print_queue_utils=>create_queue_item_by_data( 43 | EXPORTING 44 | iv_qname = 'TEST_QUEUE' 45 | iv_print_data = lv_print_data 46 | iv_name_of_main_doc = 'zcd_test' 47 | IMPORTING 48 | ev_err_msg = lv_err_msg 49 | ). 50 | out->write( lv_qitem_id ). 51 | 52 | ENDMETHOD. 53 | ENDCLASS. 54 | -------------------------------------------------------------------------------- /src/zprint_queue.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZPRINT_QUEUE 7 | E 8 | Test class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | I 17 | 001 18 | Max length 23 19 | 23 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/ztrigger_parallel.clas.abap: -------------------------------------------------------------------------------- 1 | CLASS ztrigger_parallel DEFINITION 2 | PUBLIC 3 | FINAL 4 | CREATE PUBLIC. 5 | PUBLIC SECTION. 6 | INTERFACES: if_oo_adt_classrun. 7 | PROTECTED SECTION. 8 | PRIVATE SECTION. 9 | ENDCLASS. 10 | 11 | CLASS ztrigger_parallel IMPLEMENTATION. 12 | METHOD if_oo_adt_classrun~main. 13 | DATA(lo_parallel) = NEW cl_abap_parallel( ). 14 | DATA(lo_instance_1) = NEW zcl_paralell1( ). 15 | DATA(lo_instance_2) = NEW zcl_paralell2( ). 16 | 17 | lo_parallel->run_inst( 18 | EXPORTING 19 | p_in_tab = VALUE #( ( lo_instance_1 ) ( lo_instance_2 ) ) 20 | IMPORTING 21 | p_out_tab = DATA(lt_out_tab) 22 | ). 23 | 24 | LOOP AT lt_out_tab ASSIGNING FIELD-SYMBOL(). 25 | IF -inst IS INSTANCE OF zcl_paralell1. 26 | lo_instance_1 = CAST #( -inst ). 27 | out->write( 'System time for instance 1:' ). 28 | LOOP AT lo_instance_1->get_time( ) ASSIGNING FIELD-SYMBOL(). 29 | out->write( ). 30 | ENDLOOP. 31 | out->write( |WP number: { lo_instance_1->get_wp_number( ) }| ). 32 | ENDIF. 33 | IF -inst IS INSTANCE OF zcl_paralell2. 34 | lo_instance_2 = CAST #( -inst ). 35 | out->write( 'System time for instance 2:' ). 36 | LOOP AT lo_instance_2->get_time( ) ASSIGNING FIELD-SYMBOL(). 37 | out->write( ). 38 | ENDLOOP. 39 | out->write( |WP number: { lo_instance_2->get_wp_number( ) }| ). 40 | ENDIF. 41 | ENDLOOP. 42 | 43 | ENDMETHOD. 44 | ENDCLASS. 45 | -------------------------------------------------------------------------------- /src/ztrigger_parallel.clas.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ZTRIGGER_PARALLEL 7 | E 8 | Test class 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | I 17 | 001 18 | Max length 23 19 | 23 20 | 21 | 22 | 23 | 24 | 25 | --------------------------------------------------------------------------------