Skip to content

Commit b14040c

Browse files
authored
first commit
1 parent 380a0d7 commit b14040c

30 files changed

+1558
-0
lines changed

.abapgit.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
3+
<asx:values>
4+
<DATA>
5+
<MASTER_LANGUAGE>E</MASTER_LANGUAGE>
6+
<STARTING_FOLDER>/src/</STARTING_FOLDER>
7+
<FOLDER_LOGIC>PREFIX</FOLDER_LOGIC>
8+
<IGNORE>
9+
<item>/.gitignore</item>
10+
<item>/LICENSE</item>
11+
<item>/README.md</item>
12+
<item>/package.json</item>
13+
<item>/.travis.yml</item>
14+
<item>/.gitlab-ci.yml</item>
15+
<item>/abaplint.json</item>
16+
<item>/azure-pipelines.yml</item>
17+
</IGNORE>
18+
</DATA>
19+
</asx:values>
20+
</asx:abap>

abaplint.jsonc

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
{
2+
"global": {
3+
"files": "/src/**/*.*"
4+
},
5+
"dependencies": [
6+
{
7+
"url": "https://github.com/abapedia/steampunk-2305-api-intersect-702",
8+
"folder": "/deps",
9+
"files": "/src/**/*.*"
10+
}
11+
],
12+
"syntax": {
13+
"version": "v702",
14+
"errorNamespace": "."
15+
},
16+
"rules": {
17+
"7bit_ascii": false,
18+
"abapdoc": false,
19+
"sql_value_conversion" : true,
20+
"select_single_full_key" : true,
21+
"strict_sql" : true,
22+
"easy_to_find_messages" : true,
23+
"fully_type_itabs" : true,
24+
"align_parameters": false,
25+
"smim_consistency": true,
26+
"allowed_object_naming": true,
27+
"allowed_object_types": true,
28+
"ambiguous_statement": true,
29+
"avoid_use": false,
30+
"begin_end_names": true,
31+
"begin_single_include": true,
32+
"call_transaction_authority_check": true,
33+
"cds_comment_style": true,
34+
"cds_legacy_view": true,
35+
"cds_parser_error": true,
36+
"chain_mainly_declarations": true,
37+
"change_if_to_case": {
38+
"exclude": [],
39+
"severity": "Error",
40+
"skipNames": []
41+
},
42+
"check_abstract": true,
43+
"check_comments": true,
44+
"check_ddic": true,
45+
"check_include": true,
46+
"check_subrc": false,
47+
"check_syntax": true,
48+
"check_text_elements": true,
49+
"check_transformation_exists": true,
50+
"class_attribute_names": false,
51+
"classic_exceptions_overlap": true,
52+
"cloud_types": true,
53+
"colon_missing_space": true,
54+
"commented_code": false,
55+
"constant_classes": {
56+
"exclude": [],
57+
"severity": "Error",
58+
"mapping": []
59+
},
60+
"constructor_visibility_public": true,
61+
"contains_tab": {
62+
"exclude": [],
63+
"severity": "Error",
64+
"spaces": 1
65+
},
66+
"cyclic_oo": false,
67+
"cyclomatic_complexity": {
68+
"exclude": [],
69+
"severity": "Error",
70+
"max": 25
71+
},
72+
"dangerous_statement": true,
73+
"db_operation_in_loop": true,
74+
"definitions_top": false,
75+
"description_empty": true,
76+
"double_space": false,
77+
"downport": true,
78+
"empty_line_in_statement": true,
79+
"empty_statement": true,
80+
"empty_structure": {
81+
"loop": true,
82+
"if": true,
83+
"while": true,
84+
"case": true,
85+
"select": true,
86+
"do": true,
87+
"at": true,
88+
"try": true,
89+
"when": false
90+
},
91+
"exit_or_check": true,
92+
"expand_macros": true,
93+
"exporting": true,
94+
"forbidden_identifier": true,
95+
"forbidden_pseudo_and_pragma": {
96+
"exclude": [],
97+
"severity": "Error",
98+
"pseudo": [],
99+
"pragmas": [],
100+
"ignoreGlobalClassDefinition": false,
101+
"ignoreGlobalInterface": false
102+
},
103+
"forbidden_void_type": true,
104+
"form_tables_obsolete": true,
105+
"fully_type_constants": {
106+
"checkData": true
107+
},
108+
"function_module_recommendations": true,
109+
"functional_writing": {
110+
"ignoreExceptions": true
111+
},
112+
"global_class": true,
113+
"identical_conditions": true,
114+
"identical_contents": true,
115+
"identical_descriptions": true,
116+
"identical_form_names": true,
117+
"if_in_if": true,
118+
"implement_methods": true,
119+
"in_statement_indentation": false,
120+
"indentation": false,
121+
"inline_data_old_versions": true,
122+
"intf_referencing_clas": false,
123+
"keep_single_parameter_on_one_line": false,
124+
"keyword_case": false,
125+
"line_break_multiple_parameters": false,
126+
"line_break_style": true,
127+
"line_length": false,
128+
"line_only_punc": false,
129+
"local_class_naming": false,
130+
"local_testclass_consistency": true,
131+
"local_variable_names": false,
132+
"main_file_contents": true,
133+
"many_parentheses": true,
134+
"max_one_method_parameter_per_line": true,
135+
"max_one_statement": true,
136+
"message_exists": true,
137+
"method_implemented_twice": true,
138+
"method_length": false,
139+
"method_overwrites_builtin": false,
140+
"method_parameter_names": false,
141+
"mix_returning": true,
142+
"modify_only_own_db_tables": {
143+
"reportDynamic": true,
144+
"ownTables": "^[yz]"
145+
},
146+
"msag_consistency": true,
147+
"names_no_dash": true,
148+
"nesting": {
149+
"depth": 5
150+
},
151+
"newline_between_methods": false,
152+
"no_aliases": true,
153+
"no_chained_assignment": true,
154+
"no_external_form_calls": true,
155+
"no_inline_in_optional_branches": false,
156+
"no_public_attributes": false,
157+
"no_yoda_conditions": false,
158+
"nrob_consistency": true,
159+
"object_naming": {
160+
"exclude": [],
161+
"severity": "Error",
162+
"patternKind": "required",
163+
"ignoreNames": [],
164+
"ignorePatterns": [],
165+
"clas": "^ZC(L|X)",
166+
"intf": "^ZIF",
167+
"prog": "^Z",
168+
"fugr": "^Z",
169+
"tabl": "^Z",
170+
"ttyp": "^Z",
171+
"dtel": "^Z",
172+
"doma": "^Z",
173+
"msag": "^Z",
174+
"tran": "^Z",
175+
"enqu": "^EZ",
176+
"auth": "^Z",
177+
"pinf": "^Z",
178+
"idoc": "^Z",
179+
"xslt": "^Z",
180+
"ssfo": "^Z",
181+
"ssst": "^Z",
182+
"shlp": "^Z"
183+
},
184+
"obsolete_statement": true,
185+
"omit_parameter_name": false,
186+
"omit_preceding_zeros": true,
187+
"omit_receiving": true,
188+
"parser_702_chaining": true,
189+
"parser_error": true,
190+
"parser_missing_space": false,
191+
"pragma_style": true,
192+
"prefer_corresponding": true,
193+
"prefer_inline": false,
194+
"prefer_is_not": true,
195+
"prefer_raise_exception_new": true,
196+
"prefer_returning_to_exporting": false,
197+
"prefer_xsdbool": true,
198+
"preferred_compare_operator": true,
199+
"prefix_is_current_class": {
200+
"severity": "Warning"
201+
},
202+
"reduce_string_templates": true,
203+
"release_idoc": true,
204+
"remove_descriptions": {
205+
"exclude": [],
206+
"severity": "Error",
207+
"ignoreExceptions": false,
208+
"ignoreWorkflow": true
209+
},
210+
"rfc_error_handling": true,
211+
"select_add_order_by": false,
212+
"select_performance": true,
213+
"selection_screen_naming": true,
214+
"sequential_blank": {
215+
"severity": "Warning"
216+
},
217+
"short_case": false,
218+
"sicf_consistency": true,
219+
"slow_parameter_passing": true,
220+
"space_before_colon": true,
221+
"space_before_dot": true,
222+
"sql_escape_host_variables": true,
223+
"start_at_tab": false,
224+
"static_call_via_instance": {
225+
"allowInTestclassIncludes": false
226+
},
227+
"superclass_final": true,
228+
"superfluous_value": true,
229+
"sy_modification": false,
230+
"tabl_enhancement_category": true,
231+
"try_without_catch": true,
232+
"type_form_parameters": true,
233+
"types_naming": false,
234+
"uncaught_exception": true,
235+
"unknown_types": {
236+
"exclude": [],
237+
"severity": "Error"
238+
},
239+
"unnecessary_chaining": true,
240+
"unnecessary_pragma": true,
241+
"unnecessary_return": true,
242+
"unreachable_code": {
243+
"exclude": ["zdummy.clas.testclasses.abap"]
244+
},
245+
"unsecure_fae": true,
246+
"unused_ddic": true,
247+
"unused_methods": true,
248+
"unused_types": true,
249+
"unused_variables": {
250+
"severity": "Error",
251+
"exclude": ["zdummy.clas.testclasses.abap"],
252+
"skipNames": ["lv_dummy", "i_mv_editor"]
253+
},
254+
"use_bool_expression": true,
255+
"use_class_based_exceptions": true,
256+
"use_line_exists": true,
257+
"use_new": true,
258+
"when_others_last": true,
259+
"whitespace_end": true,
260+
"xml_consistency": true
261+
}
262+
}

