on 11-08-2006 5:48 AM
Hi
i had 3 fields in my itab
status
and pr qunty and po qunty this is selected from eban table statu, menge and bsmng
i want to delete only those fields whose status = b and menge = bsmng
DELETE i_preq WHERE statu = 'B'
AND menge = i_preq-bsmng.
Imp - all this 3 fields are in one itab
this is not working
i think i have to delete in loop but then its comes performace issue if i have to delete in a loop then pls give me an example how can i and for performance tips too.
regards
points will be rewarded for answers
Oh oh oh.
No need to write more code - Less is more!
DELETE i_preq WHERE statu = 'B'
AND menge = bsmng.
Just "i_preq-" too much because in the where clause you just give the components name. The table name is already given with "DELETE i_preq ".
Regards,
Clemens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi FARUKH,
1. First u have to reard the records using
READ statement.
2. Then Use the DELETE Statement.
try it
all the best
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If u dnt want the records with statu = 'B' then why u are selecting them.
SELECT banfn
bstyp
matnr
werks
menge
pstyp
bsmng
statu
INTO TABLE itab
FROM eban
WHERE statu EQ'N'.
Is that particular data is required somewhere else?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have created a report with below code.
DATA: itab TYPE TABLE OF eban.
SELECT eban~banfn
eban~bstyp
eban~matnr
eban~werks
eban~menge
eban~pstyp
eban~bsmng
eban~statu
INTO CORRESPONDING FIELDS OF TABLE itab
FROM eban
WHERE statu IN ('N' , 'B') .
Here I got 1526 records with value of statu = N or B
SORT itab BY statu menge.
DELETE itab WHERE statu = 'B'.
Here the records with statu = 'B' are deleted and the numbers of records were 1496
For me its working. Please copy paste aboe code and try to run it and while debugging chcek the values in internal table.
Do let me know if the problm stil persists.
Best Regards,
Vibha
*Please mark all the helpful answers
Hi Farukh,
Try like this,
Sort itab by statu menge.
Loop at itab where statu = 'B' and menge = i_preq-bsmng.
DELETE i_preq.
endloop.
Check if the value in ITAB for STATU is B or b.
This should work and performance should also be good.
Hope this might have helped you.
Thanks,
Prashanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for ur reply
but this too is not working
SELECT eban~banfn
eban~bstyp
eban~matnr
eban~werks
eban~menge
eban~pstyp
eban~bsmng
eban~statu
INTO TABLE itab
FROM eban
WHERE statu IN ('N' , 'B') .
from itab i have to delete records where statu = b and menge = bsmng
i tried in many ways and as per ur suggestion to .
SORT itab BY statu menge.
*LOOP AT itab WHERE statu = 'B' AND menge = itab-bsmng.
DELETE itab.
*ENDLOOP.
*
itab1[] = itab[].
LOOP AT itab1 WHERE statu = 'b' AND menge = itab-bsmng.
READ TABLE itab WITH KEY matnr = itab1-matnr
werks = itab1-werks.
regards pls give me example code if possible
IF sy-subrc = 0.
DELETE itab .
endif.
ENDLOOP.
hai
try this:
DELETE i_preq WHERE statu = 'b'
AND menge = i_preq-bsmng.
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
loop d table
(capture d sy-tabix to local varibale l_tabix)
check the record status is 'B'.
if true.
read amount from another table(binary search) , if both r same(amounts) delete d record with index l_sytabix.
endloop.
Regards,
Ramesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This should work. The value of statu is 'B' or 'b'? If its b and if you are specifying 'B', then it will not work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.