‎2008 Jun 23 10:58 AM
hi all,
please explain the concept of for all entries if possible sample code
‎2008 Jun 23 11:01 AM
hi,
plz use the search functionality available in SDN.
u have hundreds of forums regarding this.
‎2008 Jun 23 11:01 AM
Hi,
go through this links you will find detail abt all entries with examples:
Check SDN forum first.
http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp
http://sapfans.com/forums/viewtopic.php?p=878030
http://abapreports.blogspot.com/2008/06/abap-report-with-for-all-entries.html
Regards
Adil
‎2008 Jun 23 11:02 AM
Check this out
http://www.sap-img.com/abap/usage-of-for-all-entries-in-select-statement.htm
Regards,
Santosh
‎2008 Jun 23 11:02 AM
hi,
see for eg.
Table 1 : ZARK_TEST has 2 fields
code description
001 one
003 three
004 Four
Table 2: ZARK has 2 fields
code name
001 tina
002 mina
004 rina
005 bina
select code name
into table ZARK_DATA
from ZARK
for all entires in ZARK_TEST
where code = ZARK_TEST-code.
so the values in ZARK_DATA will be
Code Name
001 Tina
004 Rina
i think this was a simple example to understand ..... if any query reply back.
reward points if useful.......:-)
and mark the post answered once ur problem is solved ....
Edited by: Ajantha Ratnakumar on Jun 23, 2008 3:37 PM
‎2008 Jun 23 11:02 AM
hiii
For all entries works as join query..see the code below.here in i_mara internal table i have taken data from mara table then for all entries in i_mara table i get data from marc table.here it will check & will join with i_mara table only.& will get data for all the entries in i_mara ..& will give records in i_marc table.
CONSTANTS:
lc_lang VALUE 'E'. " Language Key
SELECT matnr " Material Number
FROM mara
INTO TABLE i_mara
WHERE matnr IN s_matnr.
IF i_mara[] IS NOT INITIAL.
SELECT matnr " Material Number
werks " Plants
prctr " Profit Center
FROM marc
INTO TABLE i_marc
FOR ALL ENTRIES IN i_mara
WHERE matnr = i_mara-matnr
AND werks IN s_werks.
ENDIF. " IF i_mara[] IS NOreward if useful
thx
twinkal
‎2008 Jun 23 11:04 AM
Hi,
select matnr
mtart
meins
from mara
into table it_mara
where matnr in s_matnr.
if not it_mara[] is initial.
select matnr
pstat
werks
from marc
into table it_marc
for all entries in it_mara
where matnr = it_mara-matnr.
you can use for all entries option if you want to fetch some data from a table for all datas in a internal table you can use it.
here the first itab contains material number fetched from Mara, for all these material numbers we need werks, so we can use all entries option to fecth plant details for all the material numbers in table it_mara.
‎2008 Jun 23 11:04 AM
content copied from ABAP key word documentation removed by moderator. DO NOT REPEAT THIS
Edited by: Durairaj Athavan Raja on Jun 23, 2008 1:05 PM
‎2008 Jun 23 11:07 AM
Hi,
Check out the following link.
http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912
Regards.
‎2008 Jun 23 11:07 AM
select * from vbak
into table i_vbak
up to 50 rows.
* This will get 1st 50 rows of the Sales Document Header data
if sy-subrc = 0.
Select * from vbap
into table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
if sy-subrc = 0.
*This will get data from VBAK table for the records retrieved from *previous select
endif.
endif.
‎2008 Jun 23 11:08 AM
Hi,
if int_cntry[] is not intial.
Select * from zfligh appending table int_fligh
For all entries in int_cntry
Where cntry = int_cntry-cntry.
endif..
thanks,
srii.
‎2008 Jun 23 11:10 AM
Hi karanam,
for all entries are used where we want to fetch all data in one table with correspond to other example:-
select vbeln posnr
into table t_tab
from vbap.
select vbeln posnr
into t_tab1
from table vbrp
all entries in t_tab
where vbeln eq t_tab-vbeln.
there sholud be 1 key field in common between the two table which acts as a base(like vbeln in above case) its is same as putting the loop outside a select statement but its is better in terms of performance of the code.
Regards
Ankur
‎2008 Jun 23 11:12 AM
hi,
see for eg.
Table 1 : ZARK_TEST has 2 fields
code description
001 one
003 three
004 Four
Table 2: ZARK has 2 fields
code name
001 tina
002 mina
004 rina
005 bina
select code name
into table ZARK_DATA
from ZARK
for all entires in ZARK_TEST
where code = ZARK_TEST-code.
so the values in ZARK_DATA will be
Code Name
001 Tina
004 Rina
i think this was a simple example to understand ..... if any query reply back.
reward points if useful.......:-)
and mark the post answered once ur problem is solved ....
‎2008 Jun 23 11:15 AM
Hi Ajantha Ratnaku...
Infuture do not edit the content posted by Moderator.
‎2008 Jun 23 11:26 AM
can i know wat did i modify ?
i modified my own reply only......
‎2008 Jun 23 11:53 AM
Hi everyone.
Moderators have the possibility to edit all postings. Whenever they do so they will leave a notice at the end of the posting that they edited it. In most cases they will mark their edits clearly. Moderators only edit postings if there is something in them that is breaking the rules of engagement. Every edit should be seen as a warning; instead of editing moderators just might delete your posting.
In this thread I have noticed a double posting and people asking for points. I don't like to see that in the forums. As the original question has not an appropriate subject and could be solved by a simple search the whole thread should not have been started at all. Therefore I will lock this thread.
Best regards,
Jan Stallkamp
‎2008 Jun 23 11:18 AM
Hi,
Search in SDN, there are many threads on this topic.
Thanks,
Sriram Ponna.