06-13-2008 10:29 AM
Hi all,
I am facing such a case to avoid mutliple db access.
What I have is an internal table with key column filled, now I need all the infos. The normal way should loop the itab, and select data from db to fill current line. But you see, it has to access DB line by line.
Hope somebody suggest a new select clause which can retrieve all the info by one access.
Is it possible?
Thanks for your answer.
06-13-2008 11:06 AM
Hi,
To retrieve the data from the DB table using the internal table, then use FOR ALL ENTRIES key word, then you can retrieve the records from the database table with single select.
ex:
if not tab[] is initial.
select * from kna1
into table t_kna1
for all entries in itab
where kunnr eq itab-kunnr.
endif.
Even we can push the data to the DB (database) table using internal table.
INSERT INTO [DB table] FROM TABLE itab [ACCEPTING DUPLICATE KEYS]
Same we can do update... etc
Reward with points if it is helpful.
06-13-2008 11:06 AM
Hi,
To retrieve the data from the DB table using the internal table, then use FOR ALL ENTRIES key word, then you can retrieve the records from the database table with single select.
ex:
if not tab[] is initial.
select * from kna1
into table t_kna1
for all entries in itab
where kunnr eq itab-kunnr.
endif.
Even we can push the data to the DB (database) table using internal table.
INSERT INTO [DB table] FROM TABLE itab [ACCEPTING DUPLICATE KEYS]
Same we can do update... etc
Reward with points if it is helpful.
06-13-2008 11:50 AM
Hi,
The solution provided by Ravi is correct. Why you have not marked your post as answered. Is there anything else you are looking for.
06-13-2008 12:00 PM