src/package.devc.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<DEVC>
6+
<CTEXT>RTTS Serialization</CTEXT>
7+
</DEVC>
8+
</asx:values>
9+
</asx:abap>
10+
</abapGit>

src/zcl_srtti_aunit.clas.abap

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
CLASS zcl_srtti_aunit DEFINITION
2+
PUBLIC
3+
FOR TESTING
4+
FINAL
5+
CREATE PUBLIC .
6+
7+
PUBLIC SECTION.
8+
CLASS-METHODS serialize_deserialize IMPORTING variable TYPE any.
9+
PROTECTED SECTION.
10+
PRIVATE SECTION.
11+
ENDCLASS.
12+
13+
14+
15+
CLASS zcl_srtti_aunit IMPLEMENTATION.
16+
17+
METHOD serialize_deserialize.
18+
" Serialize: both type and value at the same time.
19+
FIELD-SYMBOLS <variable1> TYPE any.
20+
DATA rtti1 TYPE REF TO cl_abap_typedescr.
21+
DATA srtti1 TYPE REF TO zcl_srtti_typedescr.
22+
DATA xstring TYPE xstring.
23+
DATA srtti2 TYPE REF TO zcl_srtti_typedescr.
24+
DATA temp1 TYPE REF TO cl_abap_datadescr.
25+
DATA rtti2 LIKE temp1.
26+
DATA ref_variable2 TYPE REF TO data.
27+
FIELD-SYMBOLS <variable2> TYPE any.
28+
ASSIGN variable TO <variable1>.
29+
30+
rtti1 = cl_abap_typedescr=>describe_by_data( <variable1> ).
31+
32+
srtti1 = zcl_srtti_typedescr=>create_by_data_object( <variable1> ).
33+
34+
CALL TRANSFORMATION id
35+
SOURCE srtti = srtti1
36+
dobj = <variable1>
37+
RESULT XML xstring
38+
OPTIONS data_refs = 'heap-or-create'.
39+
40+
" Deserialize: (1) the type, to create the variable (2) then the value.
41+
42+
CALL TRANSFORMATION id
43+
SOURCE XML xstring
44+
RESULT srtti = srtti2.
45+
46+
temp1 ?= srtti2->get_rtti( ).
47+
48+
rtti2 = temp1.
49+
50+
CREATE DATA ref_variable2 TYPE HANDLE rtti2.
51+
52+
ASSIGN ref_variable2->* TO <variable2>.
53+
CALL TRANSFORMATION id
54+
SOURCE XML xstring
55+
RESULT dobj = <variable2>.
56+
57+
cl_abap_unit_assert=>assert_equals( exp = rtti1 act = rtti2 ).
58+
cl_abap_unit_assert=>assert_equals( exp = <variable1> act = <variable2> ).
59+
ENDMETHOD.
60+
61+
ENDCLASS.

src/zcl_srtti_aunit.clas.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<VSEOCLASS>
6+
<CLSNAME>ZCL_SRTTI_AUNIT</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>Test class</DESCRIPT>
9+
<CATEGORY>05</CATEGORY>
10+
<STATE>1</STATE>
11+
<CLSCCINCL>X</CLSCCINCL>
12+
<FIXPT>X</FIXPT>
13+
<UNICODE>X</UNICODE>
14+
</VSEOCLASS>
15+
</asx:values>
16+
</asx:abap>
17+
</abapGit>

0 commit comments

Comments
 (0)