Update
This commit is contained in:
20
.abapgit.xml
Normal file
20
.abapgit.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DATA>
|
||||||
|
<MASTER_LANGUAGE>E</MASTER_LANGUAGE>
|
||||||
|
<STARTING_FOLDER>/src/</STARTING_FOLDER>
|
||||||
|
<FOLDER_LOGIC>FULL</FOLDER_LOGIC>
|
||||||
|
<IGNORE>
|
||||||
|
<item>/.gitignore</item>
|
||||||
|
<item>/LICENSE</item>
|
||||||
|
<item>/README.md</item>
|
||||||
|
<item>/package.json</item>
|
||||||
|
<item>/.travis.yml</item>
|
||||||
|
<item>/.gitlab-ci.yml</item>
|
||||||
|
<item>/abaplint.json</item>
|
||||||
|
<item>/azure-pipelines.yml</item>
|
||||||
|
</IGNORE>
|
||||||
|
</DATA>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
201
LICENSE
Normal file
201
LICENSE
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
73
LICENSES/Apache-2.0.txt
Normal file
73
LICENSES/Apache-2.0.txt
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
@@ -1 +1,5 @@
|
|||||||
"initial commit"
|
ABAP cheat sheets for classic ABAP
|
||||||
|
|
||||||
|
ABAP version: 755
|
||||||
|
|
||||||
|
More information: [https://github.com/SAP-samples/abap-cheat-sheets](https://github.com/SAP-samples/abap-cheat-sheets)
|
||||||
43
src/ezdemo_abap_lock.enqu.xml
Normal file
43
src/ezdemo_abap_lock.enqu.xml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_ENQU" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD25V>
|
||||||
|
<VIEWNAME>EZDEMO_ABAP_LOCK</VIEWNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<AGGTYPE>E</AGGTYPE>
|
||||||
|
<ROOTTAB>ZDEMO_ABAP_RAPT1</ROOTTAB>
|
||||||
|
<DDTEXT>Lock on demo table</DDTEXT>
|
||||||
|
</DD25V>
|
||||||
|
<DD26E_TABLE>
|
||||||
|
<DD26E>
|
||||||
|
<VIEWNAME>EZDEMO_ABAP_LOCK</VIEWNAME>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||||
|
<TABPOS>0001</TABPOS>
|
||||||
|
<FORTABNAME>ZDEMO_ABAP_RAPT1</FORTABNAME>
|
||||||
|
<ENQMODE>E</ENQMODE>
|
||||||
|
</DD26E>
|
||||||
|
</DD26E_TABLE>
|
||||||
|
<DD27P_TABLE>
|
||||||
|
<DD27P>
|
||||||
|
<VIEWNAME>EZDEMO_ABAP_LOCK</VIEWNAME>
|
||||||
|
<OBJPOS>0001</OBJPOS>
|
||||||
|
<VIEWFIELD>CLIENT</VIEWFIELD>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ENQMODE>E</ENQMODE>
|
||||||
|
</DD27P>
|
||||||
|
<DD27P>
|
||||||
|
<VIEWNAME>EZDEMO_ABAP_LOCK</VIEWNAME>
|
||||||
|
<OBJPOS>0002</OBJPOS>
|
||||||
|
<VIEWFIELD>KEY_FIELD</VIEWFIELD>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||||
|
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ENQMODE>E</ENQMODE>
|
||||||
|
</DD27P>
|
||||||
|
</DD27P_TABLE>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
10
src/package.devc.xml
Normal file
10
src/package.devc.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DEVC>
|
||||||
|
<CTEXT>test</CTEXT>
|
||||||
|
</DEVC>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
10
src/test_abap_cheat_sheets_classic/package.devc.xml
Normal file
10
src/test_abap_cheat_sheets_classic/package.devc.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DEVC>
|
||||||
|
<CTEXT>TEST_ABAP_CHEAT_SHEETS_CLASSIC</CTEXT>
|
||||||
|
</DEVC>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
CLASS zcl_demo_abap_sap_luw_helper DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
FINAL
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
TYPES log_type TYPE SORTED TABLE OF zdemo_abap_logt WITH UNIQUE KEY id.
|
||||||
|
|
||||||
|
CLASS-DATA: itab TYPE STANDARD TABLE OF zdemo_abap_luw_t,
|
||||||
|
log_entries TYPE STANDARD TABLE OF zdemo_abap_logt.
|
||||||
|
|
||||||
|
CLASS-METHODS: get_work_process_info RETURNING VALUE(id_no) TYPE string,
|
||||||
|
create_log_entries IMPORTING log TYPE log_type,
|
||||||
|
checking_transaction_state RETURNING VALUE(tx_state) TYPE string,
|
||||||
|
cc_alv_display IMPORTING container TYPE c
|
||||||
|
log TYPE abap_bool DEFAULT abap_false,
|
||||||
|
subr_delete,
|
||||||
|
subr_insert IMPORTING values TYPE zdemo_abap_luw_t,
|
||||||
|
subr_update_log IMPORTING log TYPE log_type.
|
||||||
|
PROTECTED SECTION.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
CLASS-DATA: wp_pid TYPE wppid,
|
||||||
|
wp_index TYPE wpindex.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_DEMO_ABAP_SAP_LUW_HELPER IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD cc_alv_display.
|
||||||
|
DATA(cont) = NEW cl_gui_custom_container( container_name = container ).
|
||||||
|
|
||||||
|
IF log = abap_false.
|
||||||
|
SELECT key_field, ch, num, time_stamp
|
||||||
|
FROM zdemo_abap_luw_t
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @Itab
|
||||||
|
ORDER BY key_field.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
cl_salv_table=>factory( EXPORTING r_container = cont
|
||||||
|
container_name = CONV string( container )
|
||||||
|
IMPORTING r_salv_table = DATA(alv)
|
||||||
|
CHANGING t_table = itab ).
|
||||||
|
|
||||||
|
DATA(columns) = alv->get_columns( ).
|
||||||
|
DATA(col_tab) = columns->get( ).
|
||||||
|
LOOP AT col_tab ASSIGNING FIELD-SYMBOL(<column>).
|
||||||
|
DATA(column) = columns->get_column( <column>-columnname ).
|
||||||
|
column->set_medium_text( CONV scrtext_m( <column>-columnname ) ).
|
||||||
|
|
||||||
|
IF <column>-columnname = 'CLIENT'.
|
||||||
|
<column>-r_column->set_visible( abap_false ).
|
||||||
|
ELSE.
|
||||||
|
<column>-r_column->set_visible( abap_true ).
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
alv->display( ).
|
||||||
|
CATCH cx_salv_msg cx_salv_not_found.
|
||||||
|
MESSAGE 'ALV display not possible' TYPE 'I'
|
||||||
|
DISPLAY LIKE 'E'.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ELSE.
|
||||||
|
|
||||||
|
SELECT id, context, name, details, timestamp
|
||||||
|
FROM zdemo_abap_logt
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @log_entries
|
||||||
|
ORDER BY id.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
cl_salv_table=>factory( EXPORTING r_container = cont
|
||||||
|
container_name = CONV string( container )
|
||||||
|
IMPORTING r_salv_table = alv
|
||||||
|
CHANGING t_table = log_entries ).
|
||||||
|
|
||||||
|
columns = alv->get_columns( ).
|
||||||
|
col_tab = columns->get( ).
|
||||||
|
LOOP AT col_tab ASSIGNING FIELD-SYMBOL(<col>).
|
||||||
|
column = columns->get_column( <col>-columnname ).
|
||||||
|
column->set_medium_text( CONV scrtext_m( <col>-columnname ) ).
|
||||||
|
|
||||||
|
IF <col>-columnname = `DETAILS`.
|
||||||
|
column->set_output_length( 70 ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF <col>-columnname = 'CLIENT'.
|
||||||
|
<col>-r_column->set_visible( abap_false ).
|
||||||
|
ELSE.
|
||||||
|
<col>-r_column->set_visible( abap_true ).
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
alv->display( ).
|
||||||
|
CATCH cx_salv_msg cx_salv_not_found.
|
||||||
|
MESSAGE 'ALV display not possible' TYPE 'I'
|
||||||
|
DISPLAY LIKE 'E'.
|
||||||
|
ENDTRY.
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD checking_transaction_state.
|
||||||
|
tx_state = `Tx state: ` &&
|
||||||
|
`Update task (` && SWITCH #( cl_system_transaction_state=>get_in_update_task( ) WHEN 1 THEN `1)` ELSE `0)` ) &&
|
||||||
|
` Local update (` && SWITCH #( cl_system_transaction_state=>get_update_task_local( ) WHEN 1 THEN `1)` ELSE `0)` ) &&
|
||||||
|
` Perf. on commit (` && SWITCH #( cl_system_transaction_state=>get_on_commit( ) WHEN 1 THEN `1)` ELSE `0)` ) &&
|
||||||
|
` Perf. on rollback (` && SWITCH #( cl_system_transaction_state=>get_on_rollback( ) WHEN 1 THEN `1)` ELSE `0)` ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD create_log_entries.
|
||||||
|
INSERT zdemo_abap_logt FROM TABLE @log.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_work_process_info.
|
||||||
|
CALL FUNCTION 'TH_GET_OWN_WP_NO'
|
||||||
|
IMPORTING
|
||||||
|
wp_pid = wp_pid
|
||||||
|
wp_index = wp_index.
|
||||||
|
|
||||||
|
id_no = |Work process ID: { wp_pid } / work process index: { wp_index }|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD subr_delete.
|
||||||
|
DELETE FROM zdemo_abap_luw_t.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD subr_insert.
|
||||||
|
INSERT zdemo_abap_luw_t FROM @values.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD subr_update_log.
|
||||||
|
INSERT zdemo_abap_logt FROM TABLE @log.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_SAP_LUW_HELPER</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Helper class for SAP LUW example</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
76
src/test_abap_cheat_sheets_classic/zdemo_abap_dbluw.tabl.xml
Normal file
76
src/test_abap_cheat_sheets_classic/zdemo_abap_dbluw.tabl.xml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_DBLUW</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo database table</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<MAINFLAG>X</MAINFLAG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_DBLUW</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CH</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>TIME_STAMP</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>p</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<DATATYPE>UTCL</DATATYPE>
|
||||||
|
<LENG>000027</LENG>
|
||||||
|
<MASK> UTCL</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
826
src/test_abap_cheat_sheets_classic/zdemo_abap_dynpro.prog.abap
Normal file
826
src/test_abap_cheat_sheets_classic/zdemo_abap_dynpro.prog.abap
Normal file
@@ -0,0 +1,826 @@
|
|||||||
|
*&---------------------------------------------------------------------*
|
||||||
|
*& ABAP cheat sheet: Dynpro
|
||||||
|
*&
|
||||||
|
*&-------------------------- PURPOSE ----------------------------------*
|
||||||
|
*& - Example to demonstrate dynpro-related statements
|
||||||
|
*& - Topics covered: Dynpro flow logic and related statements (MODULE,
|
||||||
|
*& FIELD, CHAIN/ENDCHAIN, LOOP/ENDLOOP, CALL SUBSCREEN), ABAP statements
|
||||||
|
*& for calling and leaving dynpros (SET SCREEN, CALL SCREEN, LEAVE
|
||||||
|
*& SCREEN), modifying static attributes (LOOP AT SCREEN, MODIFY SCREEN),
|
||||||
|
*& statements related to the GUI status and title (GET/SET PF-STATUS,
|
||||||
|
*& SET TITLEBAR), controls (table and tabstrip controls)
|
||||||
|
*&
|
||||||
|
*&----------------------- GETTING STARTED -----------------------------*
|
||||||
|
*& - Open the program with the ABAP development tools for Eclipse (ADT).
|
||||||
|
*& - Choose F8 to run the program.
|
||||||
|
*& - Select the radio buttons and/or provide input in input fields etc.
|
||||||
|
*& to check out dynpro-related syntax in action.
|
||||||
|
*&
|
||||||
|
*&----------------------------- NOTE -----------------------------------*
|
||||||
|
*& The code presented in this class is intended only to support the ABAP
|
||||||
|
*& cheat sheets. It is not intended for direct use in a production system
|
||||||
|
*& environment. The code examples in the ABAP cheat sheets are primarily
|
||||||
|
*& intended to provide a better explanation and visualization of the
|
||||||
|
*& syntax and semantics of ABAP statements, not to solve concrete
|
||||||
|
*& programming tasks. For production application programs, you should
|
||||||
|
*& always work out your own solution for each individual case. There is
|
||||||
|
*& no guarantee for the correctness or completeness of the code.
|
||||||
|
*& Furthermore, there is no legal responsibility or liability for any
|
||||||
|
*& errors or their consequences that may occur when using the the example
|
||||||
|
*& code.
|
||||||
|
*&---------------------------------------------------------------------*
|
||||||
|
REPORT zdemo_abap_dynpro.
|
||||||
|
|
||||||
|
DATA:
|
||||||
|
"OK field
|
||||||
|
ok_code LIKE sy-ucomm,
|
||||||
|
"Auxiliary variable for storing the value of the OK field
|
||||||
|
save_ok LIKE ok_code,
|
||||||
|
dyn_num LIKE sy-dynnr,
|
||||||
|
dyn_title LIKE sy-title.
|
||||||
|
|
||||||
|
"Note: This demo database table does not have any semantic information
|
||||||
|
"that may be used for input helps etc.
|
||||||
|
TABLES zdemo_abap_flsch.
|
||||||
|
|
||||||
|
"----- Related to dynpro 9850 (Home page) -----
|
||||||
|
DATA: screen_elements TYPE abap_bool,
|
||||||
|
stmts TYPE abap_bool,
|
||||||
|
stmts2 TYPE abap_bool,
|
||||||
|
controls TYPE abap_bool.
|
||||||
|
|
||||||
|
"----- Related to dynpro 9860 (Screen elements) -----
|
||||||
|
|
||||||
|
DATA: "Icons
|
||||||
|
icon TYPE icons-text,
|
||||||
|
icon_name TYPE c LENGTH 20,
|
||||||
|
icon_text TYPE c LENGTH 10,
|
||||||
|
"check boxes
|
||||||
|
ch_a TYPE abap_bool,
|
||||||
|
ch_b TYPE abap_bool,
|
||||||
|
ch_c TYPE abap_bool,
|
||||||
|
checkbox_msg TYPE c LENGTH 4,
|
||||||
|
input_field TYPE c LENGTH 20,
|
||||||
|
"radio buttons
|
||||||
|
rb_x TYPE abap_bool,
|
||||||
|
rb_y TYPE abap_bool,
|
||||||
|
rb_z TYPE abap_bool,
|
||||||
|
radiobutton_msg TYPE c LENGTH 1.
|
||||||
|
|
||||||
|
"----- Related to dynpro 9870 (Statements I) -----
|
||||||
|
|
||||||
|
DATA: call_screen TYPE abap_bool,
|
||||||
|
call_screen_starting TYPE abap_bool,
|
||||||
|
call_screen_st_end TYPE abap_bool,
|
||||||
|
set_screen TYPE abap_bool,
|
||||||
|
leave_screen_next TYPE abap_bool,
|
||||||
|
leave_screen_set TYPE abap_bool,
|
||||||
|
leave_to_screen TYPE abap_bool,
|
||||||
|
set_pfstatus TYPE abap_bool,
|
||||||
|
set_pf_excluding TYPE abap_bool,
|
||||||
|
get_pfstatus TYPE abap_bool,
|
||||||
|
get_pfstatsus_excl TYPE abap_bool,
|
||||||
|
set_titlebar TYPE abap_bool,
|
||||||
|
set_titlebar_with TYPE abap_bool,
|
||||||
|
with_title TYPE c LENGTH 15,
|
||||||
|
col1 TYPE i,
|
||||||
|
lin1 TYPE i,
|
||||||
|
col2 TYPE i,
|
||||||
|
lin2 TYPE i,
|
||||||
|
col3 TYPE i,
|
||||||
|
lin3 TYPE i,
|
||||||
|
pf TYPE c LENGTH 1,
|
||||||
|
pfkey TYPE syst_pfkey,
|
||||||
|
title TYPE c LENGTH 1.
|
||||||
|
|
||||||
|
"Data type and objects for the EXCLUDING addition of GET/SET PF-STATUS
|
||||||
|
"statements
|
||||||
|
TYPES fu_key_tab TYPE TABLE OF sy-ucomm WITH NON-UNIQUE KEY table_line.
|
||||||
|
DATA: excl_list1 TYPE fu_key_tab,
|
||||||
|
excl_list2 TYPE fu_key_tab,
|
||||||
|
excl_list3 TYPE fu_key_tab.
|
||||||
|
|
||||||
|
"----- Related to dynpro 9880 (Statements II) -----
|
||||||
|
|
||||||
|
DATA: loop_modify TYPE abap_bool,
|
||||||
|
field_stmt TYPE abap_bool,
|
||||||
|
mod_at_exit TYPE abap_bool,
|
||||||
|
selected TYPE abap_bool,
|
||||||
|
set TYPE abap_bool,
|
||||||
|
field_a TYPE c LENGTH 1,
|
||||||
|
field_b TYPE c LENGTH 1,
|
||||||
|
field_c TYPE c LENGTH 1,
|
||||||
|
field_d TYPE c LENGTH 1,
|
||||||
|
field_e TYPE c LENGTH 1,
|
||||||
|
field_f TYPE c LENGTH 1,
|
||||||
|
output_field_1 TYPE c LENGTH 100,
|
||||||
|
output_field_2 TYPE c LENGTH 100,
|
||||||
|
output_field_3 TYPE c LENGTH 100,
|
||||||
|
field_help TYPE c LENGTH 30,
|
||||||
|
input_help TYPE c LENGTH 30,
|
||||||
|
"For GET/SET CURSOR statements
|
||||||
|
fld TYPE c LENGTH 20,
|
||||||
|
off TYPE i,
|
||||||
|
val TYPE string,
|
||||||
|
len TYPE i.
|
||||||
|
|
||||||
|
"For field and input help
|
||||||
|
TYPES: BEGIN OF values,
|
||||||
|
carrid TYPE zdemo_abap_flsch-carrid,
|
||||||
|
connid TYPE zdemo_abap_flsch-connid,
|
||||||
|
END OF values.
|
||||||
|
|
||||||
|
DATA: progname TYPE sy-repid,
|
||||||
|
dynnum TYPE sy-dynnr,
|
||||||
|
dynpro_values TYPE TABLE OF dynpread,
|
||||||
|
field_value LIKE LINE OF dynpro_values,
|
||||||
|
values_tab TYPE TABLE OF values,
|
||||||
|
tab TYPE TABLE OF zdemo_abap_flsch-carrid,
|
||||||
|
carr TYPE zdemo_abap_flsch-carrid,
|
||||||
|
conn TYPE zdemo_abap_flsch-connid.
|
||||||
|
|
||||||
|
DATA itab_flsch TYPE TABLE OF zdemo_abap_flsch-carrid.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF carrid_line,
|
||||||
|
carrid TYPE zdemo_abap_flsch-carrid,
|
||||||
|
END OF carrid_line.
|
||||||
|
|
||||||
|
DATA carrid_list TYPE STANDARD TABLE OF carrid_line.
|
||||||
|
|
||||||
|
"----- Related to dynpro 9890 (Exit command) -----
|
||||||
|
|
||||||
|
"For demonstration purposes, implementations for the
|
||||||
|
"related dialog modules are done in methods of a local
|
||||||
|
"class.
|
||||||
|
|
||||||
|
"----- Related to dynpro 9990 (Controls) -----
|
||||||
|
|
||||||
|
"For table controls
|
||||||
|
DATA lines TYPE i.
|
||||||
|
DATA fill TYPE i.
|
||||||
|
CONTROLS flights TYPE TABLEVIEW USING SCREEN 9900.
|
||||||
|
|
||||||
|
"Internal table to hold data that is to be displayed.
|
||||||
|
DATA itab_flights TYPE TABLE OF zdemo_abap_flsch WITH EMPTY KEY.
|
||||||
|
|
||||||
|
"Filling the internal table
|
||||||
|
SELECT *
|
||||||
|
FROM zdemo_abap_flsch
|
||||||
|
ORDER BY carrid, connid
|
||||||
|
INTO TABLE @itab_flights.
|
||||||
|
|
||||||
|
"For tabstrip controls
|
||||||
|
CONTROLS tabstr TYPE TABSTRIP.
|
||||||
|
DATA number LIKE sy-dynnr.
|
||||||
|
|
||||||
|
"For ALV Grid control
|
||||||
|
TYPES: BEGIN OF flight_struc,
|
||||||
|
carrid TYPE zdemo_abap_flsch-carrid,
|
||||||
|
connid TYPE zdemo_abap_flsch-connid,
|
||||||
|
countryfr TYPE zdemo_abap_flsch-countryfr,
|
||||||
|
cityfrom TYPE zdemo_abap_flsch-cityfrom,
|
||||||
|
airpfrom TYPE zdemo_abap_flsch-airpfrom,
|
||||||
|
countryto TYPE zdemo_abap_flsch-countryto,
|
||||||
|
cityto TYPE zdemo_abap_flsch-cityto,
|
||||||
|
airpto TYPE zdemo_abap_flsch-airpto,
|
||||||
|
fltime TYPE zdemo_abap_flsch-fltime,
|
||||||
|
END OF flight_struc.
|
||||||
|
|
||||||
|
DATA itab4alv TYPE TABLE OF flight_struc WITH EMPTY KEY.
|
||||||
|
|
||||||
|
"----- For other dialog modules -----
|
||||||
|
|
||||||
|
DATA: links TYPE TABLE OF tline,
|
||||||
|
field_tab TYPE TABLE OF dfies WITH EMPTY KEY.
|
||||||
|
|
||||||
|
"----- Local class -----
|
||||||
|
|
||||||
|
CLASS local_class DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
CLASS-METHODS: provide_fu_keys IMPORTING example TYPE i
|
||||||
|
RETURNING VALUE(fu_keys) TYPE fu_key_tab,
|
||||||
|
|
||||||
|
cc_alv_display IMPORTING container TYPE c,
|
||||||
|
"Implementations for dialog modules for dynpro 9890
|
||||||
|
pbo9890,
|
||||||
|
pai9890,
|
||||||
|
cancel.
|
||||||
|
|
||||||
|
"Variable declarations for dialog modules for dynpro 9890
|
||||||
|
CLASS-DATA: mandatory_field TYPE c LENGTH 20,
|
||||||
|
btn_exit_1 TYPE abap_bool,
|
||||||
|
btn_exit_2 TYPE abap_bool.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS local_class IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD provide_fu_keys.
|
||||||
|
CASE example.
|
||||||
|
WHEN 1.
|
||||||
|
fu_keys = VALUE #( ( 'CANCEL' ) ( 'SAP' ) ).
|
||||||
|
WHEN 2.
|
||||||
|
fu_keys = VALUE #( ( 'CANCEL' ) ).
|
||||||
|
WHEN OTHERS.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD cc_alv_display.
|
||||||
|
DATA(cont) = NEW cl_gui_custom_container( container_name = container ).
|
||||||
|
|
||||||
|
SELECT carrid, connid, countryfr, cityfrom, airpfrom, countryto, cityto, airpto, fltime
|
||||||
|
FROM zdemo_abap_flsch
|
||||||
|
ORDER BY carrid, connid
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @itab4alv.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
cl_salv_table=>factory( EXPORTING r_container = cont
|
||||||
|
container_name = CONV string( container )
|
||||||
|
IMPORTING r_salv_table = DATA(alv)
|
||||||
|
CHANGING t_table = itab4alv ).
|
||||||
|
alv->get_columns( )->set_optimize( abap_true ).
|
||||||
|
alv->get_display_settings( )->set_list_header( 'Flights' ).
|
||||||
|
LOOP AT alv->get_columns( )->get( ) ASSIGNING FIELD-SYMBOL(<col>).
|
||||||
|
DATA(column) = <col>-r_column.
|
||||||
|
column->set_long_text( |{ column->get_columnname( ) }| ).
|
||||||
|
ENDLOOP.
|
||||||
|
alv->display( ).
|
||||||
|
CATCH cx_salv_msg cx_salv_not_found.
|
||||||
|
MESSAGE `ALV display not possible` TYPE 'I'
|
||||||
|
DISPLAY LIKE 'E'.
|
||||||
|
ENDTRY.
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD pai9890.
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
WHEN 'CLOSE1'.
|
||||||
|
MESSAGE `Processing continues. It does so only after the input field is filled.` TYPE 'I'.
|
||||||
|
SET SCREEN 0.
|
||||||
|
LEAVE SCREEN.
|
||||||
|
WHEN 'CLOSE2'.
|
||||||
|
MESSAGE `Superfluouse message :)` TYPE 'I'.
|
||||||
|
WHEN OTHERS.
|
||||||
|
MESSAGE `Processing continues. It does so only after the input field is filled.` TYPE 'I'.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD pbo9890.
|
||||||
|
SET PF-STATUS 'STATUS9890'.
|
||||||
|
SET TITLEBAR 'TITLE9890'.
|
||||||
|
|
||||||
|
dyn_num = sy-dynnr.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD cancel.
|
||||||
|
MESSAGE `Module "cancel" was called. The dynpro will be left without the need to fill in the mandatory input field.` TYPE 'I'.
|
||||||
|
|
||||||
|
IF ok_code = 'CLOSE2'.
|
||||||
|
CLEAR: ok_code, mandatory_field.
|
||||||
|
SET SCREEN 0.
|
||||||
|
LEAVE SCREEN.
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
END-OF-SELECTION.
|
||||||
|
|
||||||
|
"Filling demo database tables
|
||||||
|
zcl_demo_abap_flight_tables=>fill_dbtabs( ).
|
||||||
|
|
||||||
|
CALL SCREEN 9850.
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
***************** Dialog modules for 9850 ****************************
|
||||||
|
|
||||||
|
MODULE status_9850 OUTPUT.
|
||||||
|
SET PF-STATUS 'STATUS9850'.
|
||||||
|
SET TITLEBAR 'TITLE9850'.
|
||||||
|
|
||||||
|
CLEAR: screen_elements, stmts, stmts2.
|
||||||
|
dyn_num = sy-dynnr.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9850 INPUT.
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
WHEN 'ENTER' OR 'GO'.
|
||||||
|
CASE abap_true.
|
||||||
|
WHEN screen_elements.
|
||||||
|
CALL SCREEN 9860.
|
||||||
|
WHEN stmts.
|
||||||
|
CALL SCREEN 9870.
|
||||||
|
WHEN stmts2.
|
||||||
|
CALL SCREEN 9880.
|
||||||
|
WHEN controls.
|
||||||
|
CALL SCREEN 9900.
|
||||||
|
ENDCASE.
|
||||||
|
WHEN OTHERS.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
***************** Dialog modules for 9860 ****************************
|
||||||
|
|
||||||
|
MODULE status_9860 OUTPUT.
|
||||||
|
SET PF-STATUS 'STATUS9860'.
|
||||||
|
SET TITLEBAR 'TITLE9860'.
|
||||||
|
|
||||||
|
"Modifying static attributes
|
||||||
|
IF loop_modify = 'X'.
|
||||||
|
LOOP AT SCREEN INTO DATA(scr).
|
||||||
|
IF scr-name = 'ICON3'.
|
||||||
|
scr-invisible = '1'.
|
||||||
|
MODIFY SCREEN FROM scr.
|
||||||
|
ENDIF.
|
||||||
|
IF scr-name = 'INPUT_FIELD'.
|
||||||
|
scr-length = 10.
|
||||||
|
scr-intensified = '1'.
|
||||||
|
"scr-required = '1'.
|
||||||
|
MODIFY SCREEN FROM scr.
|
||||||
|
ENDIF.
|
||||||
|
IF scr-name = 'RB_Z'.
|
||||||
|
scr-active = '0'.
|
||||||
|
MODIFY SCREEN FROM scr.
|
||||||
|
ENDIF.
|
||||||
|
IF scr-name = 'CH_B'.
|
||||||
|
scr-input = '0'.
|
||||||
|
MODIFY SCREEN FROM scr.
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
dyn_num = sy-dynnr.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9860 INPUT.
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
"Icons
|
||||||
|
WHEN 'ICON1'.
|
||||||
|
icon_name = 'ICON_GREEN_LIGHT'.
|
||||||
|
icon_text = `green`.
|
||||||
|
WHEN 'ICON2'.
|
||||||
|
icon_name = 'ICON_YELLOW_LIGHT'.
|
||||||
|
icon_text = `yellow`.
|
||||||
|
WHEN 'ICON3'.
|
||||||
|
icon_name = 'ICON_RED_LIGHT'.
|
||||||
|
icon_text = `red`.
|
||||||
|
"Input field
|
||||||
|
WHEN 'BTN_NO'.
|
||||||
|
MESSAGE |The text "{ input_field }" in the input field has { numofchar( input_field ) } characters. Trailing blanks are ignored.| TYPE 'I'.
|
||||||
|
"Check boxes
|
||||||
|
WHEN 'CH_BTN'.
|
||||||
|
IF ch_a = abap_true.
|
||||||
|
checkbox_msg = 'A'.
|
||||||
|
ENDIF.
|
||||||
|
IF ch_b = abap_true.
|
||||||
|
checkbox_msg = checkbox_msg && 'B'.
|
||||||
|
ENDIF.
|
||||||
|
IF ch_c = abap_true.
|
||||||
|
checkbox_msg = checkbox_msg && 'C'.
|
||||||
|
ENDIF.
|
||||||
|
IF checkbox_msg IS INITIAL.
|
||||||
|
checkbox_msg = 'None'.
|
||||||
|
ENDIF.
|
||||||
|
checkbox_msg = checkbox_msg.
|
||||||
|
MESSAGE checkbox_msg TYPE 'I'.
|
||||||
|
CLEAR checkbox_msg.
|
||||||
|
"Radio buttons
|
||||||
|
WHEN 'RB_BTN'.
|
||||||
|
CASE abap_true.
|
||||||
|
WHEN rb_x.
|
||||||
|
radiobutton_msg = 'X'.
|
||||||
|
WHEN rb_y.
|
||||||
|
radiobutton_msg = 'Y'.
|
||||||
|
WHEN rb_z.
|
||||||
|
radiobutton_msg = 'Z'.
|
||||||
|
WHEN OTHERS.
|
||||||
|
radiobutton_msg = ' '.
|
||||||
|
ENDCASE.
|
||||||
|
MESSAGE radiobutton_msg TYPE 'I'.
|
||||||
|
CLEAR radiobutton_msg.
|
||||||
|
WHEN 'HOME'.
|
||||||
|
SET SCREEN 0.
|
||||||
|
LEAVE SCREEN.
|
||||||
|
WHEN OTHERS.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
ENDCASE.
|
||||||
|
|
||||||
|
IF save_ok = 'ICON1' OR save_ok = 'ICON2' OR save_ok = 'ICON3'.
|
||||||
|
CALL FUNCTION 'ICON_CREATE'
|
||||||
|
EXPORTING
|
||||||
|
name = icon_name
|
||||||
|
text = icon_text
|
||||||
|
info = 'Status'
|
||||||
|
add_stdinf = 'X'
|
||||||
|
IMPORTING
|
||||||
|
result = icon
|
||||||
|
EXCEPTIONS
|
||||||
|
icon_not_found = 1
|
||||||
|
outputfield_too_short = 2
|
||||||
|
OTHERS = 3.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
MESSAGE `Issue.` TYPE 'I' DISPLAY LIKE 'E'.
|
||||||
|
ENDIF.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
***************** Dialog modules for 9870 ****************************
|
||||||
|
|
||||||
|
MODULE status_9870 OUTPUT.
|
||||||
|
|
||||||
|
"Control structures in case of calling the dynpro again
|
||||||
|
IF set_pfstatus IS NOT INITIAL AND pfkey = 'STATUS9870'.
|
||||||
|
SET PF-STATUS 'DEMOSTATUS'.
|
||||||
|
ELSEIF set_pfstatus IS NOT INITIAL AND pfkey = 'DEMOSTATUS'.
|
||||||
|
SET PF-STATUS 'STATUS9870'.
|
||||||
|
ELSEIF set_pf_excluding IS NOT INITIAL AND pfkey = 'STATUS9870'.
|
||||||
|
excl_list1 = local_class=>provide_fu_keys( 1 ).
|
||||||
|
SET PF-STATUS 'DEMOSTATUS' EXCLUDING excl_list1.
|
||||||
|
ELSEIF set_pf_excluding IS NOT INITIAL AND pfkey = 'DEMOSTATUS'.
|
||||||
|
excl_list2 = local_class=>provide_fu_keys( 2 ).
|
||||||
|
SET PF-STATUS 'STATUS9870' EXCLUDING excl_list2.
|
||||||
|
ELSE.
|
||||||
|
SET PF-STATUS 'STATUS9870'.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF set_titlebar IS NOT INITIAL.
|
||||||
|
IF dyn_title CS 'Demo title'.
|
||||||
|
SET TITLEBAR 'TITLE9870'.
|
||||||
|
ELSE.
|
||||||
|
SET TITLEBAR 'DEMOTITLE'.
|
||||||
|
ENDIF.
|
||||||
|
ELSEIF SET_TITLEBAR_with IS NOT INITIAL.
|
||||||
|
SET TITLEBAR 'DEMOTITLE' WITH '"' with_title '"'.
|
||||||
|
ELSE.
|
||||||
|
SET TITLEBAR 'TITLE9870'.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
"Prepopulating values
|
||||||
|
col1 = 5.
|
||||||
|
lin1 = 10.
|
||||||
|
col2 = 1.
|
||||||
|
lin2 = 1.
|
||||||
|
col3 = 80.
|
||||||
|
lin3 = 20.
|
||||||
|
dyn_num = sy-dynnr.
|
||||||
|
dyn_title = sy-title.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9870 INPUT.
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
WHEN 'ENTER' OR 'GO'.
|
||||||
|
CASE abap_true.
|
||||||
|
WHEN set_screen.
|
||||||
|
MESSAGE |A SET SCREEN statement is about to get called. The static next dynpro of dynpro { sy-dynnr } is 0.| &&
|
||||||
|
` It is dynamically overwritten. Another dynpro will be displayed. A new dynpro sequence is not started.` TYPE 'I'.
|
||||||
|
SET SCREEN 9860.
|
||||||
|
WHEN call_screen.
|
||||||
|
MESSAGE `A CALL SCREEN statement is about to get called. You will switch to another dynpro. A new dynpro sequence is started.` TYPE 'I'.
|
||||||
|
CALL SCREEN 9860.
|
||||||
|
WHEN call_screen_starting.
|
||||||
|
IF col1 < 0 OR lin1 < 0.
|
||||||
|
MESSAGE `Only positive integers can be specified.` TYPE 'E'.
|
||||||
|
ELSE.
|
||||||
|
MESSAGE |The statement "CALL SCREEN ... STARTING AT { col1 } { lin1 }." is about to get called. | &&
|
||||||
|
`Note: In the dialog box that opens, click the icon in the popup footer to remain in the program. Clicking the X leaves the program.` TYPE 'I'.
|
||||||
|
CALL SCREEN 9860 STARTING AT col1 lin1.
|
||||||
|
ENDIF.
|
||||||
|
WHEN call_screen_st_end.
|
||||||
|
IF col2 < 0 OR lin2 < 0
|
||||||
|
OR col3 < 0 OR lin3 < 0.
|
||||||
|
MESSAGE `Only positive integers can be specified.`
|
||||||
|
TYPE 'E'.
|
||||||
|
ELSE.
|
||||||
|
MESSAGE |The statement "CALL SCREEN ... STARTING AT { col2 } { lin2 } ENDING AT { col3 } { lin3 }| &&
|
||||||
|
`." is about to get called. Note: In the dialog box that opens, click the icon in the popup footer ` &&
|
||||||
|
`to remain in the program. Clicking the X leaves the program.` TYPE 'I'.
|
||||||
|
CALL SCREEN 9860 STARTING AT col2 lin2 ENDING AT col3 lin3.
|
||||||
|
ENDIF.
|
||||||
|
WHEN leave_screen_next.
|
||||||
|
MESSAGE `A LEAVE SCREEN statement is about to get called. The current dynpro is exited, and the statically ` &&
|
||||||
|
`defined next dynpro is called, which is 0 in this case. Hence, the current dynpro sequence is terminated. ` &&
|
||||||
|
`Since the dynpro sequence is nested, you return to the home page and the parent dynpro sequence.` TYPE 'I'.
|
||||||
|
LEAVE SCREEN.
|
||||||
|
WHEN leave_screen_set.
|
||||||
|
MESSAGE `A LEAVE SCREEN statement is about to get called. In this case, a SET SCREEN statement before the LEAVE ` &&
|
||||||
|
`SCREEN statement overwrites the next dynpro (0 here). A new dynpro sequence is not started, instead the statement ` &&
|
||||||
|
`branches to another dynpro in the same sequence.` TYPE 'I'.
|
||||||
|
SET SCREEN 9900.
|
||||||
|
LEAVE SCREEN.
|
||||||
|
WHEN leave_to_screen.
|
||||||
|
MESSAGE `A LEAVE TO SCREEN statement is about to get called. A new dynpro sequence is not started, instead the ` &&
|
||||||
|
`statement branches to another dynpro in the same sequence. It has the same effect as the previous example.` TYPE 'I'.
|
||||||
|
LEAVE TO SCREEN 9900.
|
||||||
|
WHEN set_pfstatus.
|
||||||
|
pfkey = sy-pfkey.
|
||||||
|
MESSAGE |The current GUI status is { pfkey }. The current dynpro { sy-dynnr } will be set as the next dynpro.| &&
|
||||||
|
` It will have a different GUI status.` TYPE 'I'.
|
||||||
|
SET SCREEN 9870.
|
||||||
|
WHEN set_pf_excluding.
|
||||||
|
GET PF-STATUS pfkey.
|
||||||
|
MESSAGE |The current GUI status is { pfkey }. The current dynpro will be set as the next dynpro.| &&
|
||||||
|
` It will have a different GUI status (set at PBO) but excluding function codes (for example, the CANCEL button).` TYPE 'I'.
|
||||||
|
SET SCREEN 9870.
|
||||||
|
WHEN get_pfstatus.
|
||||||
|
GET PF-STATUS pfkey.
|
||||||
|
MESSAGE |The current GUI status is { pfkey }, which was retrieved using GET-PF-STATUS. Value of sy-pfkey: { sy-pfkey }.| TYPE 'I'.
|
||||||
|
SET SCREEN 9870.
|
||||||
|
WHEN get_pfstatsus_excl.
|
||||||
|
GET PF-STATUS pfkey EXCLUDING excl_list3.
|
||||||
|
MESSAGE |The current GUI status is { pfkey }. The exluded function codes are: {
|
||||||
|
COND #( WHEN excl_list3 IS INITIAL THEN `None are excluded. Try to run SET PF-STATUS ... EXCLUDING ... first before this one.`
|
||||||
|
ELSE concat_lines_of( table = excl_list3 sep = `, ` ) ) }| TYPE 'I'.
|
||||||
|
SET SCREEN 9870.
|
||||||
|
CLEAR excl_list3.
|
||||||
|
WHEN set_titlebar.
|
||||||
|
MESSAGE |The current title is "{ dyn_title }". The current dynpro is set as the next dynpro.| &&
|
||||||
|
`The text in the title bar should change.` TYPE 'I'.
|
||||||
|
SET SCREEN 9870.
|
||||||
|
WHEN set_titlebar_with.
|
||||||
|
MESSAGE |The current title is "{ dyn_title }". The current dynpro is set as the next dynpro.| &&
|
||||||
|
`The text in the title bar should change according to your input in the input field.` TYPE 'I'.
|
||||||
|
SET SCREEN 9870.
|
||||||
|
ENDCASE.
|
||||||
|
WHEN 'SAP'.
|
||||||
|
cl_gui_frontend_services=>execute( document = 'https://www.sap.com' ).
|
||||||
|
SET SCREEN 9870.
|
||||||
|
WHEN 'SAYHI'.
|
||||||
|
MESSAGE `Hallo ` && sy-uname && `.` TYPE 'I'.
|
||||||
|
SET SCREEN 9870.
|
||||||
|
WHEN 'HOME'.
|
||||||
|
LEAVE TO SCREEN 9850.
|
||||||
|
WHEN 'LEAVE' OR 'CANCEL'.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
WHEN OTHERS.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
***************** Dialog modules for 9880 ****************************
|
||||||
|
|
||||||
|
MODULE status_9880 OUTPUT.
|
||||||
|
SET PF-STATUS 'STATUS9880'.
|
||||||
|
SET TITLEBAR 'TITLE9880'.
|
||||||
|
|
||||||
|
"Clearing variables in case the dynpro is called again
|
||||||
|
IF field_stmt IS INITIAL.
|
||||||
|
CLEAR: output_field_1, output_field_2, output_field_3,
|
||||||
|
field_a, field_b, field_c, field_d, field_e, field_f.
|
||||||
|
ENDIF.
|
||||||
|
IF field_d IS INITIAL.
|
||||||
|
CLEAR output_field_2.
|
||||||
|
ENDIF.
|
||||||
|
IF field_e IS INITIAL OR field_f IS INITIAL.
|
||||||
|
CLEAR output_field_3.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
"Prepopulating fields for input help
|
||||||
|
progname = sy-repid.
|
||||||
|
dynnum = sy-dynnr.
|
||||||
|
CLEAR: field_value, dynpro_values.
|
||||||
|
field_value-fieldname = 'CARR'.
|
||||||
|
APPEND field_value TO dynpro_values.
|
||||||
|
|
||||||
|
"Setting the cursor field
|
||||||
|
IF set = abap_true.
|
||||||
|
SET CURSOR FIELD 'CONN'.
|
||||||
|
CLEAR set.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
dyn_num = sy-dynnr.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9880 INPUT.
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
WHEN 'ENTER' OR 'GO'.
|
||||||
|
CASE abap_true.
|
||||||
|
WHEN loop_modify.
|
||||||
|
MESSAGE `Another dynpro will be set as the next dynpro. This dynpro includes a LOOP AT SCREEN ` &&
|
||||||
|
` and MODIFY SCREEN statements in the PBO dialog module. Some screen elements have their static ` &&
|
||||||
|
`attributes changed. For example, they are made invisible or inactive, or the length is changed.` TYPE 'I'.
|
||||||
|
SET SCREEN 9860.
|
||||||
|
LEAVE SCREEN.
|
||||||
|
WHEN field_stmt.
|
||||||
|
MESSAGE `The current dynpro will be set as the next dynpro. Depending on which checkboxes you ` &&
|
||||||
|
`have selected, text is displayed in the fields below showing the effect of FIELD statements.` TYPE 'I'.
|
||||||
|
SET SCREEN 9880.
|
||||||
|
WHEN mod_at_exit.
|
||||||
|
SET SCREEN 9890.
|
||||||
|
ENDCASE.
|
||||||
|
WHEN 'SELECTED'.
|
||||||
|
CLEAR conn.
|
||||||
|
SET SCREEN 9880.
|
||||||
|
WHEN 'GET'.
|
||||||
|
GET CURSOR FIELD fld OFFSET off VALUE val LENGTH len.
|
||||||
|
MESSAGE |Current position of cursor: Field: "{ fld }", value: "{ val }", offset: "{ off }", length "{ len }"| TYPE 'I'.
|
||||||
|
SET SCREEN 9880.
|
||||||
|
WHEN 'SET'.
|
||||||
|
set = abap_true.
|
||||||
|
MESSAGE `Clicking the pushbutton triggers a SET CURSOR statement to be called at PBO. This sets the cursor on ` &&
|
||||||
|
`a specific input field (the one in the lower left corner).` TYPE 'I'.
|
||||||
|
SET SCREEN 9880.
|
||||||
|
WHEN 'HOME'.
|
||||||
|
LEAVE TO SCREEN 9850.
|
||||||
|
WHEN 'LEAVE' OR 'CANCEL'.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
WHEN OTHERS.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
***************** Dialog modules for 9890 ****************************
|
||||||
|
"For demonstration purposes, the dialog module implementations are
|
||||||
|
"done in methods of a local class.
|
||||||
|
|
||||||
|
MODULE status_9890 OUTPUT.
|
||||||
|
local_class=>pbo9890( ).
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9890 INPUT.
|
||||||
|
local_class=>pai9890( ).
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
***************** Dialog modules for 9900 ****************************
|
||||||
|
|
||||||
|
MODULE status_9900 OUTPUT.
|
||||||
|
SET PF-STATUS 'STATUS9900'.
|
||||||
|
SET TITLEBAR 'TITLE9900'.
|
||||||
|
|
||||||
|
"For vertically scrolling in the table control
|
||||||
|
"To do this, the LINES component of the scxtab_control structure is set
|
||||||
|
"to the correct line number. Each time the scroll bar is scrolled, the
|
||||||
|
"PAI event is triggered with an empty function code, and the top_line
|
||||||
|
"component of the cxtab_control structure is automatically set to the
|
||||||
|
"new top line before PBO.
|
||||||
|
flights-lines = lines( itab_flights ).
|
||||||
|
|
||||||
|
"Setting a tab to be active by default in case of calling the
|
||||||
|
"dynpro again after leaving it.
|
||||||
|
IF tabstr-activetab IS INITIAL
|
||||||
|
OR number IS INITIAL.
|
||||||
|
number = '9920'.
|
||||||
|
tabstr-activetab = 'TAB2'.
|
||||||
|
ENDIF.
|
||||||
|
local_class=>cc_alv_display( 'ALVCONT' ).
|
||||||
|
dyn_num = sy-dynnr.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9900 INPUT.
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
WHEN 'TAB1'.
|
||||||
|
number = '9910'.
|
||||||
|
tabstr-activetab = save_ok.
|
||||||
|
WHEN 'TAB2'.
|
||||||
|
number = '9920'.
|
||||||
|
tabstr-activetab = save_ok.
|
||||||
|
WHEN 'HOME'.
|
||||||
|
"REFRESH statement: You can check out the effect, for example, by setting
|
||||||
|
"the vertical scroll bar somewhere. If you then go back and call the dynpro
|
||||||
|
"again, the control is refreshed (the scroll bar is again at the top).
|
||||||
|
REFRESH CONTROL 'FLIGHTS' FROM SCREEN sy-dynnr.
|
||||||
|
CLEAR: number, tabstr-activetab.
|
||||||
|
SET SCREEN 0.
|
||||||
|
LEAVE SCREEN.
|
||||||
|
WHEN 'CANCEL' OR 'LEAVE'.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
***************** Further dialog modules to support the example ****************************
|
||||||
|
|
||||||
|
MODULE module_1 INPUT.
|
||||||
|
output_field_1 = 'Available in module_1:' && ` ` &&
|
||||||
|
COND #( WHEN field_a = abap_true THEN 'A' ELSE '' ) &&
|
||||||
|
COND #( WHEN field_b = abap_true THEN 'B' ELSE '' ) &&
|
||||||
|
COND #( WHEN field_c = abap_true THEN 'C' ELSE '' ) &&
|
||||||
|
' /'.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_2 INPUT.
|
||||||
|
output_field_1 = output_field_1 &&
|
||||||
|
' Available in module_2:' && ` ` &&
|
||||||
|
COND #( WHEN field_a = abap_true THEN 'A' ELSE '' ) &&
|
||||||
|
COND #( WHEN field_b = abap_true THEN 'B' ELSE '' ) &&
|
||||||
|
COND #( WHEN field_c = abap_true THEN 'C' ELSE '' ) &&
|
||||||
|
' /'.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_3 INPUT.
|
||||||
|
output_field_1 = output_field_1 &&
|
||||||
|
' Available in module_3:' && ` ` &&
|
||||||
|
COND #( WHEN field_a = abap_true THEN 'A' ELSE '' ) &&
|
||||||
|
COND #( WHEN field_b = abap_true THEN 'B' ELSE '' ) &&
|
||||||
|
COND #( WHEN field_c = abap_true THEN 'C' ELSE '' ).
|
||||||
|
CLEAR: field_a, field_b, field_c.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_4 INPUT.
|
||||||
|
output_field_2 = 'module_4 was called because field_d was selected.'.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_5 INPUT.
|
||||||
|
output_field_3 = 'module_5 was called because field_e and field_f were selected.'.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_f1 INPUT.
|
||||||
|
"In this example, a demo object from the ABAP Keyword
|
||||||
|
"Documentation examples is used.
|
||||||
|
CALL FUNCTION 'HELP_OBJECT_SHOW'
|
||||||
|
EXPORTING
|
||||||
|
dokclass = 'TX'
|
||||||
|
doklangu = sy-langu
|
||||||
|
dokname = 'DEMO_FOR_F1_HELP'
|
||||||
|
TABLES
|
||||||
|
links = links.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_f4 INPUT.
|
||||||
|
CALL FUNCTION 'DYNP_VALUES_READ'
|
||||||
|
EXPORTING
|
||||||
|
dyname = progname
|
||||||
|
dynumb = dynnum
|
||||||
|
translate_to_upper = 'X'
|
||||||
|
TABLES
|
||||||
|
dynpfields = dynpro_values.
|
||||||
|
|
||||||
|
field_value = dynpro_values[ 1 ].
|
||||||
|
|
||||||
|
SELECT carrid, connid
|
||||||
|
FROM zdemo_abap_flsch
|
||||||
|
WHERE carrid = @( CONV #( field_value-fieldvalue ) )
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @values_tab.
|
||||||
|
|
||||||
|
"Note: To save extra artifacts, this example goes without a dedicated DDIC
|
||||||
|
"structure with which input help can be created comfortably. Hence, creating
|
||||||
|
"a table manually for the field_tab parameter of the function module below.
|
||||||
|
field_tab = VALUE #(
|
||||||
|
( tabname = 'ZDEMO_ABAP_FLSCH' fieldname = 'CARRID' langu = 'E' position = '1'
|
||||||
|
offset = '0' leng = '3' intlen = '6' outputlen = '3' datatype = 'CHAR' inttype = 'C' )
|
||||||
|
( tabname = 'ZDEMO_ABAP_FLSCH' fieldname = 'CONNID' langu = 'E' position = '2'
|
||||||
|
offset = '6' leng = '4' intlen = '8' outputlen = '4' datatype = 'NUMC' inttype = 'N' ) ).
|
||||||
|
|
||||||
|
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
|
||||||
|
EXPORTING
|
||||||
|
retfield = 'CONNID'
|
||||||
|
dynpprog = progname
|
||||||
|
dynpnr = dynnum
|
||||||
|
dynprofield = 'CONN'
|
||||||
|
value_org = 'S'
|
||||||
|
window_title = 'Selection'
|
||||||
|
TABLES
|
||||||
|
value_tab = values_tab
|
||||||
|
field_tab = field_tab.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_dropdown INPUT.
|
||||||
|
SELECT DISTINCT carrid
|
||||||
|
FROM zdemo_abap_flsch
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @carrid_list.
|
||||||
|
|
||||||
|
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
|
||||||
|
EXPORTING
|
||||||
|
retfield = 'CARRID'
|
||||||
|
value_org = 'S'
|
||||||
|
TABLES
|
||||||
|
value_tab = carrid_list
|
||||||
|
EXCEPTIONS
|
||||||
|
parameter_error = 1
|
||||||
|
no_values_found = 2
|
||||||
|
OTHERS = 3.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
carr = 'LH'.
|
||||||
|
ENDIF.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_fill_table OUTPUT.
|
||||||
|
TRY.
|
||||||
|
zdemo_abap_flsch = itab_flights[ flights-current_line ].
|
||||||
|
CATCH cx_sy_itab_line_not_found.
|
||||||
|
RETURN.
|
||||||
|
ENDTRY.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE module_read_table INPUT.
|
||||||
|
lines = sy-loopc.
|
||||||
|
MODIFY itab_flights FROM zdemo_abap_flsch INDEX flights-current_line.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE cancel INPUT.
|
||||||
|
local_class=>cancel( ).
|
||||||
|
ENDMODULE.
|
||||||
2793
src/test_abap_cheat_sheets_classic/zdemo_abap_dynpro.prog.xml
Normal file
2793
src/test_abap_cheat_sheets_classic/zdemo_abap_dynpro.prog.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
|||||||
|
FUNCTION-POOL ZDEMO_ABAP_FUGR. "MESSAGE-ID ..
|
||||||
|
|
||||||
|
* INCLUDE LZDEMO_ABAP_FUGRD... " Local class definition
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<PROGDIR>
|
||||||
|
<NAME>LZDEMO_ABAP_FUGRTOP</NAME>
|
||||||
|
<DBAPL>S</DBAPL>
|
||||||
|
<DBNA>D$</DBNA>
|
||||||
|
<SUBC>I</SUBC>
|
||||||
|
<APPL>S</APPL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<LDBNAME>D$S</LDBNAME>
|
||||||
|
<UCCHECK>X</UCCHECK>
|
||||||
|
</PROGDIR>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
*******************************************************************
|
||||||
|
* System-defined Include-files. *
|
||||||
|
*******************************************************************
|
||||||
|
INCLUDE LZDEMO_ABAP_FUGRTOP. " Global Declarations
|
||||||
|
INCLUDE LZDEMO_ABAP_FUGRUXX. " Function Modules
|
||||||
|
|
||||||
|
*******************************************************************
|
||||||
|
* User-defined Include-files (if necessary). *
|
||||||
|
*******************************************************************
|
||||||
|
* INCLUDE LZDEMO_ABAP_FUGRF... " Subroutines
|
||||||
|
* INCLUDE LZDEMO_ABAP_FUGRO... " PBO-Modules
|
||||||
|
* INCLUDE LZDEMO_ABAP_FUGRI... " PAI-Modules
|
||||||
|
* INCLUDE LZDEMO_ABAP_FUGRE... " Events
|
||||||
|
* INCLUDE LZDEMO_ABAP_FUGRP... " Local class implement.
|
||||||
|
* INCLUDE LZDEMO_ABAP_FUGRT99. " ABAP Unit tests
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<PROGDIR>
|
||||||
|
<NAME>SAPLZDEMO_ABAP_FUGR</NAME>
|
||||||
|
<DBAPL>S</DBAPL>
|
||||||
|
<DBNA>D$</DBNA>
|
||||||
|
<SUBC>F</SUBC>
|
||||||
|
<APPL>S</APPL>
|
||||||
|
<RLOAD>E</RLOAD>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<LDBNAME>D$S</LDBNAME>
|
||||||
|
<UCCHECK>X</UCCHECK>
|
||||||
|
</PROGDIR>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
63
src/test_abap_cheat_sheets_classic/zdemo_abap_fugr.fugr.xml
Normal file
63
src/test_abap_cheat_sheets_classic/zdemo_abap_fugr.fugr.xml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_FUGR" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<AREAT>Demo function group</AREAT>
|
||||||
|
<INCLUDES>
|
||||||
|
<SOBJ_NAME>LZDEMO_ABAP_FUGRTOP</SOBJ_NAME>
|
||||||
|
<SOBJ_NAME>SAPLZDEMO_ABAP_FUGR</SOBJ_NAME>
|
||||||
|
</INCLUDES>
|
||||||
|
<FUNCTIONS>
|
||||||
|
<item>
|
||||||
|
<FUNCNAME>ZDEMO_ABAP_DELETE_FU</FUNCNAME>
|
||||||
|
<UPDATE_TASK>1</UPDATE_TASK>
|
||||||
|
<SHORT_TEXT>Demo update function module</SHORT_TEXT>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<FUNCNAME>ZDEMO_ABAP_LOG_FU</FUNCNAME>
|
||||||
|
<UPDATE_TASK>1</UPDATE_TASK>
|
||||||
|
<SHORT_TEXT>Demo update function module</SHORT_TEXT>
|
||||||
|
<IMPORT>
|
||||||
|
<RSIMP>
|
||||||
|
<PARAMETER>LOG</PARAMETER>
|
||||||
|
<TYP>ZCL_DEMO_ABAP_SAP_LUW_HELPER=>LOG_TYPE</TYP>
|
||||||
|
</RSIMP>
|
||||||
|
<RSIMP>
|
||||||
|
<PARAMETER>CAUSE_ERROR</PARAMETER>
|
||||||
|
<DEFAULT>ABAP_FALSE</DEFAULT>
|
||||||
|
<OPTIONAL>X</OPTIONAL>
|
||||||
|
<TYP>ABAP_BOOL</TYP>
|
||||||
|
</RSIMP>
|
||||||
|
</IMPORT>
|
||||||
|
<DOCUMENTATION>
|
||||||
|
<RSFDO>
|
||||||
|
<PARAMETER>LOG</PARAMETER>
|
||||||
|
<KIND>P</KIND>
|
||||||
|
</RSFDO>
|
||||||
|
<RSFDO>
|
||||||
|
<PARAMETER>CAUSE_ERROR</PARAMETER>
|
||||||
|
<KIND>P</KIND>
|
||||||
|
</RSFDO>
|
||||||
|
</DOCUMENTATION>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<FUNCNAME>ZDEMO_ABAP_MODIFY_FU</FUNCNAME>
|
||||||
|
<UPDATE_TASK>1</UPDATE_TASK>
|
||||||
|
<SHORT_TEXT>Demo update function module</SHORT_TEXT>
|
||||||
|
<IMPORT>
|
||||||
|
<RSIMP>
|
||||||
|
<PARAMETER>VALUES</PARAMETER>
|
||||||
|
<TYP>ZDEMO_ABAP_LUW_T</TYP>
|
||||||
|
</RSIMP>
|
||||||
|
</IMPORT>
|
||||||
|
<DOCUMENTATION>
|
||||||
|
<RSFDO>
|
||||||
|
<PARAMETER>VALUES</PARAMETER>
|
||||||
|
<KIND>P</KIND>
|
||||||
|
</RSFDO>
|
||||||
|
</DOCUMENTATION>
|
||||||
|
</item>
|
||||||
|
</FUNCTIONS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
FUNCTION zdemo_abap_delete_fu.
|
||||||
|
*"----------------------------------------------------------------------
|
||||||
|
*"*"Update Function Module:
|
||||||
|
*"
|
||||||
|
*"*"Local Interface:
|
||||||
|
*"----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
DELETE FROM zdemo_abap_luw_t.
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>create_log_entries(
|
||||||
|
VALUE #( ( id = 70
|
||||||
|
context = 'Function module'
|
||||||
|
name = 'zdemo_abap_delete_fu'
|
||||||
|
details = `Function module called`
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 71
|
||||||
|
context = 'Function module'
|
||||||
|
name = 'zdemo_abap_delete_fu'
|
||||||
|
details = zcl_demo_abap_sap_luw_helper=>get_work_process_info( )
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 72
|
||||||
|
context = 'Function module'
|
||||||
|
name = 'zdemo_abap_delete_fu'
|
||||||
|
details = `SAP LUW Key: ` && cl_system_transaction_state=>get_sap_luw_key( )
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 73
|
||||||
|
context = 'Function module'
|
||||||
|
name = 'zdemo_abap_delete_fu'
|
||||||
|
details = zcl_demo_abap_sap_luw_helper=>checking_transaction_state( )
|
||||||
|
timestamp = utclong_current( ) ) ) ).
|
||||||
|
|
||||||
|
|
||||||
|
ENDFUNCTION.
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
FUNCTION ZDEMO_ABAP_LOG_FU.
|
||||||
|
*"----------------------------------------------------------------------
|
||||||
|
*"*"Update Function Module:
|
||||||
|
*"
|
||||||
|
*"*"Local Interface:
|
||||||
|
*" IMPORTING
|
||||||
|
*" VALUE(LOG) TYPE ZCL_DEMO_ABAP_SAP_LUW_HELPER=>LOG_TYPE
|
||||||
|
*" VALUE(CAUSE_ERROR) TYPE ABAP_BOOL DEFAULT ABAP_FALSE
|
||||||
|
*"----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
MODIFY zdemo_abap_logt FROM TABLE @log.
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>create_log_entries(
|
||||||
|
VALUE #( ( id = 90
|
||||||
|
context = `Function module`
|
||||||
|
name = `zdemo_abap_log_fu`
|
||||||
|
details = `Function module called`
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 91
|
||||||
|
context = `Function module`
|
||||||
|
name = `zdemo_abap_log_fu`
|
||||||
|
details = zcl_demo_abap_sap_luw_helper=>get_work_process_info( )
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 92
|
||||||
|
context = `Function module`
|
||||||
|
name = `zdemo_abap_log_fu`
|
||||||
|
details = `SAP LUW Key: ` && cl_system_transaction_state=>get_sap_luw_key( )
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 93
|
||||||
|
context = `Function module`
|
||||||
|
name = `zdemo_abap_log_fu`
|
||||||
|
details = zcl_demo_abap_sap_luw_helper=>checking_transaction_state( )
|
||||||
|
timestamp = utclong_current( ) ) ) ).
|
||||||
|
|
||||||
|
IF cause_error = abap_true.
|
||||||
|
DATA(error_not_caught) = 1 / 0.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
|
||||||
|
ENDFUNCTION.
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
FUNCTION ZDEMO_ABAP_MODIFY_FU.
|
||||||
|
*"----------------------------------------------------------------------
|
||||||
|
*"*"Update Function Module:
|
||||||
|
*"
|
||||||
|
*"*"Local Interface:
|
||||||
|
*" IMPORTING
|
||||||
|
*" VALUE(VALUES) TYPE ZDEMO_ABAP_LUW_T
|
||||||
|
*"----------------------------------------------------------------------
|
||||||
|
|
||||||
|
values-time_stamp = utclong_current( ).
|
||||||
|
|
||||||
|
MODIFY zdemo_abap_luw_t FROM @values.
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>create_log_entries(
|
||||||
|
VALUE #( ( id = 80
|
||||||
|
context = 'Function module'
|
||||||
|
name = 'zdemo_abap_modify_fu'
|
||||||
|
details = `Function module called`
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 81
|
||||||
|
context = 'Function module'
|
||||||
|
name = 'zdemo_abap_modify_fu'
|
||||||
|
details = zcl_demo_abap_sap_luw_helper=>get_work_process_info( )
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 82
|
||||||
|
context = 'Function module'
|
||||||
|
name = 'zdemo_abap_modify_fu'
|
||||||
|
details = `SAP LUW Key: ` && cl_system_transaction_state=>get_sap_luw_key( )
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 83
|
||||||
|
context = 'Function module'
|
||||||
|
name = 'zdemo_abap_modify_fu'
|
||||||
|
details = zcl_demo_abap_sap_luw_helper=>checking_transaction_state( )
|
||||||
|
timestamp = utclong_current( ) ) ) ).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ENDFUNCTION.
|
||||||
83
src/test_abap_cheat_sheets_classic/zdemo_abap_logt.tabl.xml
Normal file
83
src/test_abap_cheat_sheets_classic/zdemo_abap_logt.tabl.xml
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_LOGT</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Log table</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_LOGT</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>ID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CONTEXT</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000030</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000015</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NAME</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000040</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000020</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>DETAILS</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>g</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<DATATYPE>STRG</DATATYPE>
|
||||||
|
<MASK> STRG</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>TIMESTAMP</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>p</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<DATATYPE>UTCL</DATATYPE>
|
||||||
|
<LENG>000027</LENG>
|
||||||
|
<MASK> UTCL</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
75
src/test_abap_cheat_sheets_classic/zdemo_abap_luw_t.tabl.xml
Normal file
75
src/test_abap_cheat_sheets_classic/zdemo_abap_luw_t.tabl.xml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_LUW_T</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo database table</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_LUW_T</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CH</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>TIME_STAMP</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>p</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<DATATYPE>UTCL</DATATYPE>
|
||||||
|
<LENG>000027</LENG>
|
||||||
|
<MASK> UTCL</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
513
src/test_abap_cheat_sheets_classic/zdemo_abap_sap_luw.prog.abap
Normal file
513
src/test_abap_cheat_sheets_classic/zdemo_abap_sap_luw.prog.abap
Normal file
@@ -0,0 +1,513 @@
|
|||||||
|
*&---------------------------------------------------------------------*
|
||||||
|
*& ABAP cheat sheet: SAP LUW
|
||||||
|
*&
|
||||||
|
*&-------------------------- PURPOSE ----------------------------------*
|
||||||
|
*& - Example to demonstrate ABAP syntax in the context of the SAP LUW.
|
||||||
|
*& - Topics covered: Using update function modules and subroutines as
|
||||||
|
*& bundling techniques, synchronous/asynchronous/local updates
|
||||||
|
*&
|
||||||
|
*&----------------------- GETTING STARTED -----------------------------*
|
||||||
|
*& - Open the program with the ABAP development tools for Eclipse (ADT).
|
||||||
|
*& - Choose F8 to run the program.
|
||||||
|
*& - Select the radio buttons and choose 'Go' to progress with the program.
|
||||||
|
*&
|
||||||
|
*&----------------------------- NOTE -----------------------------------*
|
||||||
|
*&* The code presented in this class is intended only to support the ABAP
|
||||||
|
*&* cheat sheets. It is not intended for direct use in a production system
|
||||||
|
*&* environment. The code examples in the ABAP cheat sheets are primarily
|
||||||
|
*&* intended to provide a better explanation and visualization of the
|
||||||
|
*&* syntax and semantics of ABAP statements, not to solve concrete
|
||||||
|
*&* programming tasks. For production application programs, you should
|
||||||
|
*&* always work out your own solution for each individual case. There is
|
||||||
|
*&* no guarantee for the correctness or completeness of the code.
|
||||||
|
*&* Furthermore, there is no legal responsibility or liability for any
|
||||||
|
*&* errors or their consequences that may occur when using the the example
|
||||||
|
*&* code.
|
||||||
|
*&---------------------------------------------------------------------*
|
||||||
|
REPORT zdemo_abap_sap_luw.
|
||||||
|
|
||||||
|
DATA: tab_struc TYPE zdemo_abap_luw_t,
|
||||||
|
ok_code LIKE sy-ucomm,
|
||||||
|
save_ok LIKE sy-ucomm,
|
||||||
|
del_insert TYPE abap_bool,
|
||||||
|
perform TYPE abap_bool,
|
||||||
|
commit TYPE abap_bool,
|
||||||
|
commit_wait TYPE abap_bool,
|
||||||
|
local_update TYPE abap_bool,
|
||||||
|
err TYPE abap_bool,
|
||||||
|
rollback TYPE abap_bool,
|
||||||
|
terminate TYPE abap_bool,
|
||||||
|
dynnr TYPE sy-dynnr,
|
||||||
|
counter TYPE i,
|
||||||
|
log_itab TYPE zcl_demo_abap_sap_luw_helper=>log_type.
|
||||||
|
|
||||||
|
CLASS lcl DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF request4log,
|
||||||
|
log TYPE zdemo_abap_logt,
|
||||||
|
called TYPE abap_bool,
|
||||||
|
wp_info TYPE abap_bool,
|
||||||
|
luw_key TYPE abap_bool,
|
||||||
|
tx_state TYPE abap_bool,
|
||||||
|
END OF request4log.
|
||||||
|
|
||||||
|
CLASS-METHODS: prep,
|
||||||
|
create_log_entries IMPORTING req TYPE request4log.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD prep.
|
||||||
|
DELETE FROM zdemo_abap_luw_t.
|
||||||
|
|
||||||
|
INSERT zdemo_abap_luw_t FROM TABLE @( VALUE #(
|
||||||
|
( key_field = 1
|
||||||
|
ch = 'DEMO DATA'
|
||||||
|
num = 11
|
||||||
|
time_stamp = utclong_current( ) )
|
||||||
|
( key_field = 2
|
||||||
|
ch = 'THAT WAS'
|
||||||
|
num = 22
|
||||||
|
time_stamp = utclong_current( ) )
|
||||||
|
( key_field = 3
|
||||||
|
ch = 'CREATED'
|
||||||
|
num = 33
|
||||||
|
time_stamp = utclong_current( ) )
|
||||||
|
( key_field = 4
|
||||||
|
ch = 'IN ADVANCE'
|
||||||
|
num = 44
|
||||||
|
time_stamp = utclong_current( ) ) ) ).
|
||||||
|
|
||||||
|
DELETE FROM zdemo_abap_logt.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD create_log_entries.
|
||||||
|
|
||||||
|
IF req-called = abap_true.
|
||||||
|
counter += 1.
|
||||||
|
INSERT VALUE #( id = counter
|
||||||
|
context = req-log-context
|
||||||
|
name = req-log-name
|
||||||
|
details = `Called!`
|
||||||
|
timestamp = utclong_current( )
|
||||||
|
) INTO TABLE log_itab.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF req-luw_key = abap_true.
|
||||||
|
counter += 1.
|
||||||
|
INSERT VALUE #( id = counter
|
||||||
|
context = req-log-context
|
||||||
|
name = req-log-name
|
||||||
|
details = `SAP LUW key: ` &&
|
||||||
|
cl_system_transaction_state=>get_sap_luw_key( )
|
||||||
|
timestamp = utclong_current( )
|
||||||
|
) INTO TABLE log_itab.
|
||||||
|
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF req-wp_info = abap_true.
|
||||||
|
counter += 1.
|
||||||
|
INSERT VALUE #( id = counter
|
||||||
|
context = req-log-context
|
||||||
|
name = req-log-name
|
||||||
|
details =
|
||||||
|
zcl_demo_abap_sap_luw_helper=>get_work_process_info( )
|
||||||
|
timestamp = utclong_current( )
|
||||||
|
) INTO TABLE log_itab.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF req-tx_state = abap_true.
|
||||||
|
counter += 1.
|
||||||
|
INSERT VALUE #(
|
||||||
|
id = counter
|
||||||
|
context = req-log-context
|
||||||
|
name = req-log-name
|
||||||
|
details =
|
||||||
|
zcl_demo_abap_sap_luw_helper=>checking_transaction_state( )
|
||||||
|
timestamp = utclong_current( )
|
||||||
|
) INTO TABLE log_itab.
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
FORM delete.
|
||||||
|
zcl_demo_abap_sap_luw_helper=>subr_delete( ).
|
||||||
|
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'Subroutine'
|
||||||
|
name = 'delete' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
ENDFORM.
|
||||||
|
|
||||||
|
FORM insert.
|
||||||
|
|
||||||
|
DATA values TYPE zdemo_abap_luw_t.
|
||||||
|
IMPORT values = values FROM MEMORY ID 'DEMO_INSERT'.
|
||||||
|
IF sy-subrc = 0.
|
||||||
|
values-time_stamp = utclong_current( ).
|
||||||
|
zcl_demo_abap_sap_luw_helper=>subr_insert( values ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'Subroutine'
|
||||||
|
name = 'insert' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
ENDFORM.
|
||||||
|
|
||||||
|
FORM update_log.
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'Subroutine'
|
||||||
|
name = 'update_log' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>subr_update_log( log_itab ).
|
||||||
|
ENDFORM.
|
||||||
|
|
||||||
|
FORM call_on_rollback.
|
||||||
|
|
||||||
|
"No implementation here. Only to demonstrate that the
|
||||||
|
"subroutine is called in the event of triggering a
|
||||||
|
"rollback.
|
||||||
|
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'Subroutine'
|
||||||
|
name = 'call_on_rollback' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true ) ).
|
||||||
|
ENDFORM.
|
||||||
|
|
||||||
|
END-OF-SELECTION.
|
||||||
|
|
||||||
|
lcl=>prep( ).
|
||||||
|
|
||||||
|
counter += 1.
|
||||||
|
INSERT VALUE #(
|
||||||
|
id = counter
|
||||||
|
context = '-'
|
||||||
|
name = '-'
|
||||||
|
details = |Program { sy-repid } has been started.| &&
|
||||||
|
`The first dynpro is about to be called.`
|
||||||
|
timestamp = utclong_current( )
|
||||||
|
) INTO TABLE log_itab.
|
||||||
|
|
||||||
|
counter += 1.
|
||||||
|
INSERT VALUE #( id = counter
|
||||||
|
context = '-'
|
||||||
|
name = '-'
|
||||||
|
details = `SAP LUW Key: ` &&
|
||||||
|
cl_system_transaction_state=>get_sap_luw_key( )
|
||||||
|
timestamp = utclong_current( )
|
||||||
|
) INTO TABLE log_itab.
|
||||||
|
|
||||||
|
CALL SCREEN 9750.
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
***************** Dialog modules for 9750 ****************************
|
||||||
|
|
||||||
|
MODULE status_9750 OUTPUT.
|
||||||
|
SET PF-STATUS 'STATUS9750'.
|
||||||
|
SET TITLEBAR 'TITLE9750'.
|
||||||
|
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'PBO'
|
||||||
|
name = 'status_9750' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>cc_alv_display( 'DBENTRIES' ).
|
||||||
|
dynnr = sy-dynnr.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9750 INPUT.
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'PAI'
|
||||||
|
name = 'user_command_9750' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
WHEN 'GO' OR 'ENTER'.
|
||||||
|
|
||||||
|
IF del_insert = abap_true.
|
||||||
|
CALL FUNCTION 'ZDEMO_ABAP_DELETE_FU' IN UPDATE TASK.
|
||||||
|
|
||||||
|
MESSAGE `A function module has been registered ` &&
|
||||||
|
`that clears the database table.` TYPE 'I'.
|
||||||
|
|
||||||
|
ELSEIF local_update = abap_true.
|
||||||
|
|
||||||
|
SET UPDATE TASK LOCAL.
|
||||||
|
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'PAI'
|
||||||
|
name = 'user_command_9750' )
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
CALL FUNCTION 'ZDEMO_ABAP_DELETE_FU' IN UPDATE TASK.
|
||||||
|
|
||||||
|
MESSAGE `Local update has been activated. A function ` &&
|
||||||
|
`module has been registered that clears the database table.` &&
|
||||||
|
` No matter if you choose COMMIT WORK or COMMIT WORK AND ` &&
|
||||||
|
`WAIT in the next step, it will be a synchronous update.` TYPE 'I'.
|
||||||
|
|
||||||
|
ELSEIF perform = abap_true.
|
||||||
|
|
||||||
|
PERFORM delete ON COMMIT.
|
||||||
|
PERFORM call_on_rollback ON ROLLBACK.
|
||||||
|
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'PAI'
|
||||||
|
name = 'user_command_9750' )
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
MESSAGE `Subroutines have been registered for commit ` &&
|
||||||
|
`and rollback.` TYPE 'I'.
|
||||||
|
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
WHEN OTHERS.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
***************** Dialog modules for 9760 ****************************
|
||||||
|
|
||||||
|
MODULE status_9760 OUTPUT.
|
||||||
|
SET PF-STATUS 'STATUS9760'.
|
||||||
|
SET TITLEBAR 'TITLE9760'.
|
||||||
|
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'PBO'
|
||||||
|
name = 'status_9760' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
dynnr = sy-dynnr.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9760 INPUT.
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'PAI'
|
||||||
|
name = 'user_command_9760' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
WHEN 'GO' OR 'ENTER'.
|
||||||
|
|
||||||
|
IF perform = abap_true.
|
||||||
|
"Registered subroutines cannot have any parameter interface.
|
||||||
|
"Therefore, data can only be passed through external interfaces,
|
||||||
|
"for example, the ABAP memory.
|
||||||
|
EXPORT values = tab_struc TO MEMORY ID 'DEMO_INSERT'.
|
||||||
|
PERFORM insert ON COMMIT.
|
||||||
|
|
||||||
|
MESSAGE `A subroutine that inserts the entries in the ` &&
|
||||||
|
`database table has been registered. ` &&
|
||||||
|
`When you select a commit option in the next step, ` &&
|
||||||
|
`COMMIT WORK and COMMIT WORK AND WAIT have ` &&
|
||||||
|
`the same effect. The subroutines are executed in ` &&
|
||||||
|
`the current work process in this case.` TYPE 'I'.
|
||||||
|
ELSE.
|
||||||
|
CALL FUNCTION 'ZDEMO_ABAP_MODIFY_FU' IN UPDATE TASK
|
||||||
|
EXPORTING
|
||||||
|
values = tab_struc.
|
||||||
|
MESSAGE `An update function module that inserts the ` &&
|
||||||
|
`entries in the database table has ` &&
|
||||||
|
`been registered.` TYPE 'I'.
|
||||||
|
ENDIF.
|
||||||
|
WHEN OTHERS.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
***************** Dialog modules for 9770 ****************************
|
||||||
|
|
||||||
|
MODULE status_9770 OUTPUT.
|
||||||
|
SET PF-STATUS 'STATUS9770'.
|
||||||
|
SET TITLEBAR 'TITLE9770'.
|
||||||
|
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'PBO'
|
||||||
|
name = 'status_9770' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
dynnr = sy-dynnr.
|
||||||
|
|
||||||
|
IF perform = 'X'.
|
||||||
|
LOOP AT SCREEN INTO DATA(scr).
|
||||||
|
IF scr-name = 'EXCURSION_WP'
|
||||||
|
OR scr-name = 'WAIT'
|
||||||
|
OR scr-name = 'FAIL_LUW'
|
||||||
|
OR scr-name = 'ERR'
|
||||||
|
OR scr-name = 'TERMINATE'
|
||||||
|
OR scr-name = 'ERROR_A'.
|
||||||
|
scr-invisible = '1'.
|
||||||
|
MODIFY SCREEN FROM scr.
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
ENDIF.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9770 INPUT.
|
||||||
|
lcl=>create_log_entries(
|
||||||
|
VALUE #( log = VALUE #( context = 'PAI'
|
||||||
|
name = 'user_command_9770' )
|
||||||
|
called = abap_true
|
||||||
|
luw_key = abap_true
|
||||||
|
tx_state = abap_true
|
||||||
|
wp_info = abap_true ) ).
|
||||||
|
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
|
||||||
|
WHEN 'GO' OR 'ENTER' OR 'OK'.
|
||||||
|
|
||||||
|
CASE 'X'.
|
||||||
|
|
||||||
|
WHEN commit.
|
||||||
|
IF perform = abap_false.
|
||||||
|
CALL FUNCTION 'ZDEMO_ABAP_LOG_FU' IN UPDATE TASK
|
||||||
|
EXPORTING
|
||||||
|
log = log_itab.
|
||||||
|
MESSAGE `An update function module that inserts ` &&
|
||||||
|
`entries for the log has been registered. ` &&
|
||||||
|
`COMMIT WORK is about to be executed.` TYPE 'I'.
|
||||||
|
ELSE.
|
||||||
|
PERFORM update_log ON COMMIT.
|
||||||
|
|
||||||
|
MESSAGE `A subroutine that inserts entries for the ` &&
|
||||||
|
`log has been registered ` &&
|
||||||
|
`COMMIT WORK is about to be executed.` TYPE 'I'.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
COMMIT WORK.
|
||||||
|
|
||||||
|
SELECT COUNT(*) FROM zdemo_abap_luw_t INTO @DATA(entries).
|
||||||
|
|
||||||
|
MESSAGE `COMMIT WORK has been executed. Current ` &&
|
||||||
|
`number of database table entries: ` &&
|
||||||
|
entries &&
|
||||||
|
`. If it is 4 and not 1, the update will be done ` &&
|
||||||
|
`asynchronously.` TYPE 'I'.
|
||||||
|
WHEN commit_wait.
|
||||||
|
IF perform = abap_false.
|
||||||
|
CALL FUNCTION 'ZDEMO_ABAP_LOG_FU' IN UPDATE TASK
|
||||||
|
EXPORTING
|
||||||
|
log = log_itab.
|
||||||
|
MESSAGE `An update function module that inserts ` &&
|
||||||
|
`entries for the log has been registered. ` &&
|
||||||
|
`COMMIT WORK AND WAIT is about to be executed.` TYPE 'I'.
|
||||||
|
ELSE.
|
||||||
|
PERFORM update_log ON COMMIT.
|
||||||
|
|
||||||
|
MESSAGE `A subroutine that inserts entries for the ` &&
|
||||||
|
`log has been registered ` &&
|
||||||
|
`COMMIT WORK AND WAIT is about to be executed.` TYPE 'I'.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
COMMIT WORK AND WAIT.
|
||||||
|
|
||||||
|
SELECT COUNT(*) FROM zdemo_abap_luw_t INTO @entries.
|
||||||
|
|
||||||
|
MESSAGE `COMMIT WORK AND WAIT has been executed. Current ` &&
|
||||||
|
`number of database table entries: ` &&
|
||||||
|
entries &&
|
||||||
|
`. If it is 1, the update has been done synchronously.` TYPE 'I'.
|
||||||
|
WHEN rollback.
|
||||||
|
ROLLBACK WORK.
|
||||||
|
|
||||||
|
MESSAGE `ROLLBACK WORK has been executed. A rollback has ` &&
|
||||||
|
`been triggered. The original database table content ` &&
|
||||||
|
`should be displayed.`
|
||||||
|
TYPE 'I'.
|
||||||
|
|
||||||
|
MESSAGE `Note: As an exception, and only for this demo ` &&
|
||||||
|
`example, the sample implementation includes a ` &&
|
||||||
|
`database update to the log table after the ` &&
|
||||||
|
`table after the rollback, just to show the progress of the ` &&
|
||||||
|
`execution up to that point.` TYPE 'I' DISPLAY LIKE 'E'.
|
||||||
|
|
||||||
|
"Update log table
|
||||||
|
zcl_demo_abap_sap_luw_helper=>create_log_entries( log_itab ).
|
||||||
|
|
||||||
|
"Log information for triggering a rollback
|
||||||
|
zcl_demo_abap_sap_luw_helper=>create_log_entries(
|
||||||
|
VALUE #( ( id = 99
|
||||||
|
context = '-'
|
||||||
|
name = '-'
|
||||||
|
details = `Rollback triggered`
|
||||||
|
timestamp = utclong_current( ) ) ) ).
|
||||||
|
WHEN err.
|
||||||
|
CALL FUNCTION 'ZDEMO_ABAP_LOG_FU' IN UPDATE TASK
|
||||||
|
EXPORTING
|
||||||
|
log = log_itab
|
||||||
|
cause_error = abap_true.
|
||||||
|
|
||||||
|
IF local_update = abap_true.
|
||||||
|
MESSAGE `A function module has been registered that ` &&
|
||||||
|
`causes an error (zero division). COMMIT WORK AND WAIT ` &&
|
||||||
|
`is about to be executed. You are directly informed ` &&
|
||||||
|
`about the error and the program is terminated. All ` &&
|
||||||
|
`changes are implicitly rolled back. You can check ` &&
|
||||||
|
`transaction ST22 for the error caused.` TYPE 'I'.
|
||||||
|
ELSE.
|
||||||
|
MESSAGE `Function module was registered that ` &&
|
||||||
|
`causes an error (zero division). COMMIT WORK AND WAIT` &&
|
||||||
|
` will be excetued. All changes are implicitly rolled back.` &&
|
||||||
|
` When you start over or leave the example in the next dynpro, ` &&
|
||||||
|
`you should be informed about the issue in the Business Workplace. ` &&
|
||||||
|
`Also check ST22.` TYPE 'I'.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
COMMIT WORK AND WAIT.
|
||||||
|
|
||||||
|
WHEN terminate.
|
||||||
|
MESSAGE `This is an error message of type A. ` &&
|
||||||
|
`It termiantes the program. All changes are ` &&
|
||||||
|
`implicitly rolled back. ` &&
|
||||||
|
`You may want to check the database table entries of ` &&
|
||||||
|
`the example that remain unchanged.` TYPE 'A'.
|
||||||
|
ENDCASE.
|
||||||
|
|
||||||
|
WHEN OTHERS.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
ENDCASE.
|
||||||
|
|
||||||
|
SUBMIT ('ZDEMO_ABAP_SAP_LUW_DISPL').
|
||||||
|
ENDMODULE.
|
||||||
864
src/test_abap_cheat_sheets_classic/zdemo_abap_sap_luw.prog.xml
Normal file
864
src/test_abap_cheat_sheets_classic/zdemo_abap_sap_luw.prog.xml
Normal file
@@ -0,0 +1,864 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<PROGDIR>
|
||||||
|
<NAME>ZDEMO_ABAP_SAP_LUW</NAME>
|
||||||
|
<DBAPL>S</DBAPL>
|
||||||
|
<SUBC>1</SUBC>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<LDBNAME>D$S</LDBNAME>
|
||||||
|
<UCCHECK>X</UCCHECK>
|
||||||
|
</PROGDIR>
|
||||||
|
<DYNPROS>
|
||||||
|
<item>
|
||||||
|
<HEADER>
|
||||||
|
<PROGRAM>ZDEMO_ABAP_SAP_LUW</PROGRAM>
|
||||||
|
<SCREEN>9750</SCREEN>
|
||||||
|
<LANGUAGE>E</LANGUAGE>
|
||||||
|
<DESCRIPT>Delete database table entries</DESCRIPT>
|
||||||
|
<TYPE>N</TYPE>
|
||||||
|
<NEXTSCREEN>9760</NEXTSCREEN>
|
||||||
|
<LINES>027</LINES>
|
||||||
|
<COLUMNS>121</COLUMNS>
|
||||||
|
</HEADER>
|
||||||
|
<CONTAINERS>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>SCREEN</TYPE>
|
||||||
|
<NAME>SCREEN</NAME>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>RADIOGROUP</TYPE>
|
||||||
|
<NAME>%A_DEL_INSERT</NAME>
|
||||||
|
<ELEMENT_OF>SCREEN</ELEMENT_OF>
|
||||||
|
<LINE>006</LINE>
|
||||||
|
<COLUMN>004</COLUMN>
|
||||||
|
<LENGTH>076</LENGTH>
|
||||||
|
<HEIGHT>003</HEIGHT>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>CUST_CTRL</TYPE>
|
||||||
|
<NAME>DBENTRIES</NAME>
|
||||||
|
<ELEMENT_OF>SCREEN</ELEMENT_OF>
|
||||||
|
<LINE>012</LINE>
|
||||||
|
<COLUMN>005</COLUMN>
|
||||||
|
<LENGTH>068</LENGTH>
|
||||||
|
<HEIGHT>007</HEIGHT>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
</CONTAINERS>
|
||||||
|
<FIELDS>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX1</NAME>
|
||||||
|
<TEXT>The_SAP_LUW_is_started._In_this_example,_all_the_entries_in_a_database_table_(see_below)_are_to_be_deleted.</TEXT>
|
||||||
|
<LINE>002</LINE>
|
||||||
|
<COLUMN>004</COLUMN>
|
||||||
|
<LENGTH>107</LENGTH>
|
||||||
|
<VISLENGTH>107</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX2</NAME>
|
||||||
|
<TEXT>The_ABAP_SQL_statement_is_implemented_in_an_update_function_module_and_a_subroutine._</TEXT>
|
||||||
|
<LINE>003</LINE>
|
||||||
|
<COLUMN>004</COLUMN>
|
||||||
|
<LENGTH>085</LENGTH>
|
||||||
|
<VISLENGTH>085</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX3</NAME>
|
||||||
|
<TEXT>Choose_one_of_the_following_options:</TEXT>
|
||||||
|
<LINE>004</LINE>
|
||||||
|
<COLUMN>004</COLUMN>
|
||||||
|
<LENGTH>036</LENGTH>
|
||||||
|
<VISLENGTH>036</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX4</NAME>
|
||||||
|
<TEXT>Current_database_table_entries:</TEXT>
|
||||||
|
<LINE>010</LINE>
|
||||||
|
<COLUMN>004</COLUMN>
|
||||||
|
<LENGTH>031</LENGTH>
|
||||||
|
<VISLENGTH>031</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX5</NAME>
|
||||||
|
<TEXT>Dynpro_number:</TEXT>
|
||||||
|
<LINE>021</LINE>
|
||||||
|
<COLUMN>005</COLUMN>
|
||||||
|
<LENGTH>014</LENGTH>
|
||||||
|
<VISLENGTH>014</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEMPLATE</TYPE>
|
||||||
|
<NAME>DYNNR</NAME>
|
||||||
|
<TEXT>___________</TEXT>
|
||||||
|
<LINE>021</LINE>
|
||||||
|
<COLUMN>021</COLUMN>
|
||||||
|
<LENGTH>011</LENGTH>
|
||||||
|
<VISLENGTH>011</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
<OUTPUTONLY>X</OUTPUTONLY>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>OKCODE</TYPE>
|
||||||
|
<NAME>OK_CODE</NAME>
|
||||||
|
<TEXT>____________________</TEXT>
|
||||||
|
<LENGTH>020</LENGTH>
|
||||||
|
<VISLENGTH>020</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>RADIOGROUP</CONT_TYPE>
|
||||||
|
<CONT_NAME>%A_DEL_INSERT</CONT_NAME>
|
||||||
|
<TYPE>RADIO</TYPE>
|
||||||
|
<NAME>DEL_INSERT</NAME>
|
||||||
|
<TEXT>Use_update_task_(CALL_FUNCTION_..._IN_UPDATE_TASK_statement)</TEXT>
|
||||||
|
<LINE>006</LINE>
|
||||||
|
<COLUMN>004</COLUMN>
|
||||||
|
<LENGTH>062</LENGTH>
|
||||||
|
<VISLENGTH>062</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>RADIOGROUP</CONT_TYPE>
|
||||||
|
<CONT_NAME>%A_DEL_INSERT</CONT_NAME>
|
||||||
|
<TYPE>RADIO</TYPE>
|
||||||
|
<NAME>LOCAL_UPDATE</NAME>
|
||||||
|
<TEXT>Use_update_task_and_perform_local_update_(SET_UPDATE_TASK_LOCAL_statement)</TEXT>
|
||||||
|
<LINE>007</LINE>
|
||||||
|
<COLUMN>004</COLUMN>
|
||||||
|
<LENGTH>076</LENGTH>
|
||||||
|
<VISLENGTH>076</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>RADIOGROUP</CONT_TYPE>
|
||||||
|
<CONT_NAME>%A_DEL_INSERT</CONT_NAME>
|
||||||
|
<TYPE>RADIO</TYPE>
|
||||||
|
<NAME>PERFORM</NAME>
|
||||||
|
<TEXT>Use_subroutines_(PERFORM_statement)</TEXT>
|
||||||
|
<LINE>008</LINE>
|
||||||
|
<COLUMN>004</COLUMN>
|
||||||
|
<LENGTH>037</LENGTH>
|
||||||
|
<VISLENGTH>037</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
</FIELDS>
|
||||||
|
<FLOW_LOGIC>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE>PROCESS BEFORE OUTPUT.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE> MODULE STATUS_9750.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW/>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE>PROCESS AFTER INPUT.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE> MODULE USER_COMMAND_9750.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
</FLOW_LOGIC>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<HEADER>
|
||||||
|
<PROGRAM>ZDEMO_ABAP_SAP_LUW</PROGRAM>
|
||||||
|
<SCREEN>9760</SCREEN>
|
||||||
|
<LANGUAGE>E</LANGUAGE>
|
||||||
|
<DESCRIPT>Create database table entry</DESCRIPT>
|
||||||
|
<TYPE>N</TYPE>
|
||||||
|
<NEXTSCREEN>9770</NEXTSCREEN>
|
||||||
|
<LINES>027</LINES>
|
||||||
|
<COLUMNS>121</COLUMNS>
|
||||||
|
</HEADER>
|
||||||
|
<CONTAINERS>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>SCREEN</TYPE>
|
||||||
|
<NAME>SCREEN</NAME>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
</CONTAINERS>
|
||||||
|
<FIELDS>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX7</NAME>
|
||||||
|
<TEXT>To_create_a_database_table_entry,_make_entries_in_the_following_input_fields:</TEXT>
|
||||||
|
<LINE>002</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>077</LENGTH>
|
||||||
|
<VISLENGTH>077</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX8</NAME>
|
||||||
|
<TEXT>KEY_FIELD</TEXT>
|
||||||
|
<LINE>004</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>009</LENGTH>
|
||||||
|
<VISLENGTH>009</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
<LABELLEFT>X</LABELLEFT>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEMPLATE</TYPE>
|
||||||
|
<NAME>TAB_STRUC-KEY_FIELD</NAME>
|
||||||
|
<TEXT>_______.__</TEXT>
|
||||||
|
<LINE>004</LINE>
|
||||||
|
<COLUMN>015</COLUMN>
|
||||||
|
<LENGTH>010</LENGTH>
|
||||||
|
<VISLENGTH>010</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>INT4</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX11</NAME>
|
||||||
|
<TEXT>Type_i</TEXT>
|
||||||
|
<LINE>004</LINE>
|
||||||
|
<COLUMN>028</COLUMN>
|
||||||
|
<LENGTH>006</LENGTH>
|
||||||
|
<VISLENGTH>006</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX9</NAME>
|
||||||
|
<TEXT>CH</TEXT>
|
||||||
|
<LINE>006</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>002</LENGTH>
|
||||||
|
<VISLENGTH>002</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
<LABELLEFT>X</LABELLEFT>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEMPLATE</TYPE>
|
||||||
|
<NAME>TAB_STRUC-CH</NAME>
|
||||||
|
<TEXT>__________</TEXT>
|
||||||
|
<LINE>006</LINE>
|
||||||
|
<COLUMN>015</COLUMN>
|
||||||
|
<LENGTH>010</LENGTH>
|
||||||
|
<VISLENGTH>010</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX12</NAME>
|
||||||
|
<TEXT>Type_c_length_10</TEXT>
|
||||||
|
<LINE>006</LINE>
|
||||||
|
<COLUMN>028</COLUMN>
|
||||||
|
<LENGTH>016</LENGTH>
|
||||||
|
<VISLENGTH>016</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX10</NAME>
|
||||||
|
<TEXT>NUM</TEXT>
|
||||||
|
<LINE>008</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>003</LENGTH>
|
||||||
|
<VISLENGTH>003</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
<LABELLEFT>X</LABELLEFT>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEMPLATE</TYPE>
|
||||||
|
<NAME>TAB_STRUC-NUM</NAME>
|
||||||
|
<TEXT>_______.__</TEXT>
|
||||||
|
<LINE>008</LINE>
|
||||||
|
<COLUMN>015</COLUMN>
|
||||||
|
<LENGTH>010</LENGTH>
|
||||||
|
<VISLENGTH>010</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>INT4</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX13</NAME>
|
||||||
|
<TEXT>Type_i</TEXT>
|
||||||
|
<LINE>008</LINE>
|
||||||
|
<COLUMN>028</COLUMN>
|
||||||
|
<LENGTH>006</LENGTH>
|
||||||
|
<VISLENGTH>006</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX14</NAME>
|
||||||
|
<TEXT>Dynpro_number:</TEXT>
|
||||||
|
<LINE>011</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>014</LENGTH>
|
||||||
|
<VISLENGTH>014</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEMPLATE</TYPE>
|
||||||
|
<NAME>DYNNR</NAME>
|
||||||
|
<TEXT>___________</TEXT>
|
||||||
|
<LINE>011</LINE>
|
||||||
|
<COLUMN>019</COLUMN>
|
||||||
|
<LENGTH>011</LENGTH>
|
||||||
|
<VISLENGTH>011</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
<OUTPUTONLY>X</OUTPUTONLY>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>OKCODE</TYPE>
|
||||||
|
<NAME>OK_CODE</NAME>
|
||||||
|
<TEXT>____________________</TEXT>
|
||||||
|
<LENGTH>020</LENGTH>
|
||||||
|
<VISLENGTH>020</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
</FIELDS>
|
||||||
|
<FLOW_LOGIC>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE>PROCESS BEFORE OUTPUT.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE> MODULE STATUS_9760.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW/>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE>PROCESS AFTER INPUT.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE> MODULE USER_COMMAND_9760.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
</FLOW_LOGIC>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<HEADER>
|
||||||
|
<PROGRAM>ZDEMO_ABAP_SAP_LUW</PROGRAM>
|
||||||
|
<SCREEN>9770</SCREEN>
|
||||||
|
<LANGUAGE>E</LANGUAGE>
|
||||||
|
<DESCRIPT>End SAP LUW</DESCRIPT>
|
||||||
|
<TYPE>N</TYPE>
|
||||||
|
<NEXTSCREEN>0000</NEXTSCREEN>
|
||||||
|
<LINES>027</LINES>
|
||||||
|
<COLUMNS>121</COLUMNS>
|
||||||
|
</HEADER>
|
||||||
|
<CONTAINERS>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>SCREEN</TYPE>
|
||||||
|
<NAME>SCREEN</NAME>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>RADIOGROUP</TYPE>
|
||||||
|
<NAME>%A_COMMIT</NAME>
|
||||||
|
<ELEMENT_OF>SCREEN</ELEMENT_OF>
|
||||||
|
<LINE>004</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>048</LENGTH>
|
||||||
|
<HEIGHT>005</HEIGHT>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
</CONTAINERS>
|
||||||
|
<FIELDS>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX6</NAME>
|
||||||
|
<TEXT>Select_one_of_the_following_options_to_proceed:</TEXT>
|
||||||
|
<LINE>002</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>047</LENGTH>
|
||||||
|
<VISLENGTH>047</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
<LABELLEFT>X</LABELLEFT>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>%#AUTOTEXT009</NAME>
|
||||||
|
<TEXT>Dynpro_number:</TEXT>
|
||||||
|
<LINE>012</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>014</LENGTH>
|
||||||
|
<VISLENGTH>014</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEMPLATE</TYPE>
|
||||||
|
<NAME>DYNNR</NAME>
|
||||||
|
<TEXT>___________</TEXT>
|
||||||
|
<LINE>012</LINE>
|
||||||
|
<COLUMN>018</COLUMN>
|
||||||
|
<LENGTH>011</LENGTH>
|
||||||
|
<VISLENGTH>011</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
<OUTPUTONLY>X</OUTPUTONLY>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>OKCODE</TYPE>
|
||||||
|
<NAME>OK_CODE</NAME>
|
||||||
|
<TEXT>____________________</TEXT>
|
||||||
|
<LENGTH>020</LENGTH>
|
||||||
|
<VISLENGTH>020</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>RADIOGROUP</CONT_TYPE>
|
||||||
|
<CONT_NAME>%A_COMMIT</CONT_NAME>
|
||||||
|
<TYPE>RADIO</TYPE>
|
||||||
|
<NAME>COMMIT</NAME>
|
||||||
|
<TEXT>Asynchronous_update_with_COMMIT_WORK</TEXT>
|
||||||
|
<LINE>004</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>038</LENGTH>
|
||||||
|
<VISLENGTH>038</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<GROUP1>1</GROUP1>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>RADIOGROUP</CONT_TYPE>
|
||||||
|
<CONT_NAME>%A_COMMIT</CONT_NAME>
|
||||||
|
<TYPE>RADIO</TYPE>
|
||||||
|
<NAME>COMMIT_WAIT</NAME>
|
||||||
|
<TEXT>Synchronous_update_with_COMMIT_WORK_AND_WAIT</TEXT>
|
||||||
|
<LINE>005</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>046</LENGTH>
|
||||||
|
<VISLENGTH>046</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<GROUP1>1</GROUP1>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>RADIOGROUP</CONT_TYPE>
|
||||||
|
<CONT_NAME>%A_COMMIT</CONT_NAME>
|
||||||
|
<TYPE>RADIO</TYPE>
|
||||||
|
<NAME>ROLLBACK</NAME>
|
||||||
|
<TEXT>Rollback_changes_using_ROLLBACK_WORK</TEXT>
|
||||||
|
<LINE>006</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>038</LENGTH>
|
||||||
|
<VISLENGTH>038</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>RADIOGROUP</CONT_TYPE>
|
||||||
|
<CONT_NAME>%A_COMMIT</CONT_NAME>
|
||||||
|
<TYPE>RADIO</TYPE>
|
||||||
|
<NAME>ERR</NAME>
|
||||||
|
<TEXT>Cause_a_failure_in_the_current_SAP_LUW</TEXT>
|
||||||
|
<LINE>007</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>040</LENGTH>
|
||||||
|
<VISLENGTH>040</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>RADIOGROUP</CONT_TYPE>
|
||||||
|
<CONT_NAME>%A_COMMIT</CONT_NAME>
|
||||||
|
<TYPE>RADIO</TYPE>
|
||||||
|
<NAME>TERMINATE</NAME>
|
||||||
|
<TEXT>Terminate_program_with_error_message_of_type_A</TEXT>
|
||||||
|
<LINE>008</LINE>
|
||||||
|
<COLUMN>003</COLUMN>
|
||||||
|
<LENGTH>048</LENGTH>
|
||||||
|
<VISLENGTH>048</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
</FIELDS>
|
||||||
|
<FLOW_LOGIC>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE>PROCESS BEFORE OUTPUT.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE> MODULE STATUS_9770.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW/>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE>PROCESS AFTER INPUT.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE> MODULE USER_COMMAND_9770.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
</FLOW_LOGIC>
|
||||||
|
</item>
|
||||||
|
</DYNPROS>
|
||||||
|
<CUA>
|
||||||
|
<ADM>
|
||||||
|
<ACTCODE>000003</ACTCODE>
|
||||||
|
<PFKCODE>000003</PFKCODE>
|
||||||
|
</ADM>
|
||||||
|
<STA>
|
||||||
|
<RSMPE_STAT>
|
||||||
|
<CODE>STATUS9750</CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<ACTCODE>000001</ACTCODE>
|
||||||
|
<PFKCODE>000001</PFKCODE>
|
||||||
|
<BUTCODE>0001</BUTCODE>
|
||||||
|
<INT_NOTE>Delete database table entries</INT_NOTE>
|
||||||
|
</RSMPE_STAT>
|
||||||
|
<RSMPE_STAT>
|
||||||
|
<CODE>STATUS9760</CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<ACTCODE>000002</ACTCODE>
|
||||||
|
<PFKCODE>000002</PFKCODE>
|
||||||
|
<BUTCODE>0001</BUTCODE>
|
||||||
|
<INT_NOTE>Create database table entry</INT_NOTE>
|
||||||
|
</RSMPE_STAT>
|
||||||
|
<RSMPE_STAT>
|
||||||
|
<CODE>STATUS9770</CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<ACTCODE>000003</ACTCODE>
|
||||||
|
<PFKCODE>000003</PFKCODE>
|
||||||
|
<BUTCODE>0001</BUTCODE>
|
||||||
|
<INT_NOTE>End SAP LUW</INT_NOTE>
|
||||||
|
</RSMPE_STAT>
|
||||||
|
</STA>
|
||||||
|
<FUN>
|
||||||
|
<RSMPE_FUNT>
|
||||||
|
<CODE>ENTER</CODE>
|
||||||
|
<TEXTNO>001</TEXTNO>
|
||||||
|
<TEXT_TYPE>S</TEXT_TYPE>
|
||||||
|
<FUN_TEXT>Enter</FUN_TEXT>
|
||||||
|
</RSMPE_FUNT>
|
||||||
|
<RSMPE_FUNT>
|
||||||
|
<CODE>GO</CODE>
|
||||||
|
<TEXTNO>001</TEXTNO>
|
||||||
|
<TEXT_TYPE>S</TEXT_TYPE>
|
||||||
|
<TEXT_NAME>ICON_MAPPED_RELATION</TEXT_NAME>
|
||||||
|
<ICON_ID>@EY@</ICON_ID>
|
||||||
|
<FUN_TEXT>Go</FUN_TEXT>
|
||||||
|
<ICON_TEXT>Go</ICON_TEXT>
|
||||||
|
<INFO_TEXT>Go</INFO_TEXT>
|
||||||
|
</RSMPE_FUNT>
|
||||||
|
<RSMPE_FUNT>
|
||||||
|
<CODE>LEAVE</CODE>
|
||||||
|
<TEXTNO>001</TEXTNO>
|
||||||
|
<TEXT_TYPE>S</TEXT_TYPE>
|
||||||
|
<FUN_TEXT>Exit</FUN_TEXT>
|
||||||
|
</RSMPE_FUNT>
|
||||||
|
</FUN>
|
||||||
|
<BUT>
|
||||||
|
<RSMPE_BUT>
|
||||||
|
<PFK_CODE>000001</PFK_CODE>
|
||||||
|
<CODE>0001</CODE>
|
||||||
|
<NO>01</NO>
|
||||||
|
<PFNO>08</PFNO>
|
||||||
|
</RSMPE_BUT>
|
||||||
|
<RSMPE_BUT>
|
||||||
|
<PFK_CODE>000002</PFK_CODE>
|
||||||
|
<CODE>0001</CODE>
|
||||||
|
<NO>01</NO>
|
||||||
|
<PFNO>08</PFNO>
|
||||||
|
</RSMPE_BUT>
|
||||||
|
<RSMPE_BUT>
|
||||||
|
<PFK_CODE>000003</PFK_CODE>
|
||||||
|
<CODE>0001</CODE>
|
||||||
|
<NO>01</NO>
|
||||||
|
<PFNO>08</PFNO>
|
||||||
|
</RSMPE_BUT>
|
||||||
|
</BUT>
|
||||||
|
<PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000001</CODE>
|
||||||
|
<PFNO>00</PFNO>
|
||||||
|
<FUNCODE>ENTER</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000001</CODE>
|
||||||
|
<PFNO>08</PFNO>
|
||||||
|
<FUNCODE>GO</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000001</CODE>
|
||||||
|
<PFNO>15</PFNO>
|
||||||
|
<FUNCODE>LEAVE</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000002</CODE>
|
||||||
|
<PFNO>00</PFNO>
|
||||||
|
<FUNCODE>ENTER</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000002</CODE>
|
||||||
|
<PFNO>08</PFNO>
|
||||||
|
<FUNCODE>GO</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000002</CODE>
|
||||||
|
<PFNO>15</PFNO>
|
||||||
|
<FUNCODE>LEAVE</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000003</CODE>
|
||||||
|
<PFNO>00</PFNO>
|
||||||
|
<FUNCODE>ENTER</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000003</CODE>
|
||||||
|
<PFNO>08</PFNO>
|
||||||
|
<FUNCODE>GO</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000003</CODE>
|
||||||
|
<PFNO>15</PFNO>
|
||||||
|
<FUNCODE>LEAVE</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
</PFK>
|
||||||
|
<SET>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9750</STATUS>
|
||||||
|
<FUNCTION>ENTER</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9750</STATUS>
|
||||||
|
<FUNCTION>GO</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9750</STATUS>
|
||||||
|
<FUNCTION>LEAVE</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9760</STATUS>
|
||||||
|
<FUNCTION>ENTER</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9760</STATUS>
|
||||||
|
<FUNCTION>GO</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9760</STATUS>
|
||||||
|
<FUNCTION>LEAVE</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9770</STATUS>
|
||||||
|
<FUNCTION>ENTER</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9770</STATUS>
|
||||||
|
<FUNCTION>GO</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9770</STATUS>
|
||||||
|
<FUNCTION>LEAVE</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
</SET>
|
||||||
|
<DOC>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>A</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000001</OBJ_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Delete database table entries</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>P</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000001</OBJ_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Delete database table entries</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>B</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000001</OBJ_CODE>
|
||||||
|
<SUB_CODE>0001</SUB_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Delete database table entries</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>A</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000002</OBJ_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Create database table entry</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>P</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000002</OBJ_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Create database table entry</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>B</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000002</OBJ_CODE>
|
||||||
|
<SUB_CODE>0001</SUB_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Create database table entry</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>A</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000003</OBJ_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>End SAP LUW</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>P</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000003</OBJ_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>End SAP LUW</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>B</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000003</OBJ_CODE>
|
||||||
|
<SUB_CODE>0001</SUB_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>End SAP LUW</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
</DOC>
|
||||||
|
<TIT>
|
||||||
|
<RSMPE_TITT>
|
||||||
|
<CODE>TITLE9750</CODE>
|
||||||
|
<TEXT>Delete database table entries</TEXT>
|
||||||
|
</RSMPE_TITT>
|
||||||
|
<RSMPE_TITT>
|
||||||
|
<CODE>TITLE9760</CODE>
|
||||||
|
<TEXT>Create database table entry</TEXT>
|
||||||
|
</RSMPE_TITT>
|
||||||
|
<RSMPE_TITT>
|
||||||
|
<CODE>TITLE9770</CODE>
|
||||||
|
<TEXT>End SAP LUW</TEXT>
|
||||||
|
</RSMPE_TITT>
|
||||||
|
</TIT>
|
||||||
|
</CUA>
|
||||||
|
<TPOOL>
|
||||||
|
<item>
|
||||||
|
<ID>R</ID>
|
||||||
|
<ENTRY>Demonstrating SAP LUW</ENTRY>
|
||||||
|
<LENGTH>21</LENGTH>
|
||||||
|
</item>
|
||||||
|
</TPOOL>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
*&---------------------------------------------------------------------*
|
||||||
|
*& Demo program used in the context of the SAP LUW ABAP cheat sheet
|
||||||
|
*&
|
||||||
|
*&----------------------------- NOTE -----------------------------------*
|
||||||
|
*& The code presented in this class is intended only to support the ABAP
|
||||||
|
*& cheat sheets. It is not intended for direct use in a production system
|
||||||
|
*& environment. The code examples in the ABAP cheat sheets are primarily
|
||||||
|
*& intended to provide a better explanation and visualization of the
|
||||||
|
*& syntax and semantics of ABAP statements, not to solve concrete
|
||||||
|
*& programming tasks. For production application programs, you should
|
||||||
|
*& always work out your own solution for each individual case. There is
|
||||||
|
*& no guarantee for the correctness or completeness of the code.
|
||||||
|
*& Furthermore, there is no legal responsibility or liability for any
|
||||||
|
*& errors or their consequences that may occur when using the the example
|
||||||
|
*& code.
|
||||||
|
*&---------------------------------------------------------------------*
|
||||||
|
REPORT zdemo_abap_sap_luw_displ.
|
||||||
|
|
||||||
|
DATA: ok_code LIKE sy-ucomm,
|
||||||
|
save_ok LIKE sy-ucomm,
|
||||||
|
dynnr LIKE sy-dynnr.
|
||||||
|
|
||||||
|
END-OF-SELECTION.
|
||||||
|
|
||||||
|
"Checks if program is started separately
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM zdemo_abap_logt
|
||||||
|
INTO @DATA(entries).
|
||||||
|
|
||||||
|
SELECT SINGLE id
|
||||||
|
FROM zdemo_abap_logt
|
||||||
|
WHERE id = 100
|
||||||
|
INTO @DATA(exists).
|
||||||
|
|
||||||
|
IF sy-subrc = 0 OR entries = 0.
|
||||||
|
DELETE FROM zdemo_abap_logt.
|
||||||
|
|
||||||
|
DATA(check) = abap_true.
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>create_log_entries(
|
||||||
|
VALUE #( ( id = 97
|
||||||
|
context = '-'
|
||||||
|
name = '-'
|
||||||
|
details = `Choose Start over from the menu.`
|
||||||
|
timestamp = utclong_current( ) ) ) ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>create_log_entries(
|
||||||
|
VALUE #( ( id = 100
|
||||||
|
context = '-'
|
||||||
|
name = '-'
|
||||||
|
details = |New program executed: { sy-repid }|
|
||||||
|
timestamp = utclong_current( ) ) ) ).
|
||||||
|
|
||||||
|
CALL SCREEN 9780.
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
***************** Dialog modules for 9780 ****************************
|
||||||
|
|
||||||
|
MODULE status_9780 OUTPUT.
|
||||||
|
SET PF-STATUS 'STATUS9780'.
|
||||||
|
SET TITLEBAR 'TITLE9780'.
|
||||||
|
|
||||||
|
"Checks for asynchronous update
|
||||||
|
IF check = abap_false.
|
||||||
|
DATA(idx) = 0.
|
||||||
|
|
||||||
|
DO 5 TIMES. "A maximum of 5 seconds of waiting time
|
||||||
|
SELECT SINGLE id, context
|
||||||
|
FROM zdemo_abap_logt
|
||||||
|
WHERE
|
||||||
|
"Entry inserted ...
|
||||||
|
id = 93 "by the final update function module
|
||||||
|
OR id = 99 "in case of ROLLBACK WORK
|
||||||
|
OR id = 96 "in case of the intended failure in SAP LUW
|
||||||
|
OR context = 'Subroutine' "if subroutines are used
|
||||||
|
INTO @DATA(wa). "#EC CI_CMPLX_WHERE
|
||||||
|
|
||||||
|
IF sy-subrc = 0.
|
||||||
|
EXIT.
|
||||||
|
ELSE.
|
||||||
|
idx = sy-index.
|
||||||
|
WAIT UP TO 1 SECONDS.
|
||||||
|
ENDIF.
|
||||||
|
ENDDO.
|
||||||
|
|
||||||
|
IF idx = 5.
|
||||||
|
MESSAGE `The asynchronous update takes too long. ` &&
|
||||||
|
`You may want to restart the example and try again.`
|
||||||
|
TYPE 'I'.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>create_log_entries(
|
||||||
|
VALUE #(
|
||||||
|
( id = 101
|
||||||
|
context = 'PBO'
|
||||||
|
name = 'status_9780'
|
||||||
|
details = `Module called`
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 102
|
||||||
|
context = 'PBO'
|
||||||
|
name = 'status_9780'
|
||||||
|
details = zcl_demo_abap_sap_luw_helper=>get_work_process_info( )
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 103
|
||||||
|
context = 'PBO'
|
||||||
|
name = 'status_9780'
|
||||||
|
details = `SAP LUW Key: ` &&
|
||||||
|
cl_system_transaction_state=>get_sap_luw_key( )
|
||||||
|
timestamp = utclong_current( ) )
|
||||||
|
( id = 104
|
||||||
|
context = 'PBO'
|
||||||
|
name = 'status_9780'
|
||||||
|
details = zcl_demo_abap_sap_luw_helper=>checking_transaction_state( )
|
||||||
|
timestamp = utclong_current( ) ) ) ).
|
||||||
|
|
||||||
|
zcl_demo_abap_sap_luw_helper=>cc_alv_display( 'CC_DB_FINAL' ).
|
||||||
|
zcl_demo_abap_sap_luw_helper=>cc_alv_display( container = 'CC_WP'
|
||||||
|
log = abap_true ).
|
||||||
|
dynnr = sy-dynnr.
|
||||||
|
ENDMODULE.
|
||||||
|
|
||||||
|
MODULE user_command_9780 INPUT.
|
||||||
|
save_ok = ok_code.
|
||||||
|
CLEAR ok_code.
|
||||||
|
|
||||||
|
CASE save_ok.
|
||||||
|
WHEN 'STARTOVER'.
|
||||||
|
ROLLBACK WORK.
|
||||||
|
DELETE FROM zdemo_abap_logt.
|
||||||
|
SUBMIT ('ZDEMO_ABAP_SAP_LUW').
|
||||||
|
WHEN OTHERS.
|
||||||
|
DELETE FROM zdemo_abap_logt.
|
||||||
|
LEAVE PROGRAM.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMODULE.
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<PROGDIR>
|
||||||
|
<NAME>ZDEMO_ABAP_SAP_LUW_DISPL</NAME>
|
||||||
|
<DBAPL>S</DBAPL>
|
||||||
|
<SUBC>1</SUBC>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<LDBNAME>D$S</LDBNAME>
|
||||||
|
<UCCHECK>X</UCCHECK>
|
||||||
|
</PROGDIR>
|
||||||
|
<DYNPROS>
|
||||||
|
<item>
|
||||||
|
<HEADER>
|
||||||
|
<PROGRAM>ZDEMO_ABAP_SAP_LUW_DISPL</PROGRAM>
|
||||||
|
<SCREEN>9780</SCREEN>
|
||||||
|
<LANGUAGE>E</LANGUAGE>
|
||||||
|
<DESCRIPT>Display database table and log</DESCRIPT>
|
||||||
|
<TYPE>N</TYPE>
|
||||||
|
<NEXTSCREEN>9780</NEXTSCREEN>
|
||||||
|
<LINES>027</LINES>
|
||||||
|
<COLUMNS>186</COLUMNS>
|
||||||
|
</HEADER>
|
||||||
|
<CONTAINERS>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>SCREEN</TYPE>
|
||||||
|
<NAME>SCREEN</NAME>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>CUST_CTRL</TYPE>
|
||||||
|
<NAME>CC_DB_FINAL</NAME>
|
||||||
|
<ELEMENT_OF>SCREEN</ELEMENT_OF>
|
||||||
|
<LINE>003</LINE>
|
||||||
|
<COLUMN>002</COLUMN>
|
||||||
|
<LENGTH>074</LENGTH>
|
||||||
|
<HEIGHT>007</HEIGHT>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
<RPY_DYCATT>
|
||||||
|
<TYPE>CUST_CTRL</TYPE>
|
||||||
|
<NAME>CC_WP</NAME>
|
||||||
|
<ELEMENT_OF>SCREEN</ELEMENT_OF>
|
||||||
|
<LINE>013</LINE>
|
||||||
|
<COLUMN>002</COLUMN>
|
||||||
|
<LENGTH>156</LENGTH>
|
||||||
|
<HEIGHT>014</HEIGHT>
|
||||||
|
</RPY_DYCATT>
|
||||||
|
</CONTAINERS>
|
||||||
|
<FIELDS>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX15</NAME>
|
||||||
|
<TEXT>Database_table_entries:</TEXT>
|
||||||
|
<LINE>001</LINE>
|
||||||
|
<COLUMN>002</COLUMN>
|
||||||
|
<LENGTH>023</LENGTH>
|
||||||
|
<VISLENGTH>023</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>%#AUTOTEXT003</NAME>
|
||||||
|
<TEXT>Dynpro_number:</TEXT>
|
||||||
|
<LINE>001</LINE>
|
||||||
|
<COLUMN>130</COLUMN>
|
||||||
|
<LENGTH>014</LENGTH>
|
||||||
|
<VISLENGTH>014</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEMPLATE</TYPE>
|
||||||
|
<NAME>DYNNR</NAME>
|
||||||
|
<TEXT>___________</TEXT>
|
||||||
|
<LINE>001</LINE>
|
||||||
|
<COLUMN>146</COLUMN>
|
||||||
|
<LENGTH>011</LENGTH>
|
||||||
|
<VISLENGTH>011</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<OUTPUT_FLD>X</OUTPUT_FLD>
|
||||||
|
<OUTPUTONLY>X</OUTPUTONLY>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>TEXT</TYPE>
|
||||||
|
<NAME>TX16</NAME>
|
||||||
|
<TEXT>Log_database_table_entries:</TEXT>
|
||||||
|
<LINE>011</LINE>
|
||||||
|
<COLUMN>002</COLUMN>
|
||||||
|
<LENGTH>027</LENGTH>
|
||||||
|
<VISLENGTH>027</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<REQU_ENTRY>N</REQU_ENTRY>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
<RPY_DYFATC>
|
||||||
|
<CONT_TYPE>SCREEN</CONT_TYPE>
|
||||||
|
<CONT_NAME>SCREEN</CONT_NAME>
|
||||||
|
<TYPE>OKCODE</TYPE>
|
||||||
|
<NAME>OK_CODE</NAME>
|
||||||
|
<TEXT>____________________</TEXT>
|
||||||
|
<LENGTH>020</LENGTH>
|
||||||
|
<VISLENGTH>020</VISLENGTH>
|
||||||
|
<HEIGHT>001</HEIGHT>
|
||||||
|
<FORMAT>CHAR</FORMAT>
|
||||||
|
<INPUT_FLD>X</INPUT_FLD>
|
||||||
|
</RPY_DYFATC>
|
||||||
|
</FIELDS>
|
||||||
|
<FLOW_LOGIC>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE>PROCESS BEFORE OUTPUT.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE> MODULE STATUS_9780.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW/>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE>PROCESS AFTER INPUT.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
<RPY_DYFLOW>
|
||||||
|
<LINE> MODULE USER_COMMAND_9780.</LINE>
|
||||||
|
</RPY_DYFLOW>
|
||||||
|
</FLOW_LOGIC>
|
||||||
|
</item>
|
||||||
|
</DYNPROS>
|
||||||
|
<CUA>
|
||||||
|
<ADM>
|
||||||
|
<ACTCODE>000001</ACTCODE>
|
||||||
|
<PFKCODE>000001</PFKCODE>
|
||||||
|
</ADM>
|
||||||
|
<STA>
|
||||||
|
<RSMPE_STAT>
|
||||||
|
<CODE>STATUS9780</CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<ACTCODE>000001</ACTCODE>
|
||||||
|
<PFKCODE>000001</PFKCODE>
|
||||||
|
<BUTCODE>0001</BUTCODE>
|
||||||
|
<INT_NOTE>Display database table and log</INT_NOTE>
|
||||||
|
</RSMPE_STAT>
|
||||||
|
</STA>
|
||||||
|
<FUN>
|
||||||
|
<RSMPE_FUNT>
|
||||||
|
<CODE>LEAVE</CODE>
|
||||||
|
<TEXTNO>001</TEXTNO>
|
||||||
|
<TEXT_TYPE>S</TEXT_TYPE>
|
||||||
|
<FUN_TEXT>Exit</FUN_TEXT>
|
||||||
|
</RSMPE_FUNT>
|
||||||
|
<RSMPE_FUNT>
|
||||||
|
<CODE>STARTOVER</CODE>
|
||||||
|
<TEXTNO>001</TEXTNO>
|
||||||
|
<TEXT_TYPE>S</TEXT_TYPE>
|
||||||
|
<TEXT_NAME>ICON_SYSTEM_UNDO</TEXT_NAME>
|
||||||
|
<ICON_ID>@2W@</ICON_ID>
|
||||||
|
<FUN_TEXT>STARTOVER</FUN_TEXT>
|
||||||
|
<ICON_TEXT>Start over</ICON_TEXT>
|
||||||
|
<INFO_TEXT>Start over</INFO_TEXT>
|
||||||
|
</RSMPE_FUNT>
|
||||||
|
</FUN>
|
||||||
|
<BUT>
|
||||||
|
<RSMPE_BUT>
|
||||||
|
<PFK_CODE>000001</PFK_CODE>
|
||||||
|
<CODE>0001</CODE>
|
||||||
|
<NO>01</NO>
|
||||||
|
<PFNO>08</PFNO>
|
||||||
|
</RSMPE_BUT>
|
||||||
|
</BUT>
|
||||||
|
<PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000001</CODE>
|
||||||
|
<PFNO>08</PFNO>
|
||||||
|
<FUNCODE>STARTOVER</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
<RSMPE_PFK>
|
||||||
|
<CODE>000001</CODE>
|
||||||
|
<PFNO>15</PFNO>
|
||||||
|
<FUNCODE>LEAVE</FUNCODE>
|
||||||
|
<FUNNO>001</FUNNO>
|
||||||
|
</RSMPE_PFK>
|
||||||
|
</PFK>
|
||||||
|
<SET>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9780</STATUS>
|
||||||
|
<FUNCTION>LEAVE</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
<RSMPE_STAF>
|
||||||
|
<STATUS>STATUS9780</STATUS>
|
||||||
|
<FUNCTION>STARTOVER</FUNCTION>
|
||||||
|
</RSMPE_STAF>
|
||||||
|
</SET>
|
||||||
|
<DOC>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>A</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000001</OBJ_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Display database table and log</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>P</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000001</OBJ_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Display database table and log</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
<RSMPE_ATRT>
|
||||||
|
<OBJ_TYPE>B</OBJ_TYPE>
|
||||||
|
<OBJ_CODE>000001</OBJ_CODE>
|
||||||
|
<SUB_CODE>0001</SUB_CODE>
|
||||||
|
<MODAL>D</MODAL>
|
||||||
|
<INT_NOTE>Display database table and log</INT_NOTE>
|
||||||
|
</RSMPE_ATRT>
|
||||||
|
</DOC>
|
||||||
|
<TIT>
|
||||||
|
<RSMPE_TITT>
|
||||||
|
<CODE>TITLE9780</CODE>
|
||||||
|
<TEXT>Display database table and log</TEXT>
|
||||||
|
</RSMPE_TITT>
|
||||||
|
</TIT>
|
||||||
|
</CUA>
|
||||||
|
<TPOOL>
|
||||||
|
<item>
|
||||||
|
<ID>R</ID>
|
||||||
|
<ENTRY>Demonstrating SAP LUW - Display</ENTRY>
|
||||||
|
<LENGTH>31</LENGTH>
|
||||||
|
</item>
|
||||||
|
</TPOOL>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
377
src/zcl_demo_abap_amdp.clas.abap
Normal file
377
src/zcl_demo_abap_amdp.clas.abap
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
***********************************************************************
|
||||||
|
*
|
||||||
|
* ABAP cheat sheet: AMDP
|
||||||
|
*
|
||||||
|
* -------------------------- PURPOSE ----------------------------------
|
||||||
|
* - Example to demonstrate AMDP procedures and functions. It includes
|
||||||
|
* a CDS table function.
|
||||||
|
* - NOTE:
|
||||||
|
* - The example covers basics regarding AMDP method declarations
|
||||||
|
* and implementations.
|
||||||
|
* - The purpose is to give you a rough idea about AMDP. Therefore,
|
||||||
|
* the SQLScript code used in the method implementations is
|
||||||
|
* fairly simple. AMDP is not needed in simple cases like these.
|
||||||
|
* - The example is primarily intended for the SAP BTP ABAP
|
||||||
|
* environment. For example, in SAP BTP ABAP environment only
|
||||||
|
* read-only operations are possible. In general, there are more
|
||||||
|
* syntax options available in the unrestricted ABAP language scope
|
||||||
|
* in on-premise ABAP systems. Check the ABAP Keyword Documentation
|
||||||
|
* for more details and examples.
|
||||||
|
*
|
||||||
|
* ----------------------- GETTING STARTED -----------------------------
|
||||||
|
* - Open the class with the ABAP development tools for Eclipse (ADT).
|
||||||
|
* - Choose F9 to run the class.
|
||||||
|
* - Check the console output.
|
||||||
|
* - To understand the context and the ABAP syntax used, check the notes
|
||||||
|
* included in the class as comments or refer to the respective topic
|
||||||
|
* in the ABAP Keyword Documentation.
|
||||||
|
* - Due to the amount of output in the console, the examples include
|
||||||
|
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
|
||||||
|
* sections. Plus, the variable name is displayed in most cases. Hence,
|
||||||
|
* to easier and faster find the relevant output in the console, just
|
||||||
|
* search in the console for the number/variable name (CTRL+F in the
|
||||||
|
* console) or use the debugger.
|
||||||
|
*
|
||||||
|
* ----------------------------- NOTE -----------------------------------
|
||||||
|
* The code presented in this class is intended only to support the ABAP
|
||||||
|
* cheat sheets. It is not intended for direct use in a production system
|
||||||
|
* environment. The code examples in the ABAP cheat sheets are primarily
|
||||||
|
* intended to provide a better explanation and visualization of the
|
||||||
|
* syntax and semantics of ABAP statements, not to solve concrete
|
||||||
|
* programming tasks. For production application programs, you should
|
||||||
|
* always work out your own solution for each individual case. There is
|
||||||
|
* no guarantee for the correctness or completeness of the code.
|
||||||
|
* Furthermore, there is no legal responsibility or liability for any
|
||||||
|
* errors or their consequences that may occur when using the the example
|
||||||
|
* code.
|
||||||
|
*
|
||||||
|
***********************************************************************
|
||||||
|
"! <p class="shorttext synchronized">ABAP cheat sheet: AMDP</p>
|
||||||
|
"! Example to demonstrate AMDP procedures and functions.<br>Choose F9 in ADT to run the class.
|
||||||
|
CLASS zcl_demo_abap_amdp DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
FINAL
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
INTERFACES:
|
||||||
|
if_oo_adt_classrun, "Interface for displaying output
|
||||||
|
if_amdp_marker_hdb. "This interface specification is mandatory for an AMDP class
|
||||||
|
|
||||||
|
"Various internal table type specifications for the parameters of AMDP methods
|
||||||
|
"Note: Only table and elementary data types are possible for the parameters.
|
||||||
|
TYPES carr_tab TYPE STANDARD TABLE OF zdemo_abap_carr WITH EMPTY KEY.
|
||||||
|
|
||||||
|
TYPES fli_tab TYPE STANDARD TABLE OF zdemo_abap_fli WITH EMPTY KEY.
|
||||||
|
|
||||||
|
TYPES:
|
||||||
|
"Structured data type as basis for the table type below
|
||||||
|
BEGIN OF carr_fli_struc,
|
||||||
|
carrname TYPE zdemo_abap_carr-carrname,
|
||||||
|
connid TYPE zdemo_abap_flsch-connid,
|
||||||
|
cityfrom TYPE zdemo_abap_flsch-cityfrom,
|
||||||
|
cityto TYPE zdemo_abap_flsch-cityto,
|
||||||
|
END OF carr_fli_struc,
|
||||||
|
|
||||||
|
"Internal table type
|
||||||
|
carr_fli_tab TYPE STANDARD TABLE OF carr_fli_struc WITH EMPTY KEY,
|
||||||
|
|
||||||
|
"Structured data type as basis for the table type below
|
||||||
|
BEGIN OF fli_struc,
|
||||||
|
carrid TYPE zdemo_abap_flsch-carrid,
|
||||||
|
connid TYPE zdemo_abap_flsch-connid,
|
||||||
|
cityfrom TYPE zdemo_abap_flsch-cityfrom,
|
||||||
|
cityto TYPE zdemo_abap_flsch-cityto,
|
||||||
|
fltime TYPE zdemo_abap_flsch-fltime,
|
||||||
|
END OF fli_struc,
|
||||||
|
|
||||||
|
"Internal table type
|
||||||
|
flsch_tab TYPE STANDARD TABLE OF zdemo_abap_flsch WITH EMPTY KEY.
|
||||||
|
|
||||||
|
"Various instance method declarations
|
||||||
|
"The selection for instance and static methods is irrelevant for the example.
|
||||||
|
"It is just meant to visualize that AMDP methods can be declared as either of them.
|
||||||
|
|
||||||
|
"AMDP procedure
|
||||||
|
"It's a simple AMDP procedure having only an output parameter with tabular type.
|
||||||
|
"Note the parameter declaration that includes the mandatory passing by value.
|
||||||
|
"This is true for all of the AMDP method declarations.
|
||||||
|
METHODS select_carriers
|
||||||
|
EXPORTING VALUE(carr_tab) TYPE carr_tab.
|
||||||
|
|
||||||
|
"AMDP procedure to call an AMDP table function
|
||||||
|
"As can be seen in the implementation part, this example method calls the
|
||||||
|
"AMDP table function get_carr_fli. AMDP table functions can only be called
|
||||||
|
"by other AMDP methods.
|
||||||
|
METHODS select_get_carr_fli
|
||||||
|
IMPORTING VALUE(carrid) TYPE zdemo_abap_fli-carrid
|
||||||
|
EXPORTING VALUE(carr_fli_tab) TYPE carr_fli_tab.
|
||||||
|
|
||||||
|
"Various static method declarations
|
||||||
|
|
||||||
|
"The purpose of the implementation of the static constructor in this example is to
|
||||||
|
"fill a demo database table to have data to work with in the example.
|
||||||
|
CLASS-METHODS class_constructor.
|
||||||
|
|
||||||
|
"AMDP procedure
|
||||||
|
"This method demonstrates the calling of an AMDP procedure from SQLScript.
|
||||||
|
"In this example, the selection of data is 'delegated' to another AMDP method get_flights_amdp
|
||||||
|
"in the same AMDP class. The method declaration includes the addition RAISING with an
|
||||||
|
"exception class for AMDP-specific exceptions.
|
||||||
|
CLASS-METHODS get_flights
|
||||||
|
IMPORTING VALUE(carrid) TYPE zdemo_abap_fli-carrid
|
||||||
|
EXPORTING VALUE(fli_tab) TYPE fli_tab
|
||||||
|
RAISING cx_amdp_execution_error.
|
||||||
|
|
||||||
|
"AMDP Table Function for CDS Table Function
|
||||||
|
"Note that, in this case, a static method declaration is required along with the special
|
||||||
|
"syntax FOR TABLE FUNCTION. Plus, there are no parameters specified and the declaration
|
||||||
|
"is made in the PUBLIC visibility section.
|
||||||
|
CLASS-METHODS flight_analysis FOR TABLE FUNCTION zdemo_abap_table_function.
|
||||||
|
|
||||||
|
PROTECTED SECTION.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
"AMDP procedure
|
||||||
|
"This method demonstrates the calling of an AMDP procedure from SQLScript as mentioned above.
|
||||||
|
CLASS-METHODS get_flights_amdp
|
||||||
|
IMPORTING VALUE(carrid) TYPE zdemo_abap_fli-carrid
|
||||||
|
EXPORTING VALUE(fli_tab) TYPE fli_tab
|
||||||
|
RAISING cx_amdp_execution_error.
|
||||||
|
|
||||||
|
"AMDP table function
|
||||||
|
"AMDP table functions can only be called by other AMDP methods. In this example,
|
||||||
|
"the AMDP procedure select_get_carr_fli calls this AMDP table function.
|
||||||
|
METHODS get_carr_fli
|
||||||
|
IMPORTING VALUE(carrid) TYPE zdemo_abap_flsch-carrid
|
||||||
|
RETURNING VALUE(carr_fli_tab) TYPE carr_fli_tab.
|
||||||
|
|
||||||
|
CONSTANTS nl TYPE string value cl_abap_char_utilities=>newline.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS zcl_demo_abap_amdp IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD class_constructor.
|
||||||
|
"Filling demo database tables.
|
||||||
|
zcl_demo_abap_flight_tables=>fill_dbtabs( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD flight_analysis
|
||||||
|
BY DATABASE FUNCTION
|
||||||
|
FOR HDB
|
||||||
|
LANGUAGE SQLSCRIPT
|
||||||
|
OPTIONS READ-ONLY
|
||||||
|
USING zdemo_abap_flsch "Two database tables are used and must both be specified here.
|
||||||
|
zdemo_abap_carr.
|
||||||
|
* Reading data from two database tables
|
||||||
|
itab_cities =
|
||||||
|
select DISTINCT
|
||||||
|
zdemo_abap_flsch.mandt as client,
|
||||||
|
zdemo_abap_flsch.carrid as carrier_id,
|
||||||
|
zdemo_abap_flsch.airpfrom as airport_from,
|
||||||
|
zdemo_abap_flsch.airpto as airport_to,
|
||||||
|
zdemo_abap_flsch.fltime as flight_time,
|
||||||
|
zdemo_abap_flsch.distance as flight_distance,
|
||||||
|
zdemo_abap_flsch.distid as unit
|
||||||
|
from zdemo_abap_flsch;
|
||||||
|
|
||||||
|
itab_carrier_names =
|
||||||
|
select distinct
|
||||||
|
zdemo_abap_carr.mandt as client,
|
||||||
|
zdemo_abap_carr.carrid as carrier_id,
|
||||||
|
zdemo_abap_carr.carrname as carrier_name
|
||||||
|
from zdemo_abap_carr;
|
||||||
|
|
||||||
|
* Returning joined data using an inner join
|
||||||
|
return
|
||||||
|
select fl.client, fl.carrier_id, ca.carrier_name,
|
||||||
|
* Departure and destination airports are concatenated; then all results are joined by string aggregation
|
||||||
|
string_agg( concat(concat(fl.airport_from,' -> '),fl.airport_to), ', ' ORDER BY fl.airport_from) AS connections,
|
||||||
|
* Retrieving the average flight time of all flights by carrier
|
||||||
|
AVG( fl.flight_time ) as avg_flight_time,
|
||||||
|
* Retrieving the average flight distance of all flights by carrier; miles are converted to kilometers
|
||||||
|
avg( case 'MI'
|
||||||
|
when fl.unit then fl.flight_distance * 1.609
|
||||||
|
ELSE fl.flight_distance
|
||||||
|
END ) AS avg_distance
|
||||||
|
FROM :itab_cities AS fl
|
||||||
|
INNER JOIN :itab_carrier_names AS ca
|
||||||
|
ON ca.client = fl.client
|
||||||
|
AND ca.carrier_id = fl.carrier_id
|
||||||
|
WHERE fl.client = ca.client AND fl.carrier_id = ca.carrier_id
|
||||||
|
GROUP BY fl.client, ca.carrier_name, fl.carrier_id;
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_carr_fli
|
||||||
|
BY DATABASE FUNCTION
|
||||||
|
FOR HDB
|
||||||
|
LANGUAGE SQLSCRIPT
|
||||||
|
OPTIONS READ-ONLY
|
||||||
|
USING zdemo_abap_carr zdemo_abap_flsch.
|
||||||
|
* AMDP table function to be called by other AMDP methods only.
|
||||||
|
* In the example, joined data from two database table are returned.
|
||||||
|
RETURN
|
||||||
|
SELECT ca.carrname, fl.connid, fl.cityfrom, fl.cityto
|
||||||
|
FROM zdemo_abap_carr as ca
|
||||||
|
INNER JOIN zdemo_abap_flsch as fl
|
||||||
|
ON ca.carrid = fl.carrid
|
||||||
|
WHERE fl.carrid = :carrid
|
||||||
|
ORDER BY ca.mandt, ca.carrname, fl.connid;
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_flights
|
||||||
|
BY DATABASE PROCEDURE
|
||||||
|
FOR HDB
|
||||||
|
LANGUAGE SQLSCRIPT
|
||||||
|
OPTIONS READ-ONLY
|
||||||
|
USING zcl_demo_abap_amdp=>get_flights_amdp.
|
||||||
|
* Another AMDP procedure is called from SQLScript
|
||||||
|
CALL "ZCL_DEMO_ABAP_AMDP=>GET_FLIGHTS_AMDP"(
|
||||||
|
carrid => :carrid,
|
||||||
|
fli_tab => :fli_tab );
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_flights_amdp
|
||||||
|
BY DATABASE PROCEDURE
|
||||||
|
FOR HDB
|
||||||
|
LANGUAGE SQLSCRIPT
|
||||||
|
OPTIONS READ-ONLY
|
||||||
|
USING zdemo_abap_fli.
|
||||||
|
* Simple data selection
|
||||||
|
fli_tab = SELECT *
|
||||||
|
FROM "ZDEMO_ABAP_FLI"
|
||||||
|
WHERE carrid = :carrid
|
||||||
|
ORDER BY carrid;
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD if_oo_adt_classrun~main.
|
||||||
|
|
||||||
|
DATA(output) = NEW zcl_demo_abap_display( out ).
|
||||||
|
|
||||||
|
output->display( `ABAP Cheat Sheet Example: ABAP AMDP` ).
|
||||||
|
|
||||||
|
output->display( `1) AMDP procedure` ).
|
||||||
|
|
||||||
|
"Declaring an internal table to store the data that are
|
||||||
|
"returned by the following method.
|
||||||
|
"You could also choose to create the internal table inline
|
||||||
|
"within the method call,
|
||||||
|
"i. e. like ... IMPORTING carr_tab = DATA(tab) ).
|
||||||
|
DATA amdp_proc_res TYPE zcl_demo_abap_amdp=>carr_tab.
|
||||||
|
|
||||||
|
"Since the method is declared as an instance method, an instance
|
||||||
|
"has to be created. Here, the instance constructor NEW is used
|
||||||
|
"in a standalone method call that includes a chained method call.
|
||||||
|
NEW zcl_demo_abap_amdp( )->select_carriers(
|
||||||
|
IMPORTING carr_tab = amdp_proc_res ).
|
||||||
|
|
||||||
|
output->display( input = amdp_proc_res name = `amdp_proc_res` ).
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `2) Calling an AMDP Procedure from SQLScript` ).
|
||||||
|
|
||||||
|
"As can be seen in the method implementation part, this AMDP procedure
|
||||||
|
"includes an AMDP procedure call from SQLScript.
|
||||||
|
"In this example, the AMDP procedure get_flights_amdp is called by
|
||||||
|
"get_flights which is meant to select data from a database table.
|
||||||
|
"The returned result is displayed.
|
||||||
|
TRY.
|
||||||
|
|
||||||
|
zcl_demo_abap_amdp=>get_flights( EXPORTING carrid = 'LH'
|
||||||
|
IMPORTING fli_tab = DATA(call_amdp_res) ).
|
||||||
|
|
||||||
|
CATCH cx_amdp_execution_error INTO DATA(error1).
|
||||||
|
|
||||||
|
output->display( error1->get_text( ) ).
|
||||||
|
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
output->display( input = call_amdp_res name = `call_amdp_res` ).
|
||||||
|
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `3) AMDP Table Function for AMDP Method` ).
|
||||||
|
|
||||||
|
"The AMDP procedure select_get_carr_fli calls the AMDP table function
|
||||||
|
"get_carr_fli in the implementation part. AMDP table functions can
|
||||||
|
"only be called by other AMDP methods.
|
||||||
|
TRY.
|
||||||
|
|
||||||
|
NEW zcl_demo_abap_amdp( )->select_get_carr_fli(
|
||||||
|
EXPORTING carrid = 'LH'
|
||||||
|
IMPORTING carr_fli_tab = DATA(amdp_tab_func) ).
|
||||||
|
|
||||||
|
CATCH cx_amdp_execution_error INTO DATA(error2).
|
||||||
|
|
||||||
|
out->write( error2->get_text( ) ).
|
||||||
|
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
output->display( input = amdp_tab_func name = `amdp_tab_func` ).
|
||||||
|
|
||||||
|
"Note: When commented in, the following code results in a runtime
|
||||||
|
"error since you cannot call an AMDP function in ABAP directly.
|
||||||
|
* NEW zcl_demo_abap_amdp( )->get_carr_fli(
|
||||||
|
* EXPORTING carrid = 'LH' ).
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `4) AMDP Table Function for CDS Table Function` ).
|
||||||
|
|
||||||
|
|
||||||
|
"The example demonstrates that a CDS table function can be used as a
|
||||||
|
"data source of ABAP SQL read statements.
|
||||||
|
"You might want to navigate to the DDL source after FROM by holding
|
||||||
|
"CTRL and clicking the DDL source name in ADT to see the details.
|
||||||
|
"Or, just check out the F2 help.
|
||||||
|
"In this example, the CDS table function is implemented in a way to
|
||||||
|
"return accumulated data.
|
||||||
|
"In the method implementation for flight_analysis, first two kinds of
|
||||||
|
"data sets from two database tables are gathered. These data sets are
|
||||||
|
"joined using an inner join. There, some expressions are included
|
||||||
|
"(strings are aggregated, average values are determined).
|
||||||
|
|
||||||
|
SELECT * FROM zdemo_abap_table_function
|
||||||
|
INTO TABLE @DATA(cds_tab_func).
|
||||||
|
|
||||||
|
output->display( input = cds_tab_func name = `cds_tab_func` ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD select_carriers
|
||||||
|
BY DATABASE PROCEDURE
|
||||||
|
FOR HDB
|
||||||
|
LANGUAGE SQLSCRIPT
|
||||||
|
OPTIONS READ-ONLY
|
||||||
|
USING zdemo_abap_carr.
|
||||||
|
* Simple data selection
|
||||||
|
carr_tab = SELECT *
|
||||||
|
FROM "ZDEMO_ABAP_CARR"
|
||||||
|
ORDER BY carrid;
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD select_get_carr_fli
|
||||||
|
BY DATABASE PROCEDURE
|
||||||
|
FOR HDB
|
||||||
|
LANGUAGE SQLSCRIPT
|
||||||
|
OPTIONS READ-ONLY
|
||||||
|
USING zcl_demo_abap_amdp=>get_carr_fli.
|
||||||
|
* AMDP procedure to call an AMDP table function as specified after USING
|
||||||
|
carr_fli_tab = SELECT *
|
||||||
|
FROM "ZCL_DEMO_ABAP_AMDP=>GET_CARR_FLI"(
|
||||||
|
carrid => :carrid );
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
16
src/zcl_demo_abap_amdp.clas.xml
Normal file
16
src/zcl_demo_abap_amdp.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_AMDP</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: AMDP</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1387
src/zcl_demo_abap_constructor_expr.clas.abap
Normal file
1387
src/zcl_demo_abap_constructor_expr.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
27
src/zcl_demo_abap_constructor_expr.clas.locals_imp.abap
Normal file
27
src/zcl_demo_abap_constructor_expr.clas.locals_imp.abap
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
CLASS local_class DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
METHODS: constructor IMPORTING txt TYPE string,
|
||||||
|
double IMPORTING int TYPE
|
||||||
|
REF TO i RETURNING VALUE(res) TYPE i.
|
||||||
|
|
||||||
|
DATA: timestamp TYPE string,
|
||||||
|
text TYPE string.
|
||||||
|
|
||||||
|
CLASS-DATA: no_of_instances TYPE i READ-ONLY.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS local_class IMPLEMENTATION.
|
||||||
|
METHOD constructor.
|
||||||
|
"Number of instances of the class are counted.
|
||||||
|
no_of_instances = no_of_instances + 1.
|
||||||
|
"Set a time stamp.
|
||||||
|
DATA: ts TYPE timestampl.
|
||||||
|
GET TIME STAMP FIELD ts.
|
||||||
|
timestamp = |{ ts TIMESTAMP = SPACE }|.
|
||||||
|
|
||||||
|
text = |{ txt }, { sy-uname }.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
METHOD double.
|
||||||
|
res = int->* * 2.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
16
src/zcl_demo_abap_constructor_expr.clas.xml
Normal file
16
src/zcl_demo_abap_constructor_expr.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_CONSTRUCTOR_EXPR</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: Constructor expressions</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
162
src/zcl_demo_abap_display.clas.abap
Normal file
162
src/zcl_demo_abap_display.clas.abap
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
***********************************************************************
|
||||||
|
*
|
||||||
|
* Class for ABAP cheat sheet examples designed to support displaying
|
||||||
|
* output in the ADT console
|
||||||
|
*
|
||||||
|
* -------------------------- NOTE -------------------------------------
|
||||||
|
* This helper class is only used to display complex types contained in
|
||||||
|
* the example classes of the ABAP cheat sheets in older ABAP releases.
|
||||||
|
* In newer ABAP releases, this helper class is, in principle, not needed.
|
||||||
|
* You can use the write method of the classrun interface directly and
|
||||||
|
* display all types.
|
||||||
|
*
|
||||||
|
* The code presented in this class is intended only to support the ABAP
|
||||||
|
* cheat sheets. It is not intended for direct use in a production system
|
||||||
|
* environment. The code examples in the ABAP cheat sheets are primarily
|
||||||
|
* intended to provide a better explanation and visualization of the
|
||||||
|
* syntax and semantics of ABAP statements, not to solve concrete
|
||||||
|
* programming tasks. For production application programs, you should
|
||||||
|
* always work out your own solution for each individual case. There is
|
||||||
|
* no guarantee for the correctness or completeness of the code.
|
||||||
|
* Furthermore, there is no legal responsibility or liability for any
|
||||||
|
* errors or their consequences that may occur when using the the example
|
||||||
|
* code.
|
||||||
|
*
|
||||||
|
***********************************************************************
|
||||||
|
"! <p class="shorttext synchronized">Class supporting ABAP cheat sheet examples</p>
|
||||||
|
"! The class supports displaying output of the ABAP cheat sheet examples in the ADT console.
|
||||||
|
CLASS zcl_demo_abap_display DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
FINAL
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
METHODS:
|
||||||
|
constructor
|
||||||
|
IMPORTING
|
||||||
|
io_out TYPE REF TO if_oo_adt_classrun_out,
|
||||||
|
display
|
||||||
|
IMPORTING
|
||||||
|
input TYPE data
|
||||||
|
name TYPE string DEFAULT ``
|
||||||
|
RETURNING
|
||||||
|
VALUE(output) TYPE string,
|
||||||
|
next_section
|
||||||
|
IMPORTING
|
||||||
|
heading TYPE string.
|
||||||
|
|
||||||
|
PROTECTED SECTION.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
DATA:
|
||||||
|
mo_out TYPE REF TO if_oo_adt_classrun_out,
|
||||||
|
offset TYPE i.
|
||||||
|
|
||||||
|
CONSTANTS nl TYPE string VALUE cl_abap_char_utilities=>newline.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS zcl_demo_abap_display IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
mo_out = io_out.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD display.
|
||||||
|
"Checking data type
|
||||||
|
DATA(type_descr) = cl_abap_typedescr=>describe_by_data( input ).
|
||||||
|
CASE type_descr->kind.
|
||||||
|
WHEN cl_abap_typedescr=>kind_struct.
|
||||||
|
DATA(struct_descr) = CAST cl_abap_structdescr( type_descr ).
|
||||||
|
"Checking for complex output
|
||||||
|
IF struct_descr->struct_kind = cl_abap_structdescr=>structkind_nested
|
||||||
|
OR line_exists( struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_table ] )
|
||||||
|
OR line_exists( struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_dref ] )
|
||||||
|
OR line_exists( struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_oref ] ).
|
||||||
|
DATA(to_be_serialized) = abap_true.
|
||||||
|
ELSE.
|
||||||
|
DATA(display) = mo_out->get( data = input name = name ).
|
||||||
|
ENDIF.
|
||||||
|
WHEN cl_abap_typedescr=>kind_table.
|
||||||
|
DATA(table_descr) = CAST cl_abap_tabledescr( type_descr ).
|
||||||
|
TRY.
|
||||||
|
DATA(line_type_struct_descr) = CAST cl_abap_structdescr( table_descr->get_table_line_type( ) ).
|
||||||
|
"Checking for complex output
|
||||||
|
IF line_type_struct_descr->struct_kind = cl_abap_structdescr=>structkind_nested
|
||||||
|
OR line_exists( line_type_struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_table ] )
|
||||||
|
OR line_exists( line_type_struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_dref ] )
|
||||||
|
OR line_exists( line_type_struct_descr->components[ type_kind = cl_abap_typedescr=>typekind_oref ] ).
|
||||||
|
to_be_serialized = abap_true.
|
||||||
|
ELSE.
|
||||||
|
display = mo_out->get( data = input name = name ).
|
||||||
|
ENDIF.
|
||||||
|
CATCH cx_sy_move_cast_error.
|
||||||
|
to_be_serialized = abap_true.
|
||||||
|
ENDTRY.
|
||||||
|
WHEN cl_abap_typedescr=>kind_class.
|
||||||
|
to_be_serialized = abap_true.
|
||||||
|
WHEN cl_abap_typedescr=>kind_intf.
|
||||||
|
to_be_serialized = abap_true.
|
||||||
|
WHEN cl_abap_typedescr=>kind_elem.
|
||||||
|
display = mo_out->get( data = COND string( WHEN name IS INITIAL THEN input ELSE `"` && name && `":` && nl && input ) ).
|
||||||
|
WHEN cl_abap_typedescr=>kind_ref.
|
||||||
|
"Checking for data references
|
||||||
|
IF type_descr->type_kind = cl_abap_typedescr=>typekind_dref.
|
||||||
|
"Checking type of dereferenced data object
|
||||||
|
ASSIGN input->* TO FIELD-SYMBOL(<in>).
|
||||||
|
DATA(type_check_dref) = cl_abap_typedescr=>describe_by_data( <in> ).
|
||||||
|
"Processing (non-)elementary types
|
||||||
|
IF type_check_dref->kind = type_descr->kind_elem.
|
||||||
|
display = mo_out->get( data = COND string( WHEN name IS INITIAL THEN <in> ELSE `"` && name && `":` && nl && <in> ) ).
|
||||||
|
ELSE.
|
||||||
|
to_be_serialized = abap_true.
|
||||||
|
ENDIF.
|
||||||
|
ELSE.
|
||||||
|
to_be_serialized = abap_true.
|
||||||
|
ENDIF.
|
||||||
|
ENDCASE.
|
||||||
|
|
||||||
|
"Processing complex output by serializiation
|
||||||
|
FIND SUBSTRING `Data type not yet supported ...` IN display MATCH OFFSET DATA(off) MATCH LENGTH DATA(len).
|
||||||
|
IF sy-subrc = 0 OR to_be_serialized = abap_true.
|
||||||
|
"ABAP JSON serializing
|
||||||
|
DATA(json) = /ui2/cl_json=>serialize( data = input
|
||||||
|
pretty_name = /ui2/cl_json=>pretty_mode-low_case
|
||||||
|
compress = abap_false
|
||||||
|
hex_as_base64 = abap_false
|
||||||
|
format_output = abap_true
|
||||||
|
assoc_arrays = abap_true
|
||||||
|
assoc_arrays_opt = abap_true ).
|
||||||
|
IF to_be_serialized = abap_true.
|
||||||
|
IF name IS INITIAL.
|
||||||
|
REPLACE PCRE `^` IN display WITH json && nl.
|
||||||
|
ELSE.
|
||||||
|
REPLACE PCRE `^` IN display WITH `"` && name && `":` && nl && json && nl.
|
||||||
|
ENDIF.
|
||||||
|
"substring found
|
||||||
|
ELSE.
|
||||||
|
IF name IS INITIAL.
|
||||||
|
REPLACE SECTION OFFSET off LENGTH len OF display WITH json && nl.
|
||||||
|
ELSE.
|
||||||
|
REPLACE SECTION OFFSET off LENGTH len OF display WITH `"` && name && `":` && nl && json && nl.
|
||||||
|
ENDIF.
|
||||||
|
ENDIF.
|
||||||
|
mo_out->write( display && nl ).
|
||||||
|
ELSE.
|
||||||
|
mo_out->write( display && nl ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD next_section.
|
||||||
|
mo_out->write( `_________________________________________________________________________________`
|
||||||
|
&& nl
|
||||||
|
&& nl
|
||||||
|
&& heading
|
||||||
|
&& nl
|
||||||
|
&& nl ).
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
16
src/zcl_demo_abap_display.clas.xml
Normal file
16
src/zcl_demo_abap_display.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_DISPLAY</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Class supporting ABAP cheat sheet examples</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1921
src/zcl_demo_abap_dtype_dobj.clas.abap
Normal file
1921
src/zcl_demo_abap_dtype_dobj.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_dtype_dobj.clas.xml
Normal file
16
src/zcl_demo_abap_dtype_dobj.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_DTYPE_DOBJ</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP Cheat Sheet: Data Types and Data Objects</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1948
src/zcl_demo_abap_dynamic_prog.clas.abap
Normal file
1948
src/zcl_demo_abap_dynamic_prog.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
437
src/zcl_demo_abap_dynamic_prog.clas.locals_imp.abap
Normal file
437
src/zcl_demo_abap_dynamic_prog.clas.locals_imp.abap
Normal file
@@ -0,0 +1,437 @@
|
|||||||
|
CLASS lcl_det_at_runtime DEFINITION.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
CLASS-DATA: string1 TYPE string,
|
||||||
|
string2 TYPE string,
|
||||||
|
string3 TYPE string,
|
||||||
|
dyn_meth_call_result TYPE string.
|
||||||
|
|
||||||
|
TYPES: type_p TYPE p LENGTH 8 DECIMALS 2, "elementary type
|
||||||
|
type_struc TYPE zdemo_abap_carr, "structure type
|
||||||
|
"internal table type
|
||||||
|
type_itab TYPE SORTED TABLE OF zdemo_abap_flsch WITH NON-UNIQUE KEY carrid connid "primary key
|
||||||
|
WITH UNIQUE SORTED KEY cities COMPONENTS cityfrom cityto, "secondary key
|
||||||
|
type_ref TYPE REF TO lcl_det_at_runtime. "reference type
|
||||||
|
|
||||||
|
TYPES: BEGIN OF struc_builtin,
|
||||||
|
builtin_type TYPE c LENGTH 10,
|
||||||
|
len TYPE i,
|
||||||
|
dec TYPE i,
|
||||||
|
END OF struc_builtin.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF struc_dyn,
|
||||||
|
table TYPE string,
|
||||||
|
select_list TYPE string,
|
||||||
|
where_clause TYPE string_table,
|
||||||
|
order_by TYPE string,
|
||||||
|
target TYPE REF TO data,
|
||||||
|
rows TYPE i,
|
||||||
|
END OF struc_dyn.
|
||||||
|
|
||||||
|
CLASS-METHODS:
|
||||||
|
get_dyn_table_name RETURNING VALUE(tab) TYPE string,
|
||||||
|
get_dyn_dobj RETURNING VALUE(dobj) TYPE string,
|
||||||
|
get_dyn_field RETURNING VALUE(field) TYPE string,
|
||||||
|
get_dyn_select_list RETURNING VALUE(list) TYPE string,
|
||||||
|
get_dyn_where_clause RETURNING VALUE(clause_tab) TYPE string_table,
|
||||||
|
get_random_type RETURNING VALUE(random_type) TYPE string,
|
||||||
|
get_builtin_type RETURNING VALUE(builtin_type) TYPE struc_builtin,
|
||||||
|
get_dyn_class_meth EXPORTING cl TYPE string
|
||||||
|
meth TYPE string
|
||||||
|
ptab TYPE abap_parmbind_tab,
|
||||||
|
get_dyn_syntax_elements RETURNING VALUE(syntax_elements) TYPE struc_dyn,
|
||||||
|
fill_string.
|
||||||
|
|
||||||
|
PROTECTED SECTION.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_det_at_runtime IMPLEMENTATION.
|
||||||
|
METHOD get_dyn_table_name.
|
||||||
|
|
||||||
|
"Providing DDIC table names in a string table to be selected from.
|
||||||
|
DATA(flight_tables) = VALUE string_table(
|
||||||
|
( `ZDEMO_ABAP_CARR` ) ( `ZDEMO_ABAP_FLSCH` ) ( `ZDEMO_ABAP_FLI` ) ).
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime.
|
||||||
|
DATA(idx) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1
|
||||||
|
max = lines( flight_tables ) )->get_next( ).
|
||||||
|
|
||||||
|
"Returning parameter to receive the random table name.
|
||||||
|
tab = VALUE #( flight_tables[ idx ] DEFAULT `ZDEMO_ABAP_CARR` ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_builtin_type.
|
||||||
|
|
||||||
|
"Providing the names of built-in types in a string table to be selected from.
|
||||||
|
TYPES tabtyp TYPE TABLE OF struc_builtin-builtin_type WITH EMPTY KEY.
|
||||||
|
|
||||||
|
DATA(built) = VALUE tabtyp(
|
||||||
|
( 'd' )
|
||||||
|
( 'decfloat16' )
|
||||||
|
( 'decfloat34' )
|
||||||
|
( 'f' )
|
||||||
|
( 'i' )
|
||||||
|
( 'string' )
|
||||||
|
( 't' )
|
||||||
|
( 'xstring' )
|
||||||
|
( 'c' )
|
||||||
|
( 'n' )
|
||||||
|
( 'x' )
|
||||||
|
( 'p' )
|
||||||
|
).
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime
|
||||||
|
DATA(idx) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1
|
||||||
|
max = lines( built ) )->get_next( ).
|
||||||
|
|
||||||
|
"Providing the returning parameter with a random type name
|
||||||
|
TRY.
|
||||||
|
builtin_type = VALUE #( builtin_type = built[ idx ] dec = idx len = idx ).
|
||||||
|
CATCH cx_sy_itab_line_not_found.
|
||||||
|
builtin_type = VALUE #( builtin_type = `p` dec = 5 len = 5 ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_dyn_dobj.
|
||||||
|
|
||||||
|
"Providing strings with demo content
|
||||||
|
string1 = |Hallo, { sy-uname }. | &&
|
||||||
|
|This is string1.|.
|
||||||
|
string2 = |Hallo, { sy-uname }. | &&
|
||||||
|
|This is string2.|.
|
||||||
|
string3 = |Hallo, { sy-uname }. | &&
|
||||||
|
|This is string3.|.
|
||||||
|
|
||||||
|
"Filling table with data object names
|
||||||
|
DATA(str_tab) = VALUE string_table(
|
||||||
|
( `STRING1` ) ( `STRING2` ) ( `STRING3` ) ).
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime
|
||||||
|
DATA(idx) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1
|
||||||
|
max = lines( str_tab ) )->get_next( ).
|
||||||
|
|
||||||
|
"Providing the returning parameter with a random data object name
|
||||||
|
dobj = VALUE #( str_tab[ idx ] DEFAULT |Hallo, { sy-uname }. This is a string.| ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_dyn_field.
|
||||||
|
|
||||||
|
"Getting list of components of DDIC type zdemo_abap_carr
|
||||||
|
DATA(comp) = CAST cl_abap_structdescr(
|
||||||
|
cl_abap_typedescr=>describe_by_name(
|
||||||
|
'ZDEMO_ABAP_CARR' )
|
||||||
|
)->components.
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime;
|
||||||
|
"starting from 2 to exclude MANDT field
|
||||||
|
DATA(idx) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 2
|
||||||
|
max = lines( comp ) )->get_next( ).
|
||||||
|
|
||||||
|
"Providing the returning parameter with a random component name
|
||||||
|
field = VALUE #( comp[ idx ]-name DEFAULT `CARRID` ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_dyn_select_list.
|
||||||
|
|
||||||
|
"Providing SELECT lists in a string table to be selected from
|
||||||
|
DATA sel_list_tab TYPE string_table.
|
||||||
|
sel_list_tab = VALUE #(
|
||||||
|
( `CARRID, CONNID, COUNTRYFR, COUNTRYTO` )
|
||||||
|
( `CARRID, CONNID, CITYFROM, CITYTO` )
|
||||||
|
( `CARRID, CONNID, AIRPFROM, AIRPTO` )
|
||||||
|
( `CARRID, CONNID, AIRPFROM, AIRPTO, ` &&
|
||||||
|
`FLTIME, DEPTIME, ARRTIME, DISTANCE` )
|
||||||
|
).
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime
|
||||||
|
DATA(idx) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1
|
||||||
|
max = lines( sel_list_tab ) )->get_next( ).
|
||||||
|
|
||||||
|
"Providing the returning parameter with a random SELECT list
|
||||||
|
list = VALUE #( sel_list_tab[ idx ] DEFAULT `CARRID, CONNID, COUNTRYFR, COUNTRYTO` ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_dyn_where_clause.
|
||||||
|
|
||||||
|
"Providing WHERE clauses in a table to be selected from
|
||||||
|
DATA: BEGIN OF where_struc,
|
||||||
|
where_clause_tab TYPE string_table,
|
||||||
|
END OF where_struc.
|
||||||
|
|
||||||
|
DATA where_itab LIKE TABLE OF where_struc WITH EMPTY KEY.
|
||||||
|
|
||||||
|
where_itab = VALUE #(
|
||||||
|
( where_clause_tab = VALUE #( ( `CARRID = 'LH'` )
|
||||||
|
( `OR CARRID = 'AA'` ) ) )
|
||||||
|
( where_clause_tab = VALUE #( ( `CONNID BETWEEN 0 AND 300` ) ) )
|
||||||
|
( where_clause_tab = VALUE #( ( `CITYFROM LIKE '%FRA%'` ) ) )
|
||||||
|
( where_clause_tab =
|
||||||
|
VALUE #( ( `DISTANCE > 500 AND DISTID = 'KM'` ) ) ) ).
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime
|
||||||
|
DATA(idx) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1
|
||||||
|
max = lines( where_itab ) )->get_next( ).
|
||||||
|
|
||||||
|
"Providing the returning parameter with a random WHERE clause
|
||||||
|
clause_tab = VALUE #( where_itab[ idx ]-where_clause_tab DEFAULT VALUE #( ( `CARRID = 'LH'` ) ( `OR CARRID = 'AA'` ) ) ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_random_type.
|
||||||
|
|
||||||
|
"Providing names of classes in a string table to be selected from
|
||||||
|
"In this example, some types are defined in the public section
|
||||||
|
"of a local class. The class name is added here since the names
|
||||||
|
"are used in the global class.
|
||||||
|
DATA(str_tab) = VALUE string_table(
|
||||||
|
( `LCL_DET_AT_RUNTIME=>TYPE_P` )
|
||||||
|
( `LCL_DET_AT_RUNTIME=>TYPE_STRUC` )
|
||||||
|
( `LCL_DET_AT_RUNTIME=>TYPE_ITAB` )
|
||||||
|
( `LCL_DET_AT_RUNTIME=>TYPE_REF` )
|
||||||
|
( `LCL_DET_AT_RUNTIME` )
|
||||||
|
( `IF_OO_ADT_CLASSRUN` )
|
||||||
|
).
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime
|
||||||
|
DATA(idx) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1
|
||||||
|
max = lines( str_tab ) )->get_next( ).
|
||||||
|
|
||||||
|
"Providing the returning parameter with a random type name
|
||||||
|
random_type = VALUE #( str_tab[ idx ] DEFAULT `LCL_DET_AT_RUNTIME=>TYPE_STRUC` ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_dyn_class_meth.
|
||||||
|
|
||||||
|
"Providing class names in a string table to be selected from
|
||||||
|
DATA(class_tab) = VALUE string_table(
|
||||||
|
( `LCL_DEMO1` )
|
||||||
|
( `LCL_DEMO2` ) ).
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime
|
||||||
|
DATA(idx) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1
|
||||||
|
max = lines( class_tab ) )->get_next( ).
|
||||||
|
|
||||||
|
"Provide the exporting parameter with the random class name
|
||||||
|
cl = VALUE #( class_tab[ idx ] DEFAULT `LCL_DEMO1` ).
|
||||||
|
|
||||||
|
"Getting method names using RTTI
|
||||||
|
DATA(methods) = CAST cl_abap_classdescr( cl_abap_typedescr=>describe_by_name( cl ) )->methods.
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime
|
||||||
|
idx = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1
|
||||||
|
max = lines( methods ) )->get_next( ).
|
||||||
|
|
||||||
|
"Provide the exporting parameter with the random method name
|
||||||
|
meth = VALUE #( methods[ idx ]-name DEFAULT `METH_A` ).
|
||||||
|
|
||||||
|
"Data reference objects for the value parameter in the parameter table
|
||||||
|
DATA(ref_imp) = NEW string( `hi` ).
|
||||||
|
DATA(ref_exp) = NEW string( `hallo` ).
|
||||||
|
DATA(ref_ch) = NEW string( `salut` ).
|
||||||
|
DATA(ref_ret) = NEW string( `ciao` ).
|
||||||
|
|
||||||
|
"Filling the parameter tables
|
||||||
|
"Note: If the method signature has an importing parameter,
|
||||||
|
"it must be specified as exporting parameter here.
|
||||||
|
"Same is true for the exporting parameter in the signature
|
||||||
|
"that must be specified as importing parameter.
|
||||||
|
|
||||||
|
CASE meth.
|
||||||
|
|
||||||
|
WHEN `METH_A`.
|
||||||
|
|
||||||
|
ptab = VALUE #( ( name = 'A'
|
||||||
|
kind = cl_abap_objectdescr=>exporting
|
||||||
|
value = ref_exp )
|
||||||
|
( name = 'B'
|
||||||
|
kind = cl_abap_objectdescr=>importing
|
||||||
|
value = ref_imp ) ).
|
||||||
|
|
||||||
|
WHEN `METH_B`.
|
||||||
|
|
||||||
|
ptab = VALUE #( ( name = 'C'
|
||||||
|
kind = cl_abap_objectdescr=>changing
|
||||||
|
value = ref_ch )
|
||||||
|
( name = 'D'
|
||||||
|
kind = cl_abap_objectdescr=>returning
|
||||||
|
value = ref_ret ) ).
|
||||||
|
|
||||||
|
WHEN `METH_C`.
|
||||||
|
|
||||||
|
ptab = VALUE #( ( name = 'E'
|
||||||
|
kind = cl_abap_objectdescr=>exporting
|
||||||
|
value = ref_exp )
|
||||||
|
( name = 'F'
|
||||||
|
kind = cl_abap_objectdescr=>importing
|
||||||
|
value = ref_imp ) ).
|
||||||
|
|
||||||
|
WHEN `METH_D`.
|
||||||
|
|
||||||
|
ptab = VALUE #( ( name = 'G'
|
||||||
|
kind = cl_abap_objectdescr=>changing
|
||||||
|
value = ref_ch )
|
||||||
|
( name = 'H'
|
||||||
|
kind = cl_abap_objectdescr=>returning
|
||||||
|
value = ref_ret ) ).
|
||||||
|
|
||||||
|
ENDCASE.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD fill_string.
|
||||||
|
dyn_meth_call_result = |Hallo { sy-uname }. The string was filled at { utclong_current( ) }.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_dyn_syntax_elements.
|
||||||
|
|
||||||
|
"FROM clause
|
||||||
|
DATA(flight_tables) = VALUE string_table(
|
||||||
|
( `ZDEMO_ABAP_CARR` ) ( `ZDEMO_ABAP_FLSCH` ) ( `ZDEMO_ABAP_FLI` ) ).
|
||||||
|
|
||||||
|
"Getting random number to determine the table index at runtime.
|
||||||
|
DATA(idx_table) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( )
|
||||||
|
min = 1
|
||||||
|
max = lines( flight_tables ) )->get_next( ).
|
||||||
|
|
||||||
|
syntax_elements-table = VALUE #( flight_tables[ idx_table ] DEFAULT `ZDEMO_ABAP_CARR` ).
|
||||||
|
|
||||||
|
"SELECT list
|
||||||
|
DATA(comp) = CAST cl_abap_structdescr(
|
||||||
|
cl_abap_typedescr=>describe_by_name( syntax_elements-table ) )->components.
|
||||||
|
|
||||||
|
"At least 3 components
|
||||||
|
DATA(idx_comp) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( )
|
||||||
|
min = 3
|
||||||
|
max = lines( comp ) )->get_next( ).
|
||||||
|
|
||||||
|
DELETE comp FROM idx_comp + 1 TO lines( comp ).
|
||||||
|
|
||||||
|
LOOP AT comp ASSIGNING FIELD-SYMBOL(<comp>).
|
||||||
|
syntax_elements-select_list = syntax_elements-select_list && `, ` && <comp>-name.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
"Replacing initial comma
|
||||||
|
REPLACE PCRE `^,\s` IN syntax_elements-select_list WITH ``.
|
||||||
|
|
||||||
|
"WHERE clause
|
||||||
|
"Excluding the client field
|
||||||
|
DELETE comp WHERE name = 'MANDT'.
|
||||||
|
|
||||||
|
"A maximum of 4 fields are to be respected because that is the maximum of possible fields
|
||||||
|
"available in table zdemo_abap_carr (without the client field)
|
||||||
|
DATA(idx_where) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( )
|
||||||
|
min = 1
|
||||||
|
max = 4 )->get_next( ).
|
||||||
|
|
||||||
|
"In the example, the WHERE clause consists of an internal table of type string.
|
||||||
|
"The clause is set up with fields and only IS NOT INITIAL to be on the safe side for a
|
||||||
|
"somewhat 'meaningful' clause and in the interest of simplicity.
|
||||||
|
LOOP AT comp ASSIGNING FIELD-SYMBOL(<where>) TO idx_where.
|
||||||
|
IF sy-tabix = 1.
|
||||||
|
APPEND <where>-name && ` IS NOT INITIAL` TO syntax_elements-where_clause.
|
||||||
|
ELSE.
|
||||||
|
APPEND `OR ` && <where>-name && ` IS NOT INITIAL` TO syntax_elements-where_clause.
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
"ORDER BY clause
|
||||||
|
DATA(idx_order) = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( )
|
||||||
|
min = 1
|
||||||
|
max = lines( comp ) )->get_next( ).
|
||||||
|
|
||||||
|
syntax_elements-order_by = VALUE #( comp[ idx_order ]-name DEFAULT `CARRID` ).
|
||||||
|
|
||||||
|
"INTO clause
|
||||||
|
CREATE DATA syntax_elements-target TYPE TABLE OF (syntax_elements-table).
|
||||||
|
|
||||||
|
"UP TO ... ROWS
|
||||||
|
"A minimum of 2 and a maximum of 6 rows are to be retrieved by the SELECT statement
|
||||||
|
syntax_elements-rows = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( )
|
||||||
|
min = 2
|
||||||
|
max = 5 )->get_next( ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_demo1 DEFINITION.
|
||||||
|
"Note that this is just a demo class with demo methods to work with in the example.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
CLASS-METHODS:
|
||||||
|
meth_a IMPORTING a TYPE string
|
||||||
|
EXPORTING b TYPE string,
|
||||||
|
meth_b CHANGING c TYPE string
|
||||||
|
RETURNING VALUE(d) TYPE string.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_demo1 IMPLEMENTATION.
|
||||||
|
METHOD meth_a.
|
||||||
|
b = |Hallo from meth_a. '{ a }' was input.|.
|
||||||
|
|
||||||
|
"Filling an attribute for the output in the global class.
|
||||||
|
lcl_det_at_runtime=>dyn_meth_call_result = b.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD meth_b.
|
||||||
|
c = `#` && c && `#`.
|
||||||
|
d = |Hallo from meth_b. Actual parameter of changing parameter: '{ c }'|.
|
||||||
|
|
||||||
|
"Filling an attribute for the output in the global class.
|
||||||
|
lcl_det_at_runtime=>dyn_meth_call_result = d.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_demo2 DEFINITION.
|
||||||
|
"Note that this is just a demo class with demo methods to work with in the example.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
CLASS-METHODS:
|
||||||
|
meth_c IMPORTING e TYPE string
|
||||||
|
EXPORTING f TYPE string,
|
||||||
|
meth_d CHANGING g TYPE string
|
||||||
|
RETURNING VALUE(h) TYPE string.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_demo2 IMPLEMENTATION.
|
||||||
|
METHOD meth_c.
|
||||||
|
f = |Hallo from meth_c. '{ e }' was input.|.
|
||||||
|
|
||||||
|
"Filling an attribute for the output in the global class.
|
||||||
|
lcl_det_at_runtime=>dyn_meth_call_result = f.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD meth_d.
|
||||||
|
g = `*` && g && `*`.
|
||||||
|
h = |Hallo from meth_d. Actual parameter of changing parameter: '{ g }'|.
|
||||||
|
|
||||||
|
"Filling an attribute for the output in the global class.
|
||||||
|
lcl_det_at_runtime=>dyn_meth_call_result = h.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
16
src/zcl_demo_abap_dynamic_prog.clas.xml
Normal file
16
src/zcl_demo_abap_dynamic_prog.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_DYNAMIC_PROG</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: Dynamic programming</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
712
src/zcl_demo_abap_flight_tables.clas.abap
Normal file
712
src/zcl_demo_abap_flight_tables.clas.abap
Normal file
@@ -0,0 +1,712 @@
|
|||||||
|
***********************************************************************
|
||||||
|
*
|
||||||
|
* Class for ABAP cheat sheet examples designed to clear and populate
|
||||||
|
* demo database tables
|
||||||
|
*
|
||||||
|
* -------------------------- NOTE -------------------------------------
|
||||||
|
* The code presented in this class is only meant for supporting the ABAP
|
||||||
|
* cheat sheets. It is not intended for direct use in a
|
||||||
|
* production system environment. The code examples in the ABAP cheat
|
||||||
|
* sheets are primarily intended to provide a better explanation and
|
||||||
|
* visualization of the syntax and semantics of ABAP statements and not to
|
||||||
|
* solve concrete programming tasks. For production application programs,
|
||||||
|
* a dedicated solution should therefore always be worked out for each
|
||||||
|
* individual case. There is no guarantee for either the correctness or
|
||||||
|
* the completeness of the code. In addition, there is no legal
|
||||||
|
* responsibility or liability for possible errors or their consequences
|
||||||
|
* which occur through the use of the example code.
|
||||||
|
*
|
||||||
|
***********************************************************************
|
||||||
|
"! <p class="shorttext synchronized">Class supporting ABAP cheat sheet examples</p>
|
||||||
|
"! The class supports the ABAP cheat examples by clearing and populating demo database tables that are used there.
|
||||||
|
"! The demo database tables contain airline and flight information.
|
||||||
|
CLASS zcl_demo_abap_flight_tables DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
FINAL
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
CLASS-METHODS: clear_dbtabs,
|
||||||
|
fill_dbtabs.
|
||||||
|
|
||||||
|
protected section.
|
||||||
|
private section.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_DEMO_ABAP_FLIGHT_TABLES IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD clear_dbtabs.
|
||||||
|
DELETE FROM zdemo_abap_flsch.
|
||||||
|
DELETE FROM zdemo_abap_carr.
|
||||||
|
DELETE FROM zdemo_abap_fli.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD fill_dbtabs.
|
||||||
|
|
||||||
|
"Clearing db tables before filling
|
||||||
|
clear_dbtabs( ).
|
||||||
|
|
||||||
|
"Filling db table
|
||||||
|
MODIFY zdemo_abap_flsch FROM TABLE @( VALUE #(
|
||||||
|
( carrid = 'AA'
|
||||||
|
connid = 0017
|
||||||
|
countryfr = 'US'
|
||||||
|
cityfrom = 'NEW YORK'
|
||||||
|
airpfrom = 'JFK'
|
||||||
|
countryto = 'US'
|
||||||
|
cityto = 'SAN FRANCISCO'
|
||||||
|
airpto = 'SFO'
|
||||||
|
fltime = 361
|
||||||
|
deptime = '110000'
|
||||||
|
arrtime = '140100'
|
||||||
|
distance = 2572
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'AA'
|
||||||
|
connid = 0064
|
||||||
|
countryfr = 'US'
|
||||||
|
cityfrom = 'SAN FRANCISCO'
|
||||||
|
airpfrom = 'SFO'
|
||||||
|
countryto = 'US'
|
||||||
|
cityto = 'NEW YORK'
|
||||||
|
airpto = 'JFK'
|
||||||
|
fltime = 321
|
||||||
|
deptime = '090000'
|
||||||
|
arrtime = '172100'
|
||||||
|
distance = 2572
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0555
|
||||||
|
countryfr = 'IT'
|
||||||
|
cityfrom = 'ROME'
|
||||||
|
airpfrom = 'FCO'
|
||||||
|
countryto = 'DE'
|
||||||
|
cityto = 'FRANKFURT'
|
||||||
|
airpto = 'FRA'
|
||||||
|
fltime = 125
|
||||||
|
deptime = '190000'
|
||||||
|
arrtime = '210500'
|
||||||
|
distance = 845
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0788
|
||||||
|
countryfr = 'IT'
|
||||||
|
cityfrom = 'ROME'
|
||||||
|
airpfrom = 'FCO'
|
||||||
|
countryto = 'JP'
|
||||||
|
cityto = 'TOKYO'
|
||||||
|
airpto = 'TYO'
|
||||||
|
fltime = 775
|
||||||
|
deptime = '120000'
|
||||||
|
arrtime = '085500'
|
||||||
|
distance = 6130
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = ''
|
||||||
|
period = 1 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0789
|
||||||
|
countryfr = 'JP'
|
||||||
|
cityfrom = 'TOKYO'
|
||||||
|
airpfrom = 'TYO'
|
||||||
|
countryto = 'IT'
|
||||||
|
cityto = 'ROME'
|
||||||
|
airpto = 'FCO'
|
||||||
|
fltime = 940
|
||||||
|
deptime = '114500'
|
||||||
|
arrtime = '192500'
|
||||||
|
distance = 6130
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0790
|
||||||
|
countryfr = 'IT'
|
||||||
|
cityfrom = 'ROME'
|
||||||
|
airpfrom = 'FCO'
|
||||||
|
countryto = 'JP'
|
||||||
|
cityto = 'OSAKA'
|
||||||
|
airpto = 'KIX'
|
||||||
|
fltime = 815
|
||||||
|
deptime = '103500'
|
||||||
|
arrtime = '081000'
|
||||||
|
distance = 6030
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = 'X'
|
||||||
|
period = 1 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 0106
|
||||||
|
countryfr = 'US'
|
||||||
|
cityfrom = 'NEW YORK'
|
||||||
|
airpfrom = 'JFK'
|
||||||
|
countryto = 'DE'
|
||||||
|
cityto = 'FRANKFURT'
|
||||||
|
airpto = 'FRA'
|
||||||
|
fltime = 475
|
||||||
|
deptime = '193500'
|
||||||
|
arrtime = '093000'
|
||||||
|
distance = 3851
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = ''
|
||||||
|
period = 1 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 1699
|
||||||
|
countryfr = 'US'
|
||||||
|
cityfrom = 'NEW YORK'
|
||||||
|
airpfrom = 'JFK'
|
||||||
|
countryto = 'US'
|
||||||
|
cityto = 'SAN FRANCISCO'
|
||||||
|
airpto = 'SFO'
|
||||||
|
fltime = 382
|
||||||
|
deptime = '171500'
|
||||||
|
arrtime = '203700'
|
||||||
|
distance = 2572
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 1984
|
||||||
|
countryfr = 'US'
|
||||||
|
cityfrom = 'SAN FRANCISCO'
|
||||||
|
airpfrom = 'SFO'
|
||||||
|
countryto = 'US'
|
||||||
|
cityto = 'NEW YORK'
|
||||||
|
airpto = 'JFK'
|
||||||
|
fltime = 325
|
||||||
|
deptime = '100000'
|
||||||
|
arrtime = '182500'
|
||||||
|
distance = 2572
|
||||||
|
distid = 'MI'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'JL'
|
||||||
|
connid = 0407
|
||||||
|
countryfr = 'JP'
|
||||||
|
cityfrom = 'TOKYO'
|
||||||
|
airpfrom = 'NRT'
|
||||||
|
countryto = 'DE'
|
||||||
|
cityto = 'FRANKFURT'
|
||||||
|
airpto = 'FRA'
|
||||||
|
fltime = 725
|
||||||
|
deptime = '133000'
|
||||||
|
arrtime = '173500'
|
||||||
|
distance = 9100
|
||||||
|
distid = 'KM'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'JL'
|
||||||
|
connid = 0408
|
||||||
|
countryfr = 'DE'
|
||||||
|
cityfrom = 'FRANKFURT'
|
||||||
|
airpfrom = 'FRA'
|
||||||
|
countryto = 'JP'
|
||||||
|
cityto = 'TOKYO'
|
||||||
|
airpto = 'NRT'
|
||||||
|
fltime = 675
|
||||||
|
deptime = '202500'
|
||||||
|
arrtime = '154000'
|
||||||
|
distance = 9100
|
||||||
|
distid = 'KM'
|
||||||
|
fltype = 'X'
|
||||||
|
period = 1 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0400
|
||||||
|
countryfr = 'DE'
|
||||||
|
cityfrom = 'FRANKFURT'
|
||||||
|
airpfrom = 'FRA'
|
||||||
|
countryto = 'US'
|
||||||
|
cityto = 'NEW YORK'
|
||||||
|
airpto = 'JFK'
|
||||||
|
fltime = 444
|
||||||
|
deptime = '101000'
|
||||||
|
arrtime = '113400'
|
||||||
|
distance = 6162
|
||||||
|
distid = 'KM'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0401
|
||||||
|
countryfr = 'US'
|
||||||
|
cityfrom = 'NEW YORK'
|
||||||
|
airpfrom = 'JFK'
|
||||||
|
countryto = 'DE'
|
||||||
|
cityto = 'FRANKFURT'
|
||||||
|
airpto = 'FRA'
|
||||||
|
fltime = 435
|
||||||
|
deptime = '183000'
|
||||||
|
arrtime = '074500'
|
||||||
|
distance = 6162
|
||||||
|
distid = 'KM'
|
||||||
|
fltype = ''
|
||||||
|
period = 1 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0402
|
||||||
|
countryfr = 'DE'
|
||||||
|
cityfrom = 'FRANKFURT'
|
||||||
|
airpfrom = 'FRA'
|
||||||
|
countryto = 'US'
|
||||||
|
cityto = 'NEW YORK'
|
||||||
|
airpto = 'JFK'
|
||||||
|
fltime = 455
|
||||||
|
deptime = '133000'
|
||||||
|
arrtime = '150500'
|
||||||
|
distance = 6162
|
||||||
|
distid = 'KM'
|
||||||
|
fltype = 'X'
|
||||||
|
period = 0 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 2402
|
||||||
|
countryfr = 'DE'
|
||||||
|
cityfrom = 'FRANKFURT'
|
||||||
|
airpfrom = 'FRA'
|
||||||
|
countryto = 'DE'
|
||||||
|
cityto = 'BERLIN'
|
||||||
|
airpto = 'SXF'
|
||||||
|
fltime = 65
|
||||||
|
deptime = '103000'
|
||||||
|
arrtime = '113500'
|
||||||
|
distance = 555
|
||||||
|
distid = 'KM'
|
||||||
|
fltype = ''
|
||||||
|
period = 0 ) ) ).
|
||||||
|
|
||||||
|
"Filling db table
|
||||||
|
MODIFY zdemo_abap_carr FROM TABLE @( VALUE #(
|
||||||
|
( carrid = 'AA'
|
||||||
|
carrname = 'American Airlines'
|
||||||
|
currcode = 'USD'
|
||||||
|
url = 'http://www.aa.com' )
|
||||||
|
( carrid = 'LH'
|
||||||
|
carrname = 'Lufthansa'
|
||||||
|
currcode = 'EUR'
|
||||||
|
url = 'http://www.lufthansa.com' )
|
||||||
|
( carrid = 'JL'
|
||||||
|
carrname = 'Japan Airlines'
|
||||||
|
currcode = 'JPY'
|
||||||
|
url = 'http://www.jal.co.jp' )
|
||||||
|
( carrid = 'DL'
|
||||||
|
carrname = 'Delta Airlines'
|
||||||
|
currcode = 'USD'
|
||||||
|
url = 'http://www.delta-air.com' )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
carrname = 'ITA Airways'
|
||||||
|
currcode = 'EUR'
|
||||||
|
url = 'http://www.ita-airways.com' ) ) ).
|
||||||
|
|
||||||
|
"Filling db table
|
||||||
|
MODIFY zdemo_abap_fli FROM TABLE @( VALUE #(
|
||||||
|
( carrid = 'AA'
|
||||||
|
connid = 0017
|
||||||
|
fldate = '20230923'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = '747-400'
|
||||||
|
seatsmax = 385
|
||||||
|
seatsocc = 369
|
||||||
|
paymentsum = '191993.87'
|
||||||
|
seatsmax_b = 31
|
||||||
|
seatsocc_b = 31
|
||||||
|
seatsmax_f = 21
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'AA'
|
||||||
|
connid = 0017
|
||||||
|
fldate = '20230929'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = '747-400'
|
||||||
|
seatsmax = 385
|
||||||
|
seatsocc = 372
|
||||||
|
paymentsum = '193537.52'
|
||||||
|
seatsmax_b = 31
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 21
|
||||||
|
seatsocc_f = 20 )
|
||||||
|
( carrid = 'AA'
|
||||||
|
connid = 0017
|
||||||
|
fldate = '20231111'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = '747-400'
|
||||||
|
seatsmax = 385
|
||||||
|
seatsocc = 374
|
||||||
|
paymentsum = '193651.77'
|
||||||
|
seatsmax_b = 31
|
||||||
|
seatsocc_b = 29
|
||||||
|
seatsmax_f = 21
|
||||||
|
seatsocc_f = 21 )
|
||||||
|
( carrid = 'AA'
|
||||||
|
connid = 0064
|
||||||
|
fldate = '20220131'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = 'A340-600'
|
||||||
|
seatsmax = 330
|
||||||
|
seatsocc = 313
|
||||||
|
paymentsum = '168469.88'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'AA'
|
||||||
|
connid = 0064
|
||||||
|
fldate = '20220215'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = 'A340-600'
|
||||||
|
seatsmax = 330
|
||||||
|
seatsocc = 157
|
||||||
|
paymentsum = '84846.15'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 15
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 10 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0555
|
||||||
|
fldate = '20230721'
|
||||||
|
price = '226.41'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A319-100'
|
||||||
|
seatsmax = 120
|
||||||
|
seatsocc = 114
|
||||||
|
paymentsum = '26519.75'
|
||||||
|
seatsmax_b = 8
|
||||||
|
seatsocc_b = 8
|
||||||
|
seatsmax_f = 8
|
||||||
|
seatsocc_f = 8 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0555
|
||||||
|
fldate = '20230728'
|
||||||
|
price = '226.41'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A319-100'
|
||||||
|
seatsmax = 120
|
||||||
|
seatsocc = 115
|
||||||
|
paymentsum = '16695.50'
|
||||||
|
seatsmax_b = 8
|
||||||
|
seatsocc_b = 8
|
||||||
|
seatsmax_f = 8
|
||||||
|
seatsocc_f = 8 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0788
|
||||||
|
fldate = '20230922'
|
||||||
|
price = '1071.41'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 456
|
||||||
|
paymentsum = '548722.20'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 20 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0788
|
||||||
|
fldate = '20230722'
|
||||||
|
price = '1071.41'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 455
|
||||||
|
paymentsum = '544674.30'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 28
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 20 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0789
|
||||||
|
fldate = '20231025'
|
||||||
|
price = '1071.41'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 455
|
||||||
|
paymentsum = '545704.30'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0789
|
||||||
|
fldate = '20230221'
|
||||||
|
price = '1071.41'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 459
|
||||||
|
paymentsum = '549226.90'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 20 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0790
|
||||||
|
fldate = '20231228'
|
||||||
|
price = '1055.41'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = '747-400'
|
||||||
|
seatsmax = 385
|
||||||
|
seatsocc = 370
|
||||||
|
paymentsum = '462373.86'
|
||||||
|
seatsmax_b = 31
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 21
|
||||||
|
seatsocc_f = 21 )
|
||||||
|
( carrid = 'AZ'
|
||||||
|
connid = 0790
|
||||||
|
fldate = '20231201'
|
||||||
|
price = '1055.41'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = '747-400'
|
||||||
|
seatsmax = 385
|
||||||
|
seatsocc = 367
|
||||||
|
paymentsum = '463661.64'
|
||||||
|
seatsmax_b = 31
|
||||||
|
seatsocc_b = 31
|
||||||
|
seatsmax_f = 21
|
||||||
|
seatsocc_f = 21 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 0106
|
||||||
|
fldate = '20230209'
|
||||||
|
price = '652.42'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = 'A340-600'
|
||||||
|
seatsmax = 330
|
||||||
|
seatsocc = 178
|
||||||
|
paymentsum = '136750.33'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 17
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 10 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 0106
|
||||||
|
fldate = '20240102'
|
||||||
|
price = '652.42'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = 'A340-600'
|
||||||
|
seatsmax = 330
|
||||||
|
seatsocc = 16
|
||||||
|
paymentsum = '12892.33'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 2
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 10 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 1699
|
||||||
|
fldate = '20230921'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = '767-200'
|
||||||
|
seatsmax = 260
|
||||||
|
seatsocc = 250
|
||||||
|
paymentsum = '126636.91'
|
||||||
|
seatsmax_b = 21
|
||||||
|
seatsocc_b = 20
|
||||||
|
seatsmax_f = 11
|
||||||
|
seatsocc_f = 11 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 1699
|
||||||
|
fldate = '20230511'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = '767-200'
|
||||||
|
seatsmax = 260
|
||||||
|
seatsocc = 251
|
||||||
|
paymentsum = '126493.06'
|
||||||
|
seatsmax_b = 21
|
||||||
|
seatsocc_b = 20
|
||||||
|
seatsmax_f = 11
|
||||||
|
seatsocc_f = 11 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 1984
|
||||||
|
fldate = '20230719'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 460
|
||||||
|
paymentsum = '225427.35'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 29
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'DL'
|
||||||
|
connid = 1984
|
||||||
|
fldate = '20230213'
|
||||||
|
price = '464.35'
|
||||||
|
currency = 'USD'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 458
|
||||||
|
paymentsum = '225088.83'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'JL'
|
||||||
|
connid = 0407
|
||||||
|
fldate = '20231128'
|
||||||
|
price = '1102.77'
|
||||||
|
currency = 'JPY'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 458
|
||||||
|
paymentsum = '563231.65'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 27
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 20 )
|
||||||
|
( carrid = 'JL'
|
||||||
|
connid = 0407
|
||||||
|
fldate = '20231019'
|
||||||
|
price = '1102.77'
|
||||||
|
currency = 'JPY'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 452
|
||||||
|
paymentsum = '553552.12'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 28
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'JL'
|
||||||
|
connid = 0408
|
||||||
|
fldate = '20231128'
|
||||||
|
price = '1102.77'
|
||||||
|
currency = 'JPY'
|
||||||
|
planetype = '747-400'
|
||||||
|
seatsmax = 385
|
||||||
|
seatsocc = 365
|
||||||
|
paymentsum = '470129.20'
|
||||||
|
seatsmax_b = 31
|
||||||
|
seatsocc_b = 28
|
||||||
|
seatsmax_f = 21
|
||||||
|
seatsocc_f = 20 )
|
||||||
|
( carrid = 'JL'
|
||||||
|
connid = 0408
|
||||||
|
fldate = '20230123'
|
||||||
|
price = '1102.77'
|
||||||
|
currency = 'JPY'
|
||||||
|
planetype = '747-400'
|
||||||
|
seatsmax = 385
|
||||||
|
seatsocc = 372
|
||||||
|
paymentsum = '487715.90'
|
||||||
|
seatsmax_b = 31
|
||||||
|
seatsocc_b = 31
|
||||||
|
seatsmax_f = 21
|
||||||
|
seatsocc_f = 20 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0400
|
||||||
|
fldate = '20230628'
|
||||||
|
price = '1184.54'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A340-600'
|
||||||
|
seatsmax = 330
|
||||||
|
seatsocc = 319
|
||||||
|
paymentsum = '270822.24'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 20 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0400
|
||||||
|
fldate = '20230323'
|
||||||
|
price = '1184.54'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A340-600'
|
||||||
|
seatsmax = 330
|
||||||
|
seatsocc = 312
|
||||||
|
paymentsum = '262597.14'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 28
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0401
|
||||||
|
fldate = '20231128'
|
||||||
|
price = '669.20'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = '767-200'
|
||||||
|
seatsmax = 260
|
||||||
|
seatsocc = 246
|
||||||
|
paymentsum = '195417.72'
|
||||||
|
seatsmax_b = 21
|
||||||
|
seatsocc_b = 19
|
||||||
|
seatsmax_f = 11
|
||||||
|
seatsocc_f = 10 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0401
|
||||||
|
fldate = '20231229'
|
||||||
|
price = '669.20'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = '767-200'
|
||||||
|
seatsmax = 260
|
||||||
|
seatsocc = 252
|
||||||
|
paymentsum = '199300.50'
|
||||||
|
seatsmax_b = 21
|
||||||
|
seatsocc_b = 19
|
||||||
|
seatsmax_f = 11
|
||||||
|
seatsocc_f = 11 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0402
|
||||||
|
fldate = '20230617'
|
||||||
|
price = '669.20'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 461
|
||||||
|
paymentsum = '353526.12'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 29
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 18 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 0402
|
||||||
|
fldate = '20230313'
|
||||||
|
price = '669.20'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 450
|
||||||
|
paymentsum = '349223.76'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 29
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 2402
|
||||||
|
fldate = '20231028'
|
||||||
|
price = '245.20'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 451
|
||||||
|
paymentsum = '127197.62'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 29
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 19 )
|
||||||
|
( carrid = 'LH'
|
||||||
|
connid = 2402
|
||||||
|
fldate = '20231223'
|
||||||
|
price = '245.20'
|
||||||
|
currency = 'EUR'
|
||||||
|
planetype = 'A380-800'
|
||||||
|
seatsmax = 475
|
||||||
|
seatsocc = 458
|
||||||
|
paymentsum = '18944.86'
|
||||||
|
seatsmax_b = 30
|
||||||
|
seatsocc_b = 30
|
||||||
|
seatsmax_f = 20
|
||||||
|
seatsocc_f = 20 ) ) ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
16
src/zcl_demo_abap_flight_tables.clas.xml
Normal file
16
src/zcl_demo_abap_flight_tables.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_FLIGHT_TABLES</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Class supporting ABAP cheat sheet examples</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1778
src/zcl_demo_abap_internal_tables.clas.abap
Normal file
1778
src/zcl_demo_abap_internal_tables.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_internal_tables.clas.xml
Normal file
16
src/zcl_demo_abap_internal_tables.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_INTERNAL_TABLES</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: Internal tables</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1060
src/zcl_demo_abap_objects.clas.abap
Normal file
1060
src/zcl_demo_abap_objects.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
558
src/zcl_demo_abap_objects.clas.locals_imp.abap
Normal file
558
src/zcl_demo_abap_objects.clas.locals_imp.abap
Normal file
@@ -0,0 +1,558 @@
|
|||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
*& Custom exception classes
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
|
||||||
|
CLASS cx_afternoon DEFINITION INHERITING FROM cx_static_check.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS cx_night DEFINITION INHERITING FROM cx_static_check.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
*& Class to demonstrate various method parameters
|
||||||
|
*& All formal parameters are passed by reference except the
|
||||||
|
*& returning parameter.
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
CLASS lcl_demo DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
CLASS-METHODS:
|
||||||
|
"No parameters
|
||||||
|
hallo_static_ext,
|
||||||
|
|
||||||
|
"One importing parameter
|
||||||
|
powers_of_two IMPORTING i_pow TYPE i,
|
||||||
|
|
||||||
|
"Two importing parameters
|
||||||
|
"Specifying REFERENCE(p) is optional; a formal parameter
|
||||||
|
"without VALUE(p) or REFERENCE(p) is REFERENCE(p) by default
|
||||||
|
addition IMPORTING i_add1 TYPE i
|
||||||
|
REFERENCE(i_add2) TYPE i,
|
||||||
|
|
||||||
|
"Two importing parameters, one of them is optional.
|
||||||
|
addition_optional IMPORTING i_add_mand TYPE i
|
||||||
|
i_add_opt TYPE i OPTIONAL,
|
||||||
|
|
||||||
|
"Importing and exporting parameters
|
||||||
|
subtraction IMPORTING i_sub1 TYPE i
|
||||||
|
i_sub2 TYPE i
|
||||||
|
EXPORTING e_sub_result TYPE i,
|
||||||
|
|
||||||
|
"One exporting parameter
|
||||||
|
exporting_hallo EXPORTING text TYPE string,
|
||||||
|
|
||||||
|
"Changing parameter
|
||||||
|
square_root CHANGING i_sqr TYPE decfloat34,
|
||||||
|
|
||||||
|
"Importing and returning parameters
|
||||||
|
multiplication IMPORTING i_mult1 TYPE i
|
||||||
|
i_mult2 TYPE i
|
||||||
|
RETURNING VALUE(r_mult_result) TYPE i,
|
||||||
|
|
||||||
|
"Importing and exporting parameters
|
||||||
|
"for comparing the signature with method 'multiplication'
|
||||||
|
multiplication_exp_param IMPORTING i_multa TYPE i
|
||||||
|
i_multb TYPE i
|
||||||
|
EXPORTING e_mult_result TYPE i,
|
||||||
|
|
||||||
|
"Includes RAISING
|
||||||
|
division IMPORTING i_div1 TYPE i
|
||||||
|
i_div2 TYPE i
|
||||||
|
RETURNING VALUE(r_div_result) TYPE decfloat34
|
||||||
|
RAISING cx_sy_arithmetic_error,
|
||||||
|
|
||||||
|
check_daytime IMPORTING time TYPE t
|
||||||
|
EXPORTING greetings TYPE string
|
||||||
|
RAISING cx_afternoon cx_night,
|
||||||
|
|
||||||
|
"Include parameters with generic types
|
||||||
|
generic_data IMPORTING i_data TYPE data,
|
||||||
|
generic_tab IMPORTING i_anytab TYPE ANY TABLE.
|
||||||
|
|
||||||
|
CLASS-DATA: calc_result TYPE i,
|
||||||
|
string TYPE string,
|
||||||
|
some_data TYPE REF TO data.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_demo IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD hallo_static_ext.
|
||||||
|
string = |Hallo { sy-uname }. | &&
|
||||||
|
|I'm a static method of class lcl_demo.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD square_root.
|
||||||
|
i_sqr = sqrt( i_sqr ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD powers_of_two.
|
||||||
|
calc_result = i_pow * i_pow.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD addition.
|
||||||
|
calc_result = i_add1 + i_add2.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD addition_optional.
|
||||||
|
calc_result = i_add_mand + i_add_opt.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD subtraction.
|
||||||
|
e_sub_result = i_sub1 - i_sub2.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD exporting_hallo.
|
||||||
|
text = |Hallo { sy-uname }. | && |I'm a static method of class lcl_demo with one exporting parameter.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD multiplication.
|
||||||
|
r_mult_result = i_mult1 * i_mult2.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD multiplication_exp_param.
|
||||||
|
e_mult_result = i_multa * i_multb.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD division.
|
||||||
|
CLEAR string.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
r_div_result = i_div1 / i_div2.
|
||||||
|
CATCH cx_sy_arithmetic_error INTO DATA(exc).
|
||||||
|
string = exc->get_text( ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD check_daytime.
|
||||||
|
CLEAR string.
|
||||||
|
|
||||||
|
"Morning: 5 am to 12 pm
|
||||||
|
IF time BETWEEN '050001' AND '120000'.
|
||||||
|
DATA(subrc) = 0.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
"Afternoon: 12 pm to 5 pm.
|
||||||
|
IF time BETWEEN '120001' AND '170000'.
|
||||||
|
subrc = 11.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
"Evening 5 pm to 9 pm.
|
||||||
|
"Commented out on purpose to have a time range for OTHERS :)
|
||||||
|
"IF time BETWEEN '170001' AND '210000'.
|
||||||
|
" subrc = 22.
|
||||||
|
"ENDIF.
|
||||||
|
|
||||||
|
"Night: 9 pm to 4 am.
|
||||||
|
IF time BETWEEN '210001' AND '050000'.
|
||||||
|
subrc = 33.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF subrc <> 0.
|
||||||
|
CASE subrc.
|
||||||
|
WHEN 11.
|
||||||
|
greetings = |Good afternoon.|.
|
||||||
|
WHEN 33.
|
||||||
|
greetings = |Good night.|.
|
||||||
|
WHEN OTHERS.
|
||||||
|
greetings = |It's neither morning, afternoon or night. | &&
|
||||||
|
|Hence, wishing you a good evening.|.
|
||||||
|
ENDCASE.
|
||||||
|
ELSE.
|
||||||
|
greetings = |Good morning.|.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD generic_data.
|
||||||
|
"A data reference variable is created that has the type of the
|
||||||
|
"imported variable. Its content is store in the variable
|
||||||
|
"some_data in the public section to be able to access the content.
|
||||||
|
CREATE DATA some_data LIKE i_data.
|
||||||
|
ASSIGN some_data->* TO FIELD-SYMBOL(<e>).
|
||||||
|
<e> = i_data.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD generic_tab.
|
||||||
|
"See implementation of generic_data.
|
||||||
|
"Here, an internal table is handled.
|
||||||
|
CREATE DATA some_data LIKE i_anytab.
|
||||||
|
ASSIGN some_data->* TO FIELD-SYMBOL(<f>).
|
||||||
|
<f> = i_anytab.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
*& Class to demonstrate basics in the global class
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
|
||||||
|
CLASS local_class DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
METHODS: constructor.
|
||||||
|
|
||||||
|
DATA: num_inst TYPE i,
|
||||||
|
uuid TYPE sysuuid_x16,
|
||||||
|
timestamp TYPE timestampl.
|
||||||
|
|
||||||
|
CLASS-DATA: no_of_instances TYPE i READ-ONLY,
|
||||||
|
num_stat TYPE i VALUE 33.
|
||||||
|
|
||||||
|
CONSTANTS: const_number TYPE i VALUE 11.
|
||||||
|
|
||||||
|
TYPES type_i TYPE i.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS local_class IMPLEMENTATION.
|
||||||
|
METHOD constructor.
|
||||||
|
"Number of instances of the class are counted.
|
||||||
|
no_of_instances = no_of_instances + 1.
|
||||||
|
"Set a time stamp.
|
||||||
|
GET TIME STAMP FIELD timestamp.
|
||||||
|
"Increase the number.
|
||||||
|
num_inst = num_inst + 1.
|
||||||
|
"Get a random UUID.
|
||||||
|
TRY.
|
||||||
|
uuid = cl_system_uuid=>create_uuid_x16_static( ) .
|
||||||
|
CATCH cx_uuid_error.
|
||||||
|
ENDTRY.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
*& Class to demonstrate events
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
|
||||||
|
CLASS lcl_events DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
DATA: greets TYPE string.
|
||||||
|
|
||||||
|
"Events declaration.
|
||||||
|
EVENTS: morning, afternoon, evening, night.
|
||||||
|
|
||||||
|
"Event handler methods
|
||||||
|
METHODS: morning_greets FOR EVENT morning OF lcl_events,
|
||||||
|
afternoon_greets FOR EVENT afternoon OF lcl_events,
|
||||||
|
evening_greets FOR EVENT evening OF lcl_events,
|
||||||
|
night_greets FOR EVENT night OF lcl_events.
|
||||||
|
|
||||||
|
"Method to raise events
|
||||||
|
METHODS: greetings.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_events IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD greetings.
|
||||||
|
|
||||||
|
DATA(syst_time) = cl_abap_context_info=>get_system_time( ).
|
||||||
|
|
||||||
|
"Morning: 5 am to 12 pm
|
||||||
|
IF syst_time BETWEEN '050001' AND '120000'.
|
||||||
|
RAISE EVENT morning.
|
||||||
|
|
||||||
|
"Afternoon: 12 pm to 5 pm.
|
||||||
|
ELSEIF syst_time BETWEEN '120001' AND '170000'.
|
||||||
|
RAISE EVENT afternoon.
|
||||||
|
|
||||||
|
"Evening 5 pm to 9 pm.
|
||||||
|
ELSEIF syst_time BETWEEN '170001' AND '210000'.
|
||||||
|
RAISE EVENT evening.
|
||||||
|
|
||||||
|
"Night: 9 pm to 5 am.
|
||||||
|
ELSEIF syst_time BETWEEN '210001' AND '050000'.
|
||||||
|
RAISE EVENT night.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD morning_greets.
|
||||||
|
greets = |Good morning, { sy-uname }.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD afternoon_greets.
|
||||||
|
greets = |Good afternoon, { sy-uname }.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD evening_greets.
|
||||||
|
greets = |Good evening, { sy-uname }.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD night_greets.
|
||||||
|
greets = |Good night, { sy-uname }.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
*& Class to demonstrate constructors
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
|
||||||
|
CLASS lcl_constructors DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
METHODS: constructor IMPORTING num1 TYPE i
|
||||||
|
num2 TYPE i RAISING cx_sy_zerodivide.
|
||||||
|
|
||||||
|
DATA: uuid TYPE sysuuid_x16,
|
||||||
|
in_div_result TYPE i,
|
||||||
|
in_text TYPE string.
|
||||||
|
|
||||||
|
|
||||||
|
CLASS-METHODS: class_constructor,
|
||||||
|
add_1.
|
||||||
|
|
||||||
|
CLASS-DATA: no_of_instances TYPE i READ-ONLY,
|
||||||
|
stat_number TYPE i,
|
||||||
|
stat_text TYPE string.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_constructors IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
"Get time stamp.
|
||||||
|
DATA(ts1) = utclong_current( ).
|
||||||
|
"Provide message.
|
||||||
|
in_text = |The instance constructor of the class | &&
|
||||||
|
|lcl_constructors was called on { ts1 }.|.
|
||||||
|
|
||||||
|
"Count number of instances.
|
||||||
|
no_of_instances = no_of_instances + 1.
|
||||||
|
"Get random UUID.
|
||||||
|
TRY.
|
||||||
|
uuid = cl_system_uuid=>create_uuid_x16_static( ) .
|
||||||
|
CATCH cx_uuid_error.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
CLEAR in_div_result.
|
||||||
|
"Do calculation.
|
||||||
|
in_div_result = num1 / num2.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD class_constructor.
|
||||||
|
"Set a number.
|
||||||
|
stat_number = 999.
|
||||||
|
"Get time stamp.
|
||||||
|
DATA(ts2) = utclong_current( ).
|
||||||
|
"Provide message.
|
||||||
|
stat_text = |The static constructor of the class | &&
|
||||||
|
|lcl_constructors was called on { ts2 } and the | &&
|
||||||
|
|value for the variable 'stat_number' was set to | &&
|
||||||
|
|{ stat_number }.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD add_1.
|
||||||
|
stat_number += 1.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
*& Classes to demonstrate inheritance, polymorphism and casting
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
|
||||||
|
"Class 1
|
||||||
|
CLASS lcl_class1 DEFINITION.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
"Note: All methods are purposely included in the public section.
|
||||||
|
"Otherwise, it cannot be called in the demo's main class.
|
||||||
|
METHODS: constructor IMPORTING i_obj TYPE string OPTIONAL,
|
||||||
|
get_string RETURNING VALUE(str) TYPE string,
|
||||||
|
get_obj_name RETURNING VALUE(obj) TYPE string.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
DATA: obj_name TYPE string.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_class1 IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
obj_name = i_obj.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_obj_name.
|
||||||
|
obj = obj_name.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_string.
|
||||||
|
str = `Hallo`.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
"Class 2a
|
||||||
|
CLASS lcl_class2a DEFINITION INHERITING FROM lcl_class1.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
METHODS: get_string REDEFINITION,
|
||||||
|
get_number_2a RETURNING VALUE(num) TYPE i..
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_class2a IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD get_string.
|
||||||
|
str = |{ super->get_string( ) }, { sy-uname }!|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_number_2a.
|
||||||
|
num = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1 max = 100 )->get_next( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
"Class 2b
|
||||||
|
CLASS lcl_class2b DEFINITION INHERITING FROM lcl_class1 FINAL.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
METHODS: get_string REDEFINITION,
|
||||||
|
get_number_2b RETURNING VALUE(num) TYPE i.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_class2b IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD get_string.
|
||||||
|
str = |{ super->get_string( ) } from lcl_class2b, { sy-uname }!|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_number_2b.
|
||||||
|
num = cl_abap_random_int=>create(
|
||||||
|
seed = cl_abap_random=>seed( ) min = 1 max = 100 )->get_next( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
"Class 3a
|
||||||
|
CLASS lcl_class3a DEFINITION INHERITING FROM lcl_class2a FINAL.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
METHODS: get_string REDEFINITION.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_class3a IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD get_string.
|
||||||
|
str = |{ super->get_string( ) } How are you doing?|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
*& Classes to demonstrate a factory method in a singleton
|
||||||
|
*& and an abstract class.
|
||||||
|
*&--------------------------------------------------------------------*
|
||||||
|
|
||||||
|
"Using the addition CREATE PRIVATE, objects can only be created by the class itself.
|
||||||
|
CLASS lcl_singleton DEFINITION CREATE PRIVATE.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
METHODS: constructor,
|
||||||
|
"Methods for setting and getting a time stamp.
|
||||||
|
get_timestamp RETURNING VALUE(res_timestamp)
|
||||||
|
TYPE timestampl,
|
||||||
|
set_timestamp.
|
||||||
|
|
||||||
|
CLASS-METHODS:
|
||||||
|
"Factory method that returns an instance of the class.
|
||||||
|
get_instance RETURNING VALUE(res_instance) TYPE REF TO lcl_singleton.
|
||||||
|
|
||||||
|
CLASS-DATA: "Holds the number of overall instances.
|
||||||
|
no_of_instances TYPE i READ-ONLY.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
CLASS-DATA: obj TYPE REF TO lcl_singleton.
|
||||||
|
|
||||||
|
DATA: timestamp TYPE timestampl.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_singleton IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD get_instance.
|
||||||
|
"Checking if an instance of the class already exists.
|
||||||
|
"An instance should only be created if no instance exists
|
||||||
|
"to make sure that there is only a single instance overall.
|
||||||
|
IF obj IS NOT BOUND.
|
||||||
|
obj = NEW #( ).
|
||||||
|
ENDIF.
|
||||||
|
"In case an instance already exists, the existing one is
|
||||||
|
"always returned.
|
||||||
|
res_instance = obj.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
"Counts the number of instances of the class.
|
||||||
|
no_of_instances = no_of_instances + 1.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD get_timestamp.
|
||||||
|
res_timestamp = timestamp.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD set_timestamp.
|
||||||
|
GET TIME STAMP FIELD timestamp.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_sub DEFINITION DEFERRED.
|
||||||
|
|
||||||
|
CLASS lcl_abstract DEFINITION ABSTRACT.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
CLASS-METHODS: factory_method IMPORTING check_num TYPE i
|
||||||
|
RETURNING VALUE(obj) TYPE REF TO lcl_abstract.
|
||||||
|
|
||||||
|
CLASS-DATA: message TYPE string.
|
||||||
|
|
||||||
|
"Abstract method: There's no implementation in this class.
|
||||||
|
METHODS: return_string ABSTRACT
|
||||||
|
IMPORTING i_str TYPE string
|
||||||
|
RETURNING VALUE(res_string) TYPE string.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_sub DEFINITION INHERITING FROM lcl_abstract.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
METHODS: return_string REDEFINITION.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
CLASS lcl_abstract IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD factory_method.
|
||||||
|
"Purpose of factory method: An instance can only be created
|
||||||
|
"if a certain condition is met.
|
||||||
|
CASE check_num.
|
||||||
|
WHEN 1.
|
||||||
|
obj = NEW lcl_sub( ).
|
||||||
|
message = `Great! I was able to create an instance.`.
|
||||||
|
WHEN OTHERS.
|
||||||
|
message = `What a pity. I'm not allowed to create an instance.`.
|
||||||
|
ENDCASE.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_sub IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD return_string.
|
||||||
|
res_string = |I'm a returned string. | &&
|
||||||
|
|The object reference variable is { i_str }.|.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
16
src/zcl_demo_abap_objects.clas.xml
Normal file
16
src/zcl_demo_abap_objects.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_OBJECTS</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: ABAP object orientation</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
47
src/zcl_demo_abap_objects_friend.clas.abap
Normal file
47
src/zcl_demo_abap_objects_friend.clas.abap
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
***********************************************************************
|
||||||
|
*
|
||||||
|
* Class supporting an ABAP cheat sheet example
|
||||||
|
*
|
||||||
|
* ----------------------------- NOTE -----------------------------------
|
||||||
|
* The code presented in this class is intended only to support the ABAP
|
||||||
|
* cheat sheets. It is not intended for direct use in a production system
|
||||||
|
* environment. The code examples in the ABAP cheat sheets are primarily
|
||||||
|
* intended to provide a better explanation and visualization of the
|
||||||
|
* syntax and semantics of ABAP statements, not to solve concrete
|
||||||
|
* programming tasks. For production application programs, you should
|
||||||
|
* always work out your own solution for each individual case. There is
|
||||||
|
* no guarantee for the correctness or completeness of the code.
|
||||||
|
* Furthermore, there is no legal responsibility or liability for any
|
||||||
|
* errors or their consequences that may occur when using the the example
|
||||||
|
* code.
|
||||||
|
*
|
||||||
|
***********************************************************************
|
||||||
|
"! <p class="shorttext synchronized">Class supporting ABAP cheat sheet example</p>
|
||||||
|
"! The class supports the ABAP cheat sheet example about object orientation.
|
||||||
|
CLASS zcl_demo_abap_objects_friend DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
CLASS-METHODS get_strings RETURNING VALUE(res_string) TYPE string_table.
|
||||||
|
|
||||||
|
protected section.
|
||||||
|
private section.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_DEMO_ABAP_OBJECTS_FRIEND IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_strings.
|
||||||
|
"Getting the strings and adding them to the string table.
|
||||||
|
"Accessing an attribute in a public visibility section.
|
||||||
|
APPEND zcl_demo_abap_objects=>public_string TO res_string.
|
||||||
|
|
||||||
|
"Accessing an attribute in a protected visibility section.
|
||||||
|
APPEND zcl_demo_abap_objects=>protected_string TO res_string.
|
||||||
|
|
||||||
|
"Accessing an attribute in a private visibility section.
|
||||||
|
APPEND zcl_demo_abap_objects=>private_string TO res_string.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
16
src/zcl_demo_abap_objects_friend.clas.xml
Normal file
16
src/zcl_demo_abap_objects_friend.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_OBJECTS_FRIEND</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Class supporting ABAP cheat sheet example</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1404
src/zcl_demo_abap_prog_flow_logic.clas.abap
Normal file
1404
src/zcl_demo_abap_prog_flow_logic.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
11
src/zcl_demo_abap_prog_flow_logic.clas.locals_def.abap
Normal file
11
src/zcl_demo_abap_prog_flow_logic.clas.locals_def.abap
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
CLASS lcx_calc_error DEFINITION INHERITING FROM cx_no_check.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcx_some_error DEFINITION INHERITING FROM cx_no_check.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcx_invalid_email DEFINITION INHERITING FROM cx_no_check.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcx_static_exc_class DEFINITION INHERITING FROM cx_static_check.
|
||||||
|
ENDCLASS.
|
||||||
16
src/zcl_demo_abap_prog_flow_logic.clas.xml
Normal file
16
src/zcl_demo_abap_prog_flow_logic.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_PROG_FLOW_LOGIC</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: Program flow logic</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1552
src/zcl_demo_abap_sql.clas.abap
Normal file
1552
src/zcl_demo_abap_sql.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_sql.clas.xml
Normal file
16
src/zcl_demo_abap_sql.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_SQL</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: ABAP SQL</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
176
src/zcl_demo_abap_sql_group_by.clas.abap
Normal file
176
src/zcl_demo_abap_sql_group_by.clas.abap
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
***********************************************************************
|
||||||
|
*
|
||||||
|
* ABAP cheat sheet: ABAP SQL - Grouping Internal Tables
|
||||||
|
*
|
||||||
|
* -------------------------- PURPOSE ----------------------------------
|
||||||
|
* Example to demonstrate syntax options when grouping internal tables.
|
||||||
|
*
|
||||||
|
* ----------------------- GETTING STARTED -----------------------------
|
||||||
|
* - Open the class with the ABAP development tools for Eclipse (ADT).
|
||||||
|
* - Choose F9 to run the class.
|
||||||
|
* - Check the console output.
|
||||||
|
* - To understand the context and the ABAP syntax used, refer to the
|
||||||
|
* notes included in the class as comments or refer to the respective
|
||||||
|
* topic in the ABAP Keyword Documentation.
|
||||||
|
* - Due to the amount of console output, the examples contain numbers
|
||||||
|
* (e.g. 1) ..., 2) ..., 3) ...) for the individual example sections.
|
||||||
|
* Also, the variable name is displayed in most cases. So to find
|
||||||
|
* the relevant output in the console easier and faster, just search
|
||||||
|
* for the number/variable name in the console (CTRL+F in the console)
|
||||||
|
* or use the debugger.
|
||||||
|
*
|
||||||
|
* ----------------------------- NOTE -----------------------------------
|
||||||
|
* The code presented in this class is intended only to support the ABAP
|
||||||
|
* cheat sheets. It is not intended for direct use in a production system
|
||||||
|
* environment. The code examples in the ABAP cheat sheets are primarily
|
||||||
|
* intended to provide a better explanation and visualization of the
|
||||||
|
* syntax and semantics of ABAP statements, not to solve concrete
|
||||||
|
* programming tasks. For production application programs, you should
|
||||||
|
* always work out your own solution for each individual case. There is
|
||||||
|
* no guarantee for the correctness or completeness of the code.
|
||||||
|
* Furthermore, there is no legal responsibility or liability for any
|
||||||
|
* errors or their consequences that may occur when using the the example
|
||||||
|
* code.
|
||||||
|
*
|
||||||
|
***********************************************************************
|
||||||
|
"! <p class="shorttext synchronized">ABAP cheat sheet: ABAP SQL - Grouping internal tables</p>
|
||||||
|
"! Example to demonstrate grouping internal tables.<br>Choose F9 in ADT to run the class.
|
||||||
|
CLASS zcl_demo_abap_sql_group_by DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
FINAL
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
INTERFACES: if_oo_adt_classrun.
|
||||||
|
|
||||||
|
CLASS-METHODS: class_constructor.
|
||||||
|
|
||||||
|
protected section.
|
||||||
|
PRIVATE SECTION.
|
||||||
|
CLASS-DATA:
|
||||||
|
wa TYPE zdemo_abap_flsch,
|
||||||
|
member TYPE zdemo_abap_flsch,
|
||||||
|
members TYPE STANDARD TABLE OF zdemo_abap_flsch WITH EMPTY KEY.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_DEMO_ABAP_SQL_GROUP_BY IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD class_constructor.
|
||||||
|
"Fill demo database tables.
|
||||||
|
zcl_demo_abap_flight_tables=>fill_dbtabs( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD if_oo_adt_classrun~main.
|
||||||
|
|
||||||
|
DATA(output) = NEW zcl_demo_abap_display( out ).
|
||||||
|
|
||||||
|
output->display( `ABAP Cheat Sheet Example: Grouping Internal Tables` ).
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM zdemo_abap_flsch
|
||||||
|
INTO TABLE @DATA(fli_tab).
|
||||||
|
|
||||||
|
output->display( `1) Representative Binding` ).
|
||||||
|
output->display( `1a) Grouping by one column` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY wa-carrid.
|
||||||
|
output->display( wa-carrid ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->next_section( `1b) Members of one column groups` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY wa-carrid.
|
||||||
|
CLEAR members.
|
||||||
|
LOOP AT GROUP wa INTO member.
|
||||||
|
members = VALUE #( BASE members ( member ) ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->display( members ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->next_section( `1c) Grouping by two columns` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom ).
|
||||||
|
|
||||||
|
output->display( |{ wa-carrid } { wa-airpfrom }| ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->next_section( `1d) Members of two column groups` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom ).
|
||||||
|
CLEAR members.
|
||||||
|
LOOP AT GROUP wa INTO member.
|
||||||
|
members = VALUE #( BASE members ( member ) ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->display( members ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->next_section( `2) Group Key Binding` ).
|
||||||
|
output->display( `2a) Grouping by one column` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY wa-carrid
|
||||||
|
INTO DATA(key).
|
||||||
|
|
||||||
|
output->display( key ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->next_section( `2b) Members of one column groups` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY wa-carrid
|
||||||
|
INTO key.
|
||||||
|
CLEAR members.
|
||||||
|
LOOP AT GROUP key INTO member.
|
||||||
|
members = VALUE #( BASE members ( member ) ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->display( members ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->next_section( `2c) Grouping by two columns` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom )
|
||||||
|
INTO DATA(keys).
|
||||||
|
|
||||||
|
output->display( keys ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->next_section( `2d) Members of two column groups` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom )
|
||||||
|
INTO keys.
|
||||||
|
CLEAR members.
|
||||||
|
LOOP AT GROUP keys INTO member.
|
||||||
|
members = VALUE #( BASE members ( member ) ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->display( members ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
output->next_section( `2e) Two column groups without members` ).
|
||||||
|
|
||||||
|
LOOP AT fli_tab INTO wa
|
||||||
|
GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom
|
||||||
|
index = GROUP INDEX size = GROUP SIZE )
|
||||||
|
WITHOUT MEMBERS
|
||||||
|
INTO DATA(keysplus).
|
||||||
|
|
||||||
|
output->display( keysplus ).
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
16
src/zcl_demo_abap_sql_group_by.clas.xml
Normal file
16
src/zcl_demo_abap_sql_group_by.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_SQL_GROUP_BY</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: ABAP SQL - Grouping internal tables</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1760
src/zcl_demo_abap_string_proc.clas.abap
Normal file
1760
src/zcl_demo_abap_string_proc.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_string_proc.clas.xml
Normal file
16
src/zcl_demo_abap_string_proc.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_STRING_PROC</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: String processing</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
1073
src/zcl_demo_abap_structures.clas.abap
Normal file
1073
src/zcl_demo_abap_structures.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_structures.clas.xml
Normal file
16
src/zcl_demo_abap_structures.clas.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_STRUCTURES</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: Structures</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
687
src/zcl_demo_abap_unit_test.clas.abap
Normal file
687
src/zcl_demo_abap_unit_test.clas.abap
Normal file
@@ -0,0 +1,687 @@
|
|||||||
|
***********************************************************************
|
||||||
|
*
|
||||||
|
* ABAP Cheat Sheet: ABAP Unit Tests
|
||||||
|
*
|
||||||
|
* -------------------------- PURPOSE ----------------------------------
|
||||||
|
* - Example to demonstrate ABAP unit tests.
|
||||||
|
* - Topics covered: Test classes and test methods, special methods,
|
||||||
|
* implementing and injecting test doubles (constructor injection,
|
||||||
|
* back door injection, test seams)
|
||||||
|
*
|
||||||
|
* ----------------------- RUN ABAP UNIT TEST---------------------------
|
||||||
|
* - Open the class with the ABAP development tools for Eclipse (ADT).
|
||||||
|
* - Choose Ctrl/Cmd + Shift + F10 to launch all tests in the class.
|
||||||
|
* You can also right-click somewhere in the class and choose
|
||||||
|
* Run as -> ABAP Unit Test.
|
||||||
|
* - The results of a test run are displayed in the ABAP Unit tab in ADT
|
||||||
|
* and can be evaluated. The Failure Trace section provides information
|
||||||
|
* on errors found.
|
||||||
|
* - If you are interested in test coverage, you can choose
|
||||||
|
* Ctrl/Cmd + Shift + F11, or make a right-click, choose Run as ->
|
||||||
|
* ABAP Unit Test With..., select the Coverage checkbox and choose
|
||||||
|
* Execute. You can then check the results in the ABAP Coverage tab,
|
||||||
|
* what code is tested and what not.
|
||||||
|
*
|
||||||
|
* ----------------------- RUN CLASS -----------------------------
|
||||||
|
* - Open the class with the ABAP development tools for Eclipse (ADT).
|
||||||
|
* - Choose F9 to run the class.
|
||||||
|
* - Check the console output.
|
||||||
|
* - To understand the context and the ABAP syntax used, check the notes
|
||||||
|
* included in the class as comments or refer to the respective topic
|
||||||
|
* in the ABAP Keyword Documentation.
|
||||||
|
* - Due to the amount of output in the console, the examples include
|
||||||
|
* numbers (e. g. 1) ..., 2) ..., 3) ...) for the individual example
|
||||||
|
* sections. Plus, the variable name is displayed in most cases. Hence,
|
||||||
|
* to easier and faster find the relevant output in the console, just
|
||||||
|
* search in the console for the number/variable name (CTRL + F in the
|
||||||
|
* console) or use the debugger.
|
||||||
|
*
|
||||||
|
* ----------------------------- NOTE -----------------------------------
|
||||||
|
* The code presented in this class is intended only to support the ABAP
|
||||||
|
* cheat sheets. It is not intended for direct use in a production system
|
||||||
|
* environment. The code examples in the ABAP cheat sheets are primarily
|
||||||
|
* intended to provide a better explanation and visualization of the
|
||||||
|
* syntax and semantics of ABAP statements, not to solve concrete
|
||||||
|
* programming tasks. For production application programs, you should
|
||||||
|
* always work out your own solution for each individual case. There is
|
||||||
|
* no guarantee for the correctness or completeness of the code.
|
||||||
|
* Furthermore, there is no legal responsibility or liability for any
|
||||||
|
* errors or their consequences that may occur when using the the example
|
||||||
|
* code.
|
||||||
|
*
|
||||||
|
***********************************************************************
|
||||||
|
"! <p class="shorttext synchronized">ABAP cheat sheet: Unit tests</p>
|
||||||
|
"! Example to demonstrate ABAP unit tests.<br>Choose F9 in ADT to run the class.
|
||||||
|
"! To run all unit tests of the class, choose Ctrl/Cmd + Shift + F10.
|
||||||
|
CLASS zcl_demo_abap_unit_test DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
CREATE PUBLIC.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
INTERFACES: if_oo_adt_classrun.
|
||||||
|
|
||||||
|
CLASS-METHODS: class_constructor.
|
||||||
|
|
||||||
|
"Optional parameter for the instance constructor for the purpose of
|
||||||
|
"constructor injection
|
||||||
|
METHODS constructor
|
||||||
|
IMPORTING iref_data_prov TYPE REF TO zdemo_abap_get_data_itf OPTIONAL.
|
||||||
|
|
||||||
|
PROTECTED SECTION.
|
||||||
|
|
||||||
|
TYPES carr_tab TYPE TABLE OF zdemo_abap_fli WITH EMPTY KEY.
|
||||||
|
|
||||||
|
METHODS: select_flight_data IMPORTING carrier TYPE zdemo_abap_fli-carrid
|
||||||
|
RETURNING VALUE(flight_data) TYPE carr_tab.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
TYPES: int_tab_so TYPE SORTED TABLE OF i WITH UNIQUE KEY table_line,
|
||||||
|
int_tab_st TYPE STANDARD TABLE OF i WITH EMPTY KEY,
|
||||||
|
occ_rate TYPE p LENGTH 4 DECIMALS 2,
|
||||||
|
|
||||||
|
BEGIN OF nums_struc,
|
||||||
|
num1 TYPE i,
|
||||||
|
num2 TYPE i,
|
||||||
|
END OF nums_struc,
|
||||||
|
|
||||||
|
nums_tab TYPE TABLE OF nums_struc WITH EMPTY KEY.
|
||||||
|
|
||||||
|
DATA: seats_table TYPE zdemo_abap_get_data_itf=>carr_tab,
|
||||||
|
flight_tab TYPE TABLE OF zdemo_abap_fli,
|
||||||
|
|
||||||
|
"Reference variable for back door injection
|
||||||
|
"Note: In the example, it is a local interface declared in the
|
||||||
|
"Local Types tab (the CCIMP include). To make the type known to
|
||||||
|
"the global class, see the Class-relevant Local Types tab (the CCDEF include).
|
||||||
|
data_provider_local_itf TYPE REF TO lif_get_data,
|
||||||
|
|
||||||
|
"Reference variable for constructor injection
|
||||||
|
"In the example, the type refers to a global interface.
|
||||||
|
data_provider_global_itf TYPE REF TO zdemo_abap_get_data_itf,
|
||||||
|
|
||||||
|
"For demonstrating setter injection
|
||||||
|
data_provider_setter_inj TYPE REF TO zdemo_abap_get_data_itf,
|
||||||
|
|
||||||
|
"For demonstrating parameter injection
|
||||||
|
data_provider_param_inj TYPE REF TO zdemo_abap_get_data_itf..
|
||||||
|
|
||||||
|
METHODS:
|
||||||
|
"Calculates the sum of two numbers
|
||||||
|
"This method demonstrates the use of the setup and teardown methods in the test class.
|
||||||
|
get_sum IMPORTING key TYPE zdemo_abap_tab1-key_field
|
||||||
|
char TYPE zdemo_abap_tab1-char1
|
||||||
|
RETURNING VALUE(sum) TYPE i,
|
||||||
|
|
||||||
|
"Calculates the common divisors and the greatest common divisor of two numbers
|
||||||
|
get_common_div_and_gcd IMPORTING a TYPE i
|
||||||
|
b TYPE i
|
||||||
|
EXPORTING common_divisors TYPE int_tab_so
|
||||||
|
gcd TYPE i,
|
||||||
|
|
||||||
|
"Calculates the digit sum of a number
|
||||||
|
get_digit_sum IMPORTING num TYPE i
|
||||||
|
RETURNING VALUE(digit_sum) TYPE i,
|
||||||
|
|
||||||
|
"Multiple methods that all do the same (they calculate the occupancy rate of flights)
|
||||||
|
"but serve different demonstration purposes for the ABAP unit tests in the example.
|
||||||
|
"The method implementations involve a depended-on component (DOC). In this case,
|
||||||
|
"it is a database access.
|
||||||
|
"The methods are intentionally implemented in a similar way. Therefore, almost
|
||||||
|
"all of the following methods will display the same output in the console when the
|
||||||
|
"class is executed using F9.
|
||||||
|
|
||||||
|
"Method to demonstrate test double injection using inheritance and method redefinition
|
||||||
|
get_occ_rate_using_meth IMPORTING carrier_id TYPE zdemo_abap_fli-carrid
|
||||||
|
RETURNING VALUE(occupancy_rate) TYPE occ_rate,
|
||||||
|
|
||||||
|
"Method to demonstrate test double injection using test seams
|
||||||
|
get_occ_rate_test_seam IMPORTING carrier_id TYPE zdemo_abap_fli-carrid
|
||||||
|
EXPORTING occupancy_rate TYPE occ_rate
|
||||||
|
num1 TYPE i
|
||||||
|
num2 TYPE i,
|
||||||
|
|
||||||
|
"Method to demonstrate test double injection using back door injection and a local interface
|
||||||
|
get_occ_rate_local_itf IMPORTING carrier_id TYPE zdemo_abap_fli-carrid
|
||||||
|
RETURNING VALUE(occupancy_rate) TYPE occ_rate,
|
||||||
|
|
||||||
|
"Method to demonstrate test double injection using constructor injection and a global interface
|
||||||
|
get_occ_rate_global_itf IMPORTING carrier_id TYPE zdemo_abap_fli-carrid
|
||||||
|
RETURNING VALUE(occupancy_rate) TYPE occ_rate,
|
||||||
|
|
||||||
|
"Method to demonstrate test double injection using setter injection and a global interface
|
||||||
|
get_occ_rate_setter_inj IMPORTING carrier_id TYPE zdemo_abap_fli-carrid
|
||||||
|
RETURNING VALUE(occupancy_rate) TYPE occ_rate,
|
||||||
|
|
||||||
|
"Method for setter injection
|
||||||
|
setter_meth IMPORTING data_prov TYPE REF TO zdemo_abap_get_data_itf,
|
||||||
|
|
||||||
|
"Method to demonstrate test double injection using parameter injection and a global interface
|
||||||
|
"An optional parameter is specified for passing the test double if the method is tested.
|
||||||
|
get_occ_rate_param_inj IMPORTING carrier_id TYPE zdemo_abap_fli-carrid
|
||||||
|
data_prov TYPE REF TO zdemo_abap_get_data_itf OPTIONAL
|
||||||
|
RETURNING VALUE(occupancy_rate) TYPE occ_rate.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_DEMO_ABAP_UNIT_TEST IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD class_constructor.
|
||||||
|
"Filling demo database tables.
|
||||||
|
zcl_demo_abap_flight_tables=>fill_dbtabs( ).
|
||||||
|
|
||||||
|
"Preparing a demo database table for this example (get_sum method)
|
||||||
|
DELETE FROM zdemo_abap_tab1.
|
||||||
|
INSERT zdemo_abap_tab1 FROM @(
|
||||||
|
VALUE #( key_field = 1 char1 = 'aaa' char2 = 'bbb' num1 = 25 num2 = 75 ) ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
|
||||||
|
"For demonstrating the back door injection
|
||||||
|
data_provider_local_itf = NEW lcl_data_prov_local_itf( ).
|
||||||
|
|
||||||
|
"For demonstrating the constructor injection
|
||||||
|
IF iref_data_prov IS BOUND.
|
||||||
|
"Note: The parameter is only bound when you run the unit test.
|
||||||
|
"When you run the unit test and you debug, you will see that iref_data_prov
|
||||||
|
"has a type reference to LTD_TEST_DATA_GLOBAL_INTF.
|
||||||
|
|
||||||
|
data_provider_global_itf = iref_data_prov.
|
||||||
|
|
||||||
|
ELSE.
|
||||||
|
|
||||||
|
data_provider_global_itf = NEW lcl_data_prov_glo_itf( ).
|
||||||
|
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
"Object creation for the method call in the get_occ_rate_setter_inj method
|
||||||
|
data_provider_setter_inj = NEW lcl_data_prov_glo_itf( ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_common_div_and_gcd.
|
||||||
|
"Calculates the common divisors and the greatest common divisor of two numbers
|
||||||
|
|
||||||
|
CLEAR: common_divisors, gcd.
|
||||||
|
|
||||||
|
CHECK a >= 1.
|
||||||
|
CHECK b >= 1.
|
||||||
|
|
||||||
|
IF a >= b.
|
||||||
|
DATA(greater_num) = a.
|
||||||
|
DATA(lower_num) = b.
|
||||||
|
ELSE.
|
||||||
|
greater_num = b.
|
||||||
|
lower_num = a.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
"Getting common divisors
|
||||||
|
DATA(div) = 1.
|
||||||
|
|
||||||
|
WHILE div <= lower_num.
|
||||||
|
IF lower_num MOD div = 0.
|
||||||
|
DATA(divisor) = lower_num / div.
|
||||||
|
INSERT divisor INTO TABLE common_divisors.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
div += 1.
|
||||||
|
ENDWHILE.
|
||||||
|
|
||||||
|
LOOP AT common_divisors ASSIGNING FIELD-SYMBOL(<i>).
|
||||||
|
|
||||||
|
IF greater_num MOD <i> <> 0.
|
||||||
|
DELETE common_divisors WHERE table_line = <i>.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
"Extracting the greatest common divisor from the list of common divisors
|
||||||
|
gcd = common_divisors[ lines( common_divisors ) ].
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_digit_sum.
|
||||||
|
"Calculates the digit sum of a number
|
||||||
|
|
||||||
|
CLEAR digit_sum.
|
||||||
|
|
||||||
|
CHECK num >= 0.
|
||||||
|
|
||||||
|
DATA(converted_int) = CONV string( num ).
|
||||||
|
DATA(len) = strlen( converted_int ).
|
||||||
|
|
||||||
|
DO len TIMES.
|
||||||
|
DATA(idx) = sy-index - 1.
|
||||||
|
digit_sum = digit_sum + converted_int+idx(1).
|
||||||
|
ENDDO.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_occ_rate_global_itf.
|
||||||
|
"Method to demonstrate test double injection using constructor injection
|
||||||
|
"and a global interface
|
||||||
|
|
||||||
|
DATA total_seatsmax_global_itf TYPE i.
|
||||||
|
DATA total_seatsocc_global_itf TYPE i.
|
||||||
|
|
||||||
|
"Assumption: The original code in this method was as follows (the line commented out).
|
||||||
|
"It was identified as DOC (reading data from a database table).
|
||||||
|
|
||||||
|
"DATA(flight_data) = select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
"Instead of a method call like above and for a proper unit testing, a global interface
|
||||||
|
"is provided.
|
||||||
|
"In the example, an interface method is implemented in a local class in the local types
|
||||||
|
"tab (CCIMP include): lcl_data_prov_glo_itf
|
||||||
|
|
||||||
|
"When the class is executed using F9, the object used here refers to type lcl_data_prov_glo_itf.
|
||||||
|
"When the unit test is executed, the object used here refers to type ltd_test_data_global_intf,
|
||||||
|
"i.e. the local test double is injected.
|
||||||
|
DATA(flight_data) = data_provider_global_itf->select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
LOOP AT flight_data ASSIGNING FIELD-SYMBOL(<l>).
|
||||||
|
|
||||||
|
total_seatsmax_global_itf = total_seatsmax_global_itf + <l>-seatsmax.
|
||||||
|
total_seatsocc_global_itf = total_seatsocc_global_itf + <l>-seatsocc.
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
occupancy_rate = total_seatsocc_global_itf / total_seatsmax_global_itf * 100.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_occ_rate_local_itf.
|
||||||
|
"Method to demonstrate test double injection using back door
|
||||||
|
"injection and a local interface
|
||||||
|
|
||||||
|
DATA total_seatsmax_local_itf TYPE i.
|
||||||
|
DATA total_seatsocc_local_itf TYPE i.
|
||||||
|
|
||||||
|
"Assumption: The original code in this method was as follows (the line commented out).
|
||||||
|
"It was identified as DOC (reading data from a database table).
|
||||||
|
|
||||||
|
"DATA(flight_data) = select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
"Instead of a method call like above and for a proper unit testing - a global interface
|
||||||
|
"is not available - a local interface is created, and
|
||||||
|
"an interface method is implemented. In this example, the local interface is
|
||||||
|
"created in the local types tab (CCIMP include): lif_get_data
|
||||||
|
"A local class (lcl_data_prov_local_itf) is also created in the CCIMP include. It
|
||||||
|
"implements the local interface.
|
||||||
|
|
||||||
|
"When the class is executed using F9, the object used here refers to type lcl_data_prov_local_itf.
|
||||||
|
"When the unit test is executed, the object used here refers to type ltd_test_data_local_itf,
|
||||||
|
"i.e. the local test double is injected.
|
||||||
|
DATA(flight_data) = data_provider_local_itf->select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
LOOP AT flight_data ASSIGNING FIELD-SYMBOL(<k>).
|
||||||
|
|
||||||
|
total_seatsmax_local_itf = total_seatsmax_local_itf + <k>-seatsmax.
|
||||||
|
total_seatsocc_local_itf = total_seatsocc_local_itf + <k>-seatsocc.
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
occupancy_rate = total_seatsocc_local_itf / total_seatsmax_local_itf * 100.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_occ_rate_param_inj.
|
||||||
|
"This method demonstrates test double injection using parameter injection.
|
||||||
|
|
||||||
|
DATA total_seatsmax_param_inj TYPE i.
|
||||||
|
DATA total_seatsocc_param_inj TYPE i.
|
||||||
|
|
||||||
|
"Assumption: The original code in this method was as follows (the line commented out).
|
||||||
|
"It was identified as DOC (reading data from a database table).
|
||||||
|
|
||||||
|
"DATA(flight_data) = select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
"Instead of a method call like above and for a proper unit testing, a global interface
|
||||||
|
"is provided.
|
||||||
|
"In the example, an interface method is implemented in a local class in the local types
|
||||||
|
"tab (CCIMP include): lcl_data_prov_glo_itf
|
||||||
|
|
||||||
|
"The method has an optional importing parameter. When the unit test is executed,
|
||||||
|
"the parameter is bound. An object of the test double class is passed in that case.
|
||||||
|
"Otherwise, when the class is executed using F9, an object of the actual data provider
|
||||||
|
"is created.
|
||||||
|
IF data_prov IS BOUND.
|
||||||
|
data_provider_param_inj = data_prov.
|
||||||
|
ELSE.
|
||||||
|
data_provider_param_inj = NEW lcl_data_prov_glo_itf( ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
DATA(flight_data) = data_provider_param_inj->select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
LOOP AT flight_data ASSIGNING FIELD-SYMBOL(<o>).
|
||||||
|
|
||||||
|
total_seatsmax_param_inj = total_seatsmax_param_inj + <o>-seatsmax.
|
||||||
|
total_seatsocc_param_inj = total_seatsocc_param_inj + <o>-seatsocc.
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
occupancy_rate = total_seatsocc_param_inj / total_seatsmax_param_inj * 100.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_occ_rate_setter_inj.
|
||||||
|
"This method demonstrates test double injection using setting injection.
|
||||||
|
"See the setter_meth method.
|
||||||
|
|
||||||
|
DATA total_seatsmax_setter_inj TYPE i.
|
||||||
|
DATA total_seatsocc_setter_inj TYPE i.
|
||||||
|
|
||||||
|
"Assumption: The original code in this method was as follows (the line commented out).
|
||||||
|
"It was identified as DOC (reading data from a database table).
|
||||||
|
|
||||||
|
"DATA(flight_data) = select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
"Instead of a method call like above and for a proper unit testing, a global interface
|
||||||
|
"is provided.
|
||||||
|
"In the example, an interface method is implemented in a local class in the local types
|
||||||
|
"tab (CCIMP include): lcl_data_prov_glo_itf
|
||||||
|
|
||||||
|
"See the comment in the setter_meth method
|
||||||
|
DATA(flight_data) = data_provider_setter_inj->select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
LOOP AT flight_data ASSIGNING FIELD-SYMBOL(<n>).
|
||||||
|
|
||||||
|
total_seatsmax_setter_inj = total_seatsmax_setter_inj + <n>-seatsmax.
|
||||||
|
total_seatsocc_setter_inj = total_seatsocc_setter_inj + <n>-seatsocc.
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
occupancy_rate = total_seatsocc_setter_inj / total_seatsmax_setter_inj * 100.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_occ_rate_test_seam.
|
||||||
|
"Method to demonstrate test double injection using test seams
|
||||||
|
"Note: The code is just for demonstration purposes. Of course, the result can be
|
||||||
|
"achieved more elegantly using SQL expressions, for example.
|
||||||
|
|
||||||
|
TEST-SEAM select_flights.
|
||||||
|
"DOC
|
||||||
|
SELECT seatsmax, seatsocc
|
||||||
|
FROM zdemo_abap_fli
|
||||||
|
WHERE carrid = @carrier_id
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @seats_table.
|
||||||
|
END-TEST-SEAM.
|
||||||
|
|
||||||
|
DATA total_seatsmax_tm TYPE i.
|
||||||
|
DATA total_seatsocc_tm TYPE i.
|
||||||
|
|
||||||
|
LOOP AT seats_table ASSIGNING FIELD-SYMBOL(<j>).
|
||||||
|
|
||||||
|
total_seatsmax_tm = total_seatsmax_tm + <j>-seatsmax.
|
||||||
|
total_seatsocc_tm = total_seatsocc_tm + <j>-seatsocc.
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
occupancy_rate = total_seatsocc_tm / total_seatsmax_tm * 100.
|
||||||
|
|
||||||
|
"Further examples for test seams
|
||||||
|
DATA(var) = 0.
|
||||||
|
|
||||||
|
"Empty test seam; code is injected during unit test
|
||||||
|
"Check the output when running the class using F9 and
|
||||||
|
"the test results when running the unit test.
|
||||||
|
TEST-SEAM num1.
|
||||||
|
END-TEST-SEAM.
|
||||||
|
|
||||||
|
IF var = 0.
|
||||||
|
num1 = 1.
|
||||||
|
ELSE.
|
||||||
|
num1 = 999.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
num2 = 0.
|
||||||
|
|
||||||
|
"Empty injection
|
||||||
|
"See the test class: The code that is included in the test
|
||||||
|
"seam should be excluded from the test. Therefore, the
|
||||||
|
"test injection block in the test class is empty.
|
||||||
|
"Check the output when running the class using F9 and
|
||||||
|
"the test results when running the unit test.
|
||||||
|
TEST-SEAM num2.
|
||||||
|
num2 = 123.
|
||||||
|
END-TEST-SEAM.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_occ_rate_using_meth.
|
||||||
|
"This method demonstrates test double injection using inheritance and method redefinition.
|
||||||
|
|
||||||
|
DATA total_seatsmax_no TYPE i.
|
||||||
|
DATA total_seatsocc_no TYPE i.
|
||||||
|
|
||||||
|
"During the unit test, the redefined method in the test class is called.
|
||||||
|
DATA(flight_data) = select_flight_data( carrier = carrier_id ).
|
||||||
|
|
||||||
|
LOOP AT flight_data ASSIGNING FIELD-SYMBOL(<m>).
|
||||||
|
|
||||||
|
total_seatsmax_no = total_seatsmax_no + <m>-seatsmax.
|
||||||
|
total_seatsocc_no = total_seatsocc_no + <m>-seatsocc.
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
occupancy_rate = total_seatsocc_no / total_seatsmax_no * 100.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_sum.
|
||||||
|
"The method selects a record from a database table and sums the values
|
||||||
|
"of two fields, both are of type i.
|
||||||
|
|
||||||
|
SELECT SINGLE
|
||||||
|
FROM zdemo_abap_tab1
|
||||||
|
FIELDS num1 + num2 AS sum
|
||||||
|
WHERE key_field = @key
|
||||||
|
AND char1 = @char
|
||||||
|
INTO @sum.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD if_oo_adt_classrun~main.
|
||||||
|
"Note: The example includes a couple of implementations for the methods
|
||||||
|
"declared above. And by choosing F9 in ADT, you can run the class and check the
|
||||||
|
"output in the console.
|
||||||
|
"However, the focus of the example is unit tests. Therefore, check the
|
||||||
|
"test classes and methods in the test include (Test Classes tab in ADT).
|
||||||
|
"Choose Ctrl/Cmd + Shift + F10 to launch all tests in the class and check the
|
||||||
|
"test results in the ABAP Unit tab in ADT.
|
||||||
|
|
||||||
|
DATA(output) = NEW zcl_demo_abap_display( out ).
|
||||||
|
|
||||||
|
output->display( `ABAP Cheat Sheet Example: ABAP Unit Tests` ).
|
||||||
|
|
||||||
|
output->display( `************************************************************************` ).
|
||||||
|
output->display( `---> Choose Ctrl/Cmd + Shift + F10 to launch all tests in the class <---` ).
|
||||||
|
output->display( `************************************************************************` ).
|
||||||
|
|
||||||
|
output->display( `1) get_sum Method` ).
|
||||||
|
"This method demonstrates the use of the setup and teardown methods in the test class.
|
||||||
|
|
||||||
|
DATA(sum) = get_sum( key = 1 char = 'aaa' ).
|
||||||
|
|
||||||
|
output->display( input = sum name = `sum` ).
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `2) get_common_div_and_gcd Method` ).
|
||||||
|
|
||||||
|
"Filling an internal table with numbers on whose bases the common divisors and the
|
||||||
|
"greatest common divisor are to be calculated
|
||||||
|
DATA(tab) = VALUE nums_tab( ( num1 = 10 num2 = 20 )
|
||||||
|
( num1 = 100 num2 = 200 )
|
||||||
|
( num1 = 12 num2 = 6 )
|
||||||
|
( num1 = 5 num2 = 1 )
|
||||||
|
( num1 = 50 num2 = 50 )
|
||||||
|
( num1 = 4 num2 = 8 ) ).
|
||||||
|
|
||||||
|
LOOP AT tab ASSIGNING FIELD-SYMBOL(<a>).
|
||||||
|
|
||||||
|
get_common_div_and_gcd( EXPORTING a = <a>-num1
|
||||||
|
b = <a>-num2
|
||||||
|
IMPORTING common_divisors = DATA(common_divs) gcd = DATA(gcd) ).
|
||||||
|
|
||||||
|
output->display( |Common divisors of { <a>-num1 } and { <a>-num2 }| ).
|
||||||
|
|
||||||
|
output->display( input = common_divs name = `common_divs` ).
|
||||||
|
|
||||||
|
output->display( |Greatest common divisor of { <a>-num1 } and { <a>-num2 }: { gcd } | ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `3) get_digit_sum Method` ).
|
||||||
|
|
||||||
|
"Filling an internal table with numbers on whose bases the digit sum is to be calculated
|
||||||
|
DATA(tab_i) = VALUE int_tab_so( ( 12 )
|
||||||
|
( 123 )
|
||||||
|
( 3 )
|
||||||
|
( 8246 )
|
||||||
|
( 1001001 )
|
||||||
|
( 0 ) ).
|
||||||
|
|
||||||
|
LOOP AT tab_i ASSIGNING FIELD-SYMBOL(<b>).
|
||||||
|
|
||||||
|
DATA(digit_sum) = get_digit_sum( <b> ).
|
||||||
|
|
||||||
|
output->display( |The digit sum of { <b> } is { digit_sum }.| ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `4) get_occ_rate_using_meth Method` ).
|
||||||
|
"In the test class, this method demonstrates test double injection
|
||||||
|
"using inheritance and method redefinition.
|
||||||
|
|
||||||
|
"Filling an internal table with carrier ids on whose bases the occupancy
|
||||||
|
"rate is to be calculated.
|
||||||
|
DATA(tab_str) = VALUE zdemo_abap_get_data_itf=>carr_tab( ( carrid = 'LH' )
|
||||||
|
( carrid = 'AA' )
|
||||||
|
( carrid = 'DL' ) ).
|
||||||
|
|
||||||
|
LOOP AT tab_str ASSIGNING FIELD-SYMBOL(<c>).
|
||||||
|
|
||||||
|
DATA(occupancy_rate) = get_occ_rate_using_meth( <c>-carrid ).
|
||||||
|
|
||||||
|
output->display( |The occupancy rate for airline { <c>-carrid } is { occupancy_rate }%.| ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
output->next_section( `5) get_occ_rate_test_seam Method` ).
|
||||||
|
"This method demonstrates test double injection using test seams.
|
||||||
|
|
||||||
|
LOOP AT tab_str ASSIGNING FIELD-SYMBOL(<d>).
|
||||||
|
|
||||||
|
get_occ_rate_test_seam( EXPORTING carrier_id = <d>-carrid
|
||||||
|
IMPORTING occupancy_rate = DATA(occupancy_rate_test_seam)
|
||||||
|
num1 = DATA(num1)
|
||||||
|
num2 = DATA(num2) ).
|
||||||
|
|
||||||
|
output->display( |The occupancy rate for airline { <d>-carrid } is { occupancy_rate_test_seam }%.| ).
|
||||||
|
|
||||||
|
output->display( |num1: { num1 }| ).
|
||||||
|
output->display( |num2: { num2 }| ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `6) get_occ_rate_local_itf Method` ).
|
||||||
|
"This method demonstrates test double injection using back door
|
||||||
|
"injection and a local interface.
|
||||||
|
|
||||||
|
LOOP AT tab_str ASSIGNING FIELD-SYMBOL(<e>).
|
||||||
|
|
||||||
|
DATA(occupancy_rate_local_itf) = get_occ_rate_local_itf( <e>-carrid ).
|
||||||
|
|
||||||
|
output->display( |The occupancy rate for airline { <e>-carrid } is { occupancy_rate_local_itf }%.| ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `7) get_occ_rate_global_itf Method` ).
|
||||||
|
"This method demonstrates test double injection using constructor
|
||||||
|
"injection and a global interface.
|
||||||
|
|
||||||
|
LOOP AT tab_str ASSIGNING FIELD-SYMBOL(<f>).
|
||||||
|
|
||||||
|
DATA(occupancy_rate_global_itf) = get_occ_rate_global_itf( <f>-carrid ).
|
||||||
|
|
||||||
|
output->display( |The occupancy rate for airline { <f>-carrid } is { occupancy_rate_global_itf }%.| ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `8) get_occ_rate_setter_inj Method` ).
|
||||||
|
"This method demonstrates test double injection using setter injection and a global interface.
|
||||||
|
|
||||||
|
LOOP AT tab_str ASSIGNING FIELD-SYMBOL(<g>).
|
||||||
|
|
||||||
|
DATA(occupancy_rate_setter_inj) = get_occ_rate_setter_inj( <g>-carrid ).
|
||||||
|
|
||||||
|
output->display( |The occupancy rate for airline { <g>-carrid } is { occupancy_rate_setter_inj }%.| ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
|
||||||
|
output->next_section( `9) get_occ_rate_param_inj Method` ).
|
||||||
|
"This method demonstrates test double injection using parameter injection and a global interface.
|
||||||
|
|
||||||
|
LOOP AT tab_str ASSIGNING FIELD-SYMBOL(<h>).
|
||||||
|
|
||||||
|
DATA(occupancy_rate_param_inj) = get_occ_rate_param_inj( carrier_id = <h>-carrid ).
|
||||||
|
|
||||||
|
output->display( |The occupancy rate for airline { <h>-carrid } is { occupancy_rate_param_inj }%.| ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD select_flight_data.
|
||||||
|
"Method that is identified as DOC in the method implementations above.
|
||||||
|
"This method is also used for demonstrating test double injection and method redefinition.
|
||||||
|
|
||||||
|
SELECT seatsmax, seatsocc
|
||||||
|
FROM zdemo_abap_fli
|
||||||
|
WHERE carrid = @carrier
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @flight_data.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD setter_meth.
|
||||||
|
"Method to demonstrate the test double injection using setter injection
|
||||||
|
|
||||||
|
"When the unit test is executed, an object of the test double class is passed as
|
||||||
|
"a parameter. Then, the object used here refers to type ltd_test_data_setter_inj,
|
||||||
|
"i.e. the local test double is injected.
|
||||||
|
data_provider_setter_inj = data_prov.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
4
src/zcl_demo_abap_unit_test.clas.locals_def.abap
Normal file
4
src/zcl_demo_abap_unit_test.clas.locals_def.abap
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
*"* use this source file for any type of declarations (class
|
||||||
|
*"* definitions, interfaces or type declarations) you need for
|
||||||
|
*"* components in the private section
|
||||||
|
INTERFACE lif_get_data DEFERRED.
|
||||||
73
src/zcl_demo_abap_unit_test.clas.locals_imp.abap
Normal file
73
src/zcl_demo_abap_unit_test.clas.locals_imp.abap
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
******************************************************
|
||||||
|
* Local interface
|
||||||
|
******************************************************
|
||||||
|
INTERFACE lif_get_data.
|
||||||
|
|
||||||
|
TYPES: carr_tab TYPE TABLE OF zdemo_abap_fli WITH EMPTY KEY,
|
||||||
|
occ_rate TYPE p LENGTH 4 DECIMALS 2.
|
||||||
|
|
||||||
|
METHODS:
|
||||||
|
select_flight_data IMPORTING carrier TYPE zdemo_abap_fli-carrid
|
||||||
|
RETURNING VALUE(flight_data) TYPE carr_tab,
|
||||||
|
|
||||||
|
"This method is included to demonstrate the PARTIALLY IMPLEMENTED
|
||||||
|
"addition in the test class when implementing the test double
|
||||||
|
say_hello RETURNING VALUE(hi) TYPE string.
|
||||||
|
|
||||||
|
ENDINTERFACE.
|
||||||
|
|
||||||
|
******************************************************
|
||||||
|
* Local class
|
||||||
|
* The class implements the local interface.
|
||||||
|
******************************************************
|
||||||
|
CLASS lcl_data_prov_local_itf DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
INTERFACES lif_get_data.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_data_prov_local_itf IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD lif_get_data~select_flight_data.
|
||||||
|
|
||||||
|
SELECT seatsmax, seatsocc
|
||||||
|
FROM zdemo_abap_fli
|
||||||
|
WHERE carrid = @carrier
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @flight_data.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD lif_get_data~say_hello.
|
||||||
|
hi = `Hello, ` && sy-uname && `.`.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
******************************************************
|
||||||
|
* Local class that implements a global interface
|
||||||
|
* It serves the purpose of a data provider. It can be
|
||||||
|
* imagined as a global class, and a method that is
|
||||||
|
* implemented there and called by the class under test
|
||||||
|
* is identified as DOC. A local class is used in the
|
||||||
|
* example to keep the number of separate artifacts small.
|
||||||
|
******************************************************
|
||||||
|
CLASS lcl_data_prov_glo_itf DEFINITION.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
INTERFACES zdemo_abap_get_data_itf.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
CLASS lcl_data_prov_glo_itf IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD zdemo_abap_get_data_itf~select_flight_data.
|
||||||
|
|
||||||
|
SELECT seatsmax, seatsocc
|
||||||
|
FROM zdemo_abap_fli
|
||||||
|
WHERE carrid = @carrier
|
||||||
|
INTO CORRESPONDING FIELDS OF TABLE @flight_data.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD zdemo_abap_get_data_itf~say_hello.
|
||||||
|
hi = `Hello, ` && sy-uname && `.`.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
1384
src/zcl_demo_abap_unit_test.clas.testclasses.abap
Normal file
1384
src/zcl_demo_abap_unit_test.clas.testclasses.abap
Normal file
File diff suppressed because it is too large
Load Diff
17
src/zcl_demo_abap_unit_test.clas.xml
Normal file
17
src/zcl_demo_abap_unit_test.clas.xml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_DEMO_ABAP_UNIT_TEST</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>ABAP cheat sheet: Unit tests</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
84
src/zdemo_abap_carr.tabl.xml
Normal file
84
src/zdemo_abap_carr.tabl.xml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_CARR</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo table: Airline</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_CARR</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>MANDT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CARRID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CARRNAME</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000040</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000020</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CURRCODE</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000010</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CUKY</DATATYPE>
|
||||||
|
<LENG>000005</LENG>
|
||||||
|
<MASK> CUKY</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>URL</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000510</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000255</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_CARR</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
117
src/zdemo_abap_draft.tabl.xml
Normal file
117
src/zdemo_abap_draft.tabl.xml
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_DRAFT</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<LANGDEP>X</LANGDEP>
|
||||||
|
<DDTEXT>Draft table for RAP calculator</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<MAINFLAG>X</MAINFLAG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_DRAFT</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>ID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ROLLNAME>SYSUUID_X16</ROLLNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<COMPTYPE>E</COMPTYPE>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>DRAFTUUID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ROLLNAME>SYSUUID_X16</ROLLNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<COMPTYPE>E</COMPTYPE>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM1</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>ARITHM_OP</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000002</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000001</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM2</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CALC_RESULT</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>g</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<DATATYPE>STRG</DATATYPE>
|
||||||
|
<MASK> STRG</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CREA_DATE_TIME</FIELDNAME>
|
||||||
|
<ROLLNAME>TIMESTAMPL</ROLLNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<COMPTYPE>E</COMPTYPE>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>LCHG_DATE_TIME</FIELDNAME>
|
||||||
|
<ROLLNAME>TIMESTAMPL</ROLLNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<COMPTYPE>E</COMPTYPE>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>.INCLUDE</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<PRECFIELD>SYCH_BDL_DRAFT_ADMIN_INC</PRECFIELD>
|
||||||
|
<MASK> S</MASK>
|
||||||
|
<DDTEXT>Standard Include for Draft Administration (BDL Syntax Check)</DDTEXT>
|
||||||
|
<COMPTYPE>S</COMPTYPE>
|
||||||
|
<GROUPNAME>%ADMIN</GROUPNAME>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_DRAFT</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
183
src/zdemo_abap_fli.tabl.xml
Normal file
183
src/zdemo_abap_fli.tabl.xml
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_FLI</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo table: Flight</DDTEXT>
|
||||||
|
<ACTFLAG>U</ACTFLAG>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_FLI</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>MANDT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CARRID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CONNID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>N</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>NUMC</DATATYPE>
|
||||||
|
<LENG>000004</LENG>
|
||||||
|
<MASK> NUMC</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FLDATE</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>D</INTTYPE>
|
||||||
|
<INTLEN>000016</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>DATS</DATATYPE>
|
||||||
|
<LENG>000008</LENG>
|
||||||
|
<MASK> DATS</MASK>
|
||||||
|
<SHLPORIGIN>T</SHLPORIGIN>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>PRICE</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>P</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<REFTABLE>ZDEMO_ABAP_FLI</REFTABLE>
|
||||||
|
<REFFIELD>CURRENCY</REFFIELD>
|
||||||
|
<DATATYPE>CURR</DATATYPE>
|
||||||
|
<LENG>000015</LENG>
|
||||||
|
<DECIMALS>000002</DECIMALS>
|
||||||
|
<MASK> CURR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CURRENCY</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000010</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CUKY</DATATYPE>
|
||||||
|
<LENG>000005</LENG>
|
||||||
|
<MASK> CUKY</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>PLANETYPE</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>SEATSMAX</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>SEATSOCC</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>PAYMENTSUM</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>P</INTTYPE>
|
||||||
|
<INTLEN>000009</INTLEN>
|
||||||
|
<REFTABLE>ZDEMO_ABAP_FLI</REFTABLE>
|
||||||
|
<REFFIELD>CURRENCY</REFFIELD>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CURR</DATATYPE>
|
||||||
|
<LENG>000017</LENG>
|
||||||
|
<DECIMALS>000002</DECIMALS>
|
||||||
|
<MASK> CURR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>SEATSMAX_B</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>SEATSOCC_B</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>SEATSMAX_F</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>SEATSOCC_F</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_FLI</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
199
src/zdemo_abap_flsch.tabl.xml
Normal file
199
src/zdemo_abap_flsch.tabl.xml
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_FLSCH</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo table: Flight schedule</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<MAINFLAG>X</MAINFLAG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_FLSCH</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>MANDT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CARRID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CONNID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>N</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>NUMC</DATATYPE>
|
||||||
|
<LENG>000004</LENG>
|
||||||
|
<MASK> NUMC</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>COUNTRYFR</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CITYFROM</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000040</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000020</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>AIRPFROM</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>COUNTRYTO</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CITYTO</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000040</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000020</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>AIRPTO</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FLTIME</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>DEPTIME</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>T</INTTYPE>
|
||||||
|
<INTLEN>000012</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>TIMS</DATATYPE>
|
||||||
|
<LENG>000006</LENG>
|
||||||
|
<MASK> TIMS</MASK>
|
||||||
|
<SHLPORIGIN>T</SHLPORIGIN>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>ARRTIME</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>T</INTTYPE>
|
||||||
|
<INTLEN>000012</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>TIMS</DATATYPE>
|
||||||
|
<LENG>000006</LENG>
|
||||||
|
<MASK> TIMS</MASK>
|
||||||
|
<SHLPORIGIN>T</SHLPORIGIN>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>DISTANCE</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>P</INTTYPE>
|
||||||
|
<INTLEN>000005</INTLEN>
|
||||||
|
<REFTABLE>ZDEMO_ABAP_FLSCH</REFTABLE>
|
||||||
|
<REFFIELD>DISTID</REFFIELD>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>QUAN</DATATYPE>
|
||||||
|
<LENG>000009</LENG>
|
||||||
|
<DECIMALS>000004</DECIMALS>
|
||||||
|
<MASK> QUAN</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>DISTID</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>UNIT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> UNIT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FLTYPE</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000002</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000001</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>PERIOD</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000001</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT1</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> INT1</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_FLSCH</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
31
src/zdemo_abap_get_data_itf.intf.abap
Normal file
31
src/zdemo_abap_get_data_itf.intf.abap
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
***********************************************************************
|
||||||
|
* ---------------------------- PURPOSE --------------------------------
|
||||||
|
* Interface to support the ABAP cheat sheet: ABAP Unit Tests
|
||||||
|
*
|
||||||
|
* ----------------------------- NOTE ----------------------------------
|
||||||
|
* The code presented in this class is only meant for supporting the ABAP
|
||||||
|
* cheat sheets. It is not intended for direct use in a
|
||||||
|
* production system environment. The code examples in the ABAP cheat
|
||||||
|
* sheets are primarily intended to provide a better explanation and
|
||||||
|
* visualization of the syntax and semantics of ABAP statements and not to
|
||||||
|
* solve concrete programming tasks. For production application programs,
|
||||||
|
* a dedicated solution should therefore always be worked out for each
|
||||||
|
* individual case. There is no guarantee for either the correctness or
|
||||||
|
* the completeness of the code. In addition, there is no legal
|
||||||
|
* responsibility or liability for possible errors or their consequences
|
||||||
|
* which occur through the use of the example code.
|
||||||
|
*
|
||||||
|
***********************************************************************
|
||||||
|
"! <p class="shorttext synchronized">Interface for ABAP cheat sheet example</p>
|
||||||
|
"! The interface supports the ABAP cheat sheet: ABAP Unit Tests.
|
||||||
|
INTERFACE zdemo_abap_get_data_itf
|
||||||
|
PUBLIC.
|
||||||
|
|
||||||
|
TYPES: carr_tab TYPE TABLE OF zdemo_abap_fli WITH EMPTY KEY,
|
||||||
|
occ_rate TYPE p LENGTH 4 DECIMALS 2.
|
||||||
|
|
||||||
|
METHODS: select_flight_data IMPORTING carrier TYPE zdemo_abap_fli-carrid
|
||||||
|
RETURNING VALUE(flight_data) TYPE carr_tab,
|
||||||
|
say_hello RETURNING VALUE(hi) TYPE string.
|
||||||
|
|
||||||
|
ENDINTERFACE.
|
||||||
15
src/zdemo_abap_get_data_itf.intf.xml
Normal file
15
src/zdemo_abap_get_data_itf.intf.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_INTF" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOINTERF>
|
||||||
|
<CLSNAME>ZDEMO_ABAP_GET_DATA_ITF</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Interface for ABAP cheat sheet example</DESCRIPT>
|
||||||
|
<EXPOSURE>2</EXPOSURE>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOINTERF>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
39
src/zdemo_abap_objects_interface.intf.abap
Normal file
39
src/zdemo_abap_objects_interface.intf.abap
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
***********************************************************************
|
||||||
|
* ---------------------------- PURPOSE --------------------------------
|
||||||
|
* Interface to support the ABAP cheat sheet ABAP object orientation.
|
||||||
|
*
|
||||||
|
* ----------------------------- NOTE ----------------------------------
|
||||||
|
* The code presented in this class is only meant for supporting the ABAP
|
||||||
|
* cheat sheets. It is not intended for direct use in a
|
||||||
|
* production system environment. The code examples in the ABAP cheat
|
||||||
|
* sheets are primarily intended to provide a better explanation and
|
||||||
|
* visualization of the syntax and semantics of ABAP statements and not to
|
||||||
|
* solve concrete programming tasks. For production application programs,
|
||||||
|
* a dedicated solution should therefore always be worked out for each
|
||||||
|
* individual case. There is no guarantee for either the correctness or
|
||||||
|
* the completeness of the code. In addition, there is no legal
|
||||||
|
* responsibility or liability for possible errors or their consequences
|
||||||
|
* which occur through the use of the example code.
|
||||||
|
*
|
||||||
|
***********************************************************************
|
||||||
|
"! <p class="shorttext synchronized">Interface for ABAP cheat sheet example</p>
|
||||||
|
"! The interface supporta the ABAP cheat sheet on object orientation and demonstrates the use of interfaces.
|
||||||
|
INTERFACE zdemo_abap_objects_interface
|
||||||
|
PUBLIC.
|
||||||
|
|
||||||
|
METHODS: double IMPORTING i_op TYPE i
|
||||||
|
RETURNING VALUE(r_double) TYPE i,
|
||||||
|
|
||||||
|
triple DEFAULT IGNORE IMPORTING i_op TYPE i
|
||||||
|
RETURNING VALUE(r_triple) TYPE i .
|
||||||
|
|
||||||
|
DATA in_str TYPE string.
|
||||||
|
|
||||||
|
CLASS-METHODS: halve IMPORTING i_op TYPE i
|
||||||
|
RETURNING VALUE(r_halve) TYPE i.
|
||||||
|
|
||||||
|
CLASS-DATA: stat_str TYPE string.
|
||||||
|
|
||||||
|
CONSTANTS const_intf TYPE i VALUE 987.
|
||||||
|
|
||||||
|
ENDINTERFACE.
|
||||||
15
src/zdemo_abap_objects_interface.intf.xml
Normal file
15
src/zdemo_abap_objects_interface.intf.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_INTF" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOINTERF>
|
||||||
|
<CLSNAME>ZDEMO_ABAP_OBJECTS_INTERFACE</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Interface for ABAP cheat sheet example</DESCRIPT>
|
||||||
|
<EXPOSURE>2</EXPOSURE>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOINTERF>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
91
src/zdemo_abap_rapt1.tabl.xml
Normal file
91
src/zdemo_abap_rapt1.tabl.xml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo table for RAP</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<MAINFLAG>X</MAINFLAG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FIELD1</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FIELD2</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FIELD3</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FIELD4</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT1</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
84
src/zdemo_abap_rapt2.tabl.xml
Normal file
84
src/zdemo_abap_rapt2.tabl.xml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT2</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo table for RAP</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<MAINFLAG>X</MAINFLAG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT2</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>KEY_CH</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FIELD_CH1</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>FIELD_CH2</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_RAPT2</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
91
src/zdemo_abap_tab1.tabl.xml
Normal file
91
src/zdemo_abap_tab1.tabl.xml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TAB1</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo table</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<MAINFLAG>X</MAINFLAG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TAB1</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CHAR1</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CHAR2</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM1</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM2</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TAB1</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
82
src/zdemo_abap_tab2.tabl.xml
Normal file
82
src/zdemo_abap_tab2.tabl.xml
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TAB2</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo table</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<MAINFLAG>X</MAINFLAG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TAB2</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>KEY_FIELD</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CHAR1</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000020</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM1</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUMLONG</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>8</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<DATATYPE>INT8</DATATYPE>
|
||||||
|
<LENG>000019</LENG>
|
||||||
|
<MASK> INT8</MASK>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TAB2</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
99
src/zdemo_abap_tabca.tabl.xml
Normal file
99
src/zdemo_abap_tabca.tabl.xml
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_TABL" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DD02V>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TABCA</TABNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<TABCLASS>TRANSP</TABCLASS>
|
||||||
|
<CLIDEP>X</CLIDEP>
|
||||||
|
<DDTEXT>Demo table for RAP calculator</DDTEXT>
|
||||||
|
<MASTERLANG>E</MASTERLANG>
|
||||||
|
<MAINFLAG>X</MAINFLAG>
|
||||||
|
<CONTFLAG>A</CONTFLAG>
|
||||||
|
<EXCLASS>1</EXCLASS>
|
||||||
|
</DD02V>
|
||||||
|
<DD09L>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TABCA</TABNAME>
|
||||||
|
<AS4LOCAL>A</AS4LOCAL>
|
||||||
|
<TABKAT>0</TABKAT>
|
||||||
|
<TABART>APPL0</TABART>
|
||||||
|
<BUFALLOW>N</BUFALLOW>
|
||||||
|
</DD09L>
|
||||||
|
<DD03P_TABLE>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CLIENT</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000006</INTLEN>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<DATATYPE>CLNT</DATATYPE>
|
||||||
|
<LENG>000003</LENG>
|
||||||
|
<MASK> CLNT</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>ID</FIELDNAME>
|
||||||
|
<KEYFLAG>X</KEYFLAG>
|
||||||
|
<ROLLNAME>SYSUUID_X16</ROLLNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<NOTNULL>X</NOTNULL>
|
||||||
|
<COMPTYPE>E</COMPTYPE>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM1</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>ARITHM_OP</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>C</INTTYPE>
|
||||||
|
<INTLEN>000002</INTLEN>
|
||||||
|
<DATATYPE>CHAR</DATATYPE>
|
||||||
|
<LENG>000001</LENG>
|
||||||
|
<MASK> CHAR</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>NUM2</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>X</INTTYPE>
|
||||||
|
<INTLEN>000004</INTLEN>
|
||||||
|
<DATATYPE>INT4</DATATYPE>
|
||||||
|
<LENG>000010</LENG>
|
||||||
|
<MASK> INT4</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CALC_RESULT</FIELDNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<INTTYPE>g</INTTYPE>
|
||||||
|
<INTLEN>000008</INTLEN>
|
||||||
|
<DATATYPE>STRG</DATATYPE>
|
||||||
|
<MASK> STRG</MASK>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>CREA_DATE_TIME</FIELDNAME>
|
||||||
|
<ROLLNAME>TIMESTAMPL</ROLLNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<COMPTYPE>E</COMPTYPE>
|
||||||
|
</DD03P>
|
||||||
|
<DD03P>
|
||||||
|
<FIELDNAME>LCHG_DATE_TIME</FIELDNAME>
|
||||||
|
<ROLLNAME>TIMESTAMPL</ROLLNAME>
|
||||||
|
<ADMINFIELD>0</ADMINFIELD>
|
||||||
|
<COMPTYPE>E</COMPTYPE>
|
||||||
|
</DD03P>
|
||||||
|
</DD03P_TABLE>
|
||||||
|
<TABL_EXTRAS>
|
||||||
|
<TDDAT>
|
||||||
|
<TABNAME>ZDEMO_ABAP_TABCA</TABNAME>
|
||||||
|
<CCLASS>CUS_DEV_SUP_DA</CCLASS>
|
||||||
|
</TDDAT>
|
||||||
|
</TABL_EXTRAS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
13
src/zdemo_abap_table_function.ddls.asddls
Normal file
13
src/zdemo_abap_table_function.ddls.asddls
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
||||||
|
define table function ZDEMO_ABAP_TABLE_FUNCTION
|
||||||
|
returns
|
||||||
|
{
|
||||||
|
client : abap.clnt;
|
||||||
|
carrier_id : abap.char(3);
|
||||||
|
carrier_name : abap.char(20);
|
||||||
|
connections : abap.string;
|
||||||
|
avg_flight_time : abap.dec( 10, 2 );
|
||||||
|
avg_distance : abap.dec( 10, 2 );
|
||||||
|
}
|
||||||
|
implemented by method
|
||||||
|
zcl_demo_abap_amdp=>flight_analysis;
|
||||||
0
src/zdemo_abap_table_function.ddls.baseinfo
Normal file
0
src/zdemo_abap_table_function.ddls.baseinfo
Normal file
13
src/zdemo_abap_table_function.ddls.xml
Normal file
13
src/zdemo_abap_table_function.ddls.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<DDLS>
|
||||||
|
<DDLNAME>ZDEMO_ABAP_TABLE_FUNCTION</DDLNAME>
|
||||||
|
<DDLANGUAGE>E</DDLANGUAGE>
|
||||||
|
<DDTEXT>ABAP Demo: Table function</DDTEXT>
|
||||||
|
<SOURCE_TYPE>F</SOURCE_TYPE>
|
||||||
|
</DDLS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
||||||
Reference in New Issue
Block a user