Monday, 15 October 2018

View Cluster – Default selection of table

Agenda


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.

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

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

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

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.

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

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.

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

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

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

Output generated for maintenance.

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

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.

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

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.

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

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

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

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

SAP ABAP Development, SAP ABAP Tutorial and Material, SAP ABAP Study Material

No comments:

Post a Comment