Delete data from table

hi gurus,
i am new to abap.
i am create a report using
select-options: apoid,
                       material,
                       location to.
parameters:      days .
user want to delete entries from the DB table
from system date to behind 5 days left entries
for ex. as today is 25.06.2008 he wants data in DB table
of only 20.06.2008 to 25.06.2008
if other data from left these dates are deleted.
and also in output shows the
2.     Report output should contain :
a)     Number of entries selected for deleting from table
b)     Number of entries deleted from the table table
c)     Number of entries remaining in the table table
i am do some coding
plz help me in this case
TABLES: zapolp22.
                      INTERNAL TABLE                                 *
TYPES: BEGIN OF it_output,
       ordid           TYPE ZAPOLP22-ordid,       "APO order id
       schedid         TYPE zapolp22-schedid,     "APO schedule line id
       matnr           TYPE zapolp22-matnr,        "Material Number
       locto           TYPE zapolp22-locto,  "APO Destination location
       lfmng           TYPE zapolp22-lfmng,        "Delivery quantity
       lfdat           TYPE zapolp22-lfdat,        "Shipping date
       locfr           TYPE zapolp22-locfr,     "APO Supplying location
       rqmng           TYPE zapolp22-rqmng,        "Required quantity
       rqdat           TYPE zapolp22-rqdat,        "Delivery date
       prckz           TYPE zapolp22-prckz,  "Data element processing
       blkstk          TYPE zapolp22-blkstk,       "Blocked Quantity
       oppdelqty       TYPE zapolp22-oppdelqty,    "Cumulative order qty
       zzapologmod     TYPE zapolp22-zzapologmod,   "Logistic Model
       zzflagurgent    TYPE zapolp22-zzflagurgent,  "APO Urgency Flag
       zzapottype      TYPE zapolp22-zzapottype,    "APO Transport Means
       zzndays_l_time  TYPE zapolp22-zzndays_l_time,"Lead Time Transport
       END OF it_output.
DATA : itab1 TYPE STANDARD TABLE OF it_output." WITH HEADER LINE.
DATA : itab  LIKE LINE OF itab1.
              SELECTION SCREEN / PARAMETERS                          *
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME.
SELECT-OPTIONS: s_ordid FOR zapolp22-ordid,
                s_matnr FOR zapolp22-matnr,
                s_locto FOR zapolp22-locto.
SELECTION-SCREEN END OF BLOCK a1.
PARAMETERS: p_days LIKE sy-datum.
                            DATA
DATA: days TYPE i.
                   START OF SELECTION                                *
SELECT mandt
       ordid
       schedid
       matnr
       locto
       lfmng
       lfdat
       locfr
       rqmng
       rqdat
       prckz
       blkstk
       oppdelqty
       zzapologmod
       zzflagurgent
       zzapottype
       zzndays_l_time
FROM zapolp22 INTO itab
WHERE ordid IN s_ordid  AND
       matnr IN s_matnr  AND
       locto IN s_locto.
ENDSELECT.
p_days = sy-datum - days.
DELETE zapolp22 FROM itab.
IF sy-subrc = 0.
  WRITE:/ 'DEleted'.
ENDIF.
gururs plz help me its urgent.
thanks
jayant

His employer may be aware he's a newbie.  He should of course be looking to his colleagues to help.  But at least he's made an attempt.  Martin is right though - this isn't a problem that requires a guru - it's a beginner task.
For starters try FROM zapolp22 INTO TABLE itab and remove the ENDSELECT.
Then LOOP AT itab...ENDLOOP.
READ the ABAP help for any keywords you don't understand.  And DON'T use itab as a name for your internal table.  Use a MEANINGFUL name.  like t_apo_data.
matt

