‎2009 Feb 12 3:36 PM
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
‎2009 Feb 12 3:41 PM
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
‎2009 Feb 12 3:57 PM
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
‎2009 Feb 12 3:57 PM
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
‎2009 Feb 12 3:58 PM
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