Problem with FOR ALL ENTRIES statement
Hi all
please find the problem in the select statement.
SELECT vbbe~vbeln
vbap~vstel
marc~dispo
vbbe~matnr
vbbe~kunnr
vbbe~werks
vbbe~mbdat
vbbe~omeng
INTO TABLE l_t_dvbeln
FROM vbbe
INNER JOIN vbak
ON
vbbe~vbeln = vbak~vbeln
inner join vbap
on
vbbe~vbeln = vbap~vbeln and
vbbe~matnr = vbap~matnr
inner join marc
on
vbbe~matnr = marc~matnr and
vbbe~werks = marc~werks
FOR ALL entries IN g_t_stock
WHERE vbbe~matnr = g_t_stock-matnr
AND vbbe~werks = g_t_stock-werks
AND vbak~vkorg = g_t_stock-vkorg
AND vbak~vtweg = g_t_stock-vtweg
AND vbbe~kunnr = g_t_stock-kunnr
AND vbbe~mbdat IN r_mbdat.
g_t_stock is having only one record i.e.,
g_t_stock-vstel = 'DF01'.
g_t_stock-dispo = 'DEI'.
g_t_stock-matnr = '00100833'.
g_t_stock-maktx = 'SAC (300X400)'.
g_t_stock-kunnr = '0000600431'.
g_t_stock-werks = 'PF71'.
g_t_stock-labst = '7727'.
g_t_stock-vkorg = 'SF71'.
g_t_stock-vtweg = 'IC'.
and r_mbdat has the date range as
r_mbdat-sign = I
r_mbdat-option = BT
r_mbdat-low = 15.05.2008
r_mbdat-high = 08.06.2008
In vbak vbap & marc tables i have only one record as per the above selection criteria.
in VBBE table i have 7 records which satisfies the above criteria. But the select staement retrieves only 5 records.
if we remove for all entries and hardcode the values in the select statement then it retrieves all 7 records.
can anybody help me.
what is the reason it is showing only 5 records.
Hi all
actually it has to retrieve the following records
VBELN MATNR KUNNR WERKS MBDAT LABST
30001417 00100833 600431 PF71 15.05.2008 20.000
30001417 00100833 600431 PF71 15.05.2008 20.000
30001417 00100833 600431 PF71 22.05.2008 5.000
30001417 00100833 600431 PF71 22.05.2008 7.000
30001417 00100833 600431 PF71 27.05.2008 10.000
30001417 00100833 600431 PF71 27.05.2008 10.000
30001417 00100833 600431 PF71 29.05.2008 10.000
But it is retrieving only 5 records as below
VBELN MATNR KUNNR WERKS MBDAT LABST
30001417 00100833 600431 PF71 15.05.2008 20.000
30001417 00100833 600431 PF71 22.05.2008 5.000
30001417 00100833 600431 PF71 22.05.2008 7.000
30001417 00100833 600431 PF71 27.05.2008 10.000
30001417 00100833 600431 PF71 29.05.2008 10.000
Please give the reason
Similar Messages
-
Coupling INNER JOIN with FOR ALL ENTRIES statement
Hi All,
I am coupling INNER JOIN with FOR ALL ENTRIES statement .....
Would you please highlight its implications ?? Is it a best practise ?
Is it advicable to use MULTIPLE INNER JOINs with a FOR ALL ENTRIES ???
SORT itab BY matnr.
IF NOT itab[] IS INITIAL.
SELECT epmatnr epebeln ep~ebelp
epwerks epmenge ep~netpr
ekps_psp_pnr ebbelnr eb~menge
INTO TABLE iekpo
FROM ekpo AS ep
INNER JOIN ekkn AS ek
ON ekebeln = epebeln
AND ekebelp = epebelp
INNER JOIN ekbe AS eb
ON ebebeln = epebeln
AND ebebelp = epebelp
AND eb~bwart = '101'
FOR ALL ENTRIES IN itab
WHERE ep~matnr = itab-matnr.
IF sy-subrc EQ 0.
SORT iekpo BY matnr werks.
LOOP AT itab ASSIGNING <itab>.
READ TABLE iekpo WITH KEY matnr = <itab>-matnr
werks = <itab>-werks
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE iekpo-matnr TO itab1-matnr.
MOVE iekpo-ebeln TO itab1-ebeln.
MOVE iekpo-ebelp TO itab1-ebelp.
MOVE iekpo-netpr TO itab1-poprice.
MOVE iekpo-werks TO itab1-werks.
MOVE iekpo-menge TO itab1-menge1.
MOVE iekpo-menge1 TO itab1-menge2.
MOVE iekpo-belnr TO itab1-belnr.
MOVE iekpo-ps_psp_pnr TO itab1-pspel.
MOVE <itab>-pspel TO itab1-tpspel.
MOVE <itab>-sobkz TO itab1-sobkz.
MOVE <itab>-fo_qty TO itab1-fo_qty.
MOVE <itab>-schgt TO itab1-schgt.
MOVE <itab>-postp TO itab1-postp.
MOVE <itab>-beskz TO itab1-beskz.
pend_qty = iekpo-menge1 - iekpo-menge2.
MOVE pend_qty TO itab1-pending.
APPEND itab1.
pend_qty = 0.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
Regards
Jaman
Edited by: ABAP Techie on Sep 15, 2008 12:39 PM
Edited by: ABAP Techie on Sep 15, 2008 12:41 PMbest practise ... don't know ... it is allowed and o.k.
If possible you should of coourse to have no FOR ALL ENTRIES at all !
Joins, there is no general rule, check indexes etc.
The first SORT, I don't that it help for anything, use it together with the delete adjacent duplicates if you expect duplicates in the driver table.
o.k., it can help, if there is a loop afterwards and an append inside, because the new table itab1 is then sorted.
Siegfried -
Alternative for / Problems with: "For all entries in data_package"
Hi Guys
I doing some ABAP in a Start Rotine in BW and would like to do the following:
select * from /BI0/PMATERIAL into table 0mat
for all entries in DATA_PACKAGE
where material = DATA_PACKAGE-/bic/zmaterial.
But I get the following error:
E:When using the addition "FOR ALL ENTRIES IN itab", the fields "MATERIAL" and "DATA_PACKAGE-/BIC/ZMATERIAL" must have the same type and length. and length.
ZMATERIAL:
- Length: 28
- Type: CHAR - Character String
ZMATERIAL:
- Length: 18
- Type: CHAR - Character String
According to the error message "For all entries" cannot be used in this case since the lengths are not identical, but is there an alternative way to do what I would like to do?
Thanks in advance, kind regards,
TorbenHi
one thing you can try like this define one variable in other itab of same type
then loop at the first table and assign it to new field and modify the itab
then use this field with for all entries
Regards
Shiva -
Performance Problems with "For all Entries" and a big internal table
We have big Performance Problems with following Statement:
SELECT * FROM zeedmt_zmon INTO TABLE gt_zmon_help
FOR ALL ENTRIES IN gt_zmon_help
WHERE
status = 'IAI200' AND
logdat IN gs_dat AND
ztrack = gt_zmon_help-ztrack.
In the internal table gt_zmon_help are over 1000000 entries.
Anyone an Idea how to improve the Performance?
Thank you!>
Matthias Weisensel wrote:
> We have big Performance Problems with following Statement:
>
>
SELECT * FROM zeedmt_zmon INTO TABLE gt_zmon_help
> FOR ALL ENTRIES IN gt_zmon_help
> WHERE
> status = 'IAI200' AND
> logdat IN gs_dat AND
> ztrack = gt_zmon_help-ztrack.
>
> In the internal table gt_zmon_help are over 1000000 entries.
> Anyone an Idea how to improve the Performance?
>
> Thank you!
You can't expect miracles. With over a million entries in your itab any select is going to take a bit of time. Do you really need all these records in the itab? How many records is the select bringing back? I'm assuming that you have got and are using indexes on your ZEEDMT_ZMON table.
In this situation, I'd first of all try to think of another way of running the query and restricting the amount of data, but if this were not possible I'd just run it in the background and accept that it is going to take a long time. -
Hi all,
When i was trying to use for all entries, i am not able to pull records inside my internal table. Though both of the tables have the common key fields between them(and ofcourse have entries in that). Now what i have analyzed was, the first table is having 7 primary keys and the one i am using for 'for all entries' comes 6th. Does this gives any impact in pulling records inside my internal table?.Else please give me a possible solution for this. The alternate statement(a normal select query with * ) that i had used for this reserved my dialog processor for a while. Which resulted in 'time exceeded' short dump.Hi,
The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
<cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
Hope this is useful
Reema -
Problem with FOR ALL ENTRIES IN
This is my simple source code.
TABLES: stpo.
DATA: t_stpo LIKE stpo OCCURS 0 WITH HEADER LINE,
t_stpo_itm LIKE stpo OCCURS 0 WITH HEADER LINE,
t_stpo-stlnr = '00000058'.
t_stpo-stlkn = '00000003'.
append t_stpo.
t_stpo-stlnr = '00000058'.
t_stpo-stlkn = '00000007'.
append t_stpo.
SELECT * FROM stpo INTO TABLE t_stpo_itm
FOR ALL ENTRIES IN t_stpo
WHERE stlnr = t_stpo-stlnr " BOM No.
AND stlkn <> t_stpo-stlkn. " BOM item node number
The output from this source including BOM item node number 00000003, 00000007 but at SQL stlkn <> t_stpo-stlkn doesn't effected.
Could Anyone please tell me why?
Are there something wrong?
Thank you in advance.Hi,
You can also Use ranges for Stlnr and Stlkn fields, instead of int table.
TABLES: stpo.
DATA: begin of t_stpo OCCURS 0.
stlnr like stpo-stlnr,
stlkn like stpo-stlkn,
end of t_stpo.
data t_stpo_itm LIKE stpo OCCURS 0 WITH HEADER LINE.
t_stpo-stlnr = '00000058'.
t_stpo-stlkn = '00000003'.
append t_stpo.
clear t_stpo.
t_stpo-stlnr = '00000058'.
t_stpo-stlkn = '00000007'.
append t_stpo.
clear t_stpo.
if not t_stpo[] is initial.
SELECT * FROM stpo INTO TABLE t_stpo_itm
FOR ALL ENTRIES IN t_stpo
WHERE stlnr = t_stpo-stlnr " BOM No.
AND stlkn <> t_stpo-stlkn. " BOM item node number
endif.
or you can simply write a select for STPO like this:
SELECT * FROM stpo INTO TABLE t_stpo_itm
WHERE stlnr = '00000058' " BOM No.
AND ( stlkn <> '00000007' or stlkn <> '00000003' ). " BOM item node number
regards,
Anji -
Problem with for all entries in select querry
hi,
Hi,
I am using select queery like this
SELECT version COUNT( * )
from ztbi_default_va4
INTO CORRESPONDING FIELDS OF TABLE lit_new
FOR ALL ENTRIES IN lit_new1
WHERE network = lit_new1-network GROUP BY version.
this is not working showing error as:
The addition "FOR ALL ENTRIES" excludes all aggregate functions with
the exception of "COUNT( * )" as the single element of the SELECT clause.
I am using only count(*) ,not using othes like max,min etc,,,,,,,,,
please suggest any missing in syntax,,,,attach relavant code using count(*) with for all entreis
any help appriciated,,,,,
Thanks in advance,,,,Hi,
Try this -
TYPES: begin of t_data,
version TYPE version,
count type i,
end of t_data.
DATA: i_data TYPE STANDARD TABLE OF t_data,
wa_data TYPE t_data.
DATA: l_version TYPE version,
l_count TYPE i.
SELECT version COUNT( * )
from ztbi_default_va4
INTO CORRESPONDING FIELDS OF TABLE lit_new
FOR ALL ENTRIES IN lit_new1
WHERE network = lit_new1-network.
SORT lit_new.
LOOP AT lit_new INTO lwa_new.
IF lwa_new EQ l_version.
l_count = l_count + 1.
ELSE.
wa_data-version = l_version.
wa_data-count = l_count + 1.
APPEND wa_data TO i_data.
CLEAR: wa_data.
CLEAR: l_count.
ENDIF.
l_version = lwa_new-version.
CLEAR: lwa_new.
I hope this will do.
Make any necessary changes.
Regards,
Harsh Bansal -
Problem in FOR ALL ENTRIES IN statement
Hi Abaper,
I have a problem in FOR ALL ENTRIES IN statement.
I have a table /ccsht/na_estadi in this table for the particulat date there are 14 records, but my internal table read only 5 record.
Below is my code:
SELECT sociedad
xhotel_id
FROM /ccsht/mt_photel
INTO TABLE it_comp_hotel
WHERE sociedad IN p_comp
AND xhotel_id IN p_hotid.
BREAK-POINT.
SORT it_comp_hotel BY sociedad.
SELECT xhotel_id
xfecha_id
xocupacion
tot_habs_hotel
xnum_pax1
FROM /ccsht/na_estadi
INTO TABLE it_estadi "CORRESPONDING FIELDS OF TABLE it_estadi
FOR ALL ENTRIES IN it_comp_hotel
WHERE xhotel_id EQ it_comp_hotel-xhotel_id
AND xfecha_id IN p_date.
Can any one help me this issue.
Thanks in advance.
Thanks & Regards,
AmitHi Amit,
Try below
SELECT sociedad
xhotel_id
FROM /ccsht/mt_photel
INTO TABLE it_comp_hotel
WHERE sociedad IN p_comp
AND xhotel_id IN p_hotid.
BREAK-POINT.
* SORT it_comp_hotel BY sociedad. "Remove this SORT statement.
SELECT xhotel_id
xfecha_id
xocupacion
tot_habs_hotel
xnum_pax1
FROM /ccsht/na_estadi
INTO TABLE it_estadi
FOR ALL ENTRIES IN it_comp_hotel
WHERE xhotel_id EQ it_comp_hotel-xhotel_id
AND xfecha_id IN p_date.
Note: 1) i didn't find the these tables in my SAP system
2) If your table is still not fetching the data, tell me is it the Cluster table,. if yes,.. you need to
maintain the all the primary keys other wise you wont get the data in internal able.
hope this will help you out.
Regards! -
Hi All,
I have used FOR ALL ENTRIES statement in while selecting data based on some other internal table (to avoid select within loop).
While using FOR ALL ENTRIES, the target table (internal table in which data is getting stored) is getting affected.
The other fields are becoming zero and several rows gets delerted from the internal table after performing select query.
How to avoid this bug?
Kindly help me out....
Regards
Pavanhi after the for all entries statement did you used the read statement .
if not you will not get any data ..check this program..
tables:mara,marc.
data:begin of itab occurs 0,
matnr like mara-matnr,
end of itab.
data:begin of itab1 occurs 0,
matnr like marc-matnr,
werks like marc-werks,
end of itab1.
select matnr
from mara
into corresponding fields of table itab.
if itab is initial.
select matnr
werks
from marc
into table itab1
for all entries in itab
where matnr = itab-matnr.
loop at itab1.
read table itab with key matnr = itab-matnr.
write:/ itab1-matnr,itab1-werks.
endloop.
endif. -
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. -
Select FOR ALL ENTRIES statement cannot get duplicates entries
Hi all,
t_yxapy_fields consist of
inty field
0001 kostl
0002 perid
0008 ansal
0008 preas
0008 trfst
The following is the code for me to transfer the contents of t_yxapy_fields into t_pa_fields.
SELECT dbtab
FROM t777d
INTO TABLE t_pa_fields
FOR ALL ENTRIES IN t_yxapy_fields
WHERE infty = t_yxapy_fields-infty.
And t_pa_fields just ended up with
field infty
pa0001
pa0002
pa0008
Question:The first table have 3 similar infotype 0008 but the result table only have one pa0008. I need to filled up acordingly as what table 1 have. I need another 2 pa0008 in my 2nd table. What is wrng with my Select for all entries statement here?
Edited by: Siong Chao on Mar 27, 2010 10:35 AMThis has nothing to do with duplicates in t777d.
Correct, I failed to recognize that table t777d has only infty as key as pointed out by Aby. Thus in your particular case my comment was misleading. In general though FOR ALL ENTRIES removes all duplicate rows from your result set.
If you want the other 2 values just loop t_yxapy_fields this table and read t_pa_fields and if record found add the other values to t_pa_fields table. --> will trigger performance tuning issue
I'm pretty sure if you'd code this, you won't run into any performance issues, so follow Aby's recipe. To be more concrete, here's what I'd do: Define a mapping table t777d_tab, which holds the translation from infty to dbtab:
types:
begin of T_T777D_VIEW,
INFTY type T777D-INFTY,
DBTAB type T777D-DBTAB,
end of T_T777D_VIEW.
data:
T777D_TAB type hashed table of T_T777D_VIEW with unique key INFTY.
Fill table t_pa_fields, typed using t_t777d_tab from above, from table t777d. Then loop over your table t_yxapy_fields (I'd use [LOOP AT ... ASSIGNING|http://help.sap.com/abapdocu_70/en/ABAPLOOP_AT_ITAB_RESULT.htm] instead of LOOP AT ... INTO) and for each entry get the corresponding DBTAB value from t777d_tab (again use the [READ TABLE ... ASSIGNING|http://help.sap.com/abapdocu_70/en/ABAPREAD_TABLE_OUTDESC.htm] variant) and build your result table t_pa_fields.
Anyhow, I suspect that even with less optimal coding (e.g. using just standard table for lookup of DBTAB values) you'd not see much of an performance impact, because it seems that your internal tables are most likely rather small...
Cheers, harald -
How does select stmt with for all entries uses Indexes
Hello all,
I goes through a number of documents but still confused how does select for all entries uses indexes if fields are not in sequences. i got pretty much the same results if i take like two cases on Hr tables HRP1000 and HRP1001(with for all entries based upon hrp1000). Here is the sequence of index fields on hrp1001 (MANDT, OTYPE, OBJID, PLVAR, RSIGN, RELAT, ISTAT, PRIOX, BEGDA, ENDDA, VARYF, SEQNR). in second case objid field is in sequence as in defined Index but i dont see significant increase in field even though the number of records are around 30000. My question is does it make a differrence to use field sequence (same as in table indexes) in comparison to redundant field sequence (not same as defined in table indexes), secondly how we can ge tto know if table index is used in Select for entries query i tried Explain in ST05 but its not clear if it uses any index at all in hrp1001 read.
here is the sample code i use to get test results.
test case 1
REPORT zdemo_perf_select.
DATA: it_hrp1000 TYPE STANDARD TABLE OF hrp1000 WITH HEADER LINE.
DATA: it_hrp1001 TYPE STANDARD TABLE OF hrp1001 WITH HEADER LINE.
DATA: it_hrp1007 TYPE STANDARD TABLE OF hrp1007 WITH HEADER LINE.
DATA: it_pa0000 TYPE STANDARD TABLE OF pa0000 WITH HEADER LINE.
DATA: it_pa0001 TYPE STANDARD TABLE OF pa0001 WITH HEADER LINE.
DATA: it_pa0002 TYPE STANDARD TABLE OF pa0002 WITH HEADER LINE.
DATA: it_pa0105_10 TYPE STANDARD TABLE OF pa0105 WITH HEADER LINE.
DATA: it_pa0105_20 TYPE STANDARD TABLE OF pa0105 WITH HEADER LINE.
DATA: t1 TYPE timestampl,
t2 TYPE timestampl,
t3 TYPE timestampl
SELECT * FROM hrp1000 CLIENT SPECIFIED INTO TABLE it_hrp1000 bypassing buffer
WHERE mandt EQ sy-mandt AND
plvar EQ '01' AND
otype EQ 'S'AND
istat EQ '1' AND
begda <= sy-datum AND
endda >= sy-datum AND
langu EQ 'EN'.
GET TIME STAMP FIELD t1.
SELECT * FROM hrp1001 CLIENT SPECIFIED INTO TABLE it_hrp1001 bypassing buffer
FOR ALL ENTRIES IN it_hrp1000
WHERE mandt EQ sy-mandt AND
otype EQ 'S' AND
* objid EQ it_hrp1000-objid and
plvar EQ '01' AND
rsign EQ 'B' AND
relat EQ '007' AND
istat EQ '1' AND
begda LT sy-datum AND
endda GT sy-datum and
sclas EQ 'C' and
objid EQ it_hrp1000-objid.
* %_hints mssqlnt 'INDEX(HRP1001~0)'.
*delete it_hrp1001 where sclas ne 'C'.
GET TIME STAMP FIELD t2.
t3 = t1 - t2.
WRITE: 'Time taken - ', t3.
test case 2
REPORT zdemo_perf_select.
DATA: it_hrp1000 TYPE STANDARD TABLE OF hrp1000 WITH HEADER LINE.
DATA: it_hrp1001 TYPE STANDARD TABLE OF hrp1001 WITH HEADER LINE.
DATA: it_hrp1007 TYPE STANDARD TABLE OF hrp1007 WITH HEADER LINE.
DATA: it_pa0000 TYPE STANDARD TABLE OF pa0000 WITH HEADER LINE.
DATA: it_pa0001 TYPE STANDARD TABLE OF pa0001 WITH HEADER LINE.
DATA: it_pa0002 TYPE STANDARD TABLE OF pa0002 WITH HEADER LINE.
DATA: it_pa0105_10 TYPE STANDARD TABLE OF pa0105 WITH HEADER LINE.
DATA: it_pa0105_20 TYPE STANDARD TABLE OF pa0105 WITH HEADER LINE.
DATA: t1 TYPE timestampl,
t2 TYPE timestampl,
t3 TYPE timestampl
SELECT * FROM hrp1000 CLIENT SPECIFIED INTO TABLE it_hrp1000 bypassing buffer
WHERE mandt EQ sy-mandt AND
plvar EQ '01' AND
otype EQ 'S'AND
istat EQ '1' AND
begda <= sy-datum AND
endda >= sy-datum AND
langu EQ 'EN'.
GET TIME STAMP FIELD t1.
SELECT * FROM hrp1001 CLIENT SPECIFIED INTO TABLE it_hrp1001 bypassing buffer
FOR ALL ENTRIES IN it_hrp1000
WHERE mandt EQ sy-mandt AND
otype EQ 'S' AND
objid EQ it_hrp1000-objid and
plvar EQ '01' AND
rsign EQ 'B' AND
relat EQ '007' AND
istat EQ '1' AND
begda LT sy-datum AND
endda GT sy-datum and
sclas EQ 'C'." and
* objid EQ it_hrp1000-objid.
* %_hints mssqlnt 'INDEX(HRP1001~0)'.
*delete it_hrp1001 where sclas ne 'C'.
GET TIME STAMP FIELD t2.
t3 = t1 - t2.
WRITE: 'Time taken - ', t3.Mani wrote:
Thank you for your answer, its very helpful but i am still nor sure how does parameter rsdb/max_blocking_factor affect records size.
Hi,
The blocking affects the size of the statement and the memory structures for returning the result.
So if your itab has 500 rows and your blocking is 5, the very same statement will be executed 100 times.
Nothing good or bad about this so far.
Assume, your average result for an inlist 5 statement is 25 records with an average size of 109 bytes.
You average result size will be 2725 byte plus overhead which will nearly perfectly fit into two 1500 byte ethernet frames.
Nothing to do in this case.
Assume your average result for an inlist 5 statement is 7 records with an average size of 67 bytes.
You average result size will be ~ 470 byte plus overhead which will only fill 1/3 of a 1500 byte ethernet frame.
In this case, setting the blocking to 12 ... 15 will give you 66% network transfer performance gain,
and reduces the number of calls to the DB by 50%, giving additional benefit.
Now this is an extreme example. The longer the average row length is, the lower will be the average loss in the network.
You have the same effects in memory structures, but on that layer you are fighting single micro seconds instead of
hundreds of these, so in real life it is rarely measurable.
Depending on table-statistics, oracle might decide for short inlists to use a concatanation instead of an inlist.
This is supposed to be more costy, but I never had a case where I could proove a big difference.
Values from 5 to 15 for blocking seem to be ok for me. If you have special statements in customer coding,
it #might# be benefitial to do the mentioned calculations and do some network tracing to see if you can squeeze your
network efficiency by tuning the blocking.
If you have jumbo frames enabled, it might be worth to be analyzed as well.
If you are only on a DB-CI system that is loopback connected to the DB, I doubt there might be a big outcome.
Hope this helps
Volker -
Allowing duplicate in FOR ALL ENTRIES statement
Hi folks,
I am using a select query using FOR ALL ENTRIES statement. I could observe one entry is missing from the table data.When i checked that in the data base table, there are two duplicate records among which one entry is missed in the output data from the query.Is duplicates are restricted if we use FOR ALL ENTRIES statement ? Is there any key word like 'ALLOWING DUPLICATES' for this ? if not what is the solution for this.Could any body help me regarding this.
Thanks,
Shyam.
Edited by: Matt on Jul 9, 2009 1:27 PMHi Shyam,
In For all entries you should give unique records only.
sort your base table with key which you are passing in for all entries clause.
delete all duplicate entries.
Hope this will help .
Regards,
Vijay -
Replacing a inner join with for all entries
Hi Team,
In a already developed program I am replacing a inner join with select query follow up with for-all-entris and passing the data to final internal table but in both the case the result should be same then only my replacement will be correct. But my no records in both cases differs. This happening because when i am selecting data from first data base table is 32 lines. then I am doing fo-all-entries moving all the duplicate entries then the no records are four. but in final internal table i am looping the first internal table. So in final internal table the no of records are 32. But in inner join query the records are 16.So please let me know how resolve this issue?
Thanks and REgards
DeepaHi Thomas,
Thanks for ur suggestion.
The solved that in below.
In select query I did not change anything The way I had written the code was correct.
I think many of us know how to write that how to make the performance better in that way.
I made the change when I transfered the to final internal table.
The original Inner join code:
select a~field1 a~field2 a~field3 b~field2 b~field3 b~field4
from dbtab1 as a inner join dbtab2 as b
on a~field1 = b~field1 into it_final where
a~field1 in s_field1. [Field1 in both the table are key field]
Before code:
Sort itab1 by key-fields.
sort itab2 by keyfields.
loop at itab1 into wa1.
move: wa1-field1 to wa_final-field1,
wa1-field2 to wa_final-field2,
wa1-field3 to wa_final-field3.
read table itab2 into wa2 witk key field1 = wa1-field1 binary search.
if sy-subrc = 0.
move : wa2-field2 to wa_final-field4,
wa2-field3 to wa_final-field5,
wa2-field4 to wa_final-field6.
append wa_final to it_final.
endif.
Clear : wa1, wa2, wa_final.
endloop.
In this case if the one key fieild value is not present there in second internal table but its there in first internal table still it will read that row with 2nd internal values having zeroes. Normally what does not happen in inner join case if the key field value will same in both the case ,then that will fetch only those rows.
Changed Code
loop at itab1 into wa1.
read table itab2 into wa2 witk key field1 = wa1-field1 binary search.
if sy-subrc = 0.
move: wa1-field1 to wa_final-field1,
wa1-field2 to wa_final-field2,
wa1-field3 to wa_final-field3.
move : wa2-field2 to wa_final-field4,
wa2-field3 to wa_final-field5,
wa2-field4 to wa_final-field6.
append wa_final to it_final.
endif.
Clear : wa1, wa2, wa_final.
endloop.
In this case the values will read to final internal table if both key field matches.
With Regards
Deepa -
Hi,
SELECT max( VBELN ) VGBEL VGPOS POSNR FKIMG VRKME NTGEW MATNR ARKTX WERKS MVGR3
FROM VBRP
INTO TABLE T_INVIT
FOR ALL ENTRIES IN T_INVHD
WHERE VBELN = T_INVHD-VBELN
AND SPART = T_INVHD-SPART
AND werks IN swerks
AND mvgr3 IN smvgr3
group by VBELN VGBEL VGPOS POSNR FKIMG VRKME NTGEW MATNR ARKTX WERKS MVGR3.
i want to (max) invoice no against a delivery i.e vgbel but in this query i am getting error that with for all entries only count * is allowed.
regards
FoziaHi Do this way..
IF NOT T_INVHD[] is initial.
LOOP AT T_INVHD
SELECT max( VBELN ) VGBEL VGPOS POSNR FKIMG VRKME NTGEW MATNR ARKTX WERKS MVGR3
FROM VBRP
INTO T_INVIT
WHERE VBELN = T_INVHD-VBELN
AND SPART = T_INVHD-SPART
AND werks IN swerks
AND mvgr3 IN smvgr3
group by VGBEL VGPOS POSNR FKIMG VRKME NTGEW MATNR ARKTX WERKS MVGR3.
IF SY-SUBRC = 0.
APPEND T_INVIT.
CLEAR T_INVIT
ENDIF.
endselect.
endloop.
endif.
EVEN NO EFFECT ON PERFORMANCE
RGDS
RAJESH
Maybe you are looking for
-
CUBE IS NOT CLEARING THE DATA ON CONDITIONAL SCRIPT(ISSUE WITH NULLIFICATIO
Hi, I am using AWM 10.2.0.2.0A and database is 10g Release 2 to build a cube. Before the monthly incremental load I need to clear the old data. For clearing(Nullifying) the cube I am using the new "Clear" command. The Clear command has two options. A
-
Thunderbolt Display - Convincing
Convince me that I want to buy or not to by the Thunderbolt display. I cannot stomach dropping a grand on a monitor, but then again I have heard good things. I just bought a Macbook Pro Retina. While it has a nice size display, I could always use som
-
Install issue with FlashBuilder 4.5
HI. I've tried to install FlashBuilder 4.5 on my vista PC. It installed okay, but when I go to run it, it shows me the license agreement. I can click OK, it brings up the FlashBuilder 4.5 logo page, then the license agreement reappears. If I cli
-
Please assist me with the mouse over event on this clip
I'm trying to make a notices box in flash that slides over to the right and opens on mouse over. I've done the necessary actionscripting I feel, yet the clip doesnt quite behave the way it should Can someone please help me I'm including a link to dow
-
Problem with downloading trial
When I try to install the trial version of Dreamweaver cs6 I always get these errors: ERROR: DW051: Dependency of session payload {A4ED5E53-7AA0-11E1-BF04-B2D4D4A5360E} Dreamweaver Adobe Dreamweaver CS6 12 has changed. ERROR: Media DB Error : 12 What