Similar Messages

  • Open HUB ( SAP BW ) to SAP HANA through DB Connection data loading , Delete data from table option is not working Please help any one from this forum

    Issue:
    I have SAP BW system and SAP HANA System
    SAP BW to SAP HANA connecting through a DB Connection (named HANA)
    Whenever I created any Open Hub as Destination like DB Table with the help of DB Connection, table will be created at HANA Schema level ( L_F50800_D )
    Executed the Open Hub service without checking DELETING Data from table option
    Data loaded with 16 Records from BW to HANA same
    Second time again executed from BW to HANA now 32 records came ( it is going to append )
    Executed the Open Hub service with checking DELETING Data from table option
    Now am getting short Dump DBIF_RSQL_TABLE_KNOWN getting
    If checking in SAP BW system tio SAP BW system it is working fine ..
    will this option supports through DB Connection or not ?
    Please follow the attachemnet along with this discussion and help me to resolve how ?
    From
    Santhosh Kumar

    Hi Ramanjaneyulu ,
    First of all thanks for the reply ,
    Here the issue is At OH level ( Definition Level - DESTINATION TAB and FIELD DEFINITION )
    in that there is check box i have selected already that is what my issue even though selected also
    not performing the deletion from target level .
    SAP BW - to SAP HANA via DBC connection
    1. first time from BW suppose 16 records - Dtp Executed -loaded up to HANA - 16 same
    2. second time again executed from BW - now hana side appaended means 16+16 = 32
    3. so that i used to select the check box at OH level like Deleting data from table
    4. Now excuted the DTP it throws an Short Dump - DBIF_RSQL_TABLE_KNOWN
    Now please tell me how to resolve this ? will this option is applicable for HANA mean to say like , deleting data from table option ...
    Thanks
    Santhosh Kumar

  • Delete data from tables in one step

    HI ,
    There is a way to delete in one step data from 3 tables with specific key  something like similar to join but with delete operation .
    Thanks
    joy

    You need to use OPENSQL comands to do this with option DELETE CASCADE
    Please check this
    http://help.sap.com/saphelp_nw70/helpdata/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm

  • Can not delete data from table which is queried in my stored procedure

    Hi,
    Anyone knows how to fix it:
    I have a table. In a stored procedure, I have a simple query running on this table.
    When I want to delete one record from that table, I got error message:
    ORA-04091: table *** is mutating, trigger/function may not see it.
    Thanks first.

    Rick, the only time you should get a mutating table error is when a trigger is involved. FK problems have separate error codes (and would be a different problem than the one that started this thread). Using a DBA id check all the tables subject to DML by your function and by whatever calls your function for triggers. Only the owner or a DBA can see the existence of triggers on a non-owned table. This has caused some of the developers I work with to think tables that had triggers do not have them since they do not work under the owning or a DBA ID.
    By your description of what you are trying to do in the function we do that all the time without problem.
    How large is the function? How/When is it called?
    Mark D Powell

  • How to delete a single data from table using control file

    I want delete a single row data from table using sql loder control file
    Edited by: 977940 on Dec 19, 2012 9:00 PM

    977940 wrote:
    I want delete a single row data from table using sql loder control file
    Edited by: 977940 on Dec 19, 2012 9:00 PMWhy?
    And how do you imagine this happening with sqlloader?
    The entire purpose of sqlloader is to load data (hence, the name sql*loader*) into a table from an external source. If you want to delete rows from a table, you use the sql DELETE statement.
    What is the business problem you are trying to solve?

  • How to delete data from the table PA0007

    Hi Friends,
    Thank you for your kindly help.
    When I upload data to infotype 0007(planed working time),
    there is something wrong with the infotype 2011. So I want
    to delete the data of  infotype 0007. While using the program RPUREOPN to delete the data, the system will say:0007 cannot be deleted because of time constraint 1/A.
    Now how can I delete the data from table PA0007?
    Pls help me urgently.
    Best wishes
    Anne

    Hi Sikindar,
       Thank you for your help.
      There is another question. There are five clients (Client 300,310,320,330,350) in my HR DEV system. I just want to delete the data of infotype 0007 in client 350. When I change the the time constraint and delete the data in client 350, the data of infotype 0007 in other clients will be safe or not?
    Thank you again for your help!
    Best wishes
    Anne

  • Deleting data from SID Table

    Hi,
    I have deleted master data of an info object but it does not remove all the data from the SID table.
    I have selected with SID's option but not all data was removed.
    I am getting the error below when transporting
    "SID Table /BIC/ S2QKHITIND Contains Data : Characteristic ZQKHITIND Cannot be activated. "
    What needs to be done to get the charecteristic activated.
    Thanks
    James

    Hi Selva,
    Thank you for the info. I have deleted data from all the infoproviders but still get the message
    The system is unable to delete all the master data as, because some of it is still in use.  (See log:
    Object RSDMD, sub-object MD_DEL )
    Do you want to delete the data records that are no longer in use?
    What does this mean. is it due to the query open in some place or something else.
    While I am not able to delete the SID table entries as the delete is not active. Please help.
    Thanks
    James

  • Deleting data from EDPAR table

    hi  everyone,
                               I need to delete data forom table EDPAR. two conditions are there. Once through first radio button in selection screen based on values of kunnr selected from select options. In the second case. if i select the second radio button, all data from EDPAR table gets deleted.
    Can any one offer me proper CODE  to do it....Pls help.

    SAP delivers a standard transaction to edit the contents of this table, VOE4, this is safer then using a custom code to delete rows from the table.

  • Deleting data from a partition in a table

    There is a requirement to delete data from a particular partition in our PROD Env.
    Please let me know the syntax for the same.
    Also is it possible to truncate a partition?
    The DB version is 10.2.0.4 and OS is Solaris 10
    Regards,
    Narayan
    Edited by: user7202581 on Apr 14, 2013 12:11 AM

    Hi, You can use the following Syntex.
    -- For Truncate
    ALTER TABLE <table_name> TRUNCATE PARTITION <Partition_name>;
    -- For Delete
    DELETE FROM <table_name> PARTITION <partition_name>;

  • Deleting data from a table where there are no indexes on the table

    Hi
    We have one interface program for one time process.When I was testing the process it was taking too much time to load the data around 1000 records.
    it happens in 2 steps
    1 puts into stage table
    2 puts into base table
    in the process/package I have delete statement that deletes data from stage table before each process.
    Stage table did not have any indexes but the base table has(obvisiosly)
    any idea?
    please help me on this.
    Thanks,
    Y

    Hi,
    Please post the application/database details along with the OS.
    Is this interface program a seeded or custom one?
    Please enable trace on this concurrent program as per (Note: 296559.1 - FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12) and generate the TKPROF to find out why it takes that long to load/delete the data.
    Thanks,
    Hussein

  • How to delete data from single field in a database table?

    Hi guys,
         Plz suggest me How to delete data from single field in a database table?
    thnks,
    pavan

    hi
    in addition to abv details..chk this:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
    http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
    regards,
    madhu

  • Program or Function module to delete data from Open Hub Destination Table

    Hi All,
    Can anybody suggest me a Program or Function module to delete data from Open Hub Destination Table.
    Thanks & Regards,
    Vinay Kumar

    You can simply goto t-code SE14 mention the open hub destination table and Delete data by clicking on "Activate and Adjust database" with radio button "Delete Data".
    Regards,
    Arminder

  • How do you delete records from table with data in a select option

    how do you delete records from table with relevant to data in a select option..how to write coding

    Hi,
    Try
    if not s_select_option [ ] is initial.
    delete * from table
    where field in s_select_option.
    endif.
    commit work.
    Be careful though. If select option is emty, you will delete the entire table.
    Regards,
    Arek

  • Hoa to delete data from the SE11 database table

    Hi Friends,
    Need some urgent help.
    While uploading data to infotype 6 (addresses) in subtype 4(emergency address), I have uploaded the data twice and it has created a duplicate record now in table PA0006.
    I have done this in the quality server. Will this effect the user acceptance testing(UAT) in anyway and how can I delete this data from table PA0006
    Pls help me urgently.
    Bye
    Naveen

    Hi  Naveen ,
    1 .Check what is the time constraint for address infotype .
    2.If it is 2 , it would have delimited the record , if it is 3 it would have created another record , if it is one there will be no problem as it would have deleted the recored provided u have given the dates into consideration .
    3.It will not be  a problem for UAT . If it is not required do  a scat for deletion of records .
    Regards
    Gajalakshmi

  • Delete data from DSO only with a part of the key

    Hi experts,
    I have a DSO with 9 key fields and i want to delete some entrys. Our source system only provides 2 fields of the key. My problem is, that the BI is not able to delete from DSO unless I have the full key.
    Now I want to get the rest of the key fields from the active table of the DSO. Can sombody help me please with the ABAP Code? Or is there another possibility?
    I already found this thred in SDN but this is for BW 3.5:
    Delete data from ODS with only part of the key
    Thanks
    Ralf

    Ralf,
    the thread pointed out by you is for passing deletion entries to the DSO / target using the deletion entries .. namely recordmode = D.
    Are you looking at deleting data from the DSO as a one time activity or you want to handle the same using a start / end routine ...? and pass deletion entries to other data targets which get the data from this DSO ?
    Arun

Maybe you are looking for

  • I'm getting an error compiling movie Unknown error. It's always been fine before.

    Hi I'm getting an error compiling move Unknown error. Its always worked fine on my mac before. I've tried trashing my render files and switching to mercurey playback software only but it won't let me render or export. It might be to do with Magic bul

  • My itunes window wont open at all..

    there is no error message, no indication that there even is an itunes on my computer T_T i've tried redownloading it, restoring it, and even system restoring the whole computer. ..actually the problem all started when i system restored my computer in

  • Billing document from Delivery without Sales order creation

    Hi, I want to know that is it possible to create a billing document from a delivery document but without a sales document? If yes what settings can be done in the system to achieve it?

  • HDMI - DVI Adapter for AppleTV

    It is clear after speaking to Apple Support today that the new Apple TV will not work with conventional HDMI to DVI adapters. If anyone finds a workaround please post your solution to this thread. Thanks!

  • EJB & JSP

    I'm developing application using J2EE 1.3 beta version, with JDK 1.3. The application uses JSP to access EJB, said the JSP is contained in a Web component. In my JSP, I do a lookup to EJB Home object (as shown on the error message below). It works fi