2008 Feb 06 8:53 AM
Hey guys,
What does for all entries actually does?
Sample Code:
SELECT vbeln
posnr
matnr
kwmeng
kbmeng
vrkme
werks
FROM vbap
INTO TABLE i_vbap
FOR ALL ENTRIES IN i_vbak
WHERE vbeln EQ i_vbak-vbeln
AND abgru EQ space.
Thanks!
2008 Feb 06 9:00 AM
Hi,
see if i_vbap has 4 entries with
1) vbeln = 10
2) vbeln = 20
3) vbeln = 30
4) vbeln = 40
now see ur query it behaves like dis.......
SELECT vbeln
posnr
matnr
kwmeng
kbmeng
vrkme
werks
FROM vbap
INTO TABLE i_vbap
WHERE ( vbeln EQ 10 or vbeln EQ 20 or vbeln EQ 30 or vbeln EQ 40 )
AND abgru EQ space.
Cheers,
jose.
Hey guys,
What does for all entries actually does?
Sample Code:
SELECT vbeln
posnr
matnr
kwmeng
kbmeng
vrkme
werks
FROM vbap
INTO TABLE i_vbap
FOR ALL ENTRIES IN i_vbak
WHERE vbeln EQ i_vbak-vbeln
AND abgru EQ space.
Thanks!
2008 Feb 06 8:56 AM
HI,
the select shows you all entries in vbap where the vbeln is also in the internal table i_vbak.
so ... you need to fill the intern table first.
regards
Nicole
2008 Feb 06 8:56 AM
hi,
it will retrieve the data that is thre in table i_vbak..that means if the internal table has 100 records then it will retrieve 100 records data from table VBAP...basing on vbeln
it removes the duplicate entries..
Regards,
Nagaraj
2008 Feb 06 8:58 AM
Hi Mark ,
In this statement data is selected from table VBAP based on the entreis in the internal table i_vbak . i.e if the table contains
vbeln equal to the entry in internal table and abgru eq space then the resord is selected.
Regards
Arun
2008 Feb 06 9:00 AM
FOR ALL ENTRIES works like INNER JOIN
Performance wise it is better tahn INNER JOIN
If u use FOR ALL ENTRIES, 1st we have to populate the 1st ITAB.
If the 1st ITAB is not empty the we have to populate the 2nd ITAB based on the entries of 1st ITAB.
SELECT vbeln posnr matnr kwmeng kbmeng vrkme werks
FROM vbap
INTO TABLE i_vbap
FOR ALL ENTRIES IN i_vbak
WHERE vbeln EQ i_vbak-vbeln
AND abgru EQ space.
In ur code, it fetches the record s from VBAP, which are alredy in i_vbak. (ie for all entries in i_vbak, we get the records)
so, 1st u have to populate i_vbak from the databse table VBAK
Reward if useful
Narendra
2008 Feb 06 9:00 AM
Hi,
see if i_vbap has 4 entries with
1) vbeln = 10
2) vbeln = 20
3) vbeln = 30
4) vbeln = 40
now see ur query it behaves like dis.......
SELECT vbeln
posnr
matnr
kwmeng
kbmeng
vrkme
werks
FROM vbap
INTO TABLE i_vbap
WHERE ( vbeln EQ 10 or vbeln EQ 20 or vbeln EQ 30 or vbeln EQ 40 )
AND abgru EQ space.
Cheers,
jose.
2008 Feb 06 9:02 AM
Instead of writing a join on two tables.. say in your case
vbap and vbak(I think U got the information into i_vbak
from table vbak) .. U can write For all entries ..
But .. before writing check if i_vbak[] is initial ..
If not i_vbak[] is initial.
write the select for all entries ...
endif.
It gets the data from vbap for all the vbeln's where
vbap-vbeln = vbeln's in vbak
2008 Feb 06 9:04 AM
Hi,
There are 3 prerequisites for using 'for all entries'.They are:
1.Adjacent duplicates has to be deleted,
2.The first table has to be initial(in your case i_vbak)
3.Correct relationship betwn 2 tables has to be maintained.
For ur select query,
it selects the specified fields from vbap and populate into i_vbap by checking the condition i_vbak-vbeln = i_vbap-vbeln and AND abgru = space.
rewards if useful..
regards,
kavitha
2008 Feb 06 9:08 AM
HI Mark
FOR ALL ENTRIES
should be used wherevr possible for the Performance Reasons .
Always Check the while using For All Entries
The Internal should not be be Initial otherwise it will select all the records irrespctive of the where condition .
In your Condition .
SELECT vbeln
posnr
matnr
kwmeng
kbmeng
vrkme
werks
FROM vbap
INTO TABLE i_vbap
FOR ALL ENTRIES IN i_vbak
WHERE vbeln EQ i_vbak-vbeln
AND abgru EQ space.
Only Those Records From VBAP are selected , where
VBELN = i_vbak-vbeln
.
For eg if I_VBAK has 100 records
but in VBAP abgru is space only for VBELN 1 to 10 .
THEN I_VBAP will have only 10 records with VBELN from 1 to 10 .
Hope its clear .
Thanks
Praveen
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |