Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
SAP2Moose/z_moose_extractor.abap
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
7967 lines (6250 sloc)
290 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* generated on system T80 at 15.08.2022 on 19:30:56 | |
* | |
* This is version 1.3.2 | |
* | |
*The MIT License (MIT) | |
* | |
*Copyright (c) 2016 Rainer Winkler, CubeServ | |
* | |
*Permission is hereby granted, free of charge, to any person obtaining a copy | |
*of this software and associated documentation files (the "Software"), to deal | |
*in the Software without restriction, including without limitation the rights | |
*to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
*copies of the Software, and to permit persons to whom the Software is | |
*furnished to do so, subject to the following conditions: | |
* | |
*The above copyright notice and this permission notice shall be included in all | |
*copies or substantial portions of the Software. | |
* | |
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
*IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
*FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
*AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
*LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
*OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
*SOFTWARE. | |
"! The latest version is available on https://github.com/SAP2Moose/SAP2Moose | |
"! | |
"! Thanks to Enno Wulff for providing the initial ABAP 7.31 version | |
"! | |
REPORT z2mse_moose_extractor2. | |
TABLES tadir. "So that select-options work | |
SELECTION-SCREEN BEGIN OF BLOCK block_global_source WITH FRAME TITLE TEXT-001. | |
SELECTION-SCREEN END OF BLOCK block_global_source. | |
SELECTION-SCREEN BEGIN OF BLOCK block_selct_sap_comp WITH FRAME TITLE TEXT-002. | |
SELECT-OPTIONS s_pack FOR tadir-devclass. | |
SELECT-OPTIONS s_spack FOR tadir-devclass. | |
DATA: element_filter TYPE string. | |
PARAMETERS p_eltyp TYPE text30. | |
PARAMETERS p_elpar TYPE c LENGTH 30. | |
PARAMETERS p_elnam TYPE c LENGTH 61. | |
PARAMETERS p_sub AS CHECKBOX DEFAULT 'X'. | |
PARAMETERS p_nup TYPE i DEFAULT -1. | |
PARAMETERS p_ndown TYPE i DEFAULT 1. | |
"Exclude interfaces in sap name space when found via where used analysis | |
PARAMETERS p_ex AS CHECKBOX DEFAULT 'X'. | |
PARAMETERS p_dyn TYPE string. "Classes to determine dynamic accesses | |
*SELECT-OPTIONS s_compsn FOR tadir-obj_name. | |
SELECTION-SCREEN END OF BLOCK block_selct_sap_comp. | |
SELECTION-SCREEN BEGIN OF BLOCK block_using_comp WITH FRAME TITLE TEXT-003. | |
*PARAMETERS: p_dm AS CHECKBOX DEFAULT ' '. | |
*"! Usages outside package grouped | |
*"! If false, a recursive search for using components is performed until no further using components are found | |
*DATA g_param_usage_outpack_groupd TYPE abap_bool. | |
*g_param_usage_outpack_groupd = p_dm. | |
SELECTION-SCREEN END OF BLOCK block_using_comp. | |
SELECTION-SCREEN BEGIN OF BLOCK block_infos WITH FRAME TITLE TEXT-004. | |
*PARAMETERS: p_list AS CHECKBOX DEFAULT ' '. | |
*"! List Tokens of selected programs | |
*DATA g_parameter_list_tokens TYPE abap_bool. | |
*g_parameter_list_tokens = p_list. | |
SELECTION-SCREEN END OF BLOCK block_infos. | |
" include z_mse. | |
******************************************** Begin Include Z_MSE_ABAP ***************************** | |
*The MIT License (MIT) | |
* | |
*Copyright (c) 2016 Rainer Winkler, CubeServ | |
* | |
*Permission is hereby granted, free of charge, to any person obtaining a copy | |
*of this software and associated documentation files (the "Software"), to deal | |
*in the Software without restriction, including without limitation the rights | |
*to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
*copies of the Software, and to permit persons to whom the Software is | |
*furnished to do so, subject to the following conditions: | |
* | |
*The above copyright notice and this permission notice shall be included in all | |
*copies or substantial portions of the Software. | |
* | |
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
*IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
*FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
*AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
*LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
*OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
*SOFTWARE. | |
SELECTION-SCREEN BEGIN OF BLOCK bl_model_settings WITH FRAME TITLE TEXT-100. | |
PARAMETERS: p_down AS CHECKBOX DEFAULT 'X', | |
p_somix AS CHECKBOX DEFAULT 'X', | |
" Default filename | |
p_df TYPE string. | |
*"! Download model to file | |
*DATA g_parameter_download_file TYPE abap_bool. | |
*g_parameter_download_file = p_down. | |
SELECTION-SCREEN END OF BLOCK bl_model_settings. | |
SELECTION-SCREEN BEGIN OF BLOCK bl_customize WITH FRAME TITLE TEXT-200. | |
PARAMETERS: p_intrev AS CHECKBOX DEFAULT ''. | |
SELECTION-SCREEN END OF BLOCK bl_customize. | |
" Begin Model | |
"! Specifies a model. | |
"! Create an instance only once, otherwise there will be multiple models each containing only part of the informations. | |
CLASS cl_model DEFINITION | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
TYPES: BEGIN OF line_type, | |
line TYPE string, | |
END OF line_type. | |
TYPES: lines_type TYPE STANDARD TABLE OF line_type WITH DEFAULT KEY. | |
METHODS constructor. | |
"! Add a named entity | |
"! @parameter elementname | The name of the FAMIX Element. Like FAMIX.NamedEntity | |
"! @parameter name_group | optional to handle cases where names may be duplicates | |
"! @parameter is_named_entity | True if the entity has a name | |
"! @parameter is_id_required | Set true if (id: ...) is always required | |
"! @parameter can_be_referenced_by_name | True if referencing by name is possible (For this the name has to be unique) | |
"! @parameter name | the name of a FAMIX Entity that inherits from FAMIX.NamedEntity leave empty is is_named_entity is false | |
"! @parameter exists_already_with_id | only if can_be_referenced_by_name true. Zero if it does not yet exist, otherwise filled with id | |
"! @parameter processedid | the id in model either if just created or already existing | |
METHODS add_entity | |
IMPORTING elementname TYPE clike | |
name_group TYPE clike OPTIONAL | |
is_named_entity TYPE abap_bool | |
is_id_required TYPE abap_bool DEFAULT '' | |
can_be_referenced_by_name TYPE abap_bool | |
name TYPE clike OPTIONAL | |
EXPORTING VALUE(exists_already_with_id) TYPE i | |
VALUE(processed_id) TYPE i. | |
"! Generates a string with a valid MSE file | |
METHODS make_mse | |
EXPORTING | |
mse_model TYPE lines_type. | |
"! Generates an attribute of type string | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter attribute_name | the name of the attribute | |
"! @parameter string | The value of the attribute | |
METHODS add_string | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
attribute_name TYPE clike | |
string TYPE clike. | |
"! Generates an attribute of type reference using a name | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter attribute_name | the name of the attribute | |
"! @parameter elementname | the element type of the reference | |
"! @parameter name_of_reference | the reference | |
METHODS add_reference_by_name | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
attribute_name TYPE clike | |
type_of_reference TYPE clike | |
name_group_of_reference TYPE clike OPTIONAL | |
name_of_reference TYPE clike. | |
"! Generates an attribute of type reference using an id | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter attribute_name | the name of the attribute | |
"! @parameter reference_id | the id of the reference | |
METHODS add_reference_by_id | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
attribute_name TYPE clike | |
reference_id TYPE i. | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
METHODS add_boolean | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
attribute_name TYPE clike | |
is_true TYPE abap_bool. | |
" Public type so that the caller is able to test the model | |
TYPES: | |
"! A public type that returns the attributes of the model | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
BEGIN OF public_attribute_type, | |
attribute_id TYPE i, | |
attribute_type TYPE string, | |
string TYPE string, | |
reference TYPE i, | |
boolean TYPE abap_bool, | |
END OF public_attribute_type. | |
TYPES: | |
"! A public table type to contain the attributes of an element | |
public_attributes_type TYPE HASHED TABLE OF public_attribute_type WITH UNIQUE KEY attribute_id. | |
TYPES: | |
"! A type that contains informations on an element | |
BEGIN OF public_element_type, | |
element_id TYPE i, | |
element_type TYPE string, | |
is_named_entity TYPE abap_bool, | |
is_id_required TYPE abap_bool, | |
public_attributes TYPE public_attributes_type, | |
END OF public_element_type. | |
TYPES: | |
"! A public table type to contain all elements of a model | |
public_elements_type TYPE HASHED TABLE OF public_element_type WITH UNIQUE KEY element_id. | |
"! Returns the current model | |
"! Use for checks and to decide what further actions are done to build the model. | |
"! Also to give a feedback what is extracted | |
METHODS get_model | |
RETURNING VALUE(public_elements) TYPE public_elements_type. | |
protected section. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF element_in_model_type, | |
element_id TYPE i, | |
is_named_entity TYPE abap_bool, | |
is_id_required TYPE abap_bool, | |
element_type TYPE string, | |
END OF element_in_model_type. | |
"! A table with all Elements in the model | |
DATA g_elements_in_model TYPE HASHED TABLE OF element_in_model_type WITH UNIQUE KEY element_id. | |
TYPES: BEGIN OF named_entity_type, | |
element_type TYPE string, | |
element_name_group TYPE string, | |
element_name TYPE string, | |
element_id TYPE i, | |
END OF named_entity_type. | |
"! A table to find IDs using the names | |
DATA g_named_entities TYPE HASHED TABLE OF named_entity_type WITH UNIQUE KEY element_type element_name_group element_name. | |
TYPES value_type TYPE c LENGTH 1. | |
"! An attribute where a name is specified | |
CONSTANTS string_value TYPE value_type VALUE 'S'. | |
"! An attribute where a reference is specified | |
CONSTANTS reference_value TYPE value_type VALUE 'R'. | |
CONSTANTS boolean_value TYPE value_type VALUE 'B'. | |
TYPES: BEGIN OF attribute_type, | |
element_id TYPE i, | |
attribute_id TYPE i, | |
attribute_type TYPE string, | |
value_type TYPE value_type, | |
name TYPE string, | |
reference TYPE i, | |
boolean TYPE abap_bool, | |
END OF attribute_type. | |
"! A table with all the attributes of an entity | |
DATA g_attributes TYPE SORTED TABLE OF attribute_type WITH UNIQUE KEY element_id attribute_id. | |
"! The ID of processed entity in the model | |
DATA g_processed_id TYPE i. | |
"! The ID of any attribute. Unique together with mv_id | |
DATA g_attribute_id TYPE i. | |
"! True if attribute is already identically assigned | |
METHODS _check_if_attr_already_there | |
IMPORTING | |
attribute TYPE cl_model=>attribute_type | |
RETURNING | |
VALUE(already_there) TYPE abap_bool. | |
METHODS _get_element_id | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike | |
element_name_group TYPE clike | |
element_name TYPE clike | |
RETURNING | |
VALUE(my_element_id) TYPE i. | |
ENDCLASS. | |
CLASS CL_MODEL IMPLEMENTATION. | |
METHOD add_boolean. | |
DATA ls_attribute LIKE LINE OF g_attributes. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_attribute. | |
ls_attribute-element_id = _get_element_id( element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name ). | |
ls_attribute-attribute_type = attribute_name. | |
ls_attribute-value_type = boolean_value. | |
ls_attribute-boolean = is_true. | |
" SAP_2_FAMIX_52 Do not attributes twice if they are added with identical attributes | |
IF _check_if_attr_already_there( ls_attribute ) EQ abap_false. | |
sy-subrc = 1. | |
WHILE sy-subrc <> 0. | |
ADD 1 TO g_attribute_id. | |
ls_attribute-attribute_id = g_attribute_id. | |
INSERT ls_attribute INTO TABLE g_attributes. | |
ENDWHILE. | |
ENDIF. | |
ENDMETHOD. | |
METHOD add_entity. | |
IF can_be_referenced_by_name EQ abap_true. | |
ASSERT name_group IS NOT INITIAL. | |
ENDIF. | |
FIELD-SYMBOLS <ls_name> LIKE LINE OF g_named_entities. | |
IF can_be_referenced_by_name EQ abap_true. | |
READ TABLE g_named_entities ASSIGNING <ls_name> | |
WITH TABLE KEY element_type = elementname element_name_group = name_group element_name = name. | |
IF sy-subrc EQ 0. "OK | |
exists_already_with_id = <ls_name>-element_id. | |
processed_id = <ls_name>-element_id. | |
RETURN. | |
ENDIF. | |
ENDIF. | |
ADD 1 TO g_processed_id. | |
g_attribute_id = 0. | |
IF can_be_referenced_by_name EQ abap_true. | |
DATA ls_named_entity LIKE LINE OF g_named_entities. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_named_entity. | |
ls_named_entity-element_type = elementname. | |
ls_named_entity-element_name_group = name_group. | |
ls_named_entity-element_name = name. | |
ls_named_entity-element_id = g_processed_id. | |
INSERT ls_named_entity INTO TABLE g_named_entities. | |
ENDIF. | |
DATA ls_elements_in_model LIKE LINE OF g_elements_in_model. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_elements_in_model. | |
ls_elements_in_model-element_id = g_processed_id. | |
ls_elements_in_model-is_named_entity = is_named_entity. | |
ls_elements_in_model-is_id_required = is_id_required. | |
ls_elements_in_model-element_type = elementname. | |
INSERT ls_elements_in_model INTO TABLE g_elements_in_model. | |
IF is_named_entity EQ abap_true. | |
me->add_string( EXPORTING element_id = g_processed_id attribute_name = 'name' string = name element_name_group = name_group ). | |
ENDIF. | |
processed_id = g_processed_id. | |
ENDMETHOD. | |
METHOD add_reference_by_id. | |
DATA ls_attribute TYPE attribute_type. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_attribute. | |
ls_attribute-element_id = _get_element_id( element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name ). | |
ls_attribute-attribute_type = attribute_name. | |
ls_attribute-value_type = reference_value. | |
ls_attribute-reference = reference_id. | |
" SAP_2_FAMIX_52 Do not attributes twice if they are added with identical attributes | |
IF _check_if_attr_already_there( ls_attribute ) EQ abap_false. | |
sy-subrc = 1. | |
WHILE sy-subrc <> 0. | |
ADD 1 TO g_attribute_id. | |
ls_attribute-attribute_id = g_attribute_id. | |
INSERT ls_attribute INTO TABLE g_attributes. | |
ENDWHILE. | |
ENDIF. | |
ENDMETHOD. | |
METHOD add_reference_by_name. | |
ASSERT name_group_of_reference IS NOT INITIAL. | |
FIELD-SYMBOLS <named_entity> LIKE LINE OF g_named_entities. | |
READ TABLE g_named_entities ASSIGNING <named_entity> WITH TABLE KEY element_type = type_of_reference | |
element_name_group = name_group_of_reference | |
element_name = name_of_reference. | |
* ASSERT sy-subrc EQ 0. "OK | |
IF sy-subrc <> 0. | |
ASSERT 1 = 2. | |
ENDIF. | |
DATA ls_attribute LIKE LINE OF g_attributes. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_attribute. | |
ls_attribute-element_id = _get_element_id( element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name ). | |
ls_attribute-attribute_type = attribute_name. | |
ls_attribute-value_type = reference_value. | |
ls_attribute-reference = <named_entity>-element_id. | |
" SAP_2_FAMIX_52 Do not attributes twice if they are added with identical attributes | |
IF _check_if_attr_already_there( ls_attribute ) EQ abap_false. | |
sy-subrc = 1. | |
WHILE sy-subrc <> 0. | |
ADD 1 TO g_attribute_id. | |
ls_attribute-attribute_id = g_attribute_id. | |
INSERT ls_attribute INTO TABLE g_attributes. | |
ENDWHILE. | |
ENDIF. | |
ENDMETHOD. | |
METHOD add_string. | |
DATA ls_attribute LIKE LINE OF g_attributes. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_attribute. | |
ls_attribute-element_id = _get_element_id( element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name ). | |
ls_attribute-attribute_type = attribute_name. | |
ls_attribute-value_type = string_value. | |
ls_attribute-name = string. | |
" SAP_2_FAMIX_52 Do not attributes twice if they are added with identical attributes | |
IF _check_if_attr_already_there( ls_attribute ) EQ abap_false. | |
sy-subrc = 1. | |
WHILE sy-subrc <> 0. | |
ADD 1 TO g_attribute_id. | |
ls_attribute-attribute_id = g_attribute_id. | |
INSERT ls_attribute INTO TABLE g_attributes. | |
ENDWHILE. | |
ENDIF. | |
ENDMETHOD. | |
METHOD constructor. | |
g_processed_id = 0. | |
ENDMETHOD. | |
METHOD get_model. | |
DATA ls_public_element TYPE public_element_type. | |
DATA ls_public_attribute TYPE public_attribute_type. | |
DATA lt_public_attributes TYPE public_attributes_type. | |
CLEAR public_elements. | |
DATA ls_elements_in_model LIKE LINE OF g_elements_in_model. | |
LOOP AT g_elements_in_model INTO ls_elements_in_model. | |
CLEAR lt_public_attributes. | |
DATA ls_attributes LIKE LINE OF g_attributes. | |
LOOP AT g_attributes INTO ls_attributes WHERE element_id = ls_elements_in_model-element_id. | |
CLEAR ls_public_attribute. | |
ls_public_attribute-attribute_id = ls_attributes-attribute_id. | |
ls_public_attribute-attribute_type = ls_attributes-attribute_type. | |
ls_public_attribute-boolean = ls_attributes-boolean. | |
ls_public_attribute-reference = ls_attributes-reference. | |
ls_public_attribute-string = ls_attributes-name. | |
INSERT ls_public_attribute INTO TABLE lt_public_attributes. | |
ENDLOOP. | |
CLEAR ls_public_element. | |
ls_public_element-element_type = ls_elements_in_model-element_type. | |
ls_public_element-element_id = ls_elements_in_model-element_id. | |
ls_public_element-is_named_entity = ls_elements_in_model-is_named_entity. | |
ls_public_element-is_id_required = ls_elements_in_model-is_id_required. | |
ls_public_element-public_attributes = lt_public_attributes. | |
INSERT ls_public_element INTO TABLE public_elements. | |
ENDLOOP. | |
ENDMETHOD. | |
METHOD make_mse. | |
" SAP_2_FAMIX_34 Allow to export the model in the .mse Moose format | |
DATA: mse_model_line TYPE line_type. | |
mse_model_line-line = |( |. | |
SORT g_elements_in_model BY element_id. | |
DATA is_first TYPE boolean VALUE abap_true. | |
FIELD-SYMBOLS <element_in_model> LIKE LINE OF g_elements_in_model. | |
LOOP AT g_elements_in_model ASSIGNING <element_in_model>. | |
IF is_first EQ abap_false. | |
APPEND mse_model_line TO mse_model. | |
CLEAR mse_model_line. | |
ENDIF. | |
mse_model_line-line = mse_model_line-line && |(| && <element_in_model>-element_type. | |
IF <element_in_model>-is_named_entity EQ abap_true | |
OR <element_in_model>-is_id_required EQ abap_true. | |
mse_model_line-line = mse_model_line-line && | (id: | && <element_in_model>-element_id && | )|. | |
ENDIF. | |
FIELD-SYMBOLS <attribute> LIKE LINE OF g_attributes. | |
LOOP AT g_attributes ASSIGNING <attribute> WHERE element_id = <element_in_model>-element_id. | |
APPEND mse_model_line TO mse_model. | |
mse_model_line-line = | (| && <attribute>-attribute_type. | |
ASSERT ( <attribute>-value_type EQ string_value ) OR ( <attribute>-value_type EQ reference_value ) OR ( <attribute>-value_type EQ boolean_value ). | |
CASE <attribute>-value_type. | |
WHEN string_value. | |
mse_model_line-line = mse_model_line-line && | '| && <attribute>-name && |')|. | |
WHEN reference_value. | |
mse_model_line-line = mse_model_line-line && | (ref: | && <attribute>-reference && |))|. | |
WHEN boolean_value. | |
ASSERT ( <attribute>-boolean EQ abap_true ) OR ( <attribute>-boolean EQ abap_false ). | |
CASE <attribute>-boolean. | |
WHEN abap_true. | |
mse_model_line-line = mse_model_line-line && | true)|. | |
WHEN abap_false. | |
mse_model_line-line = mse_model_line-line && | false)|. | |
ENDCASE. | |
ENDCASE. | |
ENDLOOP. | |
mse_model_line-line = mse_model_line-line && |)|. | |
is_first = abap_false. | |
ENDLOOP. | |
mse_model_line-line = mse_model_line-line && |)|. | |
APPEND mse_model_line TO mse_model. | |
ENDMETHOD. | |
METHOD _check_if_attr_already_there. | |
" Check if attribute is already there | |
DATA ls_attribute_2 TYPE attribute_type. | |
DATA ls_attribute_3 TYPE attribute_type. | |
ls_attribute_3 = attribute. | |
CLEAR ls_attribute_3-attribute_id. | |
already_there = abap_false. | |
LOOP AT g_attributes INTO ls_attribute_2 WHERE element_id = attribute-element_id. | |
CLEAR ls_attribute_2-attribute_id. | |
IF ls_attribute_2 EQ ls_attribute_3. | |
already_there = abap_true. | |
EXIT. | |
ENDIF. | |
ENDLOOP. | |
ENDMETHOD. | |
METHOD _get_element_id. | |
" Get element ID | |
IF element_id <> 0. | |
my_element_id = element_id. | |
ELSE. | |
ASSERT element_name_group IS NOT INITIAL. | |
FIELD-SYMBOLS <element_named_entity> LIKE LINE OF g_named_entities. | |
READ TABLE g_named_entities ASSIGNING <element_named_entity> WITH TABLE KEY element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name. | |
ASSERT sy-subrc EQ 0. "OK | |
my_element_id = <element_named_entity>-element_id. | |
ENDIF. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_output_model DEFINITION | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS make | |
IMPORTING | |
mse_model TYPE cl_model=>lines_type | |
g_parameter_download_file TYPE abap_bool | |
i_default_prefix TYPE string. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_OUTPUT_MODEL IMPLEMENTATION. | |
METHOD make. | |
" Download the file | |
DATA: filename TYPE string, | |
default_file_name TYPE string, | |
pathname TYPE string, | |
fullpath TYPE string, | |
user_action TYPE i. | |
default_file_name = |{ i_default_prefix }_{ sy-sysid }_{ sy-datum }_{ sy-uzeit }|. | |
IF g_parameter_download_file EQ abap_true. | |
cl_gui_frontend_services=>file_save_dialog( EXPORTING default_extension = 'mse' | |
default_file_name = default_file_name | |
CHANGING filename = filename " File Name to Save | |
path = pathname " Path to File | |
fullpath = fullpath " Path + File Name | |
user_action = user_action ). " User Action (C Class Const ACTION_OK, ACTION_OVERWRITE etc) | |
IF user_action = cl_gui_frontend_services=>action_cancel. | |
WRITE: / 'Canceled by user'. | |
ELSE. | |
CALL FUNCTION 'GUI_DOWNLOAD' | |
EXPORTING | |
filename = fullpath | |
TABLES | |
data_tab = mse_model. | |
ENDIF. | |
ENDIF. | |
ENDMETHOD. | |
ENDCLASS. | |
******************************************** End Include Z_MSE_ABAP ******************************* | |
" include z_famix. | |
******************************************** Begin Include Z_FAMIX_ABAP *************************** | |
*The MIT License (MIT) | |
* | |
*Copyright (c) 2016 Rainer Winkler, CubeServ | |
* | |
*Permission is hereby granted, free of charge, to any person obtaining a copy | |
*of this software and associated documentation files (the "Software"), to deal | |
*in the Software without restriction, including without limitation the rights | |
*to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
*copies of the Software, and to permit persons to whom the Software is | |
*furnished to do so, subject to the following conditions: | |
* | |
*The above copyright notice and this permission notice shall be included in all | |
*copies or substantial portions of the Software. | |
* | |
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
*IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
*FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
*AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
*LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
*OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
*SOFTWARE. | |
CLASS cl_famix_entity DEFINITION ABSTRACT | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
PROTECTED SECTION. | |
DATA g_elementname TYPE string. | |
DATA g_model TYPE REF TO cl_model. | |
DATA g_last_used_id TYPE i. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_ENTITY IMPLEMENTATION. | |
METHOD constructor. | |
g_model = model. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_sourced_entity DEFINITION ABSTRACT INHERITING FROM cl_famix_entity | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
"! Declare source language | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter source_language_element | the FAMIX element of the source language | |
"! @parameter source_language_name | the name of the source language | |
METHODS set_declared_source_language | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
source_language_element TYPE clike | |
source_language_name TYPE clike. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_SOURCED_ENTITY IMPLEMENTATION. | |
METHOD set_declared_source_language. | |
g_model->add_reference_by_name( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'declaredSourceLanguage' | |
type_of_reference = source_language_element | |
name_of_reference = source_language_name ). | |
ENDMETHOD. | |
ENDCLASS. | |
class CL_FAMIX_FILE_ANCHOR definition | |
inheriting from CL_FAMIX_ENTITY | |
create public . | |
public section. | |
"! Call once to create a new file anchor entiry | |
"! @parameter element_id | The ID of the element for which a source is specified | |
"! @parameter file_name | The path or link to the source | |
methods ADD | |
importing | |
!ELEMENT_ID type I | |
!FILE_NAME type CLIKE | |
exporting | |
value(ID) type I . | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
ENDCLASS. | |
CLASS CL_FAMIX_FILE_ANCHOR IMPLEMENTATION. | |
METHOD add. | |
g_model->add_entity( EXPORTING elementname = |FAMIX.FileAnchor| | |
name_group = |FILE_ANCHOR| | |
is_named_entity = abap_false | |
is_id_required = abap_true | |
can_be_referenced_by_name = abap_false | |
IMPORTING processed_id = id ). | |
g_model->add_reference_by_id( EXPORTING element_id = id | |
attribute_name = 'element' | |
reference_id = element_id ). | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'fileName' | |
string = file_name ). | |
g_last_used_id = id. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_named_entity DEFINITION INHERITING FROM cl_famix_sourced_entity ABSTRACT | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
"! Call once to create a new named entity | |
"! @parameter exists_already_with_id | Contains the id if entry already existed. | |
"! @parameter id | The id in model either if just created or already existing. | |
"! @parameter modifiers | A list of modifiers separated by blank. This attribute is marked by an asterisk in the Moose Meta Browser, which may be the sign of this. Will be an Ordered Collection in Moose. | |
METHODS add | |
IMPORTING name_group TYPE clike OPTIONAL | |
name TYPE clike | |
modifiers TYPE clike OPTIONAL | |
EXPORTING VALUE(exists_already_with_id) TYPE i | |
VALUE(id) TYPE i. | |
"! Call once to set the parent package | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter parent_package | the name of an element of type FAMIX.Package | |
METHODS set_parent_package IMPORTING element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
parent_package TYPE clike | |
parent_package_name_group TYPE clike. | |
"! Set the container an element is in using the reference | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter container_element | the FAMIX element of the Container | |
"! @parameter source_anchor_id | the id of the SoureceAnchor | |
METHODS set_source_anchor_by_id IMPORTING element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
source_anchor_id TYPE i. | |
PROTECTED SECTION. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_NAMED_ENTITY IMPLEMENTATION. | |
METHOD add. | |
" ASSERT name_group IS NOT INITIAL. | |
g_model->add_entity( EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_true | |
name_group = name_group | |
name = name | |
IMPORTING exists_already_with_id = exists_already_with_id | |
processed_id = id ). | |
IF modifiers IS SUPPLIED. | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'modifiers' | |
string = modifiers ). | |
ENDIF. | |
g_last_used_id = id. | |
ENDMETHOD. | |
METHOD set_parent_package. | |
g_model->add_reference_by_name( element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name type_of_reference = 'FAMIX.Package' | |
name_of_reference = parent_package | |
name_group_of_reference = parent_package_name_group | |
attribute_name = 'parentPackage' ). | |
ENDMETHOD. | |
METHOD set_source_anchor_by_id. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'sourceAnchor' | |
reference_id = source_anchor_id ). | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_attribute DEFINITION INHERITING FROM cl_famix_named_entity | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
"! Store the relation between class, attribute name and id in internal table to enable associations | |
"! Call before performing the next time the method add, because the ID is stored internally after creating an element | |
"! @parameter class | the class of the method | |
"! @parameter attribute | the attribute name | |
METHODS store_id | |
IMPORTING | |
name_group TYPE clike | |
class TYPE clike | |
attribute TYPE clike. | |
"! Returns the ID for a given attribute of a class | |
"! Returns 0 if the attribute is not known | |
"! @parameter class | the class of the attribute | |
"! @parameter attribute | the attribute name | |
"! @parameter id | the ID of the element | |
METHODS get_id | |
IMPORTING | |
name_group TYPE clike | |
class TYPE clike | |
attribute TYPE clike | |
RETURNING VALUE(id) TYPE i. | |
METHODS add REDEFINITION. | |
"! set the parent type, for instance the class the method is contained in | |
"! Provide either ID or type and name of element | |
"! For parent: provide either parent_element and parent_name or parent_id | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter parent_element | the FAMIX element of the parent Type | |
"! @parameter parent_name_group | the name group of the parent element | |
"! @parameter parent_name | the name of the parent element | |
"! @parameter parent_id | the id of the parent element | |
METHODS set_parent_type | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
parent_element TYPE clike OPTIONAL | |
parent_name_group TYPE clike OPTIONAL | |
parent_name TYPE clike OPTIONAL | |
parent_id TYPE i OPTIONAL. | |
protected section. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF attribute_id_type, | |
name_group TYPE string, | |
class TYPE string, | |
attribute TYPE string, | |
id TYPE i, | |
END OF attribute_id_type. | |
DATA: g_attribute_ids TYPE HASHED TABLE OF attribute_id_type WITH UNIQUE KEY name_group class attribute. | |
ENDCLASS. | |
CLASS CL_FAMIX_ATTRIBUTE IMPLEMENTATION. | |
METHOD add. | |
g_model->add_entity( | |
EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_false | |
name = name | |
IMPORTING processed_id = id ). | |
g_last_used_id = id. | |
ENDMETHOD. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.Attribute'. | |
ENDMETHOD. | |
METHOD get_id. | |
FIELD-SYMBOLS <attribute_id> LIKE LINE OF g_attribute_ids. | |
READ TABLE g_attribute_ids ASSIGNING <attribute_id> WITH TABLE KEY name_group = name_group class = class attribute = attribute. | |
IF sy-subrc EQ 0. "OK | |
id = <attribute_id>-id. | |
ELSE. | |
id = 0. | |
ENDIF. | |
ENDMETHOD. | |
METHOD set_parent_type. | |
ASSERT ( parent_element IS SUPPLIED AND parent_name IS SUPPLIED ) | |
OR parent_id IS SUPPLIED. | |
IF parent_element IS SUPPLIED AND parent_name IS SUPPLIED. | |
g_model->add_reference_by_name( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'parentType' | |
type_of_reference = parent_element | |
name_group_of_reference = parent_name_group | |
name_of_reference = parent_name ). | |
ELSEIF parent_id IS SUPPLIED. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'parentType' | |
reference_id = parent_id ). | |
ENDIF. | |
ENDMETHOD. | |
METHOD store_id. | |
DATA ls_attribute_id LIKE LINE OF g_attribute_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_attribute_id. | |
ls_attribute_id-id = g_last_used_id. | |
ls_attribute_id-name_group = name_group. | |
ls_attribute_id-class = class. | |
ls_attribute_id-attribute = attribute. | |
INSERT ls_attribute_id INTO TABLE g_attribute_ids. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_container_entity DEFINITION INHERITING FROM cl_famix_named_entity ABSTRACT | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
"! Set the container an element is in | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter container_element | the FAMIX element of the Container | |
"! @parameter parent_container | the name of the Container | |
METHODS set_container IMPORTING element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL container_element TYPE clike | |
parent_container TYPE clike | |
parent_container_name_group TYPE clike. | |
"! Set the container an element is in using the reference | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter container_element | the FAMIX element of the Container | |
"! @parameter parent_container_id | the id of the Container | |
METHODS set_container_by_id IMPORTING element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL container_element TYPE clike | |
parent_container_id TYPE i. | |
PROTECTED SECTION. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_CONTAINER_ENTITY IMPLEMENTATION. | |
METHOD set_container. | |
g_model->add_reference_by_name( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
type_of_reference = container_element | |
name_of_reference = parent_container | |
name_group_of_reference = parent_container_name_group | |
attribute_name = 'container' ). | |
ENDMETHOD. | |
METHOD set_container_by_id. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'container' | |
reference_id = parent_container_id ). | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_behavioural_entty DEFINITION INHERITING FROM CL_famix_container_entity ABSTRACT | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
"! Set the signature of a method | |
"! This might not be relevant for ABAP, but is contained here for completeness | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter signature | The signature like myMethod( myParameters, ...) | |
METHODS set_signature IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
signature TYPE clike. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_BEHAVIOURAL_ENTTY IMPLEMENTATION. | |
METHOD set_signature. | |
g_model->add_string( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'signature' | |
string = signature ). | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_package DEFINITION INHERITING FROM cl_famix_named_entity | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
METHODS add REDEFINITION. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_PACKAGE IMPLEMENTATION. | |
METHOD add. | |
g_model->add_entity( EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_true | |
name_group = name_group | |
name = name | |
IMPORTING exists_already_with_id = exists_already_with_id | |
processed_id = id ). | |
g_last_used_id = id. | |
ENDMETHOD. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.Package'. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_method DEFINITION INHERITING FROM CL_famix_behavioural_entty | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
METHODS add REDEFINITION. | |
"! set the parent type, for instance the class the method is contained in | |
"! Provide either parent_name or parent_id | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter parent_element | the FAMIX element of the parent Type | |
"! @parameter parent_name_group | optional the name group of the parent element | |
"! @parameter parent_name | optional the name of the parent element | |
"! @parameter parent_id | optional the id of the parent element | |
METHODS set_parent_type | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
parent_element TYPE clike | |
parent_name_group TYPE clike OPTIONAL | |
parent_name TYPE clike OPTIONAL | |
parent_id TYPE i OPTIONAL. | |
"! Store the relation between class, method name and id in internal table to enable associations | |
"! Call before performing the next time the method add, because the ID is stored internally after creating an element | |
"! @parameter class_name_group | the name group of the class of the method | |
"! @parameter class | the class of the method | |
"! @parameter method_name_group | the name group of the method name | |
"! @parameter method | the method name | |
METHODS store_id | |
IMPORTING class_name_group TYPE clike | |
class TYPE clike | |
method_name_group TYPE clike | |
method TYPE clike. | |
"! Returns the ID for a given method of a class | |
"! Returns 0 if the class is not known | |
"! @parameter class_name_group | the name group of the class of the method | |
"! @parameter class | the class of the method | |
"! @parameter method_name_group | the name group of the method name | |
"! @parameter method | the method name | |
"! @parameter id | the ID of the element | |
METHODS get_id | |
IMPORTING class_name_group TYPE clike | |
class TYPE clike | |
method_name_group TYPE clike | |
method TYPE clike | |
RETURNING VALUE(id) TYPE i. | |
protected section. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_method_id, | |
class_name_group TYPE string, | |
class TYPE string, | |
method_name_group TYPE string, | |
method TYPE string, | |
id TYPE i, | |
END OF ty_method_id. | |
DATA: g_method_ids TYPE HASHED TABLE OF ty_method_id WITH UNIQUE KEY class_name_group class method_name_group method. | |
ENDCLASS. | |
CLASS CL_FAMIX_METHOD IMPLEMENTATION. | |
METHOD add. | |
g_model->add_entity( | |
EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_false | |
name = name | |
IMPORTING processed_id = id ). | |
g_last_used_id = id. | |
ENDMETHOD. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.Method'. | |
ENDMETHOD. | |
METHOD get_id. | |
FIELD-SYMBOLS <method_id> LIKE LINE OF g_method_ids. | |
READ TABLE g_method_ids ASSIGNING <method_id> WITH TABLE KEY class_name_group = class_name_group | |
class = class | |
method_name_group = method_name_group | |
method = method. | |
IF sy-subrc EQ 0. "OK | |
id = <method_id>-id. | |
ELSE. | |
id = 0. | |
ENDIF. | |
ENDMETHOD. | |
METHOD set_parent_type. | |
ASSERT parent_name IS SUPPLIED OR parent_id IS SUPPLIED. | |
IF parent_name IS SUPPLIED. | |
g_model->add_reference_by_name( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'parentType' | |
type_of_reference = parent_element | |
name_group_of_reference = parent_name_group | |
name_of_reference = parent_name ). | |
ELSEIF parent_id IS SUPPLIED. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'parentType' | |
reference_id = parent_id ). | |
ENDIF. | |
ENDMETHOD. | |
METHOD store_id. | |
DATA ls_method_id LIKE LINE OF g_method_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_method_id. | |
ls_method_id-id = g_last_used_id. | |
ls_method_id-class_name_group = class_name_group. | |
ls_method_id-class = class. | |
ls_method_id-method_name_group = method_name_group. | |
ls_method_id-method = method. | |
INSERT ls_method_id INTO TABLE g_method_ids. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_class DEFINITION INHERITING FROM CL_famix_container_entity | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
"! Set if it is an interface | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
METHODS is_interface | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL . | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_CLASS IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.Class'. | |
ENDMETHOD. | |
METHOD is_interface. | |
g_model->add_boolean( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'isInterface' | |
is_true = abap_true ). | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_association DEFINITION INHERITING FROM cl_famix_sourced_entity ABSTRACT | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS add | |
RETURNING VALUE(id) TYPE i. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_ASSOCIATION IMPLEMENTATION. | |
METHOD add. | |
g_model->add_entity( EXPORTING elementname = g_elementname | |
is_named_entity = abap_false | |
can_be_referenced_by_name = abap_false | |
IMPORTING processed_id = id ). | |
g_last_used_id = id. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_access DEFINITION INHERITING FROM CL_famix_association | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
"! Checks that accessor and variable of an access are a new access | |
"! @parameter accessor_id | the accessing method or function (type BehaviouralEntity) | |
"! @parameter variable_id | the accessed parameter, variable ... (type StructuralEntity) | |
METHODS is_new_access | |
IMPORTING | |
accessor_id TYPE i | |
variable_id TYPE i | |
RETURNING VALUE(is_new) TYPE abap_bool. | |
"! defines accessor and variable of an access | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter accessor_id | the accessing method or function (type BehaviouralEntity) | |
"! @parameter variable_id | the accessed parameter, variable ... (type StructuralEntity) | |
METHODS set_accessor_variable_relation | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
accessor_id TYPE i | |
variable_id TYPE i. | |
protected section. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_accessor_variable_id, | |
accessor_id TYPE i, | |
variable_id TYPE i, | |
END OF ty_accessor_variable_id. | |
DATA: g_accessor_variable_ids TYPE HASHED TABLE OF ty_accessor_variable_id WITH UNIQUE KEY accessor_id variable_id. | |
ENDCLASS. | |
CLASS CL_FAMIX_ACCESS IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.Access'. | |
ENDMETHOD. | |
METHOD is_new_access. | |
READ TABLE g_accessor_variable_ids TRANSPORTING NO FIELDS WITH TABLE KEY accessor_id = accessor_id variable_id = variable_id. | |
IF sy-subrc <> 0. "OK | |
is_new = abap_true. | |
ENDIF. | |
ENDMETHOD. | |
METHOD set_accessor_variable_relation. | |
DATA ls_accessor_id LIKE LINE OF g_accessor_variable_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_accessor_id. | |
ls_accessor_id-accessor_id = accessor_id. | |
ls_accessor_id-variable_id = variable_id. | |
INSERT ls_accessor_id INTO TABLE g_accessor_variable_ids. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'accessor' | |
reference_id = accessor_id ). | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'variable' | |
reference_id = variable_id ). | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_invocation DEFINITION INHERITING FROM CL_famix_association | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
METHODS is_new_invocation_to_candidate | |
IMPORTING | |
sender_id TYPE i | |
candidates_id TYPE i | |
RETURNING VALUE(is_new) TYPE abap_bool. | |
"! defines an invocation | |
"! this also models standard call by functions or methods to components other than attributes | |
"! Us this method to reference the receiver using his id | |
"! Provide either ID or type and name of element | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter elemenent_type | the element type of the element (not needed if ID is provided) | |
"! @parameter element_name_group | the name group of the element where the ID shall be added | |
"! @parameter element_name | the name of the element | |
"! @parameter sender_id | the id of the sender or calling method or function | |
"! @parameter candidates_id | the id of the candidate, this is the used method or function of type BehaviouralEntity in case of method or function usage | |
"! @parameter receiver_id | optional the id of the receiver or called method or function | |
"! @parameter signature | optional a signature | |
"! @parameter receiver_source_code | optional a receiver source code | |
METHODS set_invocation_by_reference | |
IMPORTING | |
element_id TYPE i | |
element_type TYPE clike OPTIONAL | |
element_name_group TYPE clike OPTIONAL | |
element_name TYPE clike OPTIONAL | |
sender_id TYPE i | |
candidates_id TYPE i OPTIONAL | |
receiver_id TYPE i OPTIONAL | |
signature TYPE clike OPTIONAL | |
receiver_source_code TYPE clike OPTIONAL. | |
protected section. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_sender_candidate, | |
sender_id TYPE i, | |
candidates_id TYPE i, | |
END OF ty_sender_candidate. | |
DATA g_sender_candidates TYPE HASHED TABLE OF ty_sender_candidate WITH UNIQUE KEY sender_id candidates_id. | |
ENDCLASS. | |
CLASS CL_FAMIX_INVOCATION IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.Invocation'. | |
ENDMETHOD. | |
METHOD is_new_invocation_to_candidate. | |
READ TABLE g_sender_candidates TRANSPORTING NO FIELDS WITH TABLE KEY sender_id = sender_id candidates_id = candidates_id. | |
IF sy-subrc <> 0. "OK | |
is_new = abap_true. | |
ENDIF. | |
ENDMETHOD. | |
METHOD set_invocation_by_reference. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'sender' | |
reference_id = sender_id ). | |
IF candidates_id IS SUPPLIED. | |
DATA ls_sender_candidate LIKE LINE OF g_sender_candidates. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_sender_candidate. | |
ls_sender_candidate-sender_id = sender_id. | |
ls_sender_candidate-candidates_id = candidates_id. | |
INSERT ls_sender_candidate INTO TABLE g_sender_candidates. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name attribute_name = 'candidates' | |
reference_id = candidates_id ). | |
ENDIF. | |
IF receiver_id IS SUPPLIED. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'receiver' | |
reference_id = receiver_id ). | |
ENDIF. | |
IF signature IS SUPPLIED. | |
g_model->add_string( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name | |
attribute_name = 'signature' | |
string = signature ). | |
ENDIF. | |
IF receiver_source_code IS SUPPLIED. | |
g_model->add_string( EXPORTING element_id = element_id | |
element_type = element_type | |
element_name_group = element_name_group | |
element_name = element_name attribute_name = 'receiverSourceCode' | |
string = receiver_source_code ). | |
ENDIF. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_inheritance DEFINITION INHERITING FROM CL_famix_association | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
"! defines an inheritance | |
"! @parameter element_id | the ID of the element where the ID shall be added | |
"! @parameter subclass_element | the FAMIX element of the subclass Type | |
"! @parameter subclass_name_group | the name group of the subclass | |
"! @parameter subclass_name | the name of the subclass | |
"! @parameter superclass_element | the FAMIX element of the subclass Type | |
"! @parameter superclass_name_group | the name group | |
"! @parameter superclass_name | the name of the subclass of the superclass | |
METHODS set_sub_and_super_class | |
IMPORTING | |
element_id TYPE i | |
subclass_element TYPE clike | |
subclass_name_group TYPE clike | |
subclass_name TYPE clike | |
superclass_element TYPE clike | |
superclass_name_group TYPE clike | |
superclass_name TYPE clike. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_INHERITANCE IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.Inheritance'. | |
ENDMETHOD. | |
METHOD set_sub_and_super_class. | |
g_model->add_reference_by_name( EXPORTING element_id = element_id | |
attribute_name = 'subclass' | |
type_of_reference = subclass_element | |
name_group_of_reference = subclass_name_group | |
name_of_reference = subclass_name ). | |
g_model->add_reference_by_name( EXPORTING element_id = element_id | |
attribute_name = 'superclass' | |
type_of_reference = superclass_element | |
name_group_of_reference = superclass_name_group | |
name_of_reference = superclass_name ). | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS cl_famix_custom_source_lng DEFINITION INHERITING FROM cl_famix_entity | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
"! @parameter exists_already_with_id | contains the id if entry already existed | |
METHODS add IMPORTING name TYPE clike | |
name_group TYPE clike | |
EXPORTING VALUE(exists_already_with_id) TYPE i | |
VALUE(id) TYPE i. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_CUSTOM_SOURCE_LNG IMPLEMENTATION. | |
METHOD add. | |
g_model->add_entity( EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_true | |
name = name | |
name_group = name_group | |
IMPORTING exists_already_with_id = exists_already_with_id | |
processed_id = id ). | |
g_last_used_id = id. | |
ENDMETHOD. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.CustomSourceLanguage'. | |
ENDMETHOD. | |
ENDCLASS. | |
class ZCX_2MSE_EXTR3_CLASSES_WR_TYPE definition | |
inheriting from CX_NO_CHECK | |
create public . | |
public section. | |
interfaces IF_T100_DYN_MSG . | |
interfaces IF_T100_MESSAGE . | |
methods CONSTRUCTOR | |
importing | |
!TEXTID like IF_T100_MESSAGE=>T100KEY optional | |
!PREVIOUS like PREVIOUS optional . | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS ZCX_2MSE_EXTR3_CLASSES_WR_TYPE IMPLEMENTATION. | |
method CONSTRUCTOR. | |
CALL METHOD SUPER->CONSTRUCTOR | |
EXPORTING | |
PREVIOUS = PREVIOUS | |
. | |
clear me->textid. | |
if textid is initial. | |
IF_T100_MESSAGE~T100KEY = IF_T100_MESSAGE=>DEFAULT_TEXTID. | |
else. | |
IF_T100_MESSAGE~T100KEY = TEXTID. | |
endif. | |
endmethod. | |
ENDCLASS. | |
" Obsolete: | |
CLASS cl_famix_module DEFINITION INHERITING FROM cl_famix_named_entity | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
METHODS add REDEFINITION. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS CL_FAMIX_MODULE IMPLEMENTATION. | |
METHOD add. | |
g_model->add_entity( EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_true | |
name = name | |
name_group = name_group | |
IMPORTING exists_already_with_id = exists_already_with_id | |
processed_id = id ). | |
g_last_used_id = id. | |
ENDMETHOD. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'FAMIX.Module'. | |
ENDMETHOD. | |
ENDCLASS. | |
******************************************** End Include Z_FAMIX_ABAP ***************************** | |
class CL_SOMIX_ENTITY definition | |
abstract | |
create public . | |
public section. | |
methods CONSTRUCTOR | |
importing | |
!MODEL type ref to CL_MODEL . | |
protected section. | |
data G_MODEL type ref to CL_MODEL . | |
data G_ELEMENTNAME type STRING . | |
data G_LAST_USED_ID type I . | |
private section. | |
ENDCLASS. | |
CLASS cl_somix_coupling DEFINITION | |
INHERITING FROM cl_somix_entity | |
ABSTRACT | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
METHODS add | |
RETURNING VALUE(id) TYPE i. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
ENDCLASS. | |
CLASS cl_somix_access DEFINITION | |
INHERITING FROM cl_somix_coupling | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
METHODS set_accessor_accessed_relation | |
IMPORTING | |
element_id TYPE i | |
accessor_id TYPE i | |
accessed_id TYPE i | |
is_write TYPE abap_bool | |
is_read TYPE abap_bool | |
is_dependent TYPE abap_bool. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_accessor_accessed_id, | |
accessor_id TYPE i, | |
accessed_id TYPE i, | |
END OF ty_accessor_accessed_id. | |
DATA: g_accessor_accessed_ids TYPE HASHED TABLE OF ty_accessor_accessed_id WITH UNIQUE KEY accessor_id accessed_id. | |
ENDCLASS. | |
CLASS cl_somix_call DEFINITION | |
INHERITING FROM cl_somix_coupling | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
METHODS set_caller_called_relation | |
IMPORTING | |
element_id TYPE i | |
caller_id TYPE i | |
called_id TYPE i. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_caller_called, | |
caller_id TYPE i, | |
called_id TYPE i, | |
END OF ty_caller_called. | |
DATA g_caller_called_ids TYPE HASHED TABLE OF ty_caller_called WITH UNIQUE KEY caller_id called_id. | |
ENDCLASS. | |
CLASS cl_somix_element DEFINITION | |
INHERITING FROM cl_somix_entity | |
ABSTRACT | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
ENDCLASS. | |
class CL_SOMIX_COMPONENT definition | |
inheriting from CL_SOMIX_ELEMENT | |
abstract | |
create public . | |
public section. | |
protected section. | |
data IS_PART_OF type ref to CL_SOMIX_COMPONENT . | |
data PART_SPECIFICATION type STRING . | |
private section. | |
ENDCLASS. | |
CLASS cl_somix_code DEFINITION | |
INHERITING FROM cl_somix_component | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
METHODS constructor | |
IMPORTING | |
!model TYPE REF TO cl_model . | |
"! Call method to store ID before add is used the next time for the same type of element | |
METHODS add | |
IMPORTING | |
grouping_name_group TYPE clike | |
grouping TYPE clike | |
code_name_group TYPE clike | |
code TYPE clike | |
!technical_type TYPE clike | |
!link_to_editor TYPE clike | |
EXPORTING | |
VALUE(exists_already_with_id) TYPE i | |
VALUE(id) TYPE i | |
CHANGING | |
unique_name TYPE clike. | |
"! Returns the ID for a given code. May use a grouping it is contained in. | |
"! Returns 0 if the data is not known | |
"! @parameter grouping_name_group | the name group of the grouping | |
"! @parameter grouping | the grouping | |
"! @parameter code_name_group | the name group of the code | |
"! @parameter code | the ID of the element | |
METHODS get_id | |
IMPORTING grouping_name_group TYPE clike | |
grouping TYPE clike | |
code_name_group TYPE clike | |
code TYPE clike | |
RETURNING VALUE(id) TYPE i. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_code_id, | |
grouping_name_group TYPE string, | |
grouping TYPE string, | |
code_name_group TYPE string, | |
code TYPE string, | |
id TYPE i, | |
END OF ty_code_id. | |
DATA: g_code_ids TYPE HASHED TABLE OF ty_code_id WITH UNIQUE KEY grouping_name_group grouping code_name_group code. | |
ENDCLASS. | |
CLASS cl_somix_data DEFINITION | |
INHERITING FROM cl_somix_component | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
METHODS constructor | |
IMPORTING | |
!model TYPE REF TO cl_model . | |
"! Call method to store ID before add is used the next time for the same type of element | |
METHODS add | |
IMPORTING | |
grouping_name_group TYPE clike | |
grouping TYPE clike | |
data_name_group TYPE clike | |
data TYPE clike | |
!technical_type TYPE clike | |
!link_to_editor TYPE clike | |
EXPORTING | |
VALUE(exists_already_with_id) TYPE i | |
VALUE(id) TYPE i | |
CHANGING | |
unique_name TYPE clike. | |
"! Returns the ID for a given data. May use also a grouping the data is contained. | |
"! Returns 0 if the attribute is not known | |
"! @parameter grouping_name_group | the namegroup of the grouping the data is contained in | |
"! @parameter grouping | a grouping the data is contained in | |
"! @parameter data_name_group | the the namegroup of the data | |
"! @parameter data | the data name | |
"! @parameter id | the ID of the element | |
METHODS get_id | |
IMPORTING | |
grouping_name_group TYPE clike | |
grouping TYPE clike | |
data_name_group TYPE clike | |
data TYPE clike | |
RETURNING VALUE(id) TYPE i. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF data_id_type, | |
grouping_name_group TYPE string, | |
grouping TYPE string, | |
data_name_group TYPE string, | |
data TYPE string, | |
id TYPE i, | |
END OF data_id_type. | |
DATA: g_data_ids TYPE HASHED TABLE OF data_id_type WITH UNIQUE KEY grouping_name_group data_name_group grouping data. | |
DATA is_persistent TYPE abap_bool . ##TODO " Add attribute for this | |
ENDCLASS. | |
class CL_SOMIX_EXTRACTION definition | |
inheriting from CL_SOMIX_ENTITY | |
create public . | |
public section. | |
protected section. | |
private section. | |
ENDCLASS. | |
CLASS cl_somix_grouping DEFINITION | |
INHERITING FROM cl_somix_element | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
METHODS constructor | |
IMPORTING | |
!model TYPE REF TO cl_model . | |
"! Call method to store ID before add is used the next time for the same type of element | |
METHODS add | |
IMPORTING | |
!grouping_name_group TYPE clike | |
!grouping TYPE clike | |
!technical_type TYPE clike | |
!link_to_editor TYPE clike | |
EXPORTING | |
VALUE(exists_already_with_id) TYPE i | |
VALUE(id) TYPE i | |
CHANGING | |
unique_name TYPE clike. | |
"! Returns the ID for a given code. May use a grouping it is contained in. | |
"! Returns 0 if the data is not known | |
"! @parameter grouping_name_group | the name group of the grouping | |
"! @parameter grouping | the grouping | |
"! @parameter code_name_group | the name group of the code | |
"! @parameter code | the ID of the element | |
METHODS get_id | |
IMPORTING grouping_name_group TYPE clike | |
grouping TYPE clike | |
RETURNING VALUE(id) TYPE i. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_grouping_id, | |
grouping_name_group TYPE string, | |
grouping TYPE string, | |
id TYPE i, | |
END OF ty_grouping_id. | |
DATA: g_grouping_ids TYPE HASHED TABLE OF ty_grouping_id WITH UNIQUE KEY grouping_name_group grouping. | |
ENDCLASS. | |
CLASS cl_somix_parentchild DEFINITION | |
INHERITING FROM cl_somix_entity | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
TYPES: ty_helper_type TYPE c LENGTH 1. | |
METHODS constructor IMPORTING model TYPE REF TO cl_model. | |
METHODS add | |
IMPORTING | |
parent_id TYPE i | |
child_id TYPE i | |
is_main TYPE abap_bool | |
RETURNING VALUE(id) TYPE i. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_parent_child_id, | |
parent_id TYPE i, | |
child_id TYPE i, | |
element_id TYPE i, | |
END OF ty_parent_child_id. | |
DATA: g_parent_child_ids TYPE HASHED TABLE OF ty_parent_child_id WITH UNIQUE KEY parent_id child_id. | |
ENDCLASS. | |
CLASS CL_SOMIX_ACCESS IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'SOMIX.Access'. | |
ENDMETHOD. | |
METHOD set_accessor_accessed_relation. | |
DATA ls_accessor_id LIKE LINE OF g_accessor_accessed_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_accessor_id. | |
ls_accessor_id-accessor_id = accessor_id. | |
ls_accessor_id-accessed_id = accessed_id. | |
INSERT ls_accessor_id INTO TABLE g_accessor_accessed_ids. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
attribute_name = 'accessor' | |
reference_id = accessor_id ). | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
attribute_name = 'accessed' | |
reference_id = accessed_id ). | |
IF is_write EQ 'X'. | |
g_model->add_boolean( EXPORTING element_id = element_id | |
attribute_name = 'isWrite' | |
is_true = 'X' ). | |
ENDIF. | |
IF is_read EQ 'X'. | |
g_model->add_boolean( EXPORTING element_id = element_id | |
attribute_name = 'isRead' | |
is_true = 'X' ). " SAP2Moose cannot differenciate currently, between read, write, and dependency. So set here always. | |
ENDIF. | |
IF is_dependent EQ 'X'. | |
g_model->add_boolean( EXPORTING element_id = element_id | |
attribute_name = 'isDependent' | |
is_true = 'X' ). " SAP2Moose cannot differenciate currently, between read, write, and dependency. So set here always. | |
ENDIF. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_SOMIX_CALL IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'SOMIX.Call'. | |
ENDMETHOD. | |
METHOD set_caller_called_relation. | |
DATA ls_caller_called_id LIKE LINE OF g_caller_called_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_caller_called_id. | |
ls_caller_called_id-caller_id = caller_id. | |
ls_caller_called_id-called_id = called_id. | |
INSERT ls_caller_called_id INTO TABLE g_caller_called_ids. | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
attribute_name = 'caller' | |
reference_id = caller_id ). | |
g_model->add_reference_by_id( EXPORTING element_id = element_id | |
attribute_name = 'called' | |
reference_id = called_id ). | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_SOMIX_CODE IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'SOMIX.Code'. | |
ENDMETHOD. | |
METHOD get_id. | |
FIELD-SYMBOLS <code_id> LIKE LINE OF g_code_ids. | |
READ TABLE g_code_ids ASSIGNING <code_id> WITH TABLE KEY grouping_name_group = grouping_name_group | |
grouping = grouping | |
code_name_group = code_name_group | |
code = code. | |
IF sy-subrc EQ 0. "OK | |
id = <code_id>-id. | |
ELSE. | |
id = 0. | |
ENDIF. | |
ENDMETHOD. | |
METHOD add. | |
FIELD-SYMBOLS <code_id> LIKE LINE OF g_code_ids. | |
READ TABLE g_code_ids ASSIGNING <code_id> WITH TABLE KEY grouping_name_group = grouping_name_group | |
grouping = grouping | |
code_name_group = code_name_group | |
code = code. | |
IF sy-subrc EQ 0. | |
id = <code_id>-id. | |
ELSE. | |
g_model->add_entity( | |
EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_false | |
name = code | |
IMPORTING processed_id = id ). | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'technicalType' | |
string = technical_type ). | |
ENDIF. | |
ASSERT unique_name IS NOT INITIAL. | |
TRANSLATE unique_name TO LOWER CASE. " To be compatible with specification. Not case sensitive names are here in lower case. | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'uniqueName' | |
string = unique_name ). | |
IF link_to_editor IS NOT INITIAL. | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'linkToEditor' | |
string = link_to_editor ). | |
ENDIF. | |
DATA ls_code_id LIKE LINE OF g_code_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_code_id. | |
ls_code_id-id = id. | |
ls_code_id-grouping_name_group = grouping_name_group. | |
ls_code_id-grouping = grouping. | |
ls_code_id-code_name_group = code_name_group. | |
ls_code_id-code = code. | |
INSERT ls_code_id INTO TABLE g_code_ids. | |
g_last_used_id = id. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_SOMIX_COMPONENT IMPLEMENTATION. | |
ENDCLASS. | |
CLASS CL_SOMIX_COUPLING IMPLEMENTATION. | |
METHOD add. | |
g_model->add_entity( EXPORTING elementname = g_elementname | |
is_named_entity = abap_false | |
can_be_referenced_by_name = abap_false | |
IMPORTING processed_id = id ). | |
g_last_used_id = id. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_SOMIX_DATA IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'SOMIX.Data'. | |
ENDMETHOD. | |
METHOD get_id. | |
FIELD-SYMBOLS <data_id> LIKE LINE OF g_data_ids. | |
READ TABLE g_data_ids ASSIGNING <data_id> WITH TABLE KEY grouping_name_group = grouping_name_group grouping = grouping data_name_group = data_name_group data = data. | |
IF sy-subrc EQ 0. "OK | |
id = <data_id>-id. | |
ELSE. | |
id = 0. | |
ENDIF. | |
ENDMETHOD. | |
METHOD add. | |
FIELD-SYMBOLS <data_id> LIKE LINE OF g_data_ids. | |
READ TABLE g_data_ids ASSIGNING <data_id> WITH TABLE KEY grouping_name_group = grouping_name_group grouping = grouping data_name_group = data_name_group data = data. | |
IF sy-subrc EQ 0. "OK | |
id = <data_id>-id. | |
ELSE. | |
g_model->add_entity( | |
EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_false | |
name = data | |
IMPORTING processed_id = id ). | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'technicalType' | |
string = technical_type ). | |
ENDIF. | |
ASSERT unique_name IS NOT INITIAL. | |
TRANSLATE unique_name TO LOWER CASE. " To be compatible with specification. Not case sensitive names are here in lower case. | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'uniqueName' | |
string = unique_name ). | |
IF link_to_editor IS NOT INITIAL. | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'linkToEditor' | |
string = link_to_editor ). | |
ENDIF. | |
DATA ls_data_id LIKE LINE OF g_data_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_data_id. | |
ls_data_id-id = id. | |
ls_data_id-grouping_name_group = grouping_name_group. | |
ls_data_id-grouping = grouping. | |
ls_data_id-data_name_group = data_name_group. | |
ls_data_id-data = data. | |
INSERT ls_data_id INTO TABLE g_data_ids. | |
g_last_used_id = id. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_SOMIX_ELEMENT IMPLEMENTATION. | |
ENDCLASS. | |
CLASS CL_SOMIX_ENTITY IMPLEMENTATION. | |
METHOD constructor. | |
g_model = model. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_SOMIX_EXTRACTION IMPLEMENTATION. | |
ENDCLASS. | |
CLASS CL_SOMIX_GROUPING IMPLEMENTATION. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'SOMIX.Grouping'. | |
ENDMETHOD. | |
METHOD get_id. | |
FIELD-SYMBOLS <grouping_id> LIKE LINE OF g_grouping_ids. | |
READ TABLE g_grouping_ids ASSIGNING <grouping_id> WITH TABLE KEY grouping_name_group = grouping_name_group | |
grouping = grouping. | |
IF sy-subrc EQ 0. "OK | |
id = <grouping_id>-id. | |
ELSE. | |
id = 0. | |
ENDIF. | |
ENDMETHOD. | |
METHOD add. | |
FIELD-SYMBOLS <grouping_id> LIKE LINE OF g_grouping_ids. | |
READ TABLE g_grouping_ids ASSIGNING <grouping_id> WITH TABLE KEY grouping_name_group = grouping_name_group | |
grouping = grouping. | |
IF sy-subrc EQ 0. "OK | |
id = <grouping_id>-id. | |
ELSE. | |
g_model->add_entity( EXPORTING elementname = g_elementname | |
is_named_entity = abap_true | |
can_be_referenced_by_name = abap_true | |
name_group = grouping_name_group | |
name = grouping | |
IMPORTING exists_already_with_id = exists_already_with_id | |
processed_id = id ). | |
ENDIF. | |
ASSERT unique_name IS NOT INITIAL. | |
TRANSLATE unique_name TO LOWER CASE. " To be compatible with specification. Not case sensitive names are here in lower case. | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'uniqueName' | |
string = unique_name ). | |
IF technical_type IS NOT INITIAL. | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'technicalType' | |
string = technical_type ). | |
ENDIF. | |
IF link_to_editor IS NOT INITIAL. | |
g_model->add_string( EXPORTING element_id = id | |
attribute_name = 'linkToEditor' | |
string = link_to_editor ). | |
ENDIF. | |
DATA ls_grouping_id LIKE LINE OF g_grouping_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
CLEAR ls_grouping_id. | |
ls_grouping_id-id = id. | |
ls_grouping_id-grouping_name_group = grouping_name_group. | |
ls_grouping_id-grouping = grouping. | |
INSERT ls_grouping_id INTO TABLE g_grouping_ids. | |
g_last_used_id = id. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_SOMIX_PARENTCHILD IMPLEMENTATION. | |
METHOD add. | |
DATA ls_parent_id LIKE LINE OF g_parent_child_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion | |
READ TABLE g_parent_child_ids INTO ls_parent_id WITH TABLE KEY parent_id = parent_id | |
child_id = child_id. | |
IF sy-subrc EQ 0. | |
id = ls_parent_id-element_id. | |
ELSE. | |
g_model->add_entity( EXPORTING elementname = g_elementname | |
is_named_entity = abap_false | |
can_be_referenced_by_name = abap_false | |
IMPORTING processed_id = id ). | |
g_model->add_reference_by_id( EXPORTING element_id = id | |
attribute_name = 'parent' | |
reference_id = parent_id ). | |
g_model->add_reference_by_id( EXPORTING element_id = id | |
attribute_name = 'child' | |
reference_id = child_id ). | |
IF is_main EQ 'X'. | |
g_model->add_boolean( EXPORTING element_id = id | |
attribute_name = 'isMain' | |
is_true = 'X' ). | |
ENDIF. | |
CLEAR ls_parent_id. | |
ls_parent_id-parent_id = parent_id. | |
ls_parent_id-child_id = child_id. | |
ls_parent_id-element_id = id. | |
INSERT ls_parent_id INTO TABLE g_parent_child_ids. | |
ENDIF. | |
g_last_used_id = id. | |
ENDMETHOD. | |
METHOD constructor. | |
CALL METHOD super->constructor( model ). | |
g_elementname = 'SOMIX.ParentChild'. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_EXTR3_ACCESS_OR_INVOCATN DEFINITION DEFERRED. | |
CLASS CL_EXTR3_ASSOCIATION DEFINITION DEFERRED. | |
CLASS CL_EXTR3_MODEL_BUILDER DEFINITION DEFERRED. | |
CLASS CL_EXTR3_ELEMENTS DEFINITION DEFERRED. | |
"! I know all elements and associations between elements that are currently known. | |
"! I provide general methods to add new elements and associations between elements. | |
CLASS cl_extr3_element_manager DEFINITION | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
"! A unique identifier for each object extracted | |
TYPES element_id_type TYPE i . | |
TYPES: | |
BEGIN OF association_type, | |
element_id1 TYPE element_id_type, | |
element_id2 TYPE element_id_type, | |
ass_type TYPE c LENGTH 30, "To prevent problem with local classes, better would be: cl_extr3_association=>ass_type, | |
association TYPE REF TO cl_extr3_association, | |
END OF association_type . | |
TYPES: | |
associations_type TYPE STANDARD TABLE OF association_type WITH KEY element_id1 element_id2 ass_type association . | |
DATA model TYPE REF TO cl_model . | |
DATA famix_package TYPE REF TO cl_famix_package . | |
DATA famix_class TYPE REF TO cl_famix_class . | |
DATA famix_method TYPE REF TO cl_famix_method . | |
DATA famix_attribute TYPE REF TO cl_famix_attribute . | |
DATA famix_invocation TYPE REF TO cl_famix_invocation . | |
DATA famix_access TYPE REF TO cl_famix_access . | |
DATA famix_file_anchor TYPE REF TO cl_famix_file_anchor . | |
DATA somix_extraction TYPE REF TO cl_somix_extraction. | |
DATA somix_grouping TYPE REF TO cl_somix_grouping. | |
DATA somix_code TYPE REF TO cl_somix_code. | |
DATA somix_data TYPE REF TO cl_somix_data. | |
DATA somix_call TYPE REF TO cl_somix_call. | |
DATA somix_access TYPE REF TO cl_somix_access. | |
DATA somix_parentchild TYPE REF TO cl_somix_parentchild. | |
DATA exclude_found_sap_intf TYPE abap_bool READ-ONLY . | |
DATA interface_use_structure TYPE abap_bool READ-ONLY . | |
DATA model_builder TYPE REF TO cl_extr3_model_builder . | |
DATA use_somix TYPE abap_bool READ-ONLY . | |
METHODS constructor | |
IMPORTING | |
!i_model_builder TYPE REF TO cl_extr3_model_builder | |
!i_exclude_found_sap_intf TYPE abap_bool | |
!i_interface_use_structure TYPE abap_bool | |
!i_use_somix TYPE abap_bool OPTIONAL . | |
"! Call if an element might be added. | |
"! Add the element if it is not already part of the model. | |
METHODS add_element | |
IMPORTING | |
!element TYPE REF TO cl_extr3_elements | |
!is_specific TYPE abap_bool | |
RETURNING | |
VALUE(element_id) TYPE cl_extr3_element_manager=>element_id_type . | |
METHODS add_association | |
IMPORTING | |
!element_1 TYPE element_id_type | |
!element_2 TYPE element_id_type | |
!association TYPE REF TO cl_extr3_association . | |
"! Call so that the classes that contain the collected elements determine further informations that are required for the model. | |
METHODS collect_infos | |
IMPORTING | |
!sysid TYPE string OPTIONAL . | |
"! Call to build the mse model | |
METHODS make_model | |
RETURNING | |
VALUE(r_result) TYPE cl_model=>lines_type . | |
METHODS get_element | |
IMPORTING | |
!i_element_id TYPE element_id_type | |
RETURNING | |
VALUE(r_result) TYPE REF TO cl_extr3_elements . | |
METHODS get_associations | |
IMPORTING | |
!i_element_id TYPE element_id_type | |
RETURNING | |
VALUE(associations) TYPE associations_type . | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF element_type, | |
element_id TYPE element_id_type, | |
"! A reference to the instance that handles this object | |
element TYPE REF TO cl_extr3_elements, | |
END OF element_type. | |
TYPES elements_type TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. | |
DATA elements TYPE elements_type. | |
TYPES associations1_type TYPE SORTED TABLE OF association_type WITH UNIQUE KEY element_id1 element_id2 ass_type. | |
TYPES associations2_type TYPE SORTED TABLE OF association_type WITH UNIQUE KEY element_id2 element_id1 ass_type. | |
DATA associations1 TYPE associations1_type. | |
DATA associations2 TYPE associations2_type. | |
DATA next_element_id TYPE i. | |
ENDCLASS. | |
"! I am the top superclass for all classes that require the element manager. | |
CLASS cl_extr3 DEFINITION | |
CREATE PROTECTED . | |
PUBLIC SECTION. | |
"! Call once to clear all global variables. This is required before an extraction is repeated | |
CLASS-METHODS clear_all. | |
CONSTANTS: ng_source_language TYPE string VALUE 'SOURCE_LANGUAGE', | |
ng_abap_package TYPE string VALUE 'ABAP_PACKAGE', | |
ng_abap_class TYPE string VALUE 'ABAP_CLASS', | |
ng_abap_method TYPE string VALUE 'ABAP_METHOD', | |
ng_abap_attribute TYPE string VALUE 'ABAP_ATTRIBUTE', | |
ng_abap_program TYPE string VALUE 'ABAP_PROGRAM', | |
ng_abap_webdynpro TYPE string VALUE 'ABAP_WEBDYNPRO', | |
ng_database_schema TYPE string VALUE 'DATABASE_SCHEMA', | |
ng_sap_table TYPE string VALUE 'SAP_TABLE'. | |
PROTECTED SECTION. | |
DATA element_manager TYPE REF TO cl_extr3_element_manager. | |
METHODS constructor | |
IMPORTING | |
i_element_manager TYPE REF TO cl_extr3_element_manager. | |
PRIVATE SECTION. | |
ENDCLASS. | |
"! I describe an association between elements. | |
"! I have sub classes that specify concrete types of associations. | |
CLASS cl_extr3_association DEFINITION | |
INHERITING FROM cl_extr3. | |
PUBLIC SECTION. | |
types ass_type TYPE c LENGTH 30. | |
DATA type TYPE ass_type READ-ONLY. | |
CONSTANTS: parent_package_ass LIKE type VALUE 'parent_package', | |
access_ass LIKE type VALUE 'access', | |
invocation_ass LIKE type VALUE 'invocation'. | |
METHODS make_model | |
IMPORTING | |
association TYPE cl_extr3_element_manager=>association_type. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
ENDCLASS. | |
CLASS cl_extr3_access_or_invocatn DEFINITION | |
INHERITING FROM cl_extr3_association | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
PROTECTED SECTION. | |
METHODS _get_somix_id_used_and_using | |
IMPORTING | |
i_association TYPE cl_extr3_element_manager=>association_type | |
EXPORTING | |
e_using_id TYPE i | |
e_used_id TYPE i. | |
METHODS _get_famix_id_used_and_using | |
IMPORTING | |
i_association TYPE cl_extr3_element_manager=>association_type | |
EXPORTING | |
e_using_method_id TYPE i | |
e_used_id TYPE i. | |
PRIVATE SECTION. | |
ENDCLASS. | |
CLASS cl_extr3_access DEFINITION | |
INHERITING FROM cl_extr3_access_or_invocatn | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
CLASS-METHODS clear. | |
CLASS-METHODS get_instance | |
IMPORTING | |
i_element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_access. | |
METHODS add | |
IMPORTING | |
accessed_element_id1 TYPE cl_extr3_element_manager=>element_id_type | |
accessing_element_id2 TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS make_model REDEFINITION. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
CLASS-DATA instance TYPE REF TO cl_extr3_access. | |
TYPES: BEGIN OF association_type, | |
accessed_element_id1 TYPE cl_extr3_element_manager=>element_id_type, | |
accessing_element_id2 TYPE cl_extr3_element_manager=>element_id_type, | |
END OF association_type. | |
TYPES associations_type TYPE STANDARD TABLE OF association_type WITH DEFAULT KEY. | |
DATA associations TYPE HASHED TABLE OF association_type WITH UNIQUE KEY accessed_element_id1 accessing_element_id2. | |
ENDCLASS. | |
"! I am the abstract super class of all elements. | |
"! My subclasses know the details of elements. | |
CLASS cl_extr3_elements DEFINITION | |
INHERITING FROM cl_extr3. | |
PUBLIC SECTION. | |
"! True if further informations are collected | |
DATA infos_are_collected TYPE abap_bool. | |
"! Collect further informations | |
METHODS collect_infos IMPORTING sysid TYPE string. | |
DATA type TYPE c LENGTH 30. | |
CONSTANTS: package_type LIKE type VALUE 'package', | |
table_type LIKE type VALUE 'table', | |
class_type LIKE type VALUE 'class', | |
program_type LIKE type VALUE 'program', | |
web_dynpro_comps_type LIKE type VALUE 'web_dynpro_components'. | |
METHODS make_model | |
IMPORTING | |
element_id TYPE cl_extr3_element_manager=>element_id_type | |
associations TYPE cl_extr3_element_manager=>associations_type. | |
METHODS name | |
IMPORTING | |
element_id TYPE cl_extr3_element_manager=>element_id_type | |
EXPORTING | |
element_type TYPE string | |
parent_name TYPE string | |
name TYPE string. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
ENDCLASS. | |
CLASS cl_extr3_invocation DEFINITION | |
INHERITING FROM cl_extr3_access_or_invocatn | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
CLASS-METHODS clear. | |
CLASS-METHODS get_instance | |
IMPORTING | |
i_element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_invocation. | |
METHODS add | |
IMPORTING | |
invoced_element_id1 TYPE cl_extr3_element_manager=>element_id_type | |
invocing_element_id2 TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS make_model REDEFINITION. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
CLASS-DATA instance TYPE REF TO cl_extr3_invocation. | |
TYPES: BEGIN OF association_type, | |
invoced_element_id1 TYPE cl_extr3_element_manager=>element_id_type, | |
invocing_element_id2 TYPE cl_extr3_element_manager=>element_id_type, | |
END OF association_type. | |
TYPES associations_type TYPE STANDARD TABLE OF association_type WITH DEFAULT KEY. | |
DATA associations TYPE HASHED TABLE OF association_type WITH UNIQUE KEY invoced_element_id1 invocing_element_id2. | |
ENDCLASS. | |
CLASS cl_extr3_parent_package DEFINITION | |
INHERITING FROM cl_extr3_association | |
FINAL | |
CREATE PRIVATE . | |
PUBLIC SECTION. | |
CLASS-METHODS clear. | |
CLASS-METHODS get_instance | |
IMPORTING | |
i_element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_parent_package. | |
METHODS add | |
IMPORTING | |
element_id TYPE cl_extr3_element_manager=>element_id_type | |
parent_element_id TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS make_model REDEFINITION. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
CLASS-DATA instance TYPE REF TO cl_extr3_parent_package. | |
TYPES: BEGIN OF association_type, | |
element_id1 TYPE cl_extr3_element_manager=>element_id_type, | |
element_id2 TYPE cl_extr3_element_manager=>element_id_type, | |
END OF association_type. | |
TYPES associations_type TYPE STANDARD TABLE OF association_type WITH DEFAULT KEY. | |
DATA associations TYPE HASHED TABLE OF association_type WITH UNIQUE KEY element_id1 element_id2. | |
ENDCLASS. | |
"! I know how to build required associations | |
"! I have subclasses with concrete specifications that are used to find or build concrete associations. | |
CLASS cl_extr3_association_build DEFINITION | |
INHERITING FROM cl_extr3. | |
PUBLIC SECTION. | |
METHODS search_down | |
IMPORTING | |
element_id TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS search_up | |
IMPORTING | |
element_id TYPE cl_extr3_element_manager=>element_id_type. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
ENDCLASS. | |
CLASS cl_extr3_classes DEFINITION | |
INHERITING FROM cl_extr3_elements | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
CONSTANTS: is_class_type TYPE seoclstype VALUE 0, | |
interface_type TYPE seoclstype VALUE 1, | |
attribute_type TYPE seocmptype VALUE 0, | |
method_type TYPE seocmptype VALUE 1, | |
event_type TYPE seocmptype VALUE 2. | |
TYPES: BEGIN OF ty_class_component, | |
clsname TYPE string, | |
cmpname TYPE string, | |
cmptype TYPE seocmptype, | |
mtdtype TYPE seomtdtype, | |
END OF ty_class_component. | |
TYPES ty_class_components TYPE STANDARD TABLE OF ty_class_component WITH KEY clsname cmpname. | |
DATA: class_components TYPE ty_class_components. | |
CLASS-METHODS clear. | |
CLASS-METHODS get_instance | |
IMPORTING | |
element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING | |
VALUE(r_instance) TYPE REF TO cl_extr3_classes. | |
METHODS add | |
IMPORTING | |
class TYPE string | |
is_specific TYPE abap_bool | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type | |
VALUE(class_components) TYPE ty_class_components. | |
METHODS add_component | |
IMPORTING | |
clsname TYPE string | |
cmpname TYPE string | |
is_specific TYPE abap_bool | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS class_name | |
IMPORTING | |
element_id TYPE i | |
EXPORTING | |
VALUE(class_name) TYPE string | |
VALUE(clstype) TYPE seoclstype | |
VALUE(exists) TYPE abap_bool. | |
METHODS comp_name | |
IMPORTING | |
element_id TYPE i | |
EXPORTING | |
VALUE(class_name) TYPE string | |
VALUE(cmpname) TYPE string | |
VALUE(cmptype) TYPE seocmptype | |
VALUE(exists) TYPE abap_bool. | |
METHODS is_redefinition_of_method | |
IMPORTING | |
invoced_element_id1 TYPE i | |
invocing_element_id2 TYPE i | |
RETURNING | |
VALUE(r_result) TYPE abap_bool. | |
METHODS make_model REDEFINITION. | |
METHODS name REDEFINITION. | |
METHODS collect_infos REDEFINITION. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
CLASS-DATA instance TYPE REF TO cl_extr3_classes. | |
TYPES: BEGIN OF element_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
class_name TYPE string, | |
clstype TYPE seoclstype, | |
adt_link TYPE string, | |
END OF element_type. | |
DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. | |
DATA elements_class_name TYPE HASHED TABLE OF element_type WITH UNIQUE KEY class_name. | |
TYPES: BEGIN OF element_comp_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
clsname TYPE string, | |
cmpname TYPE string, | |
cmptype TYPE seocmptype, | |
mtdtype TYPE seomtdtype, | |
adt_link TYPE string, | |
END OF element_comp_type. | |
DATA elements_comp_element_id TYPE HASHED TABLE OF element_comp_type WITH UNIQUE KEY element_id. | |
DATA elements_comp_clsname_cmpname TYPE SORTED TABLE OF element_comp_type WITH UNIQUE KEY clsname cmpname. | |
TYPES: BEGIN OF element_metarel_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
refclsname TYPE string, | |
reltype TYPE seoreltype, | |
END OF element_metarel_type. | |
DATA elements_metarel_element_id TYPE HASHED TABLE OF element_metarel_type WITH UNIQUE KEY element_id. | |
DATA elements_metarel_refclsname TYPE HASHED TABLE OF element_metarel_type WITH UNIQUE KEY refclsname. | |
TYPES: BEGIN OF redefined_type, | |
clsname TYPE seoclsname, | |
refclsname TYPE seoclsname, | |
mtdname TYPE seocpdname, | |
END OF redefined_type. | |
TYPES: BEGIN OF redefined_method_type, | |
clsname TYPE seoclsname, | |
defined_in_clsname TYPE seoclsname, | |
method TYPE seocpdname, | |
END OF redefined_method_type. | |
DATA redefined_methods TYPE HASHED TABLE OF redefined_method_type WITH UNIQUE KEY method clsname defined_in_clsname. | |
METHODS _add_component | |
IMPORTING | |
clsname TYPE string | |
cmpname TYPE string | |
is_specific TYPE abap_bool | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(is_added_now) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS _add_metarel | |
IMPORTING | |
clsname TYPE string | |
is_specific TYPE abap_bool. | |
"! Call me only after checking that the component to be added is not already added. | |
METHODS _add_single_component_to_class | |
IMPORTING | |
i_found_class_name TYPE string | |
i_found_cmpname TYPE string | |
i_found_cmptype TYPE seocmptype | |
i_found_mtdtype TYPE seomtdtype | |
is_specific TYPE abap_bool | |
RETURNING | |
VALUE(r_new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS _get_redefined | |
IMPORTING | |
class TYPE string | |
RETURNING | |
VALUE(r_result) TYPE cl_extr3_classes=>ty_class_components. | |
ENDCLASS. | |
"! I describe an element of type package | |
CLASS cl_extr3_packages DEFINITION | |
INHERITING FROM cl_extr3_elements | |
CREATE PRIVATE | |
. | |
PUBLIC SECTION. | |
TYPES: | |
ty_s_pack TYPE RANGE OF tadir-devclass. | |
TYPES: BEGIN OF ty_package, | |
package TYPE devclass, | |
parentpackage TYPE parentcl, | |
END OF ty_package. | |
TYPES ty_packages TYPE HASHED TABLE OF ty_package WITH UNIQUE KEY package. | |
CLASS-METHODS clear. | |
CLASS-METHODS get_instance | |
IMPORTING | |
i_element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_packages. | |
METHODS add | |
IMPORTING package TYPE devclass | |
EXPORTING VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS devclass | |
IMPORTING | |
i_element_id TYPE i | |
RETURNING | |
VALUE(r_result) TYPE devclass. | |
METHODS make_model REDEFINITION. | |
METHODS name REDEFINITION. | |
METHODS collect_infos REDEFINITION. | |
PROTECTED SECTION. | |
METHODS _does_package_exists | |
IMPORTING | |
i_package TYPE devclass | |
RETURNING | |
VALUE(exists) TYPE abap_bool. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF element_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
devclass TYPE devclass, | |
END OF element_type. | |
CLASS-DATA instance TYPE REF TO cl_extr3_packages. | |
DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. | |
DATA elements_devclass TYPE HASHED TABLE OF element_type WITH UNIQUE KEY devclass. | |
ENDCLASS. | |
CLASS cl_extr3_programs DEFINITION | |
INHERITING FROM cl_extr3_elements | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
CLASS-METHODS clear. | |
CLASS-METHODS get_instance | |
IMPORTING | |
i_element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING | |
VALUE(r_instance) TYPE REF TO cl_extr3_programs. | |
CONSTANTS: type_function TYPE string VALUE 'FUNCTION', | |
type_function_include TYPE string VALUE 'FUNCTION_INCLUDE', | |
type_program TYPE string VALUE 'PROGRAM', | |
type_bw_transformation TYPE string VALUE 'BW_TRAN'. | |
METHODS add | |
IMPORTING | |
program TYPE program | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS add_function | |
IMPORTING | |
function TYPE string | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS program_name | |
IMPORTING | |
i_element_id TYPE i | |
EXPORTING | |
VALUE(program_type) TYPE string | |
VALUE(program) TYPE progname | |
VALUE(external_program_name_class) TYPE string | |
VALUE(external_program_name_method) TYPE string | |
VALUE(program_attribute_1) TYPE string | |
VALUE(program_attribute_2) TYPE string | |
VALUE(subc) TYPE subc. | |
METHODS add_function_group | |
IMPORTING | |
fgr TYPE string | |
EXPORTING | |
is_added TYPE abap_bool | |
new_element_id TYPE i. | |
METHODS make_model REDEFINITION. | |
METHODS name REDEFINITION. | |
METHODS collect_infos REDEFINITION. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
CLASS-DATA instance TYPE REF TO cl_extr3_programs. | |
TYPES: BEGIN OF element_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
program TYPE progname, | |
external_program_name TYPE string, | |
subc TYPE subc, | |
program_type TYPE string, | |
program_attribute_1 TYPE string, | |
program_attribute_2 TYPE string, | |
adt_or_bwmt_link TYPE string, | |
END OF element_type. | |
DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. | |
DATA elements_program TYPE HASHED TABLE OF element_type WITH UNIQUE KEY program. | |
METHODS _convert_program_2_ext_name | |
IMPORTING | |
i_element_program TYPE progname | |
EXPORTING | |
program_type TYPE string | |
program_attribute_1 TYPE string | |
program_attribute_2 TYPE string | |
VALUE(r_result) TYPE string. | |
METHODS _extract_function_name | |
IMPORTING | |
i_element_program TYPE progname | |
EXPORTING | |
function_group TYPE rs38l_area | |
function TYPE rs38l_fnam | |
function_include TYPE string | |
VALUE(r_result) TYPE string. | |
METHODS _extract_sap_bw_logic | |
IMPORTING | |
i_element_program TYPE progname | |
EXPORTING | |
tranid TYPE rstranid | |
VALUE(r_result) TYPE string. | |
METHODS _get_names_for_function_groups | |
IMPORTING | |
i_element TYPE cl_extr3_programs=>element_type | |
RETURNING | |
VALUE(name_of_mapped_class) TYPE string. | |
ENDCLASS. | |
"! I describe elements of type table | |
CLASS cl_extr3_tables DEFINITION | |
INHERITING FROM cl_extr3_elements | |
FINAL | |
CREATE PRIVATE . | |
PUBLIC SECTION. | |
DATA database_schema TYPE db_schema READ-ONLY. | |
METHODS constructor | |
IMPORTING | |
!i_element_manager TYPE REF TO cl_extr3_element_manager . | |
CLASS-METHODS clear . | |
CLASS-METHODS get_instance | |
IMPORTING | |
!i_element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING | |
VALUE(r_instance) TYPE REF TO cl_extr3_tables . | |
METHODS add | |
IMPORTING | |
!table TYPE string | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type . | |
METHODS table_name | |
IMPORTING | |
!i_element_id TYPE i | |
RETURNING | |
VALUE(r_result) TYPE tabname . | |
METHODS collect_infos | |
REDEFINITION . | |
METHODS make_model | |
REDEFINITION . | |
METHODS name | |
REDEFINITION . | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
CLASS-DATA instance TYPE REF TO cl_extr3_tables. | |
TYPES: BEGIN OF element_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
tabname TYPE tabname, | |
END OF element_type. | |
DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. | |
DATA elements_tabname TYPE HASHED TABLE OF element_type WITH UNIQUE KEY tabname. | |
ENDCLASS. | |
CLASS cl_extr3_web_dynpro_comp DEFINITION | |
INHERITING FROM cl_extr3_elements | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
CLASS-METHODS clear. | |
CLASS-METHODS get_instance | |
IMPORTING | |
element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING | |
VALUE(r_instance) TYPE REF TO cl_extr3_web_dynpro_comp. | |
METHODS add | |
IMPORTING | |
wdy_component_name TYPE wdy_component_name | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS add_component | |
IMPORTING | |
wdy_component_name TYPE wdy_component_name | |
wdy_controller_name TYPE wdy_controller_name | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
METHODS wdy_component_name | |
IMPORTING | |
element_id TYPE i | |
EXPORTING | |
VALUE(wdy_component_name) TYPE wdy_component_name. | |
METHODS wdy_controller_name | |
IMPORTING | |
element_id TYPE i | |
EXPORTING | |
VALUE(wdy_component_name) TYPE wdy_component_name | |
VALUE(wdy_controller_name) TYPE wdy_controller_name. | |
METHODS make_model REDEFINITION. | |
METHODS name REDEFINITION. | |
METHODS collect_infos REDEFINITION. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
CLASS-DATA instance TYPE REF TO cl_extr3_web_dynpro_comp. | |
TYPES: BEGIN OF element_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
wdy_component_name TYPE wdy_component_name, | |
END OF element_type. | |
DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. | |
DATA elements_wdy_component_name TYPE HASHED TABLE OF element_type WITH UNIQUE KEY wdy_component_name. | |
TYPES: BEGIN OF element_comp_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
wdy_component_name TYPE wdy_component_name, | |
wdy_controller_name TYPE wdy_controller_name, | |
END OF element_comp_type. | |
DATA elements_comp_element_id TYPE HASHED TABLE OF element_comp_type WITH UNIQUE KEY element_id. | |
DATA elements_comp_comp_contr_name TYPE HASHED TABLE OF element_comp_type WITH UNIQUE KEY wdy_component_name wdy_controller_name. | |
METHODS _add_component | |
IMPORTING | |
wdy_component_name TYPE wdy_component_name | |
wdy_controller_name TYPE wdy_controller_name | |
EXPORTING | |
VALUE(is_added) TYPE abap_bool | |
VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. | |
ENDCLASS. | |
CLASS cl_extr3_tadir_builder DEFINITION | |
INHERITING FROM cl_extr3_association_build | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
METHODS constructor | |
IMPORTING | |
i_element_manager TYPE REF TO cl_extr3_element_manager. | |
METHODS search_down REDEFINITION. | |
METHODS search_up REDEFINITION. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
DATA: tables TYPE REF TO cl_extr3_tables, | |
classes TYPE REF TO cl_extr3_classes, | |
programs TYPE REF TO cl_extr3_programs, | |
web_dynpro_components TYPE REF TO cl_extr3_web_dynpro_comp, | |
parent_package TYPE REF TO cl_extr3_parent_package. | |
ENDCLASS. | |
CLASS cl_extr3_where_used_builder DEFINITION | |
INHERITING FROM cl_extr3_association_build | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
TYPE-POOLS seop . | |
METHODS set_dynamic_read | |
IMPORTING | |
!i_dynamic_read TYPE string OPTIONAL . | |
METHODS search_down | |
REDEFINITION . | |
METHODS search_up | |
REDEFINITION . | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: | |
BEGIN OF wbcrossgt_type, | |
otype TYPE char2, | |
name TYPE eu_lname, | |
include TYPE programm, | |
direct TYPE sgrade, | |
indirect TYPE sgrade, | |
END OF wbcrossgt_type , | |
wbcrossgts_type TYPE SORTED TABLE OF wbcrossgt_type WITH UNIQUE KEY otype name include, | |
BEGIN OF cross_type, | |
type TYPE char1, | |
name TYPE seu_name, | |
include TYPE syrepid, | |
END OF cross_type, | |
cross_types TYPE STANDARD TABLE OF cross_type WITH DEFAULT KEY, | |
BEGIN OF wbcrossi_type, | |
name TYPE eu_lname, | |
include TYPE program, | |
" Ignore field master, it is in most cases identical to field include | |
END OF wbcrossi_type, | |
wbcrossi_types TYPE STANDARD TABLE OF wbcrossi_type WITH DEFAULT KEY. | |
DATA: g_dynamic_usage TYPE SORTED TABLE OF wbcrossgt WITH UNIQUE KEY otype name include. | |
ENDCLASS. | |
"! I build all initial elements that are the starting point for searching further elements. | |
CLASS cl_extr3_initial_elements DEFINITION | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
TYPES: BEGIN OF ty_package, | |
package TYPE devclass, | |
parentpackage TYPE parentcl, | |
END OF ty_package. | |
TYPES ty_packages TYPE HASHED TABLE OF ty_package WITH UNIQUE KEY package. | |
CONSTANTS: select_class_method TYPE string VALUE 'Class', | |
select_table TYPE string VALUE 'Table', | |
select_program TYPE string VALUE 'Program', | |
select_function TYPE string VALUE 'Function'. | |
TYPES: ty_s_pack TYPE RANGE OF tadir-devclass . | |
TYPES: | |
BEGIN OF ty_tdevc_test, | |
devclass TYPE devclass, | |
parentcl TYPE parentcl, | |
END OF ty_tdevc_test. | |
TYPES ty_t_tdevc_test TYPE HASHED TABLE OF ty_tdevc_test WITH UNIQUE KEY devclass. | |
METHODS select_packages | |
IMPORTING | |
!top_packages TYPE ty_s_pack | |
!sub_packages_filter TYPE ty_s_pack OPTIONAL | |
!including_sub_packages TYPE abap_bool DEFAULT abap_false. | |
TYPES: ty_filter TYPE string. | |
METHODS select_specific | |
IMPORTING | |
model_builder TYPE REF TO cl_extr3_model_builder | |
element_manager TYPE REF TO cl_extr3_element_manager | |
i_element_type_filter TYPE ty_filter | |
i_parent_name_filter TYPE ty_filter | |
i_name_filter TYPE ty_filter. | |
METHODS get_selected | |
RETURNING VALUE(r_packages) TYPE ty_packages. | |
"! @parameter tdevc_test | provide test data for table TDEVC during unit tests. | |
METHODS constructor | |
IMPORTING | |
!tdevc_test TYPE ty_t_tdevc_test OPTIONAL. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF ty_package_store, | |
package TYPE devclass, | |
parentpackage TYPE parentcl, | |
subclass_searched TYPE abap_bool, | |
is_to_be_returned TYPE abap_bool, | |
END OF ty_package_store. | |
TYPES ty_packages_store TYPE HASHED TABLE OF ty_package_store WITH UNIQUE KEY package. | |
DATA g_selected_packages TYPE ty_packages. | |
"! Select packages according to filter transfered by report | |
"! @parameter top_packages | Select packages | |
"! @parameter sub_packages_filter | Optional: Include sub packages only if they are filtered by this filter | |
"! @parameter including_sub_packages | Default false: Search sub packages | |
"! Filled during tests | |
DATA g_tdevc_test TYPE ty_t_tdevc_test. | |
DATA g_is_test TYPE abap_bool. | |
METHODS _select_top_packages | |
IMPORTING | |
i_top_packages TYPE cl_extr3_packages=>ty_s_pack | |
RETURNING | |
VALUE(r_packages) TYPE cl_extr3_packages=>ty_packages. | |
TYPES: | |
ty_packages_to_search_sub TYPE HASHED TABLE OF ty_package WITH UNIQUE KEY package. | |
METHODS _select_sub_packages | |
IMPORTING | |
i_packages_to_search_sub TYPE ty_packages_to_search_sub | |
RETURNING | |
VALUE(r_packages) TYPE cl_extr3_packages=>ty_packages. | |
METHODS _select_class | |
IMPORTING | |
name_filter TYPE cl_extr3_initial_elements=>ty_filter | |
element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING | |
VALUE(new_element_id) TYPE i. | |
METHODS _select_class_method | |
IMPORTING | |
name_filter TYPE cl_extr3_initial_elements=>ty_filter | |
parent_name_filter TYPE cl_extr3_initial_elements=>ty_filter | |
element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING | |
VALUE(new_element_id) TYPE i. | |
METHODS _select_table | |
IMPORTING | |
name_filter TYPE cl_extr3_initial_elements=>ty_filter | |
element_manager TYPE REF TO cl_extr3_element_manager | |
RETURNING | |
VALUE(new_element_id) TYPE i. | |
METHODS _select_program | |
IMPORTING | |
element_manager TYPE REF TO cl_extr3_element_manager | |
name_filter TYPE cl_extr3_initial_elements=>ty_filter | |
RETURNING | |
VALUE(new_element_id) TYPE i. | |
METHODS _select_function | |
IMPORTING | |
element_manager TYPE REF TO cl_extr3_element_manager | |
name_filter TYPE cl_extr3_initial_elements=>ty_filter | |
RETURNING | |
VALUE(new_element_id) TYPE i. | |
ENDCLASS. | |
"! I know the level where an element was added to the model. | |
"! I know whether it was found in upward or downward search. | |
CLASS cl_extr3_model_builder DEFINITION | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
TYPES: BEGIN OF found_element_type, | |
where TYPE c LENGTH 1, | |
level TYPE i, | |
"! Not zero in case an element is found in up and down search. If filled this is the level for downsearch | |
alternate_level TYPE i, | |
element_type TYPE string, | |
parent_name TYPE string, | |
name TYPE string, | |
specific TYPE abap_bool, | |
up_search_done TYPE abap_bool, | |
down_search_done TYPE abap_bool, | |
END OF found_element_type. | |
TYPES: found_elements_type TYPE STANDARD TABLE OF found_element_type. | |
METHODS search | |
IMPORTING | |
i_search_up TYPE i | |
i_search_down TYPE i. | |
"! I am called once to notify that the initial selection of elements is started. | |
"! All elements added to the model before my method search is called belong to the level 0 | |
METHODS initial_selection_started. | |
"! Called whenever a new element ID was added to the model. | |
"! @parameters i_is_specific | set to true if the element is added due to a specific search. It is for instance to be false, if all components of a class are added. | |
METHODS new_element_id | |
IMPORTING | |
i_element_id TYPE i | |
i_is_specific TYPE abap_bool. | |
METHODS initialize | |
IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager | |
i_dynamic_read TYPE string OPTIONAL. | |
METHODS write_found_elements | |
IMPORTING | |
write TYPE abap_bool OPTIONAL | |
EXPORTING | |
fes TYPE found_elements_type. | |
METHODS usage_of_single_element. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: BEGIN OF found_in_level_type, | |
element_id TYPE cl_extr3_element_manager=>element_id_type, | |
"! A flag to mark all elements that are part of the initial selection | |
found_in_initial_selection TYPE abap_bool, | |
"! Elements that where added when the main search is finished | |
found_in_post_selection TYPE abap_bool, | |
"! Marks that an initially selected element is analyzed for lower and higher levels as requested | |
initially_selected_analyzed TYPE abap_bool, | |
"! The level where an element is first found. Needed to stop searching as specified. | |
"! Also required to determine whether an upward or downward search will be done. | |
found_in_level_upsearch TYPE i, | |
found_in_level_downsearch TYPE i, | |
"! Used to analyze usages of a single element. | |
"! Marks an element that is specifically marked. | |
"! In case a specific search is done, only elements with this flag are used for an where used analysis | |
specific TYPE abap_bool, | |
END OF found_in_level_type. | |
TYPES found_in_levels_type TYPE HASHED TABLE OF found_in_level_type WITH UNIQUE KEY element_id. | |
DATA: found_in_levels TYPE found_in_levels_type, | |
is_initial_selection TYPE abap_bool, | |
is_up_search TYPE abap_bool, | |
"! Add newly found elements during upsearch in this level | |
level_for_found_in_upsearch TYPE i, | |
is_down_search TYPE abap_bool, | |
"! Add newly found elements during downsearch in this level | |
level_for_found_in_downsearch TYPE i, | |
is_post_selection TYPE abap_bool. | |
TYPES: BEGIN OF builder_type, | |
association_builder TYPE REF TO cl_extr3_association_build, | |
END OF builder_type. | |
DATA element_manager TYPE REF TO cl_extr3_element_manager. | |
"! Use for initial search | |
DATA association_builders_init TYPE STANDARD TABLE OF builder_type. | |
"! Use for final search | |
DATA association_builders_post TYPE STANDARD TABLE OF builder_type. | |
"! Use for search | |
DATA association_builders TYPE STANDARD TABLE OF builder_type. | |
DATA: tadir_builder TYPE REF TO cl_extr3_tadir_builder, | |
where_used_builder TYPE REF TO cl_extr3_where_used_builder. | |
"! A single element is analyzed of usage and using | |
DATA is_usage_of_single_element TYPE abap_bool. | |
METHODS _post_search. | |
METHODS _initial_search. | |
METHODS _search_up | |
IMPORTING | |
i_search_up TYPE i. | |
METHODS _search_down | |
IMPORTING | |
i_search_down TYPE i. | |
ENDCLASS. | |
"! I am the starting point for an extraction. I am called from the main report. | |
class CL_EXTRACT3 definition | |
final | |
create public . | |
public section. | |
types: | |
ty_s_pack TYPE RANGE OF tadir-devclass . | |
types: | |
ty_string_range TYPE RANGE OF char45 . | |
constants TECHTYPE_ABAPPACKAGE type STRING value 'ABAPPackage' ##NO_TEXT. | |
constants TECHTYPE_ABAPMETHOD type STRING value 'ABAPMethod' ##NO_TEXT. | |
constants TECHTYPE_ABAPCLASSATTRIBUTE type STRING value 'ABAPClassAttribute' ##NO_TEXT. | |
constants TECHTYPE_ABAP_FUNCTION type STRING value 'ABAPFunktion' ##NO_TEXT. | |
constants TECHTYPE_WEBDYNPRO_CONTROLLER type STRING value 'ABAPWebDynproController' ##NO_TEXT. | |
constants MODIFIER_ABAPGLOBALCLASS type STRING value 'ABAPGlobalClass' ##NO_TEXT. | |
constants MODIFIER_ABAPGLOBALINTERFACE type STRING value 'ABAPGlobalInterface' ##NO_TEXT. | |
constants MODIFIER_WEBDYNPRO_COMPONENT type STRING value 'ABAPWebDynproComponent' ##NO_TEXT. | |
constants MODIFIER_DBTABLE type STRING value 'DBTable' ##NO_TEXT. | |
constants MODIFIER_PROGRAM type STRING value 'ABAPProgram' ##NO_TEXT. | |
constants MODIFIER_FUNCTION_GROUP type STRING value 'ABAPFunktionGroup' ##NO_TEXT. | |
constants MODIFIER_BW_TRANSFORMATION type STRING value 'BWTransformation' ##NO_TEXT. | |
constants MODIFIER_UNKNOWN type STRING value 'UNKNOWN' ##NO_TEXT. | |
class-methods CHECK_IF_TESTED | |
returning | |
value(IS_TESTED) type ABAP_BOOL . | |
methods CONSTRUCTOR . | |
"! Main start to do the extraction | |
"! @parameter i_search_up | how often is a upward searched in the where-used-information to be repeated. Search infinite if < 0 | |
"! @parameter i_exclude_found_sap_intf | exclude found interfaces in SAP namespace in the where-used analysis | |
methods EXTRACT | |
importing | |
!MODEL_BUILDER type ref to CL_EXTR3_MODEL_BUILDER | |
!ELEMENT_MANAGER type ref to CL_EXTR3_ELEMENT_MANAGER | |
!INITIAL_ELEMENTS type ref to CL_EXTR3_INITIAL_ELEMENTS | |
!I_SEARCH_UP type I | |
!I_SEARCH_DOWN type I | |
!I_EXCLUDE_FOUND_SAP_INTF type ABAP_BOOL | |
exporting | |
!MSE_MODEL type CL_MODEL=>LINES_TYPE | |
value(NOTHING_DONE) type ABAP_BOOL . | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
CLASS-DATA: g_check_for_test_done TYPE abap_bool, | |
g_is_tested TYPE abap_bool. | |
ENDCLASS. | |
CLASS CL_EXTR3_ACCESS IMPLEMENTATION. | |
METHOD add. | |
DATA association TYPE association_type. | |
ASSERT accessed_element_id1 IS NOT INITIAL. | |
ASSERT accessing_element_id2 IS NOT INITIAL. | |
association-accessed_element_id1 = accessed_element_id1. | |
association-accessing_element_id2 = accessing_element_id2. | |
INSERT association INTO TABLE associations. | |
element_manager->add_association( EXPORTING element_1 = association-accessed_element_id1 | |
element_2 = association-accessing_element_id2 | |
association = me ). | |
ENDMETHOD. | |
METHOD clear. | |
CLEAR instance. | |
ENDMETHOD. | |
METHOD get_instance. | |
IF instance IS NOT BOUND. | |
CREATE OBJECT instance | |
EXPORTING | |
i_element_manager = i_element_manager. | |
ENDIF. | |
instance->type = access_ass.. | |
r_instance = instance. | |
ENDMETHOD. | |
METHOD make_model. | |
DATA using_method_id TYPE i. | |
DATA using_id TYPE i. | |
DATA used_id TYPE i. | |
IF element_manager->use_somix EQ 'X'. | |
_get_somix_id_used_and_using( EXPORTING i_association = association | |
IMPORTING e_using_id = using_id | |
e_used_id = used_id ). | |
ASSERT using_id IS NOT INITIAL. | |
ASSERT used_id IS NOT INITIAL. | |
ELSE. | |
_get_famix_id_used_and_using( EXPORTING i_association = association | |
IMPORTING e_using_method_id = using_method_id | |
e_used_id = used_id ). | |
ASSERT using_method_id IS NOT INITIAL. | |
ASSERT used_id IS NOT INITIAL. | |
ENDIF. | |
DATA last_id2 TYPE i. | |
IF element_manager->use_somix EQ 'X'. | |
last_id2 = element_manager->somix_access->add( ). | |
element_manager->somix_access->set_accessor_accessed_relation( | |
EXPORTING | |
element_id = last_id2 | |
accessor_id = using_id | |
accessed_id = used_id | |
is_write = 'X' " SAP2Moose cannot differenciate currently, between read, write, and dependency. So set here always. | |
is_read = 'X' " SAP2Moose cannot differenciate currently, between read, write, and dependency. So set here always. | |
is_dependent = 'X' " SAP2Moose cannot differenciate currently, between read, write, and dependency. So set here always. | |
). | |
ELSE. | |
last_id2 = element_manager->famix_access->add( ). | |
element_manager->famix_access->set_accessor_variable_relation( EXPORTING element_id = last_id2 | |
accessor_id = using_method_id | |
variable_id = used_id ). | |
ENDIF. | |
ENDMETHOD. | |
ENDCLASS. | |
CLASS CL_EXTR3_ACCESS_OR_INVOCATN IMPLEMENTATION. | |
METHOD _get_famix_id_used_and_using. | |
DATA: invoced_element TYPE REF TO cl_extr3_elements, | |
invocing_element TYPE REF TO cl_extr3_elements. | |
DATA used_id TYPE i. | |
invoced_element = element_manager->get_element( i_element_id = i_association-element_id1 ). | |
invocing_element = element_manager->get_element( i_element_id = i_association-element_id2 ). | |
CASE invoced_element->type. | |
WHEN invoced_element->class_type. | |
DATA classes TYPE REF TO cl_extr3_classes. | |
DATA: invoced_class_name TYPE string, | |
invoced_cmpname TYPE string, | |
invoced_cmptype TYPE seocmptype. | |
classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). | |
classes->comp_name( EXPORTING element_id = i_association-element_id1 | |
IMPORTING class_name = invoced_class_name | |
cmpname = invoced_cmpname | |
cmptype = invoced_cmptype ). | |
CASE invoced_cmptype. | |
WHEN classes->attribute_type. | |
e_used_id = element_manager->famix_attribute->get_id( name_group = ng_abap_class | |
class = invoced_class_name | |
attribute = invoced_cmpname ). | |
WHEN classes->method_type OR classes->event_type. | |
e_used_id = element_manager->famix_method->get_id( class_name_group = ng_abap_class | |
class = invoced_class_name | |
method_name_group = ng_abap_method | |
method = invoced_cmpname ). | |
ENDCASE. | |
WHEN invoced_element->table_type. | |
DATA tables TYPE REF TO cl_extr3_tables. | |
DATA tabname TYPE tabname. | |
tables = cl_extr3_tables=>get_instance( i_element_manager = element_manager ). | |
tabname = tables->table_name( i_element_id = i_association-element_id1 ). | |
e_used_id = element_manager->famix_attribute->get_id( name_group = ng_sap_table | |
class = tabname | |
attribute = tabname ). | |
WHEN invoced_element->program_type. | |
DATA programs2 TYPE REF TO cl_extr3_programs. | |
DATA: invoced_ext_progr_name_class TYPE string, | |
invoced_ext_progr_name_method TYPE string. | |
programs2 = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). | |
programs2->program_name( EXPORTING i_element_id = i_association-element_id1 | |
IMPORTING external_program_name_class = invoced_ext_progr_name_class | |
external_program_name_method = invoced_ext_progr_name_method ). | |
e_used_id = element_manager->famix_method->get_id( class_name_group = ng_abap_program | |
class = invoced_ext_progr_name_class | |
method_name_group = ng_abap_program | |
method = invoced_ext_progr_name_method ). | |
WHEN OTHERS. | |
ASSERT 1 = 2. | |
ENDCASE. | |
DATA: invoicing_famix_class TYPE string, | |
invoicing_famix_method TYPE string, | |
invoicing_class_name_group TYPE string, | |
invoicing_method_name_group TYPE string. | |
CASE invocing_element->type. | |
WHEN invocing_element->class_type. | |
invoicing_class_name_group = ng_abap_class. | |
invoicing_method_name_group = ng_abap_method. | |
DATA: invocing_class_name TYPE string, | |
invocing_cmpname TYPE string. | |
classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). | |
classes->comp_name( EXPORTING element_id = i_association-element_id2 | |
IMPORTING class_name = invocing_class_name | |
cmpname = invocing_cmpname ). | |
invoicing_famix_class = invocing_class_name. | |
invoicing_famix_method = invocing_cmpname. | |
WHEN invocing_element->web_dynpro_comps_type. | |
invoicing_class_name_group = ng_abap_webdynpro. | |
invoicing_method_name_group = ng_abap_webdynpro. | |
DATA web_dynpro_component TYPE REF TO cl_extr3_web_dynpro_comp. |