Skip to content

Commit

Permalink
Support programs better #53
Browse files Browse the repository at this point in the history
Implement usage of program with SUBMIT statement.
All unit tests green.
  • Loading branch information
RainerWinkler committed Feb 1, 2018
1 parent 0f49a4b commit 5be4b1d
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 8 deletions.
75 changes: 67 additions & 8 deletions src/main/extr/assocbuild/z2mse_extr3_where_used_builder.clas.abap
Expand Up @@ -24,7 +24,15 @@ CLASS z2mse_extr3_where_used_builder DEFINITION
direct TYPE sgrade,
indirect TYPE sgrade,
END OF wbcrossgt_type ,
wbcrossgts_type TYPE SORTED TABLE OF wbcrossgt_type WITH UNIQUE KEY otype name include.
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.

DATA: g_dynamic_usage TYPE SORTED TABLE OF wbcrossgt WITH UNIQUE KEY otype name include.
ENDCLASS.

Expand Down Expand Up @@ -153,18 +161,69 @@ CLASS z2mse_extr3_where_used_builder IMPLEMENTATION.

is_access = abap_true.

WHEN element->program_type.

DATA programs2 TYPE REF TO z2mse_extr3_programs.
programs2 = z2mse_extr3_programs=>get_instance( i_element_manager = element_manager ).

DATA program TYPE progname.

programs2->program_name(
EXPORTING
i_element_id = element_id
IMPORTING
program = program
* external_program_name_class =
* external_program_name_method =
* subc =
).

DATA: cross_type TYPE char1,
cross_name TYPE seu_name.

cross_type = 'R'.
cross_name = program.

ENDCASE.

IF where_used_name IS NOT INITIAL.
IF where_used_name IS NOT INITIAL OR cross_name IS NOT INITIAL.

DATA: wbcrossgts TYPE wbcrossgts_type,
wbcrossgt TYPE wbcrossgt_type.
wbcrossgt TYPE wbcrossgt_type,
cross TYPE cross_type,
crosss TYPE cross_types.

SELECT otype name include direct indirect
FROM wbcrossgt
INTO TABLE wbcrossgts
WHERE otype = otype
AND name = where_used_name.
IF otype IS NOT INITIAL.

SELECT otype name include direct indirect
FROM wbcrossgt
INTO TABLE wbcrossgts
WHERE otype = otype
AND name = where_used_name.

ENDIF.

IF cross_type IS NOT INITIAL.

SELECT type name include FROM cross INTO TABLE crosss
WHERE type = cross_type
AND name = cross_name.

LOOP AT crosss INTO cross.

" Most where used information is in table wbcrossgt. Now some information is read from table cross. Use nonetheless wbcrossgt
" for further processing. There is an integration test, that assures the correctness of the whole coding.

CLEAR wbcrossgt.

wbcrossgt-name = cross-name.
wbcrossgt-include = cross-include.

INSERT wbcrossgt INTO TABLE wbcrossgts.

ENDLOOP.

ENDIF.

" Read dynamic usages

Expand Down
Expand Up @@ -59,6 +59,20 @@ CLASS z2mse_extr3_access_or_invocatn IMPLEMENTATION.

e_used_id = element_manager->famix_attribute->get_id( class = tabname
attribute = tabname ).
WHEN invoced_element->program_type.
DATA programs2 TYPE REF TO z2mse_extr3_programs.
DATA invoved_progname TYPE progname.
programs2 = z2mse_extr3_programs=>get_instance( i_element_manager = element_manager ).
programs2->program_name( EXPORTING i_element_id = i_association-element_id1
IMPORTING program = invoved_progname ).

e_used_id = element_manager->famix_method->get_id(
* class_name_group =
class = invoved_progname
* method_name_group =
method = invoved_progname
).

WHEN OTHERS.
ASSERT 1 = 2.
ENDCASE.
Expand Down
2 changes: 2 additions & 0 deletions src/main/extr/z2mse_extract3.clas.testclasses.abap
Expand Up @@ -180,6 +180,8 @@ CLASS ltcl_main IMPLEMENTATION.
( |FAMIX.Method Z2MSE_TEST_PROGRAM_A>>Z2MSE_TEST_PROGRAM_A signature Z2MSE_TEST_PROGRAM_A| )
( |FAMIX.Method Z2MSE_TEST_PROGRAM_B>>Z2MSE_TEST_PROGRAM_B signature Z2MSE_TEST_PROGRAM_B| )
( |FAMIX.Invocation sender Z2MSE_TEST_PROGRAM_A>>Z2MSE_TEST_PROGRAM_A candidates Z2MSE_TEST_CL_A>>METHOD_A signature DUMMY| )
" New usage of programs by programs "Support programs better #53"
( |FAMIX.Invocation sender Z2MSE_TEST_PROGRAM_A>>Z2MSE_TEST_PROGRAM_A candidates Z2MSE_TEST_PROGRAM_B>>Z2MSE_TEST_PROGRAM_B signature DUMMY| )
" New in 0.3.0 Functions are displayed as external name of the found include program
" The parent package of functions is not yet found, because the include is not in the TADIR
( |FAMIX.Class FGR-Z2MSE_TEST_FGR_A modifiers ABAPFunktionGroup| )
Expand Down

0 comments on commit 5be4b1d

Please sign in to comment.