Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
rameez_khan
Active Participant
Agenda of the blog:

To default the selection of table on view cluster maintenance screen for the filter values given on the initial screen.

Requirement / Need for solution:

Recently we provided view cluster to our client for maintenance of data. This view cluster consists of multiple tables which gives a good view of all tables at one go.

However, when the filter values are given on initial screen by default always the first table in the list is selected.

Hence the need for solution arises to select the table in output when the filter values is provided.

Example / Recreation of problem:

Let us go through an example to understand the problem in detail.

Consider a view maintenance cluster having 3 tables in the list for maintenance, below screen-shot demonstrates this example.



To maintain the data, we will use tcode: SM34 and select checkbox for “Enter conditions” which is used to pass the filter criteria.



Now we click on maintain button, and we will be prompted with tables available in the list. Here we can select tables available in the maintenance cluster for providing filter values.



After the table selection is complete, for each table we will be prompted with field Selection where we have to select fields on which we will pass the filter values.



Provide the values that needs to be filtered and check the output.



Output generated for maintenance.



In this example we can see that we have selected material group table on initial screen, yet by default material type table was selected as it is the first table in list of cluster.



Although data is filtered correctly, we would like to see the table with filtered entries as selected table
in output. In case of multiple tables are selected, we would like to see the one of the tables to be displayed by default.

Solution for the given requirement:

To achieve this, we will have to implement event given in view cluster.

Step 1) Go to SE54, Edit View cluster. Give cluster name and the click on change.
Select the events folder from Dialog Structure and click on new entry.
Give event: “03 - Before navigation in another object” along with subroutine name.



Step 2) Press Enter and Give Program name. Click on Editor to navigate.





Step 3) Write the code in subroutine to select table as default for output.
REPORT zrjk_view_cluster_demo.

"-- Global variables and internal tables for processing different objects
* in view cluster maintenance, and access routines to these tables.
INCLUDE: lsvcmcod.

*---------------------------------------------------------------------*
* Form Z_SELECT_TABLES *
*---------------------------------------------------------------------*
* Select the view to be displayed for range entered *
*---------------------------------------------------------------------*
FORM z_select_tables.

DATA: ls_vcl_struc LIKE LINE OF vcl_struc_tab.
STATICS: lf_first TYPE xfeld.

IF lf_first IS INITIAL.
"-- Static is used because event is fired on every navigation
lf_first = abap_true.
"-- Get the Selected View Name.
CLEAR: ls_vcl_struc.
READ TABLE vcl_struc_tab INTO ls_vcl_struc
WITH KEY get_range = abap_true.
IF sy-subrc IS INITIAL.
"-- Pass the View Name to be displayed on Overview screen.
vcl_akt_view = ls_vcl_struc-object.
ENDIF.
ENDIF.
ENDFORM.

Conclusion:

The above solution adds a user-friendly option to cluster maintenance where the user does not have to click on the same table again to open it for maintenance and also avoids confusion that might arise of the standard behaviour.

Let me know your views in the below comment section 😉
3 Comments