Max no of records in for all entries table
Hello all,
Hi have used for all entries in a select statement in BW extractor. This extractor is working fine for the test data. When i moved this code to pre-production for testing, there this extractor has to deal with thousands of records. In pre-prod , this select statement is not picking up all the records available in DB. Can any one give any idea on behavior of for all entries for large number of records. and is the any max limit for for all entries table.
Thank you..correct answer will be rewarded.
Regards
Sravan
Moderator message - Please search before asking and do not offer rewards (particularly since as far as I can see, you've awarded a total of two points in the last two years - post locked
Rob
Similar Messages
-
Performance issue fetching huge number of record with "FOR ALL ENTRIES"
Hello,
We need to extract an huge amount of data (about 1.000.000 records) from VBEP table, which overall dimension is about 120 milions records.
We actually use this statements:
CHECK NOT ( it_massive_vbep[] IS INITIAL ) .
SELECT (list of fields) FROM vbep JOIN vbap
ON vbepvbeln = vbapvbeln AND
vbepposnr = vbapposnr
INTO CORRESPONDING FIELDS OF w_sched
FOR ALL ENTRIES IN it_massive_vbep
WHERE vbep~vbeln = it_massive_vbep-tabkey-vbeln
AND vbep~posnr = it_massive_vbep-tabkey-posnr
AND vbep~etenr = it_massive_vbep-tabkey-etenr.
notice that internal table it_massive_vbep contains always records with fully specified key.
Do you think this query could be further optimized?
many thanks,
-Enricothe are 2 option to improve performance:
+ you should work in blocks of 10.000 to 50.000
+ you should check archiving options, does this really make sense
> VBEP table, which overall dimension is about 120 milions records.
it_massive_vbep into it_vbep_notsomassive (it_vbep_2)
CHECK NOT ( it_vbep_2[] IS INITIAL ) .
get runtime field start.
SELECT (+list of fields+)
INTO CORRESPONDING FIELDS OF TABLE w_sched
FROM vbep JOIN vbap
ON vbep~vbeln = vbap~vbeln AND
vbep~posnr = vbap~posnr
FOR ALL ENTRIES IN it_vbep_2
WHERE vbep~vbeln = it_vbep_2-vbeln
AND vbep~posnr = it_vbep_2-posnr
AND vbep~etenr = it_vbep_2-etenr.
get runtime field stop.
t = stop - start.
write: / t.
Be aware that even 10.000 will take some time.
Other question, how did you get the 1.000.000 records in it_massive_vbep. They are not typed in, but somehow select.
Change the FAE into a JOIN and it will be much faster.
Siegfried -
Problem in getting records using FOR ALL ENTRIES
Hi All,
I am bringing the employee details with required selection criteria into an internal master table IT_EMPDETAILS.
Now, I would want to fill the other columns of this internal table, using FOR ALL ENTRIES as below:
SELECT ZRCODE FROM PA9001
INTO CORRESPONDING FIELDS OF TABLE IT_EMPDETAILS
FOR ALL ENTRIES IN IT_EMPDETAILS
WHERE PERNR = IT_EMPDETAILS-PERNR
AND ENDDA = '99991231'.
but while i use this, it is actually clearing the IT_EMPDETAILS instead of filling the column of IT_EMPDETAILS table.
what could be going wrong??
Thanks in advance,
MohanDear All,
Thanks for the amazing replies, yesterday's world cup match is really doing wonders i guess!
To give more insight at what i am looking for and what is done so far:
I tried creating another Internal table and then filled that with only PERNR.
and then using that. tried to fill IT_EMPDETAILS internal table using for all entries,
alas it did not work, and it did not work with APPENDING CORRESPONDING either.
now, coming to using LOOP, if I use loop, I am going run the loop for 1lakh emp(approx..and going high everyday) and modify the internal table for 1lakh records. AND not only that, I am going to loop another 9 tables in similar manner. that is 9lakh loops AND thats not all,
after that I have to again loop the master internal table to loop and fill other employee details like 'text' instead of 'code' from a master table.
This is one of the most query intensive, realtime, online comprehensive employee report that i am making.
Appreciate replies from ABAP performance tuning experts and gurus in advance.
Cheers,
Mohan -
For all entries table handled by Tables parameter of Subroutine!
Hi....
See my code...
Dont leave as it seems very big code... Actually its very small one...
In sourse code of function module...
data:itab1 type standard table of <local structure of top include> with header line,
itab2 type standrad table of knvp with header line.
perform routine_data tables itab1
using p_var
Subroutine code, saved in F include of that function group...
form routine_data tables itab1 type standard table
using p_var
select * from <db table>
into corresponding fields of table itab
where <keyfield> = p_var.
endform.
Back to source cod eof Function module..
if sy-subrc is = 0.
select parvw kunn2 kunnr from knvp
into corresponding fields of table itab2 for all entries in itab1
where kunnr = itab1-kunnr
and ( parvw = 'WE' or parvw = 'RE' or parvw = 'RG').
endif.
This code is working fine......
==================Now coming to my problem==========================
In source code of function module...
data:itab1 type standard table of <local structure of top include> with header line,
itab2 type standrad table of knvp with header line.
perform routine_data tables itab1
using p_var
Subroutine code, saved in F include of that function group...
form routine_data tables itab1 type standard table
using p_var
select * from <db table>
into corresponding fields of table itab
where <keyfield> = p_var.
endform.
Function module source code...
perform routine2_data tables itab1
itab2.
F include coding part for above subroutine....
form routine2_data tables itab1 type standard table
itab2 type standard table
select parvw kunn2 kunnr from knvp
into corresponding fields of table itab2 for all entries in itab1
where kunnr = itab1-kunnr <-----causing error
and ( parvw = 'WE' or parvw = 'RE' or parvw = 'RG').
endform.
Giving error message....
>>> The specified type has no structure and therefore no component called 'KUNNR".....
So here the problem is there is a incorrect way to declare parameters....
Plz remind that SUBROUTINES OF FUNCTION MODULES SAVING IN INCLUDE PROGRAMS, because they making some deffenrce with normal external subroutines...
also...
Here for all entries is mandatory!
And Two sub routines are mandatory!
Thanks for your attention...
Naveen Inuganti.Hi ,
Use the below syntax to pass the tables as parameters
*The below perform is in the source code of the F.M
PERFORM goods_movement_post TABLES itab1
itab2
itab3
USING ls_goodsmvt_header
g_mov_code.
suppose u are using the itab1 & itab2 tables data to get the itab3 Data
And The below code is in the Frms include
FORM goods_movement_post
TABLES
pt_itab1 STRUCTURE vbak
pt_itab2 STRUCTURE vbap
pt_itab3 STRUCTURE bapiret2
USING
p_ls_goodsmvt_header STRUCTURE bapi2017_gm_head_01
p_g_mov_code.
ENDFORM
Thanks & Reagrds
Mallikharjuna Reddy -
Using aggregate function along with for all entries: sugest alternative
My requirement:
For each record in i_vbap for which 'charg' is initial, need to determine batch using the following logic:
For the material (MATNR) in i_vbap, select the batch (CHARG) which has the largest (MAX) unrestricted inventory quantity (CLABS) from MCHB table.
How do I implement this logic without using select statement inside a loop as I cannot use MAX ( CLABS ) function along with FOR ALL ENTRIES in a SELECT?
Suggest an alternative.For each record in i_vbap for which 'charg' is initial ,fetch all the existing 'clabs' value.
[ Remember to include all the key fields in selct ]
Sort the new table .
Put a loop,use at end of 'charg' and append to another table. U get ur solution
I think this should be the most economic way to do so. -
Performance on Select Single&Write AND Select*(For All Entries)&Read&Write
Hi Experts,
I got a code review problem & we are in a argument.
I need the best performance code out of this two codes. I have tested this both on 5 & 1000 & 3000 & 100,000 & 180,000 records.
But still, I just need a second opinion of experts.
TYPES : BEGIN OF ty_account,
saknr TYPE skat-saknr,
END OF ty_account.
DATA : g_txt50 TYPE skat-txt50.
DATA : g_it_skat TYPE TABLE OF skat, g_wa_skat LIKE LINE OF g_it_skat.
DATA : g_it_account TYPE TABLE OF ty_account, g_wa_account LIKE LINE OF g_it_account.
Code 1.
SELECT saknr INTO TABLE g_it_account FROM skat.
LOOP AT g_it_account INTO g_wa_account.
SELECT SINGLE txt50 INTO g_txt50 FROM skat
WHERE spras = 'E'
AND ktopl = 'XXXX'
AND saknr = g_wa_account-saknr.
WRITE :/ g_wa_account-saknr, g_txt50.
CLEAR : g_wa_account, g_txt50.
ENDLOOP.
Code 2.
SELECT saknr INTO TABLE g_it_account FROM skat.
SELECT * INTO TABLE g_it_skat FROM skat
FOR ALL ENTRIES IN g_it_account
WHERE spras = 'E'
AND ktopl = 'XXXX'
AND saknr = g_it_account-saknr.
LOOP AT g_it_account INTO g_wa_account.
READ TABLE g_it_skat INTO g_wa_skat WITH KEY saknr = g_wa_account-saknr.
WRITE :/ g_wa_account-saknr, g_wa_skat-txt50.
CLEAR : g_wa_account, g_wa_skat.
ENDLOOP.
Thanks & Regards,
Dileep .CHi Dilip.
from you both the code I have found that you are selecting 2 diffrent fields.
In Code 1.
you are selecting SAKNR and then for these SAKNR you are selecting TXT50 from the same table.
and in Code 2 you are selecting all the fields from SAKT table for all the values of SAKNR.
I don't know whats your requirement.
Better you declare a select option on screen and then fetch required fields from SAKT table for the values entered on screen for SAKNR.
you only need TXT50 and SAKNR fields.
so declare two types one for SAKNR and another for TXT50.
Points to be remember.
1. while using for all entries always check the for all entries table should not be blank.
2. you will have to fetch all the key fields in table while applying for all entries,
you can compare key fields with a constant which is greater than initial value.
3. while reading the table sort the table by the field on which you are going to read it.
try this:
TYPES : BEGIN OF ty_account,
saknr TYPE skat-saknr,
END OF ty_account.
TYPES : begin of T_txt50,
saknr type saknr,
txt50 type txt50,
end of t_txt50.
DATA: i_account type table of t_account,
w_account type t_account,
i_txt50 type table t_txt50,
w_txt50 type t_txt50.
select SAKNR from SKAT into table i_account.
if sy-subrc = 0.
sort i_account by saknr.
select saknr txt50 from SKAT into table i_txt50
for all entries in i_account
where SAKNR = i_account-SAKNR
here mention al the primary keys and compare them with their constants.
endif.
Note; here you need to take care that, you will have to fetch all the key fields in table i_txt50.
and compare those fields with there constants which should be greater than initial values.
they should be in proper sequence.
now for writing.
loop at i_account into w_account.
clear w_txt50.
sort i_txt50 by saknr.
read table i_txt50 into w_txt50 with key SAKNR = w_account-saknr
if sy-subrc = 0.
write: w_txt50-saknr, w-txt50-txt50.
clear w_txt50, w_account.
endif.
endloop.
Hope it wil clear your doubts.
Thanks
Lalit -
Use HR_READ_INFOTYPE or select (for all entries)
Hi
As I have understood the difference between FM HR_READ_INFOTYPE and a select directly from PA0001 (as example) is that the FM take the authorization into account. (please correct me if I am wrong).
My problem is that I need to select from the infotype for a lot of pernr, so I would use this statement:
SELECT * FROM pa0001 INTO CORRESPONDING FIELDS OF TABLE wt_pa0001
FOR ALL ENTRIES IN wt_pernr
WHERE pernr = wt_pernr-pernr
AND begda LE pn-endda
AND endda GE pn-begda.
but then I don't get the authorization check.
For the FM HR_READ_INFOTYPE I can't use the "FOR ALL ENTRIES".
Can I do it in an easy way, or do need to do the select, and then use an authority check after the select from each infotype?Calling HR_READ_INFOTYPE or selecting directly from the tables may depend on how much data you are processing. If you only need to retrieve a few records, you could process the PERNR records you need in a loop and call HR_READ_INFOTYPE for each. If you're processing a larger number of records, check the authorization for the each table first and then do a SELECT for all entries. Before you read, make sure that your "FOR ALL ENTRIES" table is not empty. In order to make your code more generic, you may want to use function module HR_CHECK_AUTHORITY_INFTY to check the authorization for each infotype. This is the FM that the HR_READ_INFOTYPE function module uses.
.. Craig -
Hello,
probably it is a silly problem, but can anybody tell me why this FOR ALL ENTRIES IN statement does not fill all the columns of my internal table?
At the end of the report only the columns LGOBE contains values.
data itab type zmm_t_alv.
select mardmatnr mardwerks mardlgort mardlabst
maktspras maktmaktx
into corresponding fields of table itab
from mard inner join makt
on mardmatnr = maktmatnr
where makt~spras = 'D'.
select lgobe
into corresponding fields of table itab
from t001l
for all entries in itab
where t001l~werks = itab-werks.
break-point.
Thanks,
ManuelPlease read the documentation aboutr for all entries
For all entries selects all records from a db table which correspond to the entries in an internal table, the result must be stored in a different table.
Otherwise use a loop at itab.
select single ...
modify itab
endloop
Be careful with empty For all entries tables, it behave like a ranges table, no entry means no restriction and you get all records from the db table. That is a different behavior than the loop above.
Use field1 field2 ... in corresponding fields of ....
If you specify only one field then you get only one result.
If you want one the field 'lgobe' then use into wa-lgobe and not the much slower into corresponding!
Siegfried -
Hi Expert,
Could you please help me in this inner join , Inner join is performance wise is not good so i want to replace instated of inner join for all entries. But when i am checking records of internal table there is difference. in inner join i am getting 11 records but for all entries i am getting 5 records .
Please help me out where excatly i have done mistake.
SELECT maralvorm maramatkl
maramatnr marameins
maraprdha maraspart
marcausss marcbearz
marcbeskz marcbstmi
marc~wzeit
marcdisgr marcmaabc * marcdismm marcdispo
marcdispr marcdzeit
marcplifz marcdisls
marcbstma marcbstrf
marc~basmg
marceisbe marcfevor
marcfxhor marclvorm
marcmatnr marcmmsta
marcprctr marcsobsl
marctranz marcwerks
marc~xchar
marclgpro marcfhori
marc~rgekz
mbewbklas mbewbwkey
mbewlbkum mbewsalk3
mbewmatnr mbewpeinh
mbewstprs maktmaktx
maktmatnr cepcabtei
cepc~prctr
marcschgt marcminbe
marc~ekgrp
marc~eprio
marc~kausf
marc~shflg
marc~shzet
marc~fabkz
marc~lgrad
marc~shpro
marc~eislo
marc~rwpro
marc~lgfsb
marczzfdwe marczzfdwi
marczzsspe marczzsspi
INTO TABLE i_matl
FROM ( mara
INNER JOIN marc
ON marcmatnr = maramatnr
INNER JOIN mbew
ON mbewmatnr = marcmatnr
AND mbewbwkey = marcwerks
INNER JOIN makt
ON maktmatnr = maramatnr
INNER JOIN cepc
ON cepcprctr = marcprctr
AND cepcdatbi >= sy-datum ) "* WHERE maralvorm IN sp$00094
AND mara~matkl IN sp$00084
AND mara~meins IN sp$00091
AND mara~prdha IN sp$00066
AND mara~spart IN sp$00085
AND marc~disgr IN sp$00089
AND marc~dismm IN sp$00067
AND marc~dispo IN sp$00061
AND marc~dispr IN sp$00083
AND marc~fevor IN sp$00090
AND marc~lvorm IN sp$00092
AND marc~mmsta IN sp$00086
AND marc~beskz IN s_beskz
AND marc~sobsl IN sp$00068
AND marc~werks IN sp$00062
AND marc~xchar IN sp$00093
AND marc~maabc IN sp$00099
AND marc~lgrad IN s_lgrad
AND marc~lgpro IN s_lgpro
AND marc~rwpro IN s_rwpro
AND marc~lgfsb IN s_lgfsb
AND marc~schgt INs_schgt * AND marc~shflg IN s_shflg
AND marc~shzet IN s_shzet
AND marc~fabkz IN s_fabkz
AND marc~shpro IN s_shpro
AND marc~eislo IN s_eislo
AND marc~zzfdwe IN s_zzfdwe
AND marc~zzfdwi IN s_zzfdwi
AND marc~zzsspe IN s_zzsspe
AND marc~zzsspi IN s_zzsspi
AND mbew~bklas IN sp$00063
AND mbew~lbkum IN sp$00088
AND makt~maktx IN sp$00059
AND makt~spras = c_en
AND makt~matnr IN sp$00060
AND cepc~prctr IN sp$00087.
I am using for all entries
fetching data from marc data base table
SELECT matnr werks lvorm xchar mmsta
maabc ekgrp dispr dismm
dispo plifz ausss disls
beskz sobsl minbe eisbe
bstmi bstma bstrf fhori
rgekz fevor bearz tranz
basmg dzeit wzeit lgrad
prctr fxhor lgpro disgr
kausf rwpro lgfsb schgt
eprio shflg shzet fabkz
shpro eislo zzfdwe zzfdwi
zzsspe zzsspi
FROM marc INTO TABLE i_marc
WHERE werks IN sp$00062
AND lvorm IN sp$00092
AND xchar IN sp$00093
AND mmsta IN sp$00086
AND maabc IN sp$00099
AND dispr IN sp$00083
AND dismm IN sp$00067
AND dispo IN sp$00061
AND beskz IN s_beskz
AND sobsl IN sp$00068
AND fevor IN sp$00090
AND lgrad IN s_lgrad
AND lgpro IN s_lgpro
AND disgr IN sp$00089
AND rwpro IN s_rwpro
AND lgfsb IN s_lgfsb
AND schgt IN s_schgt
AND shflg IN s_shflg
AND shzet IN s_shzet
AND fabkz IN s_fabkz
AND shpro IN s_shpro
AND eislo IN s_eislo
AND zzfdwe IN s_zzfdwe
AND zzfdwi IN s_zzfdwi
AND zzsspe IN s_zzsspe
AND zzsspi IN s_zzsspi.
IF sy-subrc EQ 0.
SORT i_marc BY matnr werks.
ENDIF.
DELETE ADJACENT DUPLICATES FROM i_marc comparing matnr werks.
*fetching data from mara data base table
IF NOT i_marc[] IS INITIAL.
SELECT matnr lvorm matkl
meins spart prdha
FROM mara INTO TABLE i_mara
FOR ALL ENTRIES IN i_marc
WHERE matnr = i_marc-matnr
AND lvorm IN sp$00094
AND matkl IN sp$00084
AND meins IN sp$00091
AND prdha IN sp$00066
AND spart IN sp$00085.
ENDIF.
IF sy-subrc EQ 0.
SORT i_mara BY matnr.
ENDIF.
DELETE ADJACENT DUPLICATES FROM i_mara comparing matnr.
*fetching data from mbew data base table
IF NOT i_mara[] IS INITIAL.
SELECT matnr bwkey bwtar lbkum
salk3 stprs peinh bklas
FROM mbew INTO TABLE i_mbew
FOR ALL ENTRIES IN i_marc
WHERE matnr = i_marc-matnr
AND bwkey = i_marc-werks
AND bklas IN sp$00063
AND lbkum IN sp$00088.
ENDIF.
IF sy-subrc EQ 0.
SORT i_mbew BY matnr bwkey bwtar.
ENDIF.
*DELETE ADJACENT DUPLICATES FROM i_mbew comparing matnr bwkey bwtar.
*fetching data from makt data base table
IF NOT i_mara[] IS INITIAL.
SELECT matnr spras maktx
FROM makt INTO TABLE i_makt
FOR ALL ENTRIES IN i_mara
WHERE matnr = i_mara-matnr
AND maktx IN sp$00059
AND makt~spras = c_en.
ENDIF.
IF sy-subrc EQ 0.
SORT i_makt BY matnr spras.
ENDIF.
DELETE ADJACENT DUPLICATES FROM i_makt.
*fetching data from cpec data base table
IF NOT i_marc[] IS INITIAL.
SELECT prctr datbi kokrs abtei
FROM cepc INTO TABLE i_cepc
FOR ALL ENTRIES IN i_marc
WHERE prctr = i_marc-prctr
AND prctr IN sp$00087
AND datbi >= sy-datum.
ENDIF.
IF sy-subrc EQ 0.
SORT i_cepc BY prctr datbi kokrs.
ENDIF.
*DELETE ADJACENT DUPLICATES FROM i_cepc.
LOOP AT i_cepc INTO wa_cpec.
read table i_marc into wa_marc with key
prctr = wa_cpec-prctr binary search.
if sy-subrc = 0.
i_matl-abtei = wa_cpec-abtei.
i_matl-prctr1 = wa_cpec-prctr.
i_matl-ausss = wa_marc-ausss.
i_matl-bearz = wa_marc-bearz.
i_matl-beskz = wa_marc-beskz.
i_matl-bstmi = wa_marc-bstmi.
i_matl-wzeit = wa_marc-wzeit.
i_matl-disgr = wa_marc-disgr.
i_matl-maabc = wa_marc-maabc.
i_matl-dismm = wa_marc-dismm.
i_matl-dispo = wa_marc-dispo.
i_matl-dispr = wa_marc-dispr.
i_matl-dzeit = wa_marc-dzeit.
i_matl-plifz = wa_marc-plifz.
i_matl-disls = wa_marc-disls.
i_matl-bstma = wa_marc-bstma.
i_matl-bstrf = wa_marc-bstrf.
i_matl-basmg = wa_marc-basmg.
i_matl-eisbe = wa_marc-eisbe.
i_matl-fevor = wa_marc-fevor.
i_matl-fxhor = wa_marc-fxhor.
i_matl-lvorm1 = wa_marc-fevor.
i_matl-matnr1 = wa_marc-matnr.
i_matl-mmsta = wa_marc-mmsta.
i_matl-prctr = wa_marc-prctr.
i_matl-sobsl = wa_marc-sobsl.
i_matl-tranz = wa_marc-tranz.
i_matl-werks = wa_marc-werks.
i_matl-xchar = wa_marc-xchar.
i_matl-lgpro = wa_marc-lgpro.
i_matl-fhori = wa_marc-fhori.
i_matl-rgekz = wa_marc-rgekz.
i_matl-schgt = wa_marc-schgt.
i_matl-minbe = wa_marc-minbe.
i_matl-ekgrp = wa_marc-ekgrp.
i_matl-eprio = wa_marc-eprio.
i_matl-kausf = wa_marc-kausf.
i_matl-shflg = wa_marc-shflg.
i_matl-shzet = wa_marc-shzet.
i_matl-fabkz = wa_marc-fabkz.
i_matl-lgrad = wa_marc-lgrad.
i_matl-shpro = wa_marc-shpro.
i_matl-eislo = wa_marc-eislo.
i_matl-rwpro = wa_marc-rwpro.
i_matl-lgfsb = wa_marc-lgfsb.
i_matl-zzfdwe = wa_marc-zzfdwe.
i_matl-zzfdwi = wa_marc-zzfdwi.
i_matl-zzsspe = wa_marc-zzsspe.
i_matl-zzsspi = wa_marc-zzsspi.
endif.
READ TABLE i_mara INTO wa_mara WITH KEY
matnr = wa_marc-matnr binary search.
i_matl-lvorm = wa_mara-lvorm.
i_matl-matkl = wa_mara-matkl.
i_matl-matnr = wa_mara-matnr.
i_matl-meins = wa_mara-meins.
i_matl-prdha = wa_mara-prdha.
i_matl-spart = wa_mara-spart.
READ TABLE i_makt INTO wa_makt WITH KEY
matnr = wa_mara-matnr binary search.
i_matl-matnr3 = wa_makt-matnr.
i_matl-maktx = wa_makt-maktx.
READ TABLE i_mbew INTO wa_mbew WITH KEY
matnr = wa_marc-matnr binary search.
i_matl-bklas = wa_mbew-bklas.
i_matl-bwkey = wa_mbew-bwkey.
i_matl-lbkum = wa_mbew-lbkum.
i_matl-salk3 = wa_mbew-salk3.
i_matl-matnr2 = wa_mbew-matnr.
i_matl-peinh = wa_mbew-peinh.
i_matl-stprs = wa_mbew-stprs.
READ TABLE i_cepc INTO wa_cpec WITH KEY
prctr = wa_marc-prctr.
APPEND i_matl.
CLEAR: wa_cpec, wa_mbew, wa_mara, wa_marc.
ENDLOOP.
Thaks
Waiting your reply.Hi Sasmita,
I think your final loop is the problem. As you are looping through the CEPC internal table, and reading the other tables. For different materials there might be a same profit center, the read table will fetch you only first occurance of the profit center from the mara or marc table.
So loop through either mara or marc table and read the remaining and populate your final internal tables. This might solve your problem.
Regards,
Ramesh Babu S
*Reward points if it is helpful.... -
Unable to Get the Data Using For All Entries
Hi everybody, i am using for all entries in a program. but when i am writing a code using for all entries i am getting an error as
Where condition does not refers to the FOR ALL ENTRIES tables...
SELECT KUNNR
NAME1
ORT01
LAND1
FROM KNA1 INTO TABLE ITAB1 WHERE KUNNR IN S_KUNNR.
IF NOT ITAB1 IS INITIAL.
SELECT VBELN
ERDAT
KUNNR
FROM VBAK INTO TABLE ITAB2 FOR ALL ENTRIES IN ITAB1 WHERE KUNNR = IT_KNA1-KUNNR.
ENDIF.
can anybody help out in this
regards
hyder aliThe correct one may be like this:
SELECT KUNNR
NAME1
ORT01
LAND1
FROM KNA1 INTO TABLE ITAB1 WHERE KUNNR IN S_KUNNR.
IF NOT ITAB1 IS INITIAL.
SELECT VBELN
ERDAT
KUNNR
FROM VBAK INTO TABLE ITAB2 FOR ALL ENTRIES IN ITAB1 WHERE KUNNR = ITAB1-KUNNR. "modified here
ENDIF.
Edited by: XuJian84 on Mar 9, 2010 4:25 AM -
FOR ALL ENTRIES IN is needed or not needed ?
I have below SELECT stmt in my progam ( actually, I have copied one BW program into R/3 system and created similar tables in R/3 as well ).
SELECT *
INTO TABLE t_codei
FROM ZBIC_CODEI_OHB " /bic/pcodei_ohb
FOR ALL ENTRIES IN it_requid
WHERE gnfldnm = 'AUDIT_FILE'
AND destinatn = it_requid-tgt
AND objvers = 'A'.
However in my R/3 program, I had to have comment it_requid internal table which was used in the above SELECT stmt.
So, if I use selection-screen PARAMETER instead it_requid-tgt, then I am getting syntax error as "WHERE condition does not refer to the FOR ALL ENTRIES table".
So what can I do ? Can I Remove "FOR ALL ENTRIES IN it_requid" in the below stmt (how it effects performance)? Or Build it_requid internal table with p_path value ?
Or is there any optimal solution ?
SELECT *
INTO TABLE t_codei
FROM ZBIC_CODEI_OHB " /bic/pcodei_ohb
FOR ALL ENTRIES IN it_requid
WHERE gnfldnm = 'AUDIT_FILE'
AND destinatn = p_path " it_requid-tgt
AND objvers = 'A'.
Thanks in advance for your help.Hi,
When you use * For all entries in * , You must inclue at least one fields in where condition.
but when you used the parameter and not using any fields of for all entries table fields it will give error, so must be include at least one fields in where condition.
You can include both in following way
SELECT *
INTO TABLE t_codei
FROM ZBIC_CODEI_OHB " /bic/pcodei_ohb
FOR ALL ENTRIES IN it_requid
WHERE gnfldnm = 'AUDIT_FILE'
AND ( destinatn = it_requid-tgt or destinatn = p_path )
AND objvers = 'A'.
Rgds
Ravi Lanjewar -
FOR ALL ENTRIES IN - Not selecting all Records
Hi,
SELECT obknr ppaufnr ppposnr
FROM ser05
INTO TABLE gi_ser05
FOR ALL ENTRIES IN gi_objkpo
WHERE obknr EQ gi_objkpo-obknr
AND ppaufnr IN so_aufnr
AND ppposnr EQ '0001'.
IF NOT gi_ser05 IS INITIAL.
SELECT bwart matnr menge dmbtr aufnr
FROM aufm
INTO TABLE gi_aufm
FOR ALL ENTRIES IN gi_ser05
WHERE aufnr = gi_ser05-ppaufnr
AND bwart IN ('261','262').
ENDIF.
In debugging, this code is fetching 129 entries in gi_aufm.
Where in AUFM table for same WHERE Conditions there are 139 records.
Why it's skipping Records?HI ,
SELECT obknr ppaufnr ppposnr
FROM ser05
INTO TABLE gi_ser05
FOR ALL ENTRIES IN gi_objkpo
WHERE obknr EQ gi_objkpo-obknr
AND ppaufnr IN so_aufnr
AND ppposnr EQ '0001'.
IF NOT gi_ser05 IS INITIAL.
SELECT bwart matnr menge dmbtr aufnr
FROM aufm
INTO TABLE gi_aufm
FOR ALL ENTRIES IN gi_ser05
WHERE aufnr = gi_ser05-ppaufnr
AND bwart IN ('261','262').
ENDIF.
in above code where you are getting Less Records
Because from above code it seems that you not selected
MANDT
MBLNR
MJAHR
ZEILE from table aufm
which is primary key of table AUFM and all records are depended on entries in table gi_objkpo which you are using for
all entries .
so first check data in table by passing values according to where condition .
Regards
Deepak. -
FOR ALL ENTRIES not returning correct number of records
Hi,
I have the following code: -
SELECT vbelv "Delivery
posnv "Delivery Item
rfmng "GR Qty
plmin "Sign
INTO TABLE t_gr
FROM vbfa
FOR ALL ENTRIES IN t_deliveries
WHERE vbelv EQ t_deliveries-vbeln
AND posnv EQ t_deliveries-posnr
AND vbtyp_n EQ c_goods_receipt.
The internal table t_deliveries has a single entry. The table VBFA has 5 records for the delivery/item.
When the SQL is executed it returns 4 records. If I amend the code to use the following it returns the 5 records. Has anybody had a similar issue.
LOOP AT t_deliveries INTO st_deliveries.
SELECT vbelv "Delivery
posnv "Delivery Item
rfmng "GR Qty
plmin "Sign
APPENDING TABLE t_gr
FROM vbfa
WHERE vbelv EQ st_deliveries-vbeln
AND posnv EQ st_deliveries-posnr
AND vbtyp_n EQ c_goods_receipt.
ENDLOOP.FOR ALL Entries can fatch only the unique rows from the table. So, check in the VBFA for the your inputs and the output fields, you will have only 4 unique records. That's why it is picking up only 4 records.
Try to include one more fields which makes every row as a unique row.
Regards,
Naimesh Patel -
Maximum number of records for usage of "For all entries"
Hi,
Is there a limit on maximum number of records to be selected from the database using "For all entries" statement ?
Thanks in advanceThere is a UNDOCUMENTED(??) behaviousr
FOR ALL ENTRIES does ahidden SELECT DISTINCT & drops duplicates.
http://web.mit.edu/fss/dev/abap_review_check_list.htm
3 pitfalls
"FOR ALL ENTRIES IN..." (outer join) are very fast but keep in the mind the special features and 3 pitfalls of using it.
(a) Duplicates are removed from the answer set as if you had specified "SELECT DISTINCT"... So unless you intend for duplicates to be deleted include the unique key of the detail line items in your select statement. In the data dictionary (SE11) the fields belonging to the unique key are marked with an "X" in the key column.
^^!!!!
(b) If the "one" table (the table that appears in the clause FOR ALL ENTRIES IN) is empty, all rows in the "many" table (the table that appears in the SELECT INTO clause ) are selected. Therefore make sure you check that the "one" table has rows before issuing a select with the "FOR ALL ENTRIES IN..." clause.
(c) If the 'one' table (the table that appears in the clause FOR ALL ENTRIES IN) is very large there is performance degradation Steven Buttiglieri created sample code to illustrate this. -
For all entries against Ranges
Hi,
I have a question regarding a Select query where I have to select some data and then store it in table and refer it for the 2nd Select.
eg: Select from table 1
into itab1.
select from table 2
into itab2
for all entries in itab1.
My question is should I use a Range for the 1st select instead of an itab.The itab1 will be containing max 50 records.
The problem with for all entries is that I cannot use 'UP TO ROWS' as it only deletes extra entries at application level and not database level. I will be selecting 1000 rows even if I want only 100 rows.
Please let me know ur viewsFrom a performance perspective ranges perform better than FOR ALL ENTRIES however the number of records you can use in your range is limited. You will get a run time dump if your range size increases beyond the allowable. If you are very confident that you have not more than 50 entries in your range, I would recommend that you use the range instead of FOR ALL ENTRIES.
An even better option would be to use a join of two tables. If you can provide specifics I could help you further.
Maybe you are looking for
-
The email comes up when I press the "Submit" button but the email to field is blank.
-
HD tv show won't load onto iPhone4s?
i downloaded an HD tv show from the iTunes store to my iMac, and was trying to transfer an episode to my iPhone 4s. I received an error message that this phone cannot play the video. Is this correct? I transferred the show to my iPad 3 without any is
-
Weblogic 10.0 sends chunked encoding with a HTTP 1.0 request
This took ages to find, it was only the mod_weblogic's Debug ALL parameter that pointed me in the right direction because it printed all the headers in each stage. Server: Apache 2.0 with mod_weblogic and SSL (Dev: Windows XP SP2) Apache 2.2 with mod
-
Hi, How to find out the list of PO change during 1St to up to 31st i.e. list of po verson made during the month. Pl help me. Thanks,
-
How to launch a word document through VC
Hi All, I have requirement which is as follows: I need to provide help for the screens of my application for which there are separate word documents which describes the process of using the application. There are about 6 help documents (MS word). I n