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 field Select from table

Former Member
0 Likes
6,046

Hi,

I have to select certain field from table. The field which I have to select I do not know.

It will come dynamically from program.

Plz help me what is correct statement to execute.

Thanks.

S Sahoo

4 REPLIES 4
Read only

Former Member
0 Likes
1,287

SELECT (FIELD_NAME) FROM <dbtab>

INTO CORRESPONDING FIELDS OF TABLE itab.

REGARDS,

SUMIT NENE

Read only

Former Member
0 Likes
1,287

Hi Sahoo,

Pllease follow below steps.

1, Create internal table with field Fieldname TYPE FIELDNAME (Say ITAB)

2. Append Fields (thats you want to select) to internal table [at run time]

3. Use

SELECT (ITAB)

into table <table>

from <DB>

where <cond>

Hope this helps,

Nag

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,287

You can use fm FREE_SELECTIONS_DIALOG,RKD_SEL_BUILD_WHERE_CLAUSE,RH_DYNAMIC_WHERE_BUILD , for more details search in SCN.

Refer link:[http://www.sap-img.com/abap/how-can-we-give-dynamic-table-name-in-select-statement.htm]

Read only

Former Member
0 Likes
1,287

Hi sunil,

Please folow this link http://help.sap.com/search/highlightContent.jsp

Warm regards,

Pravin