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

Select query

Former Member
0 Likes
688

Hi,

In my code have fetched the value in a table using a function module.Consider the values is present in table gi_table this is being declared as gi_table LIKE ekbe occurs 0 with header line,

Now my problem is have to fetch the values from the table gi_table using select query.

Please use a more informative subject line. Many of the posts in this forum are about SELECT Queries.

if i write

select belnr from gi_table where some codn

.Error is thrown which specifies gi_table is not present.Please help to write a select query to fetch the values from the table gi_table.I cant change the declaration of gi_table bcoz if i change in the FM its not accepting.

Edited by: Rob Burbank on Feb 12, 2009 10:51 AM

4 REPLIES 4
Read only

Former Member
0 Likes
667

You cannot use an sql select on an internal table.

Instead use

loop at your_itab

where 'some where condition'

endloop.

F1 on the loop statement will be able to help as well.

Regards

Greg Kern

Read only

Former Member
0 Likes
667

Hi,

You can not use Select statements to retrieve data from Internal tables.

Only Loop statements and Read statements are used to retrive data for Internal tables.

Once you selected data from FM, then use Loop at ITAB....Endloop.

Regards,

Anil

Read only

tarangini_katta
Active Contributor
0 Likes
667

Hi DIvya,

You can't write select query to the internal table.

select * from itab is not avaliable.

Loop you intenakl table and pass the ur required data to the another internal table.

Thanks

Read only

Former Member
0 Likes
667

Hi Divya,

SELECT query is written only to fetch records from a database table... Which is available in data dictionary (SE11). For internal tables, you cannot use SELECT query..

Instead You have to Use LOOP AT itab. ENDLOOP. statements or READ TABLE itab WITH KEY ... Statement to access records of internal table.

If you want to include a condition..

You may say..

LOOP AT itab WHERE fld1 = var1.

..... Do you processing..

ENDLOOP.

In this way you can also modify or alter any of the records in the internal table using

MODIFY statement.

Plz let me know if you need more info.

Thanks

Geetha