2006 Nov 29 1:47 PM
DATA : lv_gbstk TYPE c VALUE 'A'.
SELECT vbeln "order number
FROM vbuk
INTO TABLE ct_ordnsnt
FOR ALL ENTRIES IN lt_ztsd2marc
WHERE vbeln <> lt_ztsd2marc-ordnr
AND gbstk = lv_gbstk.
its taking all values of vbeln .
DATA : lv_gbstk TYPE c VALUE 'A'.
SELECT vbeln "order number
FROM vbuk
INTO TABLE ct_ordnsnt
FOR ALL ENTRIES IN lt_ztsd2marc
WHERE vbeln <> lt_ztsd2marc-ordnr
AND gbstk = lv_gbstk.
its taking all values of vbeln .
2006 Nov 29 1:49 PM
That means lt_ztsd2marc is empty and the second issue could be <> condition.
First check if the table is empty, the you should not use FOR ALL ENTRIES.
IF NOT lt_ztsd2marc[] IS INITIAL.
SELECT vbeln "order number
FROM vbuk
INTO TABLE ct_ordnsnt
FOR ALL ENTRIES IN lt_ztsd2marc
WHERE vbeln <> lt_ztsd2marc-ordnr
AND gbstk = lv_gbstk.
ENDIF.Regards,
Ravi
Note - Please mark all the helpful answers
2006 Nov 29 2:05 PM
hi
i mean gbstk = lv_gbstk. is not workin in the code bcz my lt_ztsd2marc is havin data.but its not pickin those gbstk whic r equal to A
2006 Nov 29 1:49 PM
hi,
check if lt_ztsd2marc is empty, that is the prerequest for using for all entries.
santhosh
2006 Nov 29 1:59 PM
hi,
as you are using
for all entries in itab..
check whether the previous itab is initial.
if it is initial it will select all records .
eg:
if not previous_itab[] is initial.
select query of itab....
for all entries in previous_itab
endif.
hope this helps.
Regards
Abdullah
2006 Nov 29 2:01 PM
hi Neha,
if not lt_ztsd2marc[] is initial.
SELECT vbeln "order number
FROM vbuk
INTO TABLE ct_ordnsnt
FOR ALL ENTRIES IN lt_ztsd2marc
WHERE vbeln <> lt_ztsd2marc-ordnr
AND gbstk = lv_gbstk.
endif.Regards,
Santosh
2006 Nov 29 2:05 PM
Hi Neha,
The code seems to be correct but before writing this just check weather lt_ztsd2marc has some value or not.
Thanks
Vikranth Khimavath
2006 Nov 29 2:11 PM
try
SELECT vbeln "order number
FROM vbuk
INTO CORRESPONDING FIELDS OF TABLE ct_ordnsnt
FOR ALL ENTRIES IN lt_ztsd2marc
WHERE vbeln <> lt_ztsd2marc-ordnr
AND gbstk = lv_gbstk.
perhaps handy next time to include the data declarations or the errors you get with this query.
kind regards
arthur
Message was edited by:
A. de Smidt
2006 Nov 29 2:28 PM
3 major drawbacks of the "for all entries" clause :
1. duplicate rows are automatically removed
2. if the itab used in the clause is empty , all the rows in the source table will be selected .
3. performance degradation when using the clause on big tables.
May be the second point is ur problem ,
but u r saying there r entries in the table , so try like this
SELECT vbeln "order number
FROM vbuk
INTO TABLE ct_ordnsnt
WHERE gbstk = lv_gbstk.
then filter the entries using lt_ztsd2marc- table
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |