Add XML and JSON cheat sheet
This commit is contained in:
1362
src/zcl_demo_abap_xml_json.clas.abap
Normal file
1362
src/zcl_demo_abap_xml_json.clas.abap
Normal file
File diff suppressed because it is too large
Load Diff
16
src/zcl_demo_abap_xml_json.clas.xml
Normal file
16
src/zcl_demo_abap_xml_json.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_XML_JSON</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>ABAP cheat sheet: Working with XML and JSON in ABAP</DESCRIPT>
|
||||
<STATE>1</STATE>
|
||||
<CLSCCINCL>X</CLSCCINCL>
|
||||
<FIXPT>X</FIXPT>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOCLASS>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
35
src/zdemo_abap_st_carriers_html.xslt.source.xml
Normal file
35
src/zdemo_abap_st_carriers_html.xslt.source.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?sap.transform simple?>
|
||||
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
|
||||
<tt:root name="CARRIER_INFO"/>
|
||||
<tt:template>
|
||||
<html>
|
||||
<body>
|
||||
<h2>Information about Carriers</h2>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td><b>ID</b></td>
|
||||
<td><b>Name</b></td>
|
||||
<td><b>Currency</b></td>
|
||||
<td><b>Website</b></td>
|
||||
</tr>
|
||||
<tt:loop ref=".CARRIER_INFO">
|
||||
<tr><td>
|
||||
<tt:value ref="$ref.carrid"/>
|
||||
</td>
|
||||
<td>
|
||||
<tt:value ref="$ref.carrname"/>
|
||||
</td>
|
||||
<td>
|
||||
<tt:value ref="$ref.currcode"/>
|
||||
</td>
|
||||
<td>
|
||||
<a><tt:attribute name="href" value-ref="$ref.url" />
|
||||
<tt:value ref="$ref.url"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tt:loop>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</tt:template>
|
||||
</tt:transform>
|
||||
12
src/zdemo_abap_st_carriers_html.xslt.xml
Normal file
12
src/zdemo_abap_st_carriers_html.xslt.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_XSLT" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<ATTRIBUTES>
|
||||
<XSLTDESC>ZDEMO_ABAP_ST_CARRIERS_HTML</XSLTDESC>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Simple Transformation Demo</DESCRIPT>
|
||||
</ATTRIBUTES>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
19
src/zdemo_abap_st_strtab_html.xslt.source.xml
Normal file
19
src/zdemo_abap_st_strtab_html.xslt.source.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?sap.transform simple?>
|
||||
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
|
||||
<tt:root name="STRING_TABLE"/>
|
||||
<tt:template>
|
||||
<html>
|
||||
<body>
|
||||
<h2>Content of String Table</h2>
|
||||
<table border="1">
|
||||
<tt:loop ref=".STRING_TABLE">
|
||||
<tr><td>
|
||||
<tt:value ref="$ref"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tt:loop>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</tt:template>
|
||||
</tt:transform>
|
||||
12
src/zdemo_abap_st_strtab_html.xslt.xml
Normal file
12
src/zdemo_abap_st_strtab_html.xslt.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_XSLT" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<ATTRIBUTES>
|
||||
<XSLTDESC>ZDEMO_ABAP_ST_STRTAB_HTML</XSLTDESC>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Simple Transformation Demo</DESCRIPT>
|
||||
</ATTRIBUTES>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
21
src/zdemo_abap_xslt_flights.xslt.source.xml
Normal file
21
src/zdemo_abap_xslt_flights.xslt.source.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:strip-space elements="*"/>
|
||||
|
||||
<xsl:template match="node()|@*">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()|@*"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*[MAXSEATS and OCCSEATS]">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()|@*"/>
|
||||
<FREESEATS>
|
||||
<xsl:value-of select="MAXSEATS - OCCSEATS"/>
|
||||
</FREESEATS>
|
||||
<OCCUPANCYRATE>
|
||||
<xsl:value-of select="format-number(OCCSEATS div MAXSEATS * 100, '##.##')"/>
|
||||
</OCCUPANCYRATE>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
12
src/zdemo_abap_xslt_flights.xslt.xml
Normal file
12
src/zdemo_abap_xslt_flights.xslt.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_XSLT" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<ATTRIBUTES>
|
||||
<XSLTDESC>ZDEMO_ABAP_XSLT_FLIGHTS</XSLTDESC>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>XSLT Demo</DESCRIPT>
|
||||
</ATTRIBUTES>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
||||
Reference in New Issue
Block a user