Skip to Content
author's profile photo Former Member
Former Member

Reg:Delete

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Oct 24, 2006 at 09:28 AM

    Hi Ganesh,

    It is wrong.

    delete itab where werks not in s_werks. is correct.

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2006 at 09: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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 24, 2006 at 09: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2006 at 10:27 AM

    Hi,

    delete itab where werks ne s_werks.

    change to

    <b>delete itab where not werks in s_werks.</b>

    Regards

    amole

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.