Friday, June 3, 2011

Dynamic SELECT statement

Dynamic SELECT Statement (Enhanced functionality of Transaction SE16 and Index Identifier)


Introduction:

The purpose of this document is to briefly describe a development, which will dynamically retrieve data from database tables, based upon user input. Here, table name can be specified by the use or which field needs to be displayed can be put into selection screen, even which will be the restricting criteria, also can be specified. The output will be displayed in simple report format.

Along with the report, it will also notify the user whether Primary / Secondary index is being used or not during data selection.

In production system, there can be two ways of checking data from standard table / Custom table.

  • Conventional Method (Using transaction SE16).

  • Dynamitic select statements (Describe in this document).

Conventional Method:

The following section will briefly describe what are the steps followed to check data using Conventional method:

Step1:

Run transaction SE16 & put table name as selection criteria.

Step2:

Choose the fields which will be the selection criteria for data selection from settings > Fields for selection

Put the selection criteria:

Step3:

Report will be displayed in the following format:

Choose the desired output fields from Settings > Format list > Choose Fields.

The final report will be displayed:

Step4:

Number of entries in the table can also be checked using SE16 Transaction.

Step5:

Whether the data selection is done using primary / secondary index can also be checked using transaction SE11 / ST05.

Dynamitic select statements

In this method we have written a program, which will take selection criteria dynamically (Table name, filter criteria, display fields) and produce a report with single user intervention. It will also display whether primary / secondary index is being used or not during data selection.

Run the report ZDYN_ALV (for source code, click here).

Provide the field names for the selection criteria.

Provide the selection criteria as below.

The output will be shown in the below format.

This program will display data in a single step execution. When we are trying to access live system from remote location each step execution (Dialog step) is very time expensive. This program will reduce the steps taken to display desired data. Also it will analyze the particular select statement is optimized or not by specifying the Index.

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

goodsites