Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reg:Delete

Former Member
0 Likes
916

Hi all,

I am retriving some values into an internal table from DBH table based on certain condition.After retrival i have to delete entries where werks not in Plant on the screen.here werks is a select-options field.

Plz reply

Regards,

9 REPLIES 9
Read only

Former Member
0 Likes
862

Assume that ITAB has the records.

delete itab where werks in s_werks. "S_WERKS is the select option.

Regards,

Ravi

Read only

Former Member
0 Likes
862

DELETE ITAB WHERE NOT WERKS IN S_WERKS.

In fact it would be ideal if you can include the WHERE CLause to filter the plant in the SELECT statement

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
862

Hi Ganesh,

Get all Plants entered on selection screen into an internal table(ITAB1). Then loop to the actual table and check whether the Plant is falling in the internal table ITAB1. If so, then delete that entry.

Satya

Read only

Former Member
0 Likes
862

Hi,

If possible pl dont select those records in the initial selection using the following where condition

WHERE NOT werks in s_werks ( AND other conditions)

Or use the following for deletion :

delete itab where not werks in s_werks .

Pl reward if sounds good !!

Cheers.

Read only

0 Likes
862

Actually i have looped at the internal table and placed the statement

delete itab where not werks in s_werks .

but the values are deleted even if werks = s_werks.

I have comented loop and checked even though it still does the same.Wht shall i do

Plz reply

Read only

0 Likes
862

Ganesh,

Check that s_werks contains at leat 1 record.

werks = s_werks is not possible, if s_werks really is a range defined with SELECT-OPTIONS

delete outside the loop!

Regards,

Clemens

Read only

0 Likes
862

HI ganesh,

when you use the delete itab where werks not in s_werks, you don't need to loop the itab.

just say:

delete itab where werks not in s_werks.

Regards,

Ravi

Read only

0 Likes
862

Hi Ravi,

I just dont know why output shows List contains no data.

when ever delete is fired though werks = s_werks it is getting deleted.and it is such a long code tht i cant post u.plz suggest wht may be the reasons why output cant be displayed if data is present in DB table.

regards

Read only

Former Member
0 Likes
862

Hi,

Pl check how many records selected in the initial selection. U may use describe table command. Give break point there .

After deletion also check how many records are there , u may use describe table command. May be while deleting , its deleting all the records. Debug it.

Good Luck,