Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic selection based on values from Ztable

anuj_srivastava
Active Participant
0 Likes
867

Hi all,

My query is that i have to select the data from the database table .But the fields to be selected from that database table is decided from the Ztable ( this Ztable contains the field name ).

How can this be achieved ??

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
783

Hi,

use the below logic for this.

types: ty_fields type fieldname.
data: it_fields type table of ty_fields.

select fieldname from ztable into table it_fields where ... " Get the fieldnames into it_fields

select (it_fields) from dbtable into table it_tab where ... " Use table it_fields for list of fields to be fetched

hope this helps you.

Regards,

Manoj Kumar P

6 REPLIES 6
Read only

Former Member
0 Likes
783

hi


select * from ztable into table twhere_clause.
...
select * from ...
  where ( twhere_clause ).
...

regards,darek

Read only

Former Member
0 Likes
784

Hi,

use the below logic for this.

types: ty_fields type fieldname.
data: it_fields type table of ty_fields.

select fieldname from ztable into table it_fields where ... " Get the fieldnames into it_fields

select (it_fields) from dbtable into table it_tab where ... " Use table it_fields for list of fields to be fetched

hope this helps you.

Regards,

Manoj Kumar P

Read only

Former Member
0 Likes
783

HI,

Create the dynamic internal table using the ZTABLE fields.

SELECT * FROM (DBtab) INTO CORRESPONDING FIELDS OF <FS_ITAB> WHERE Condit

[Create dynamic internal table |]

Read only

Former Member
0 Likes
783

follow the method mentined below:

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.

Read only

Former Member
0 Likes
783
Read only

anuj_srivastava
Active Participant
0 Likes
783

Hi ,

Thx all