This commit is contained in:
danrega
2024-02-12 11:42:11 +01:00
parent 8e2bfd7392
commit 20bc698fa3
9 changed files with 4093 additions and 4099 deletions

View File

@@ -1790,7 +1790,7 @@ DATA(tdo_by_dref1) = cl_abap_typedescr=>describe_by_data_ref( dref1 ).
DATA(dref2) = NEW string_table( ). DATA(dref2) = NEW string_table( ).
DATA(tdo_by_dref2) = cl_abap_typedescr=>describe_by_data_ref( dref2 ). DATA(tdo_by_dref2) = cl_abap_typedescr=>describe_by_data_ref( dref2 ).
"... using the cl_abap_typedescr=>describe_by_data_ref method "... using the cl_abap_typedescr=>describe_by_object_ref method
"In this case, an object reference variable is used. "In this case, an object reference variable is used.
DATA oref TYPE REF TO zcl_demo_abap_objects. DATA oref TYPE REF TO zcl_demo_abap_objects.
oref = NEW #( ). oref = NEW #( ).
@@ -2168,8 +2168,7 @@ CREATE DATA dref_cr TYPE HANDLE tdo_ref.
[zcl_demo_abap_dynamic_prog](./src/zcl_demo_abap_dynamic_prog.clas.abap) [zcl_demo_abap_dynamic_prog](./src/zcl_demo_abap_dynamic_prog.clas.abap)
> **💡 Note**<br> > **💡 Note**<br>
> - The executable example ... > - The executable example covers the following topics, among others:
> - covers the following topics, among others:
> - Field symbols and data references as supporting elements for dynamic programming > - Field symbols and data references as supporting elements for dynamic programming
> - Dynamic ABAP syntax components > - Dynamic ABAP syntax components
> - Runtime type services (RTTS), i. e. runtime type identification (RTTI) and runtime type creation (RTTC) > - Runtime type services (RTTS), i. e. runtime type identification (RTTI) and runtime type creation (RTTC)

View File

