How to delete the complete contents of database table ? should be empty !!

Hi Guys,
I have requirement where i have delete the contents of database table..i have make it empty (no records at all) and then i have to fill it with the records from the excel sheet.
I can upload data from the excel sheet.
Please tell me how to delete the complete contents of the database table ??
Regards
Rahul

hi ,
just write like this,
delete from <database table>.
commit work.
sample code, here edpar is database table.
delete from edpar." FROM TABLE g_tab_delete.
  call function 'DB_COMMIT'.
  loop at g_tab_edpar into g_wa_edpar.
    insert into edpar values g_wa_edpar.
    if sy-subrc  eq 0.
      move-corresponding g_wa_edpar to g_wa_edpar1.
      append g_wa_edpar1 to g_tab_edpar1.
    else.
      move-corresponding g_wa_edpar to g_wa_edpar2.
      append g_wa_edpar2 to g_tab_edpar2.
    endif.
  endloop.
that's all it works.
reward points if helpful.
regards,
seshu.

Similar Messages

  • How to delete the duplicate data  from PSA Table

    Dear All,
    How to delete the duplicate data  from PSA Table, I have the purchase cube and I am getting the data from Item data source.
    In PSA table, I found the some cancellation records for that particular records quantity  would be negative for the same record value would be positive.
    Due to this reason the quantity is updated to target but the values would summarized and got  the summarized value  of all normal and cancellation .
    Please let me know the solution how to delete the data while updating to the target.
    Thanks
    Regards,
    Sai

    Hi,
    in deleting the records in PSA table difficult and how many you will the delete.
    you can achieve the different ways.
    1. creating the DSO maintain the some key fields it will overwrite the based on key fields.
    2. you can write the ABAP logic deleting the duplicate records at info package level check with the your ABAPer.
    3.you can restrict the cancellation records at query level.
    Thanks,
    Phani.

  • How to tracke the new entries in database table ?

    Hi,
    How to tracke the new entries in database table ? is there any FM or report is there to check it ?
    regards
    vishnu

    Hi Vishnu,
    u can write a report program for this and in that use the event  :
    AT NEW <field-name> ( use primary key)
    your statements
    ENDAT
    for eg.
    loop at itab ( herfe itab must be of type of table for which u want to track new entries)
    at new matnr
    write:/ new record
    endat
    endloop.
    schedule this report in background to run in every 5 or 10 mins as per your requirement and hence changes can be tracked.
    regards
    Vinod

  • I want to delete the transactional record from database table

    Hai,
    I want to delete the transactional data from database table with out using the dialog programming is it there any trancation for this.
    for master data we have the transaction code for delete the records. The t.code is 'OBR2'.
    Plz help in that cse.
    Thanks and regards,
    P.Naganjana Reddy

    Hai,
    Plz help me urgent.
    I am asking i want to delete transactional data from database table without using the dialog programming.
    Thanks and Regards,
    P.Naganjana

  • How to delete the line for 300SAP* in table USR02 in SQL Management studio

    Hello
    I used to delete the line for 300SAP* in table USR02 in SQL Enterprise Manager. After I could log on with “pass”.
    I wander how to delete it in SQL Management studio. When I expand tdatabase it takes so long time and it is uncontrollable

    Hello,
    you have to delete the row by a sql statement.
    Open a new query and run a script like this:
    use <Your SID DB>                 -- e.g. use PRD
    setuser 'your sid in lowercase'  --- e.g. setuser 'prd'
    delete from USR02 where MANDT = '300' and BNAME = 'sap*'
    go
    Run a complete backup before deleting data manually.
    Regards
      Clas

  • How to delete the trailng zeros in my table

    Hai
    I had a serious problem
    My table name called nrgp_main
    Here nrgpno declared as char(8) i had changed as 10 by mistake and i have update two times
    the number is like this 003800001 i need to cut the first '0' and update it
    Thanks & regards
    Srikkanth

    Duplicate post
    how to delete the trailng zeros in my table

  • How to get the complete definition of a table using SQL?

    How to get the complete definition code of a table using SQL?

    Something like this ?
    SQL> set long 10000
    SQL> set pages 200
    SQL> select dbms_metadata.get_ddl('TABLE','EMP') from dual;
    DBMS_METADATA.GET_DDL('TABLE','EMP')
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0),
             CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
             CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
              REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    SQL>Amardeep Sidhu

  • How to delete the duplicate records in a table without promary key

    I have a table that contains around 1 million records and there is no promary key or auto number coulums. I need to delete the duplicate records from this table. what is the simple effective way to do this.

    Please see this link:
    Remove duplicate records ...
    sqldevelop.wordpress.com

  • How to add the entries and how to delete the entries from custom Z-table?

    Hi Experts,
    My requirement is I need to add the entries from program to three custom z-tables . Assume as zabc1,zabc2,zabc3.
    Here how to add the entries from program to Z-table.???
    And one more requirement is I want to provide a deletion checkbox in selection screen . Initial it was unchecked. If I am giving tick mark then the entries should be deleted from above custom Z-tables. this all will done in backgroung job?
    Could you please guide me the logic how to crack this???
    Let me know if you need more Info
    Thanks
    Sanju

    Hi Sanjana,
    What you can do is to use the ABAP keyword INSERT or MODIFY to add or modify records to a given database table. Here are the syntax taken from SAP documentation:
    *Insert Statement
    INSERT dbtab
    Syntax
    INSERT { {INTO target VALUES source }
           | {     target FROM   source } }.
    Effect
    The INSERT statement inserts one or more rows specified in source in the database table specified in target. The two variants with INTO and VALUES or without INTO with FROM behave identically, with the exception that you cannot specify any internal tables in source after VALUES.
    System Fields
    The INSERT statement sets the values of the system fields sy-subrc and sy-dbcnt.
    sy-subrc Meaning
    0 At least one row was inserted.
    4 At least one row could not be inserted, because the database table already contains a row with the same primary key or a unique secondary index.
    The INSERT statement sets sy-dbcnt to the number of rows inserted.
    Note
    The inserted rows are finally included in the table in the next database commit. Up until this point, they can still be removed by a database rollback.
    *Modify Statement
    MODIFY dbtab
    Syntax
    MODIFY target FROM source.
    Effect
    The MODIFY statement inserts one or several lines specified in source in the database table specified in target, or overwrites existing lines.
    System fields
    The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.
    sy-subrc Meaning
    0 At least one line is inserted or changed.
    4 At least one line could not be processed since there is already a line with the same unique name secondary index in the database table.
    The MODIFY statement sets sy-dbcnt to the number of processed lines.
    Note
    The changes are transferred finally to the database table with the next database commit. Up to that point, they can be reversed using a database rollback.
    Hope it helps...
    P.S. Please award points if it helps...

  • How to delete the data in New data table Because...

    Hi all,
    I have an urgent issue :
    in the process chain DSO has finished a delta load with 18592 data entries transfered and added, and activated , but when I checked New data table , there are still 18592 data entries there. This will cause problem I think, because this chain has to run daily, so next run will make the data in new data table added twice, so could you pls let me know the way to delete data in new data table?
    thanks in advance

    Dear Ryan Zhang  ,
    When activation DSO will automatically clears New table and places records in active table and change log table.
    If records still exist in New table means it has not activated properly.
    Check in active table and change log table if any entries are found.
    If not ,try activation again.
    If entries are there in active table then try these
    Go to SE14
    Give the active table name..
    Click on Edit
    Click on activate and adjust database.
    Load again and try to activate.
    Hope it helps
    Regards
    Bala

  • How to restrict the entries of a database table based on the user name

    Hi All,
    I have created a Database Table. Table maintenance generator is generated for the table.
    UNAME(user name) is one of the fields in the table. whenever the user creates a new entry, the field UNAME will be populated automatically with SY-UNAME value. I have used Table event '05' to do this.
    My requirement is...
    When a user tries to maintain the entries of the table using SM30, when 'DISPLAY' is chosen, all the records of the table should be displayed.
    When 'MAINTAIN' is chosen, only those records which have UNAME = SY-UNAME(User Logged in) should be in EDIT mode. and rest all the records should be in DISPLAY mode(greyed out). It should allow to edit only those records which are created by the user logged in.
    Could you please tell me how to do this..? Thanks in advance.
    Thanks & Regards,
    Paddu.

    HI,
    In table main. gen there are number of events , try to select one event like 05 for the Sy-uname.
    For the  requirement:
    In that event write the code like
    this is basic idea not the code:
    Case ' Sy-ucomm'.
    when 'display'.  " button
       Nomally for the display button it will show all the records, but we need to write a code like this.
    select all records frm the table.
    ( Need to write the code in case if the user first maintained the data then again press the display , list has to be refreshed.)
    when ' Maintain'. " button.
    Fetch the records that are with SY-UNAME and find out the edit function and implement it on each and every record.
    endcase.
    Thanks and Regards,
    Bharani.

  • How to access the Mobile Time & Travel database tables?

    How can I access the database tables stored in SAPMobileEngine\webapps\me\WEB-INF\wwwroot\te_data\customer\database_2_0\<name_of_declared_table>  ??
    Formerly the tables were stored in ...\database as XML files and could be viewed with a standard texteditor. Now the files are stored in ...\database_2_0 as DAT files in a special format. How can I get access to the tables? (like longtext.dat or CATS_MY_TABLE_*.DAT)

    Michael,
    Are you running MTT 1.6 SR2 Patch 03?
    The database is in serialized format and you will have unserialized them by using Eclipse IDE (or NW Development Studio). This will convert it to xml format. But I think the application itself will need it to be serialized format.
    Peter

  • How to delete the complete status of the tasklist one time?

    When finished the planning cycle, all task lists which have been marked as completed must be reset to incomplete. Is there any way to do that in one time? I did that job by hand now which took me so much time.
    thanks in advance.

    Hi,
    You do this through deleting some records from backend tables. Absolutely harmless if you know what you are doing. Check out below post:
    Re: Hyperion Planning  : how to untick all steps in task list at once
    Remember Recycling the planning service after the change.
    Cheers,
    Alp

  • How to delete the data inside a internal table?

    I got a internal table name g_itab1.
    currently my g_itab1 has a FNAME(50) component.
    Inside my component there is ADMINO, EYEAR, FIRSTNAME, LASTNAME and CONTACT.
    I want to clear away ADMINO, EYEAR, FIRSTNAME, LASTNAME and CONTACT inside my internal table.
    How do i clear it? i have tried using CLEAR g_itab1.
    It doesn't work.. the data are still inside.

    hi
                    DELETE TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn.
    Example to delete all of the lines between 5 and 36 in a table of names where the entry begins with one of the letters 'A' to 'C'.
             DELETE  itab  FROM 5 TO 36 WHERE NAME CA 'ABC'.
    reward if useful
    regards
    sree

  • How to delete the NULL entries in nest table

    Hi,
    After I used a loop and open/fetch cursor populated the object table
    I found there are random NULL entries in my object table (nest table)
    The data look like this
    NULL NULL           NULL
    NULL NULL           NULL
    123     03-MAY-04     ACTIVE
    NULL NULL           NULL
    NULL NULL           NULL
    234     21-MAY-04     ACTIVE
    NULL NULL           NULL
    345     11-MAY-04     ACTIVE
    NULL NULL           NULL
    How can I get rid of those NULL entries in my nest table? So it can become
    123     03-MAY-04     ACTIVE
    234     21-MAY-04     ACTIVE
    345     11-MAY-04     ACTIVE
    Additional info:
    create type myType as object
    (id NUMBER (10,0),
    eff_date date,
    status VARCHAR2(17)
    create type myNestTab as table of myType;
    I have tried Delete procedure in following two ways.
    Version 1:
    FOR i IN l_my_nest_tab.FIRST..l_my_nest_tab.LAST
    LOOP
    IF l_my_nest_tab(i).id IS NULL THEN
    l_curr_event_tb.DELETE(i);
                   END IF;                         
    END LOOP;
    Version 2:
    FOR i IN l_my_nest_tab.FIRST..l_my_nest_tab.LAST
    LOOP
    IF l_my_nest_tab(i) IS NULL THEN
    l_curr_event_tb.DELETE(i);
                   END IF;                         
    END LOOP;
    Both of them give me the error “no data found.” And only left me the first NOT NULL entry in the table.
    123     03-MAY-04     ACTIVE
    Thanks in avdance.

    Hi Vishnu,
    u can write a report program for this and in that use the event  :
    AT NEW <field-name> ( use primary key)
    your statements
    ENDAT
    for eg.
    loop at itab ( herfe itab must be of type of table for which u want to track new entries)
    at new matnr
    write:/ new record
    endat
    endloop.
    schedule this report in background to run in every 5 or 10 mins as per your requirement and hence changes can be tracked.
    regards
    Vinod

Maybe you are looking for

  • Cost Center overlapping

    Hi, We have created one Cost Center AAA under production group. Before post the documents we have deleted AAA cost center. It is showing Red Mark symbol in OKEON(Cost Center Standard Heirarchy). After we have created AAA(same code deleted cost center

  • Problem with Amarok/Opera/Virtualbox appearance

    I use a plain fluxbox session and only a few non-GTK apps, such as K3B, Amarok, Opera and Virtualbox. Thing is I have KDE 4 stuff installed, and I'm guessing these apps are still KDE 3.x, so in the new "systemsettings" control panel when I change the

  • In Place Discovery Search - "Search in Progress", not progressing?

    Hi, When I click SAVE to run the In Place Discovery Search, it just seems to stay "in progress" and never complete. I can run an estimate on the search and it seems to work fine. No errors to report? Suggestions?

  • Will Adobe make a product that is Adobe Muse combined with Adobe Edge Reflow?

    I love how Adobe Muse works, its simple and very easy to learn. The only issue I have with the program is, the sites that I produce from Muse is not a fully responsive site. I was wondering if Adobe will allow us to set-up our own breakpoints in the

  • Xcode crazily massive update!

    I really like the new functionality of the updated version and at first I was really peeved off that I had to pay for it when Apple was already making a nice chunk off the Apps I would be putting on thier store anyways as well as the Apple computer I