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
Similar Messages
-
I have a problem in using for all entries
Hi i have a problem in using <b>for all entries</b>
i have declared the two internal tables as below
DATA: BEGIN OF ITAB OCCURS 10,
EBELN LIKE EKKO-EBELN,
LIFNR LIKE EKKO-LIFNR,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
* MATNR LIKE EKPO-MATNR,
* TXZ01 LIKE EKPO-TXZ01,
VGABE LIKE EKBE-VGABE,
GJAHR LIKE EKBE-GJAHR,
KNUMV LIKE EKKO-KNUMV,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 10,
EBELN LIKE EKPO-EBELN,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
MENGE LIKE EKPO-MENGE,
MWSKZ LIKE EKPO-MWSKZ,
LIFNR LIKE EKKO-LIFNR,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
END OF ITAB1.
<b>and now i have tried to move the values in those internal tables using these statements</b>
SELECT A~EBELN A~LIFNR A~KNUMV B~VGABE B~EBELP B~GJAHR B~BELNR
FROM EKKO AS A
INNER JOIN EKBE AS B ON B~EBELN = A~EBELN
INTO CORRESPONDING
FIELDS OF TABLE ITAB WHERE B~VGABE = '2'.
SELECT EKPO~EBELN EKPO~MATNR EKPO~TXZ01 EKPO~WERKS EKPO~NETWR
EKPO~MENGE EKPO~MWSKZ
FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE ITAB1
FOR ALL ENTRIES IN ITAB
WHERE EBELN = ITAB-EBELN.
LOOP AT ITAB1.
READ TABLE ITAB WITH KEY EBELN = ITAB-EBELN.
ITAB-EBELN = ITAB1-EBELN.
ITAB1-LIFNR = ITAB-LIFNR.
ITAB1-EBELP = ITAB-EBELP.
ITAB1-BELNR = ITAB-BELNR.
ITAB1-EBELP = ITAB-EBELP.
APPEND ITAB1.
ENDLOOP.
But when i was using loop then it was displaying values in debugging mode but while i was trying to execute it was taking a lot of time i thought that it was due to more information in the already declared internal table so i have tried to remove the previous entries but it was showing an error while i was removing the old entries
and when i remove the loop at itab1 then i'll get output directly but it was displaying the itab fields which is my 1st internal table but not the values of itab1 can u explain me what is the possible error for that
Regards ,
Pavanbefore using for all entries in, u need to check whether the driver internal table is empty, if it is empty, u should not enter into select statement.
if u wont use this check means, when the driver internal table is empty, the second select will take all the entires from the tables.
SELECT AEBELN ALIFNR AKNUMV BVGABE BEBELP BGJAHR B~BELNR
FROM EKKO AS A
INNER JOIN EKBE AS B ON BEBELN = AEBELN
INTO CORRESPONDING
FIELDS OF TABLE ITAB WHERE B~VGABE = '2'.
if itab[] is not initial.
SELECT EKPOEBELN EKPOMATNR EKPOTXZ01 EKPOWERKS EKPO~NETWR
EKPOMENGE EKPOMWSKZ
FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE ITAB1
FOR ALL ENTRIES IN ITAB
WHERE EBELN = ITAB-EBELN.
endif.
I hope this will help u.
else,
Sujatha. -
Select... for all entries in...
Hi,
Can anybody help me to sort out this issue. This select should work. I m filling an itab with distinct pernr. in temp it should give <b>all the records for which pernr should not be in itab.</b>
report ZTEST4.
data : begin of ITAB occurs 0,
PERNR like PA0001-PERNR,
ename like pa0001-ename,
end of ITAB.
data : temp like itab occurs 0 with header line.
clear : ITAB, TEMP.
refresh : ITAB,TEMP.
select distinct PERNR into table ITAB from PA0001 where PERNR le 10.
select PERNR ENAME into table TEMP from PA0001
for all entries in ITAB where pernr not in itab-pernr.
sort TEMP by PERNR.
break-point.Hi Sagar,
If i understand it well, you exclude all PERNR LE 10.
But first things first.
You cannot use the FOR ALL ENTRIES in your case (it doesn't allow the operator "NOT IN").
Your code should be:
REPORT ztest4.
TYPES: BEGIN OF ty_itab,
pernr TYPE persno,
ename TYPE emnam,
END OF ty_itab.
DATA : itab TYPE ty_itab occurs 0,
wtab TYPE ty_itab.
CLEAR: itab,
wtab.
SELECT pernr ename
INTO TABLE itab
FROM pa0001
WHERE pernr LE 10
ORDER BY pernr.
IF sy-subrc EQ 0.
DELETE ADJACENT DUPLICATES FROM itab COMPARING pernr.
ENDIF.
Regards,
Rob. -
Duplicate entries missing using for all entries in select query.
Hi Gurus,
Is there any way to avoid missing duplicate entries in an internal table if you use for all entries in select statement?
Note : i am selecting two tables using non key fields and i have to aggregate the data. I want only 2 data fields and one amount field in my final internal table. I can add all the primary key fields into my internal table and collect my required fields in another table, but I just want to know is there any other way to avoid missing duplicate entries without adding all the key fields?
Regards,
RaghavendraHi,
Just check what are the other possible fields in the table which may be having
duplicate entries and make use of them in the selection accordingly.
You may not miss any entries unless there is any restriction on them.
You can better judge that in debugging mode while selecting data from that table. -
Why should we select all key fields when using for all entries
Hi,
Why should we select all key fields in our select query when using for all entries statement?
I read about for all entries but this point was not clear in any post.
Please explain me
Regards,
SubhashiniDear Subhasini,
It is because FOR ALL ENTRIES deletes the duplicate entries before populating the target internal table.
Please do an F1 on FOR ALL ENTRIES & read the SAP documentation.
I mean how duplicate entries will not get deleted when we use this?
Quite simple, if you select all key fields then each entry will be unique & there will not be any duplicate entries to delete !!
BR,
Suhas
Edited by: Suhas Saha on Oct 16, 2009 9:41 AM -
I NEED select ..... for all entries for this logic
From table RBDRSEG, we need to pick up the field RBDRSEG-MATNR where RBDRSEG- RBLNR= RBKP-BELNR. If the program does not find any data then it can pick up the material id field from EKPO-MATNR for all the invoices picked up during the processing.
Hi,
Lets say that Invoices are in Int table ITAB.
IF NOT ITAB[] IS INITIAL.
SELECT MATNR FROM RBDRSEG INTO V_MATNR
for all entries in itab
where RBLNR= ITAB-BELNR.
IF SY-SUBRC <> 0.
SELECT MATNR FROM RSEG INTO V_MATNR
for all entries in ITAB
where BELNR= ITAB-BELNR.
ENDIF.
ENDIF.
Use RSEG instead of EKPO because EKPO don't have BELNR(Invoice) field.
Regards,
Anji
Message was edited by:
Anji Reddy Vangala
Message was edited by:
Anji Reddy Vangala -
Need to SUM on a field with FOR ALL ENTRIES
Hi All,
I need to use something like this appearing below ....but SUM is not allowed with FOR ALL ENTRIES ......Whats the efficient ALTERNATIVE ???
SELECT sum( menge ) INTO TABLE imseg
FROM mseg
FOR ALL ENTRIES IN iresb
WHERE matnr = iresb-matnr
AND bwart = '281'
AND aufpl = iresb-aufpl
AND aplzl = iresb-aplzl.
Any help will be rewarded & appreciated ...
Regards
JamanHi Karthik,
Thanx a ton....
How about the below approach .....its allowed & working fine ....also simplifying my work..
SELECT matnr menge rsnum rspos
INTO (ws-matnr, ws-menge, ws-rsnum, ws-rspos)
FROM mseg
FOR ALL ENTRIES IN iresb
WHERE matnr = iresb-matnr
AND bwart = mvtyp1
AND rsnum = iresb-rsnum
AND rspos = iresb-rspos.
imseg2-matnr = ws-matnr.
imseg2-menge = ws-menge.
imseg2-rsnum = ws-rsnum.
imseg2-rspos = ws-rspos.
COLLECT imseg2.
ENDSELECT. -
For All Entries is NOT better than INNER JOIN in most cases
I quote from Siegfried Boes' excellent post here: Will writing an inner join be better or creating a view?
For all the FOR ALL ENTRIES lovers ... there is no proof for these reappearing recommendation.
There is nearly nobody who receives forum points, who recommends FOR ALL ENTRIES instead of Joins. What is the reason ???
It is easier to prove the opposite. A Join is a nested loop inside the database, a FOR ALL ENTRIES is partly outside of the database. FOR ALL ENTRIES works in blocks, joins on totals.
FOR ALL ENTRIES are not recommded on really large tables, because the chances are too high that
too many records are transferred.
People prefer FOR ALL ENTRIES, because JOINs are not so easy to understand. Joins can go wrong, but with a bit of understanding they can be fixed.
Some Joins are slow and can not be fixed, but then the FOR ALL ENTRIES would be extremely slow.
There are several kinds of views:
- projection views, i.e. only one table involved just fields reduced
- join views, several tables, joins conditions stored in dictionary
- materialized views, here the joined data are actually stored in the database. Storing and synchronisation has to be done manually.
Only the last one creates real overhead. It should be the exception.
Join Views and Joins are nearly identical. The view is better for reuse. The join is better in complicated, becuase if the access goes wrong, it can often be fixed by adding a hint. Hints can not be added to views.
Abraham Bukit points out:
If it is cluster table, (you can't use join). If it is buffered table, I would also say avoid join.
If they all are transaction table which are not buffered and are not cluster tables.
He further supports Siegfried's statement that FAE is easier to undestand than INNER JOINs.
Thomas Zloch says, regarding buffered tables:
At least think twice, maybe compare runtimes if in doubt.
So, unless someone has some EVIDENCE that FOR ALL ENTRIES is better, I don't think we want to see this discussed further.
Kind regards
MattTo give food for thought here's an example I gave in a thread:
If you have a statement like
SELECT ... FOR ALL ENTRIES IN FAE_itab WHERE f = FAE_itab-f.
SAP sends it to the database depending how the parameter rsdb/prefer_union_all is set:
rsdb/prefer_union_all = 0 =>
SELECT ... WHERE f = FAE_itab[1]-f
OR f = FAE_itab[2]-f
OR f = FAE_itab[N]-f
You have some influence of the generated statement type: Instead of OR'ed fields an IN list can be used
if you have only a single coulmn N to compare:
rsdb/prefer_in_itab_opt parameter:
SELECT ... WHERE f IN (itab[1]-f, itab[2]-f, ..., itab[N]-f)
rsdb/prefer_union_all = 1 =>
SELECT ... WHERE f = FAE_itab[1]-f
UNION ALL SELECT ... WHERE f = FAE_itab[2]-f
UNION ALL SELECT ... WHERE f = FAE_itab[N]-f
see: Note 48230 - Parameters for the SELECT ... FOR ALL ENTRIES statement
As you can see for the 2nd parameter several statements are generated and combined with a UNION ALL,
the first setting generates statements with OR's (or uses IN if possible) for the entries in FAE_itab.
I give you a little example here (my parameters are set in a way that the OR's are translated to IN lists; i traced the execution in ST05)
Select myid into table t_tabcount from mydbtable
for all entries in t_table " 484 entries
where myid = t_table-myid .
ST05 trace:
|Transaction SEU_INT|Work process no 0|Proc.type DIA|Client 200|User |
|Duration |Obj. name |Op. |Recs.|RC |Statement|
| 640|mydbtable |PREPARE| | 0|SELECT WHERE "myid" IN ( :A0 , :A1 , :A2 , :A3 , :A4 ) AND "myid" = :A5|
| 2|mydbtable |OPEN | | 0|SELECT WHERE "myid" IN ( 1 , 2 , 3 , 4 , 5 ) AND "myid" = 72 |
| 2.536|mydbtable |FETCH | 0| 1403| |
| 3|mydbtable |REOPEN | | 0|SELECT WHERE "myid" IN ( 6 , 7 , 8 , 9 , 10 ) AND "myid" = 72 |
| 118|mydbtable |FETCH | 0| |
| 2|mydbtable |REOPEN | | 0|SELECT WHERE "myid" IN ( 11 , 12 , 13 , 14 , 15 ) AND "myid" = 72 |
| 3|mydbtable |REOPEN | | 0|SELECT WHERE "myid" IN ( 475 , 476 , 477 , 478 , 479 ) AND "myid" = 72 |
| 94|mydbtable |FETCH | 0| 1403| |
| 2|mydbtable |REOPEN | | 0|SELECT WHERE "myid" IN ( 480 , 481 , 482 , 483 , 484 ) AND "myid" = 72 |
You see the IN list contained 5 entries each , wich made up about 97 statements for all 484 entries.
For every statment you have a single fetch operation wich means a separate access to the database.
If you would replace the FAE with a join you would only have one fetch to the database.
With the example above we can derive these observations:
1. From database point of view these settings kill performance when you access a big table and/or have a lot of entries or columns in your FAE_itab. Furthermore, you hide information what data you will access
at all and thus you block the database from creating a more efficient execution plan because it DOESN'T KNOW wich data you will select in the next step. I.e. it may be more efficient to scan the table in one shot instead of having many index accesses - but the database can make this decision only if it can examine ONE statement that has ALL the information of what data to retrieve.
2. A second impact is that with every statement execution you trigger the allocation of database resources
wich will contribute to the overhead described above.
Said that, FAE can never be a replacement for joining big tables (think of having a table with thousands of records in a FAE table )
Edited by: kishan P on Nov 2, 2010 2:16 PM - Format Fixed -
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 stmnt. in SELECT query is not running properly
Hello experts,
In my report program, I write one query on table BSIS.
Internal table declaration -
DATA : BEGIN OF DLC_BSIS OCCURS 0,
BUKRS LIKE BSIS-BUKRS,
GJAHR LIKE BSIS-GJAHR,
BELNR LIKE BSIS-BELNR,
SHKZG LIKE BSIS-SHKZG,
BSCHL LIKE BSIS-BSCHL,
AUFNR LIKE BSIS-AUFNR,
HKONT LIKE BSIS-HKONT,
QSSKZ LIKE BSIS-QSSKZ,
DMBTR LIKE BSIS-DMBTR,
END OF DLC_BSIS.
Query as follows --
SELECT BUKRS
GJAHR
BELNR
AHKZG
BSCHL
AUFNR
HKONT
QSSKZ
DMBTR FROM BSIS
INTO TABLE DLC_BSIS
FOR ALL ENTRIES IN IT_BKPF2
WHERE BELNR = IT_BKPF2-BELNR
AND BUKRS = IT_BKPF2-BUKRS
AND GJAHR = IT_BKPF2-GJAHR.
IT_BKPF2 internal table having -- BUKRS - LT01
BELNR - 6400000061
GJAHR - 2009.
And in BSIS database table -- 3 entries are there for the above documnet.
But, in my internal only one entry has come for the same above document.
I think For all entries stmnt. is not running properly. But Why it's not running properly.??
What would be the reason..??
Thanks in advance....!!
Regards,
Poonam.>
Poonam Patil wrote:
> Hello experts,
> In my report program, I write one query on table BSIS.
>
> Internal table declaration -
>
> DATA : BEGIN OF DLC_BSIS OCCURS 0,
> BUKRS LIKE BSIS-BUKRS,
> GJAHR LIKE BSIS-GJAHR,
> BELNR LIKE BSIS-BELNR,
> SHKZG LIKE BSIS-SHKZG,
> BSCHL LIKE BSIS-BSCHL,
> AUFNR LIKE BSIS-AUFNR,
> HKONT LIKE BSIS-HKONT,
> QSSKZ LIKE BSIS-QSSKZ,
> DMBTR LIKE BSIS-DMBTR,
> END OF DLC_BSIS.
>
> Query as follows --
>
> SELECT BUKRS
> GJAHR
> BELNR
> AHKZG
> BSCHL
> AUFNR
> HKONT
> QSSKZ
> DMBTR FROM BSIS
> INTO TABLE DLC_BSIS
> FOR ALL ENTRIES IN IT_BKPF2
> WHERE BELNR = IT_BKPF2-BELNR
> AND BUKRS = IT_BKPF2-BUKRS
> AND GJAHR = IT_BKPF2-GJAHR.
>
> IT_BKPF2 internal table having -- BUKRS - LT01
> BELNR - 6400000061
> GJAHR - 2009.
>
> And in BSIS database table -- 3 entries are there for the above documnet.
>
> But, in my internal only one entry has come for the same above document.
>
> I think For all entries stmnt. is not running properly. But Why it's not running properly.??
> What would be the reason..??
>
>
> Thanks in advance....!!
>
> Regards,
> Poonam.
include the buzei field in selection criteria i have faced the same situation earlier.
always select all the key fields.
varun -
The select with for all entries is not working correctly
IF NOT i_ekko_ekpo[] IS INITIAL.
SELECT ebeln
ebelp
zekkn
vgabe
bewtp
menge
bpmng
shkzg
INTO TABLE i_ekbe
FROM ekbe
FOR ALL ENTRIES IN i_ekko_ekpo
WHERE ebeln EQ i_ekko_ekpo-ebeln.
AND ebelp EQ i_ekko_ekpo-ebelp.
IF sy-subrc EQ 0.
SORT i_ekbe.
ENDIF.
ENDIF.
I have a PO with 2 line items in i_ekko_ekpo. In EKBE, I have 49 recs for this PO and this select is returning only 13 recs.
I tried by commenting EBELP and still the same result.
Thanks
Kiran
Edited by: kiran dasari on May 22, 2009 9:56 PMHi Sudhi, I added these now but still no charm
SELECT ebeln
ebelp
zekkn
vgabe
bewtp
menge
bpmng
shkzg
INTO TABLE i_ekbe
FROM ekbe
FOR ALL ENTRIES IN i_ekko_ekpo
WHERE ebeln EQ i_ekko_ekpo-ebeln
AND ebelp EQ i_ekko_ekpo-ebelp
AND zekkn GE '00'
AND vgabe IN ('1','2').
And as per your note: in the 13 entries, am having duplicate also. This is something weird for me now.
Any more clues.
Thanks
Kiran -
Alternate Index not read with FOR ALL ENTRIES
I have a select statement like:
SELECT d~dokar
d~doknr
d~dokvr
d~doktl
l~lifnr
l~stcd1
l~stcd2
APPENDING CORRESPONDING FIELDS OF TABLE t_dms
FROM lfa1 AS l JOIN drad AS d
ON llifnr = dobjky
FOR ALL ENTRIES IN t_infile
WHERE ( l~stcd2 = t_infile-taxcode2ssn
OR l~stcd2 = t_infile-taxcode2fed
OR l~stcd2 = t_infile-fedtaxid2 )
AND d~dokob = 'LFA1'
AND d~obzae = '0000'
AND d~doktl IN s_doktl.
I have defined an alternate index on LFA1 called ZX2 (MANDT, STCD2). T_INFILE is sorted by a field called FEDTAXID. This is a nine character field. TAXCODE2SSN is the same number but it is formatted 999-99-9999. TAXCODE2FED is the same number only formated 99-0000000. FEDTAXID2 is the same as FEDTAXID.
S_DOKTL is defined as sign = I, Option = BT, Low = 000, High = 000.
The problem is LFA1ZX2 is not being used. The file is being read sequentially. Any ideas what is causing the alternate index to be ignored? I wrote another select statement where I removed the FOR ALL ENTRIES and the "ddoktl IN s_doktl" and the alternate index is being used. Any thoughts?
Thanks,It's probably the OR-condition causing the problem. An alternative could be a driver table (t_infile or a new one) that does not have one line with three tax code variations but rather one line for each variation in one generic column. If this driver table is sorted by tax code and stripped of duplicates, there might be an improvement possible.
Thomas -
Is it not recommended to use FOR ALL ENTRIES in version 4.5B
Hi,
Is it not recommended to used For all entries in version 4.5B as Size limit for SQL is 32KB hence we should not be using FOR ALL ENTRIES, instead of this we should be using select inside the loop?
Can anyone please let me know if this is correct and if you can provide me the SAP documentation on the specific statement.
Regards
RiaHi Ria,
From what I understand, you cannot use JOINS with FOR ALL ENTRIES in 4.5b & lower versions. In general the SELECT..FOR ALL ENTRIES statement has been in use from 3.1i versions. For more information, PL take a look at OSS Note #652634.
Regards,
Suresh Datti -
Select statment using FOR ALL ENTRIES not allow to do sum,
Hi All,
SELECT DELIV_NUMB
SUM( GRS_WGT_DL )
UNIT_OF_WT
FROM /BIC/AGSSD000600
INTO TABLE I_GROSS
FOR ALL ENTRIES IN I_LAYTWO
WHERE DELIV_NUMB = I_LAYTWO-DELIV_NUMB
GROUP BY DELIV_NUMB UNIT_OF_WT.
While compiling it shows the error
The addition "FOR ALL ENTRIES" excludes all aggregate functions with
the exception of "COUNT( * )", as the single element of the SELECT
clause.
Please give some solution to do sum
with regards,
Thambe .You could just select all entries into an internal table and then loop through and use COLLECT or similar to get your sum values.
Gareth. -
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
Maybe you are looking for
-
how do I print from a web page Firefox "help" says 1. at top of f'fox window click on f'fox button however, when at the page from which I want to print, there is no visible f'fox button! What can I do? Do I need to save the page and then print from i
-
Odd LV 2009 Snippet Behavior - Please confirm
While helping out in this thread I encountered an odd behavior with snippets. If you try to place the snippet onto a block diagram you will encounter the "searching" dialog box when it's looking for the typedefs. If you click on the "Ignore Item" eac
-
Using two computers on network
I'm purchasing a second computer (MacBook Pro) to use upstairs, in addition to my iMac (24" aluminum) downstairs. I intend to set up a network using Airport Extreme, and I wish to copy all my browser bookmarks & settings to the MacBook. To do this, I
-
To normal. How do I do this?
A window came up wherein you could change your font color and your background color. I thought it might be fun so I changed both. I am now having problems with some items on Firefox and want to change it back to your original colors. How do I do this
-
The detail module has disappeard from my tool panel in lightroom 5. How do I get it back?