@@ -209,6 +209,7 @@ Use the standalone version of the abapGit report to import the demo examples of
- Only one user on the system can import this repository because all object names must be globally unique. Before importing the code, you should perform a system-wide search for classes named *ZCL_DEMO_ABAP**, for example. If someone has already imported the content into the system, you can simply check out that imported code. - Only one user on the system can import this repository because all object names must be globally unique. Before importing the code, you should perform a system-wide search for classes named *ZCL_DEMO_ABAP**, for example. If someone has already imported the content into the system, you can simply check out that imported code.
- Regarding possible code check warnings, e.g. for the many strings in the code, not using an `ORDER BY` clause, or messages regarding using `SELECT *`, the code deliberately avoids [pragmas](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpragma_glosry.htm) and [pseudo comments](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpseudo_comment_glosry.htm) in order to focus on the available ABAP syntax. See also the [Disclaimer](#%EF%B8%8F-disclaimer). - Regarding possible code check warnings, e.g. for the many strings in the code, not using an `ORDER BY` clause, or messages regarding using `SELECT *`, the code deliberately avoids [pragmas](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpragma_glosry.htm) and [pseudo comments](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenpseudo_comment_glosry.htm) in order to focus on the available ABAP syntax. See also the [Disclaimer](#%EF%B8%8F-disclaimer).
- Regarding the examples to be imported into on-premise ABAP systems, note the following: The cheat sheet documents cover ABAP syntax regardless of the ABAP release to avoid scattering information and to have the information in one place. Therefore, the lower the release, the fewer syntax options and examples are available. For example, the RAP examples in particular require at least ABAP version 7.56. The code examples in the classic ABAP branches do not necessarily reflect all (described) syntax variations and options that are available in classic ABAP and in the particular ABAP release. - Regarding the examples to be imported into on-premise ABAP systems, note the following: The cheat sheet documents cover ABAP syntax regardless of the ABAP release to avoid scattering information and to have the information in one place. Therefore, the lower the release, the fewer syntax options and examples are available. For example, the RAP examples in particular require at least ABAP version 7.56. The code examples in the classic ABAP branches do not necessarily reflect all (described) syntax variations and options that are available in classic ABAP and in the particular ABAP release.
- If you encounter import problems with the XSLT/ST objects, try to manually paste the code from the `...source.xml` files [here](https://github.com/SAP-samples/abap-cheat-sheets/tree/main/src) into the improperly imported objects and activate all non-active objects.
<br> <br>

View File

@@ -702,7 +702,7 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
DATA xml_a TYPE xstring. DATA xml_a TYPE xstring.
CALL TRANSFORMATION zdemo_abap_xslt_flights CALL TRANSFORMATION zdemo_abap_xslt_fl
SOURCE XML xml_flights SOURCE XML xml_flights
RESULT XML xml_a. RESULT XML xml_a.
@@ -728,7 +728,7 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
DATA xml_b TYPE xstring. DATA xml_b TYPE xstring.
CALL TRANSFORMATION zdemo_abap_xslt_flights CALL TRANSFORMATION zdemo_abap_xslt_fl
SOURCE flights = fli_itab SOURCE flights = fli_itab
RESULT XML xml_b. RESULT XML xml_b.
@@ -747,7 +747,7 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
DATA xml_c TYPE xstring. DATA xml_c TYPE xstring.
"ABAP -> XML "ABAP -> XML
CALL TRANSFORMATION zdemo_abap_st_strtab_html CALL TRANSFORMATION zdemo_abap_st_strhtml
SOURCE string_table = string_table_a SOURCE string_table = string_table_a
RESULT XML xml_c. RESULT XML xml_c.
@@ -758,7 +758,7 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
"XML -> ABAP "XML -> ABAP
DATA string_table_b TYPE string_table. DATA string_table_b TYPE string_table.
CALL TRANSFORMATION zdemo_abap_st_strtab_html CALL TRANSFORMATION zdemo_abap_st_strhtml
SOURCE XML xml_c SOURCE XML xml_c
RESULT string_table = string_table_b. RESULT string_table = string_table_b.
@@ -783,7 +783,7 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
"addition. In this example, the XML header should not be added. "addition. In this example, the XML header should not be added.
"So, you can take the resulting html and test it in an HTML viewer. "So, you can take the resulting html and test it in an HTML viewer.
CALL TRANSFORMATION zdemo_abap_st_carriers_html CALL TRANSFORMATION zdemo_abap_st_carrhtml
SOURCE carrier_info = carr_tab_a SOURCE carrier_info = carr_tab_a
RESULT XML str_a RESULT XML str_a
OPTIONS xml_header = 'NO'. OPTIONS xml_header = 'NO'.
@@ -795,7 +795,7 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
"XML -> ABAP "XML -> ABAP
DATA carr_tab_b LIKE carr_tab_a. DATA carr_tab_b LIKE carr_tab_a.
CALL TRANSFORMATION zdemo_abap_st_carriers_html CALL TRANSFORMATION zdemo_abap_st_carrhtml
SOURCE XML str_a SOURCE XML str_a
RESULT carrier_info = carr_tab_b. RESULT carrier_info = carr_tab_b.
@@ -989,7 +989,7 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
"CALL TRANSFORMATION. They are either ... "CALL TRANSFORMATION. They are either ...
"... XSLT programs "... XSLT programs
CALL TRANSFORMATION zdemo_abap_st_carriers_html SOURCE carrier_info = carr_tab_a CALL TRANSFORMATION zdemo_abap_st_carrhtml SOURCE carrier_info = carr_tab_a
RESULT XML str_a. RESULT XML str_a.
"... predefined identity transformations "... predefined identity transformations
@@ -1014,7 +1014,7 @@ CLASS zcl_demo_abap_xml_json IMPLEMENTATION.
ENDTRY. ENDTRY.
"... Simple Transformation "... Simple Transformation
CALL TRANSFORMATION zdemo_abap_st_carriers_html SOURCE XML str_a CALL TRANSFORMATION zdemo_abap_st_carrhtml SOURCE XML str_a
RESULT carrier_info = carr_tab_b. RESULT carrier_info = carr_tab_b.
************************************************************************ ************************************************************************

View File

@@ -1,12 +1,11 @@
<?sap.transform simple?> <?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"> <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="CARRIER_INFO"/> <tt:root name="CARRIER_INFO"/>
<tt:template> <tt:template>
<html> <html>
<body> <body>
<h2>Information about Carriers</h2> <h2>Carrier Information</h2>
<table border="1"> <table border="1">
<tr> <tr>
<td> <td>

View File

@@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values> <asx:values>
<ATTRIBUTES> <ATTRIBUTES>
<XSLTDESC>ZDEMO_ABAP_ST_STRTAB_HTML</XSLTDESC> <XSLTDESC>ZDEMO_ABAP_ST_CARRHTML</XSLTDESC>
<LANGU>E</LANGU> <LANGU>E</LANGU>
<DESCRIPT>ST Demo</DESCRIPT> <DESCRIPT>ST Demo</DESCRIPT>
</ATTRIBUTES> </ATTRIBUTES>

View File

@@ -1,12 +1,10 @@
<?sap.transform simple?> <?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"> <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="STRING_TABLE"/> <tt:root name="STRING_TABLE"/>
<tt:template> <tt:template>
<html> <html>
<body> <body>
<h2>Content of String Table</h2> <h2>String Table Content</h2>
<table border="1"> <table border="1">
<tt:loop ref=".STRING_TABLE"> <tt:loop ref=".STRING_TABLE">
<tr> <tr>
@@ -19,5 +17,4 @@
</body> </body>
</html> </html>
</tt:template> </tt:template>
</tt:transform> </tt:transform>

View File

@@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values> <asx:values>
<ATTRIBUTES> <ATTRIBUTES>
<XSLTDESC>ZDEMO_ABAP_ST_CARRIERS_HTML</XSLTDESC> <XSLTDESC>ZDEMO_ABAP_ST_STRHTML</XSLTDESC>
<LANGU>E</LANGU> <LANGU>E</LANGU>
<DESCRIPT>ST Demo</DESCRIPT> <DESCRIPT>ST Demo</DESCRIPT>
</ATTRIBUTES> </ATTRIBUTES>

View File

@@ -1,7 +1,5 @@
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0"> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/> <xsl:strip-space elements="*"/>
<xsl:template match="node()|@*"> <xsl:template match="node()|@*">
<xsl:copy> <xsl:copy>
<xsl:apply-templates select="node()|@*"/> <xsl:apply-templates select="node()|@*"/>
@@ -18,5 +16,5 @@
</OCCUPANCYRATE> </OCCUPANCYRATE>
</xsl:copy> </xsl:copy>
</xsl:template> </xsl:template>
</xsl:transform> </xsl:transform>

View File

@@ -3,7 +3,7 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values> <asx:values>
<ATTRIBUTES> <ATTRIBUTES>
<XSLTDESC>ZDEMO_ABAP_XSLT_FLIGHTS</XSLTDESC> <XSLTDESC>ZDEMO_ABAP_XSLT_FL</XSLTDESC>
<LANGU>E</LANGU> <LANGU>E</LANGU>
<DESCRIPT>XSLT Demo</DESCRIPT> <DESCRIPT>XSLT Demo</DESCRIPT>
</ATTRIBUTES> </ATTRIBUTES>