Dynamic Data Selection – Dynamic SQL

Hi Techies!

There will be instances where you need to read tables dynamically. For a example when you work with access sequences in SAP, you will need to read data using this method.

In the below example, program is defined in such a way that the table which it needs to fetch data from is determined only at run-time.

User have the option of reading data from either EKKO (Purchasing Document Header) or EKPO (Purchasing Document Item) tables. Selection parameters which can be used to read each table is different. Selection parameters Purchasing document number and company code can read can filter entries in EKKO, where Purchasing document, line item and material can filter the result of EKPO.

Selection Screen.

For option EKKO.

For Option EKPO.


Selection Screen Definition:

Enable and disable selection screen parameters at PBO.


Logic to determine the table and where conditions at run-time.


Fetch data dynamically.

SAP, SAP ABAP, Dynamic data fetching, Dynamic SQL, dynamic select, access sequence, PBO, PAI, hide screen fields, modify screen, Isuru Fernando.

Share with your colleagues!

Get the latest tips and tricks on SAP!


Add a Comment

Your email address will not be published. Required fields are marked *

Get the latest tips and tricks on SAP!