‎2006 Oct 23 12:58 PM
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,
‎2006 Oct 23 1:02 PM
Assume that ITAB has the records.
delete itab where werks in s_werks. "S_WERKS is the select option.
Regards,
Ravi
‎2006 Oct 23 1:03 PM
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
‎2006 Oct 23 1:04 PM
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
‎2006 Oct 23 1:29 PM
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.
‎2006 Oct 23 1:32 PM
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
‎2006 Oct 23 1:37 PM
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
‎2006 Oct 23 1:39 PM
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
‎2006 Oct 23 1:47 PM
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
‎2006 Oct 23 2:52 PM
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,