‎2006 Oct 24 10:26 AM
Hi all,
I have retrived data from an DB table.From the retrieved entreis deleted entries where werks not in Plant on the screen.
for this i have used the code
delete itab where werks ne s_werks.
is this the corect code.Bcoz even though werks = s_werks the data from itab is gettin deleted.
here s_werks is a select-option field.
regards
‎2006 Oct 24 10:28 AM
Hi Ganesh,
It is wrong.
delete itab where werks not in s_werks. is correct.
Regards,
Ravi
‎2006 Oct 24 10:28 AM
Hi Ganesh,
It is wrong.
delete itab where werks not in s_werks. is correct.
Regards,
Ravi
‎2006 Oct 24 10:47 AM
Hi Ravi,
I have 2 db tables and based on particular conditions i am retriving data into these 2 internal tables.The selection-screen contains fields date,werks as a range.if i give only one valu in the date ie. 09/04/2006 the data preior to this date is also retrieved how does this happen.Plz clarify
regards
‎2006 Oct 24 11:34 AM
Hi Ganesh,
Can you show the select statement?
If your select statement has something like this:
where date <= s_date-low.
Then it would get all the dates before that.
REgards,
ravi
‎2006 Oct 24 12:05 PM
No the select stm is not like tht it is as follows
select zchangedt zlocid matnr werks from db table into corresponding fields of itab2 for all entries in itab1 where ZCYLBARCD = ITAB1-BARCD.
IF SY-SUBRC = 0.
delete int_ITAB2 where not werks in s_werks[].
ENDIF.
‎2006 Oct 24 12:09 PM
Hi ganesh,
As you can see, the where clause itself doesn't filter the data based on the date you enter in the selection screen.
Just entering some date in the selection screen doesn't filter the data.YOur select should have the where condition based on that date as well.
select zchangedt zlocid matnr werks from db table into corresponding fields of itab2 for all entries in itab1 where ZCYLBARCD = ITAB1-BARCD
<b> and zchangedt in s_date.</b>
Make the highlighted change.
Regards,
ravi
‎2006 Oct 24 10:29 AM
hi Ganesh,
Declare it in this way in your select statement ..
i.e,
select *
where werks <b>in </b> s_werks
and delete statement should be
<b>delete it_marc where werks not in s_werks. </b>
Regards,
Santosh
‎2006 Oct 24 10:40 AM
Hi,
If possible,it is better to take needed records.So if possible,
select the records from db table which is given in screen.
select * from marc into table itab where werks in s_werks.
Otherwise,the code should be
data itab type standard table of marc.
tables marc.
select-options s_werks for marc-werks.
select * from marc into table itab.
delete itab where not werks in s_werks.
sort itab by werks.
Kindly reward points by clicking the star on the left of reply,if it helps as per SDN policy.
‎2006 Oct 24 11:27 AM
Hi,
delete itab where werks ne s_werks.
change to
<b>delete itab where not werks in s_werks.</b>
Regards
amole