cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting (Performance issue)

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (7)

Answers (7)

Clemenss
Active Contributor
0 Kudos

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

Clemenss
Active Contributor
0 Kudos

Hi,

sorry, I was too fast, but this is the fastest way:

<pre>

field-symbols:

<preq> like i_preq.

loop at i_preq assigning <preq>

where statu = 'B'.

check <preq>-menge = <preq>-bsmng.

delete i_preq.

endloop.

</pre>

Regards,

Clemens

former_member735409
Participant
0 Kudos

Hi FARUKH,

1. First u have to reard the records using

READ statement.

2. Then Use the DELETE Statement.

try it

all the best

Former Member
0 Kudos

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?

Former Member
0 Kudos

Thnks vibha for replying .

c iam doing a huge report of in ventory self stocs in that i need open prchase requisition .

B = Po created of pr and N for not edited

for that i have to select both of them and on the basis of pr quanity and po quanity i can get only those which are open

regards

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

hai

try this:

DELETE i_preq WHERE statu = 'b'

AND menge = i_preq-bsmng.

regards

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.