fabiopagoti / WB-Objects

ABAP Framework to handle Workbench objects
www.abap101.com
MIT License
7 stars 4 forks source link

Create demo to count global and local classes/interfaces attributes, methods and events using WB searcher. #28

Open fabiopagoti opened 10 years ago

fabiopagoti commented 10 years ago

This new demo is based on DEMO2 - #20

Create a new demo based on ZWB_OBJECTS_DEMO2 (give it the name 7 as it's not used yet).

The purpose of this demo is to show another use of a WB searcher so use any WB searcher which fill the following gap.

This program should have:

The user will insert ABAP WB Classes, Interfaces, Programs and Includes and the program should count how many attributes, methods and events each of them have (or in the global classes and interfaces or inside the local classes of the specified programs and includes).

It could be a ALV with the following structure:

[Program name]| Class/Interface Name | Attributes | Methods | Events | ZCL_xxx | 1 | 2 | 0 | ZIF_xxx | 3 | 5 | 2 Program Name | LCL_xxx | 2 | 2 | 1

Scenario 1 - Global Class

Given Class CL_A has 3 attributes AND Class CL_A has 4 methods AND Class CL_A has 2 events

When Program ZWB_OBJECTS_DEMO7 is executed

Then An ALV should be displayed as Class/Interface Name | Attributes | Methods | Events CL_A | 3 | 4 | 2

Scenario 2 - Global Interface

Given Interface IF_B has 5 attributes AND Interface IF_B has 6 methods AND Interface IF_B has 7 events

When Program ZWB_OBJECTS_DEMO7 is executed

Then An ALV should be displayed as Class/Interface Name | Attributes | Methods | Events IF_B | 5 | 6 | 7

Scenario 3 - Local classes/interfaces inside programs/includes

Given Program/Include ZABC contains local class CL_A AND Program/Include ZABC contains local interface IF_B AND Class CL_A has 3 attributes AND Class CL_A has 4 methods AND Class CL_A has 2 events Interface IF_B has 5 attributes AND Interface IF_B has 6 methods AND Interface IF_B has 7 events

When Program ZWB_OBJECTS_DEMO7 is executed

Then An ALV should be displayed as Program| Class/Interface Name | Attributes | Methods | Events ZABC |CL_A | 3 | 4 | 2 ZABC |IF_B | 5 | 6 | 7

Scenario 4 - Regular expressions used in global classes/interfaces select-options

Given Global classes/interfaces select-options is filled with ZCL_WB* AND Global classes/interfaces select-options is filled with ZIF_WB* AND

Classes that match the pattern ZCLWB* = [CLASSES] AND [CLASSES] ZCL_WB_A ZCL_WB_B ZCL_WB_C

Interfaces that match the pattern ZIFWB* = [INTERFACES] [INTERFACES] ZIF_WB_Y

When Program ZWB_OBJECTS_DEMO7 is executed

Then An ALV should be displayed as Class/Interface Name | Attributes | Methods | Events ZCL_WB_A | x | x | x ZCL_WB_B | x | x | x ZCL_WB_C | x | x | x ZIF_WB_Y | x | x | x

Scenario 5 - Regular expressions used in local classes/interfaces select-options (programs and includes)

Given programs/includes select-options is filled with ZWB AND

Programs/Includes that match the pattern ZWB = [PROGRAMS] AND [PROGRAMS] Z_WB_DEMO1

Program/Include Z_WB_DEMO1 contains local class CL_A AND Program/Include Z_WB_DEMO1 contains local interface IF_B

When Program ZWB_OBJECTS_DEMO7 is executed

Then An ALV should be displayed as Program| Class/Interface Name | Attributes | Methods | Events Z_WB_DEMO1 |CL_A | x | x | x Z_WB_DEMO1 |IF_B | x | x | x


Notes

Rodrigobcr commented 10 years ago

Hello, Fábio. The Demo7 is ready to tests. Preview: sem ttulo sem ttulo2

fabiopagoti commented 10 years ago

{user mode} Excellent. It looks great!

{functional mode} In this case I would just declare a select-options with the high field. As you are using WB searcher, it should accept ranges like ZCL_A1 to ZCL_A30 for exemple.

{ABAP mode} Other than that seems ok to create a pull request on GitHub. I hope you used Code Inspector and other tools to make sure there is nothing wrong technically with your code. If you didn't I will do it and reject your pull request if you deliver something with no code quality. :-)